Skip to content

Commit b0a97d5

Browse files
committed
Merge branch 'master' into tgeotex_streaming
# Conflicts: # 62_CAD/CMakeLists.txt
2 parents b44ac2b + 5080b10 commit b0a97d5

134 files changed

Lines changed: 14426 additions & 4857 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

05_StreamingAndBufferDeviceAddressApp/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
2424
endif()
2525

2626
set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
27-
set(DEPENDS
28-
app_resources/common.hlsl
29-
app_resources/shader.comp.hlsl
30-
)
31-
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
32-
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)
3327

3428
set(SM 6_8)
3529
set(JSON [=[
@@ -50,7 +44,6 @@ set(COMPILE_OPTIONS
5044
NBL_CREATE_NSC_COMPILE_RULES(
5145
TARGET ${EXECUTABLE_NAME}SPIRV
5246
LINK_TO ${EXECUTABLE_NAME}
53-
DEPENDS ${DEPENDS}
5447
BINARY_DIR ${OUTPUT_DIRECTORY}
5548
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
5649
COMMON_OPTIONS ${COMPILE_OPTIONS}
@@ -66,4 +59,4 @@ NBL_CREATE_RESOURCE_ARCHIVE(
6659
LINK_TO ${EXECUTABLE_NAME}
6760
BIND ${OUTPUT_DIRECTORY}
6861
BUILTINS ${KEYS}
69-
)
62+
)

07_StagingAndMultipleQueues/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
2424
endif()
2525

2626
set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
27-
set(DEPENDS
28-
app_resources/common.hlsl
29-
app_resources/comp_shader.hlsl
30-
)
31-
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
32-
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)
3327

3428
set(SM 6_8)
3529
set(JSON [=[
@@ -50,7 +44,6 @@ set(COMPILE_OPTIONS
5044
NBL_CREATE_NSC_COMPILE_RULES(
5145
TARGET ${EXECUTABLE_NAME}SPIRV
5246
LINK_TO ${EXECUTABLE_NAME}
53-
DEPENDS ${DEPENDS}
5447
BINARY_DIR ${OUTPUT_DIRECTORY}
5548
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
5649
COMMON_OPTIONS ${COMPILE_OPTIONS}
@@ -66,4 +59,4 @@ NBL_CREATE_RESOURCE_ARCHIVE(
6659
LINK_TO ${EXECUTABLE_NAME}
6760
BIND ${OUTPUT_DIRECTORY}
6861
BUILTINS ${KEYS}
69-
)
62+
)

09_GeometryCreator/main.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
44

5+
#include <nbl/builtin/hlsl/math/thin_lens_projection.hlsl>
56

67
#include "common.hpp"
78

@@ -73,7 +74,7 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
7374
{
7475
core::vectorSIMDf cameraPosition(-5.81655884, 2.58630896, -4.23974705);
7576
core::vectorSIMDf cameraTarget(-0.349590302, -0.213266611, 0.317821503);
76-
matrix4SIMD projectionMatrix = matrix4SIMD::buildProjectionMatrixPerspectiveFovLH(core::radians(60.0f), float(m_initialResolution.x)/float(m_initialResolution.y), 0.1, 10000);
77+
float32_t4x4 projectionMatrix = hlsl::math::thin_lens::lhPerspectiveFovMatrix<float>(core::radians(60.0f), float(m_initialResolution.x) / m_initialResolution.y, 0.1f, 10000.0f);
7778
camera = Camera(cameraPosition, cameraTarget, projectionMatrix, 1.069f, 0.4f);
7879
}
7980

@@ -139,13 +140,8 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
139140
cb->beginRenderPass(info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
140141
}
141142

142-
float32_t3x4 viewMatrix;
143-
float32_t4x4 viewProjMatrix;
144-
// TODO: get rid of legacy matrices
145-
{
146-
memcpy(&viewMatrix,camera.getViewMatrix().pointer(),sizeof(viewMatrix));
147-
memcpy(&viewProjMatrix,camera.getConcatenatedMatrix().pointer(),sizeof(viewProjMatrix));
148-
}
143+
float32_t3x4 viewMatrix = camera.getViewMatrix();
144+
float32_t4x4 viewProjMatrix = camera.getConcatenatedMatrix();
149145
const auto viewParams = CSimpleDebugRenderer::SViewParams(viewMatrix,viewProjMatrix);
150146

151147
// tear down scene every frame
@@ -251,7 +247,7 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
251247
InputSystem::ChannelReader<IKeyboardEventChannel> keyboard;
252248

253249
//
254-
Camera camera = Camera(core::vectorSIMDf(0, 0, 0), core::vectorSIMDf(0, 0, 0), core::matrix4SIMD());
250+
Camera camera = Camera(core::vectorSIMDf(0, 0, 0), core::vectorSIMDf(0, 0, 0), hlsl::float32_t4x4());
255251

256252
uint16_t gcIndex = {};
257253

@@ -270,4 +266,4 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
270266
}
271267
};
272268

273-
NBL_MAIN_FUNC(GeometryCreatorApp)
269+
NBL_MAIN_FUNC(GeometryCreatorApp)

10_CountingSort/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
2424
endif()
2525

2626
set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
27-
set(DEPENDS
28-
app_resources/common.hlsl
29-
app_resources/prefix_sum_shader.comp.hlsl
30-
app_resources/scatter_shader.comp.hlsl
31-
)
32-
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
33-
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)
3427

3528
set(SM 6_8)
3629
set(REQUIRED_CAPS [=[
@@ -72,7 +65,6 @@ set(COMPILE_OPTIONS
7265
NBL_CREATE_NSC_COMPILE_RULES(
7366
TARGET ${EXECUTABLE_NAME}SPIRV
7467
LINK_TO ${EXECUTABLE_NAME}
75-
DEPENDS ${DEPENDS}
7668
BINARY_DIR ${OUTPUT_DIRECTORY}
7769
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
7870
COMMON_OPTIONS ${COMPILE_OPTIONS}

11_FFT/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
2424
endif()
2525

2626
set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
27-
set(DEPENDS
28-
app_resources/common.hlsl
29-
app_resources/shader.comp.hlsl
30-
)
31-
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
32-
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)
3327

3428
set(SM 6_8)
3529
set(JSON [=[
@@ -50,7 +44,6 @@ set(COMPILE_OPTIONS
5044
NBL_CREATE_NSC_COMPILE_RULES(
5145
TARGET ${EXECUTABLE_NAME}SPIRV
5246
LINK_TO ${EXECUTABLE_NAME}
53-
DEPENDS ${DEPENDS}
5447
BINARY_DIR ${OUTPUT_DIRECTORY}
5548
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
5649
COMMON_OPTIONS ${COMPILE_OPTIONS}
@@ -66,4 +59,4 @@ NBL_CREATE_RESOURCE_ARCHIVE(
6659
LINK_TO ${EXECUTABLE_NAME}
6760
BIND ${OUTPUT_DIRECTORY}
6861
BUILTINS ${KEYS}
69-
)
62+
)

12_MeshLoaders/main.cpp

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "common.hpp"
66

77
#include "../3rdparty/portable-file-dialogs/portable-file-dialogs.h"
8+
#include <nbl/builtin/hlsl/math/thin_lens_projection.hlsl>
89

910
#ifdef NBL_BUILD_MITSUBA_LOADER
1011
#include "nbl/ext/MitsubaLoader/CSerializedLoader.h"
@@ -19,12 +20,18 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
1920
using device_base_t = MonoWindowApplication;
2021
using asset_base_t = BuiltinResourcesApplication;
2122

22-
public:
23-
inline MeshLoadersApp(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD)
24-
: IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD),
25-
device_base_t({ 1280,720 }, EF_D32_SFLOAT, _localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD)
26-
{
27-
}
23+
enum DrawBoundingBoxMode
24+
{
25+
DBBM_NONE,
26+
DBBM_AABB,
27+
DBBM_OBB,
28+
DBBM_COUNT
29+
};
30+
31+
public:
32+
inline MeshLoadersApp(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD)
33+
: IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD),
34+
device_base_t({1280,720}, EF_D32_SFLOAT, _localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}
2835

2936
inline bool onAppInitialized(smart_refctd_ptr<ISystem>&& system) override
3037
{
@@ -171,7 +178,9 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
171178
if (event.keyCode == E_KEY_CODE::EKC_R && event.action == SKeyboardEvent::ECA_RELEASED)
172179
reload = true;
173180
if (event.keyCode == E_KEY_CODE::EKC_B && event.action == SKeyboardEvent::ECA_RELEASED)
174-
m_drawBBs = !m_drawBBs;
181+
{
182+
m_drawBBMode = DrawBoundingBoxMode((m_drawBBMode + 1) % DBBM_COUNT);
183+
}
175184
}
176185
camera.keyboardProcess(events);
177186
},
@@ -182,24 +191,17 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
182191
reloadModel();
183192
}
184193
// draw scene
185-
float32_t3x4 viewMatrix;
186-
float32_t4x4 viewProjMatrix;
187-
{
188-
// TODO: get rid of legacy matrices
189-
{
190-
memcpy(&viewMatrix,camera.getViewMatrix().pointer(),sizeof(viewMatrix));
191-
memcpy(&viewProjMatrix,camera.getConcatenatedMatrix().pointer(),sizeof(viewProjMatrix));
192-
}
193-
m_renderer->render(cb,CSimpleDebugRenderer::SViewParams(viewMatrix,viewProjMatrix));
194-
}
194+
float32_t3x4 viewMatrix = camera.getViewMatrix();
195+
float32_t4x4 viewProjMatrix = camera.getConcatenatedMatrix();
196+
m_renderer->render(cb,CSimpleDebugRenderer::SViewParams(viewMatrix,viewProjMatrix));
195197
#ifdef NBL_BUILD_DEBUG_DRAW
196-
if (m_drawBBs)
198+
if (m_drawBBMode != DBBM_NONE)
197199
{
198200
const ISemaphore::SWaitInfo drawFinished = { .semaphore = m_semaphore.get(),.value = m_realFrameIx + 1u };
199201
ext::debug_draw::DrawAABB::DrawParameters drawParams;
200202
drawParams.commandBuffer = cb;
201203
drawParams.cameraMat = viewProjMatrix;
202-
m_drawAABB->render(drawParams, drawFinished, m_aabbInstances);
204+
m_drawAABB->render(drawParams, drawFinished, m_drawBBMode == DBBM_OBB ? m_obbInstances : m_aabbInstances);
203205
}
204206
#endif
205207
cb->endRenderPass();
@@ -460,6 +462,7 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
460462
core::vector<hlsl::float32_t3x4> worldTforms;
461463
const auto& converted = reservation.getGPUObjects<ICPUPolygonGeometry>();
462464
m_aabbInstances.resize(converted.size());
465+
m_obbInstances.resize(converted.size());
463466
for (uint32_t i = 0; i < converted.size(); i++)
464467
{
465468
const auto& geom = converted[i];
@@ -472,18 +475,36 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
472475
bound = hlsl::shapes::util::union_(transformed,bound);
473476

474477
#ifdef NBL_BUILD_DEBUG_DRAW
475-
auto& inst = m_aabbInstances[i];
478+
479+
auto& aabbInst = m_aabbInstances[i];
476480
const auto tmpAabb = shapes::AABB<3,float>(promoted.minVx, promoted.maxVx);
477-
hlsl::float32_t3x4 instanceTransform = ext::debug_draw::DrawAABB::getTransformFromAABB(tmpAabb);
481+
482+
hlsl::float32_t3x4 aabbTransform = ext::debug_draw::DrawAABB::getTransformFromAABB(tmpAabb);
478483
const auto tmpWorld = hlsl::float32_t3x4(promotedWorld);
479-
inst.color = { 1,1,1,1 };
480-
inst.transform[0] = tmpWorld[0];
481-
inst.transform[1] = tmpWorld[1];
482-
inst.transform[2] = tmpWorld[2];
483-
inst.transform[3] = float32_t4(0, 0, 0, 1);
484-
inst.transform = math::linalg::promoted_mul(inst.transform, instanceTransform);
484+
const auto world4x4 = float32_t4x4{
485+
tmpWorld[0],
486+
tmpWorld[1],
487+
tmpWorld[2],
488+
float32_t4(0, 0, 0, 1)
489+
};
490+
491+
aabbInst.color = { 1,1,1,1 };
492+
aabbInst.transform = math::linalg::promoted_mul(world4x4, aabbTransform);
493+
494+
auto& obbInst = m_obbInstances[i];
495+
const auto& cpuGeom = geometries[i].get();
496+
const auto obb = CPolygonGeometryManipulator::calculateOBB(
497+
cpuGeom->getPositionView().getElementCount(),
498+
[geo = cpuGeom, &world4x4](size_t vertex_i) {
499+
hlsl::float32_t3 pt;
500+
geo->getPositionView().decodeElement(vertex_i, pt);
501+
return pt;
502+
});
503+
obbInst.color = { 0, 0, 1, 1 };
504+
obbInst.transform = math::linalg::promoted_mul(world4x4, obb.transform);
485505
#endif
486506
}
507+
487508
printAABB(bound,"Total");
488509
if (!m_renderer->addGeometries({ &converted.front().get(),converted.size() }))
489510
return false;
@@ -503,7 +524,7 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
503524
{
504525
const auto measure = hlsl::length(diagonal);
505526
const auto aspectRatio = float(m_window->getWidth()) / float(m_window->getHeight());
506-
camera.setProjectionMatrix(core::matrix4SIMD::buildProjectionMatrixPerspectiveFovRH(1.2f, aspectRatio, distance * measure * 0.1, measure * 4.0));
527+
camera.setProjectionMatrix(hlsl::math::thin_lens::rhPerspectiveFovMatrix<float>(1.2f, aspectRatio, distance * measure * 0.1, measure * 4.0));
507528
camera.setMoveSpeed(measure * 0.04);
508529
}
509530
const auto pos = bound.maxVx + diagonal * distance;
@@ -539,14 +560,16 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
539560
InputSystem::ChannelReader<IMouseEventChannel> mouse;
540561
InputSystem::ChannelReader<IKeyboardEventChannel> keyboard;
541562
//
542-
Camera camera = Camera(core::vectorSIMDf(0, 0, 0), core::vectorSIMDf(0, 0, 0), core::matrix4SIMD());
563+
Camera camera = Camera(core::vectorSIMDf(0, 0, 0), core::vectorSIMDf(0, 0, 0), hlsl::float32_t4x4());
543564
// mutables
544565
std::string m_modelPath;
545566

546-
bool m_drawBBs = true;
567+
DrawBoundingBoxMode m_drawBBMode;
547568
#ifdef NBL_BUILD_DEBUG_DRAW
548569
smart_refctd_ptr<ext::debug_draw::DrawAABB> m_drawAABB;
549570
std::vector<ext::debug_draw::InstanceData> m_aabbInstances;
571+
std::vector<ext::debug_draw::InstanceData> m_obbInstances;
572+
550573
#endif
551574

552575
bool m_saveGeom = false;

14_Mortons/CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ else()
3030
endif()
3131

3232
set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/auto-gen")
33-
set(DEPENDS
34-
app_resources/common.hlsl
35-
app_resources/testCommon.hlsl
36-
app_resources/testCommon2.hlsl
37-
app_resources/test.comp.hlsl
38-
app_resources/test2.comp.hlsl
39-
)
40-
target_sources(${EXECUTABLE_NAME} PRIVATE ${DEPENDS})
41-
set_source_files_properties(${DEPENDS} PROPERTIES HEADER_FILE_ONLY ON)
4233

4334
set(SM 6_8)
4435
set(JSON [=[
@@ -63,7 +54,6 @@ set(COMPILE_OPTIONS
6354
NBL_CREATE_NSC_COMPILE_RULES(
6455
TARGET ${EXECUTABLE_NAME}SPIRV
6556
LINK_TO ${EXECUTABLE_NAME}
66-
DEPENDS ${DEPENDS}
6757
BINARY_DIR ${OUTPUT_DIRECTORY}
6858
MOUNT_POINT_DEFINE NBL_THIS_EXAMPLE_BUILD_MOUNT_POINT
6959
COMMON_OPTIONS ${COMPILE_OPTIONS}
@@ -79,4 +69,4 @@ NBL_CREATE_RESOURCE_ARCHIVE(
7969
LINK_TO ${EXECUTABLE_NAME}
8070
BIND ${OUTPUT_DIRECTORY}
8171
BUILTINS ${KEYS}
82-
)
72+
)

0 commit comments

Comments
 (0)