Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
e337219
add CCubeProjection.hpp, ILinearProjection.hpp & IProjection.hpp head…
AnastaZIuk Oct 20, 2024
960ef01
add range_value_t to IProjection
AnastaZIuk Oct 20, 2024
2801151
create IProjectionRange, pair with IProjection, use concepts for spec…
AnastaZIuk Oct 21, 2024
2fe2a7f
save draft of CVirtualCameraEvent.hpp & ICameraControl.hpp, update so…
AnastaZIuk Oct 21, 2024
ebd0a6e
update ICameraControl & CVirtualCameraEvent, add processVirtualEvent
AnastaZIuk Oct 23, 2024
a0ec5ae
put CVirtualCameraEvent logic into ICameraController, update the clas…
AnastaZIuk Oct 23, 2024
1b9b903
add more getters & setters to ICameraController, remove some content …
AnastaZIuk Oct 23, 2024
71b4e76
save work, make classes compile (but runtime crashes), mark TODOs for…
AnastaZIuk Oct 24, 2024
31813e6
create ICamera.hpp interface for all types of cameraz, update IProjec…
AnastaZIuk Oct 25, 2024
be70213
improve IProjection, make the matrix private & allow to change it wit…
AnastaZIuk Oct 25, 2024
b7e6d9e
address https://github.com/Devsh-Graphics-Programming/Nabla/pull/760/…
AnastaZIuk Oct 25, 2024
9bb8823
init default keys to virtual events, make ICameraController<T> inheri…
AnastaZIuk Oct 25, 2024
afe6ad0
split responsibilities & update sources
AnastaZIuk Oct 26, 2024
82efd37
add updateOrthonormalMatrix
AnastaZIuk Oct 26, 2024
06400fb
start eliminating first runtime bugs & typos
AnastaZIuk Oct 26, 2024
de18f19
add debug asserts for matrix base checks
AnastaZIuk Oct 28, 2024
9e12014
fix another bugs, make the rotation work!
AnastaZIuk Oct 28, 2024
21a46e4
movement fixes, finally gimbal fully controls camera position & orien…
AnastaZIuk Oct 28, 2024
384674c
small typo
AnastaZIuk Oct 28, 2024
7d582bc
accumulate move & rotation deltas, add setOrientation & correct proce…
AnastaZIuk Oct 29, 2024
8ef623f
remove old test methods
AnastaZIuk Oct 30, 2024
94dffeb
remove gimbal member from camera interface, have matrix precision typ…
AnastaZIuk Nov 2, 2024
ddb86a6
move virtual events outside templates into CVirtualGimbalEvent, have …
AnastaZIuk Nov 3, 2024
5f4bd96
bad typo
AnastaZIuk Nov 3, 2024
a91b5cf
create CGeneralPurposeGimbal & IGimbal (which will apply to any kind …
AnastaZIuk Nov 6, 2024
7ef8a92
change keys lookup table, add scale events to CVirtualGimbalEvent::Vi…
AnastaZIuk Nov 6, 2024
263feae
lets call manipulate only one by putting all virtual events into sing…
AnastaZIuk Nov 6, 2024
6624e39
Add key-mapping UI window. Virtual events handling fixed! I was not e…
AnastaZIuk Nov 7, 2024
03a8bf8
create keysmapping.hpp with displayKeyMappingsAndVirtualStates utilit…
AnastaZIuk Nov 7, 2024
2f50f96
create CCameraController, update ICameraController, have mouse contro…
AnastaZIuk Nov 8, 2024
360d9aa
rename + refactor ICameraController to more abstract IGimbalControlle…
AnastaZIuk Nov 11, 2024
f0d4690
accumulate transform in FPS camera' base_t::World case with respect t…
AnastaZIuk Nov 12, 2024
6dab0d4
I need more space for more viewports, allow to resize the window
AnastaZIuk Nov 14, 2024
a50cf75
set better initial position & orientation of camera, cleanup in GC sh…
AnastaZIuk Nov 15, 2024
efdd123
pull master & resolve conflicts
AnastaZIuk Nov 15, 2024
b8e179b
update the UI example to use TRI buffer & smooth resize surface -> I …
AnastaZIuk Nov 15, 2024
6ae1327
fix some init bugs
AnastaZIuk Nov 15, 2024
ac0977b
play with aspect ratio, make projection work in GUI window on window …
AnastaZIuk Nov 15, 2024
cd26e13
Make room for multiple geometry creator scene frame-buffers, add seco…
AnastaZIuk Nov 18, 2024
f0d82b3
display second gizmo on the scene (and make it capable of manipulatio…
AnastaZIuk Nov 18, 2024
827787c
add `inline const matrix<precision_t, 3, 4> operator()() const` IGimb…
AnastaZIuk Nov 22, 2024
7ae02fd
add virtual getIdentifier to camera interface, display matrices for b…
AnastaZIuk Nov 22, 2024
09bacb0
one step ahead to imguizmo controller - display the scene from second…
AnastaZIuk Dec 2, 2024
f88acfe
fix gizmo manipulation bugs, make sure a model is manipulated only on…
AnastaZIuk Dec 3, 2024
6c9b04a
add toRetardedImguizmoTRSInput, have nicely aligned *local base* orie…
AnastaZIuk Dec 4, 2024
e9d8a24
make the imguizmo controller work for translations
AnastaZIuk Dec 4, 2024
bc670ca
fix ManipulationMode::World manipulations, treat impulses as relative…
AnastaZIuk Dec 4, 2024
558238e
save work to continue tomorrow - start adjusting to comments regardin…
AnastaZIuk Dec 5, 2024
c3b0118
make CCubeProjection use IQuadProjection & IProjection interface, upd…
AnastaZIuk Dec 6, 2024
a0a1380
add some getters to IQuadProjection
AnastaZIuk Dec 10, 2024
c02e9f6
remove templates from ICamera interface, hardcode 64bit for its gimba…
AnastaZIuk Dec 12, 2024
09ac39e
fix a typo which broke my projections, comment out a few debug windows
AnastaZIuk Dec 12, 2024
01a7323
add camera selection with mouse disabled on move, display camera prop…
AnastaZIuk Dec 12, 2024
d5749a1
have virtual events mapping per camera in node tree, disable all gizm…
AnastaZIuk Dec 12, 2024
551b34b
modify projection parameters independently of camera, improve TRS edi…
AnastaZIuk Dec 13, 2024
2d0fbfc
increase FBOs resolution, make full screen mode work again after updates
AnastaZIuk Dec 13, 2024
1c87634
disable WiP features (display on red or vanish)
AnastaZIuk Dec 13, 2024
742b41a
add help text for disabling/enabling selected camera movement
AnastaZIuk Dec 13, 2024
702d747
Release & RWDI will need closer look, comment out more WiP
AnastaZIuk Dec 13, 2024
521116e
allow to manipulate model gizmos in ortho mode, add sliders to move/r…
AnastaZIuk Dec 14, 2024
2aa1021
allow to pick combo with object type when TRS editor has object from …
AnastaZIuk Dec 14, 2024
318a7c9
forgot to remove old struct from ICamera interface, also use ImGuiSli…
AnastaZIuk Dec 14, 2024
1f69a54
create `CPlanarProjection.hpp` & `IPlanarProjection.hpp` classes, add…
AnastaZIuk Dec 17, 2024
507d9f0
planar projections are bound to controllers, now I need to fix manipu…
AnastaZIuk Dec 18, 2024
d98c10b
use `struct CPlanarProjectionWithMeta : public CPlanarProjection<plan…
AnastaZIuk Dec 19, 2024
263e60b
fix gizmo ID stack usage
AnastaZIuk Dec 19, 2024
4a66fec
set render window constraints to avoid aspect ratio glitches & divisi…
AnastaZIuk Dec 20, 2024
2f9c5f2
control active render window by switching between bound planar & proj…
AnastaZIuk Dec 20, 2024
a0abbe2
preserve virtual active event state when required & use bound project…
AnastaZIuk Dec 21, 2024
b9327d4
correct projection updates
AnastaZIuk Dec 21, 2024
b66723b
added cameraz.json to builtin resources
YasInvolved Dec 22, 2024
0e4456f
move default config to app_resources
YasInvolved Dec 22, 2024
20214bf
allow to pick object from the scene in TRS editor, add more help-texts
AnastaZIuk Dec 22, 2024
a6ac635
load default config if file specified in parameter is not found
YasInvolved Dec 22, 2024
fefb40b
Merge branch 'cameraz' of github.com:Devsh-Graphics-Programming/Nabla…
YasInvolved Dec 22, 2024
5f9ff5b
make DepthFboAttachmentFormat (gc scene fbo) EF_D32_SFLOAT to increas…
AnastaZIuk Dec 22, 2024
5f3fd6f
split viewports and planars in JSON
YasInvolved Dec 22, 2024
ecb14f5
replace cerr with logFail to improve logging
YasInvolved Dec 22, 2024
ed42789
moved data parsing to before gfx initialization
YasInvolved Dec 22, 2024
3afb9c8
switch to system cursor when outside of viewport
YasInvolved Dec 22, 2024
3698f02
ImGuizmo last invocation cache needs to be inspected, add a few comments
AnastaZIuk Dec 23, 2024
c5ec2c6
Merge branch 'yas_cameraz' of github.com:Devsh-Graphics-Programming/N…
AnastaZIuk Dec 23, 2024
ddfcac5
fix a little loading bug after the merge
AnastaZIuk Dec 23, 2024
bbce80e
minor visual bug with cursor
AnastaZIuk Dec 23, 2024
1dcd899
add new Free Lock camera to the scene, update cameras.json input, fix…
AnastaZIuk Dec 23, 2024
0a638b4
make default positioning sexy, update input constants
AnastaZIuk Dec 23, 2024
195f139
create COrbitCamera.hpp & add to the demo example
AnastaZIuk Dec 30, 2024
1810e70
make mouse stay in window area when camera movement is enabled
YasInvolved Dec 31, 2024
c41ff66
Merge branch 'cameraz' into yas_cameraz_cursorfix
YasInvolved Jan 13, 2025
e0c284a
small optimization
YasInvolved Jan 13, 2025
2316f8f
cursor behaviour choice menu
YasInvolved Jan 13, 2025
88d96c1
Merge branch 'yas_cameraz_cursorfix' of github.com:Devsh-Graphics-Pro…
YasInvolved Jan 13, 2025
61c0824
Merge pull request #167 from Devsh-Graphics-Programming/yas_cameraz_c…
AnastaZIuk Jan 24, 2025
c43fa03
wooops thats funny, correct scope target definitions for UI ex
AnastaZIuk Jan 24, 2025
09e882d
a few transpose updates due to ambiguity, need Ali changes to apply a…
AnastaZIuk Jan 24, 2025
51ac12d
pull master & resolve conflicts
AnastaZIuk Jan 24, 2025
f1e87ae
core::transpose to hlsl::transpose
AnastaZIuk Jan 24, 2025
c50beb0
correct bugs, save changes with tests, allow gizmos to controller cam…
AnastaZIuk Jan 31, 2025
491aa0b
finally managed to get reference frame virtual events from imguizmo, …
AnastaZIuk Feb 2, 2025
2b75a10
allow cameras orientation to be controlled with raw input pitch/yaw/r…
AnastaZIuk Feb 6, 2025
d02ccca
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
AnastaZIuk Feb 17, 2025
5944c8d
Merge master into cameraz, fix CI capture
AnastaZIuk Feb 3, 2026
c936ded
adjust to code, precompile remaining runtime shaders
AnastaZIuk Feb 3, 2026
26875f5
unit tests for virtual events
AnastaZIuk Feb 3, 2026
893106e
camera types and control updates
AnastaZIuk Feb 5, 2026
fc6dc1c
Add camera workflows and continuity tests
AnastaZIuk Feb 7, 2026
e0ef7ab
Merge remote-tracking branch 'origin/master' into cameraz
AnastaZIuk Feb 7, 2026
f74c701
Refactor UI app and camera math internals
AnastaZIuk Feb 14, 2026
8df8db2
Render debug grid with scene depth
AnastaZIuk Feb 14, 2026
6148a04
Move 61 UI app implementation from inl to cpp
AnastaZIuk Feb 18, 2026
a344c2f
Stabilize world axis overlay arrows
AnastaZIuk Feb 18, 2026
c30b5e4
Improve camera smoke visuals and HDR sky environment
AnastaZIuk Feb 18, 2026
bf0e727
Integrate frustum visualization into camera smoke
AnastaZIuk Feb 18, 2026
7e432db
Align continuity script with split frustum views
AnastaZIuk Feb 18, 2026
aec6529
Merge remote-tracking branch 'origin/master' into cameraz
AnastaZIuk Feb 19, 2026
d1cb4e9
Finalize camera smoke and continuity tests
AnastaZIuk Feb 19, 2026
4ef7c1d
Load UI sky env from shared media
AnastaZIuk Feb 19, 2026
d5f8582
Refine cameraz smoke input handling
AnastaZIuk Apr 3, 2026
bfa5371
Merge master
AnastaZIuk Apr 3, 2026
32a29b2
Fix json alias conflict after master merge
AnastaZIuk Apr 3, 2026
0640ebd
Refine cameraz camera solver and presets
AnastaZIuk Apr 3, 2026
5d4f144
Rename target pose controller to camera goal solver
AnastaZIuk Apr 3, 2026
6efdce6
Unify cameraz goals across capture apply and playback
AnastaZIuk Apr 3, 2026
a536336
Refine camera goal solver state handling
AnastaZIuk Apr 4, 2026
c97af89
Surface preset compatibility in camera UI
AnastaZIuk Apr 4, 2026
d2c0855
Refine preset policy filtering in 61_UI
AnastaZIuk Apr 4, 2026
60620af
Codify shared spherical preset flow for Chase and Dolly
AnastaZIuk Apr 4, 2026
68d2957
Decouple planar projection bindings from controllers
AnastaZIuk Apr 4, 2026
a0db278
Keep camera input presets outside the controller core
AnastaZIuk Apr 4, 2026
254edd1
Add collected virtual event helpers to input binding
AnastaZIuk Apr 4, 2026
62af390
Use input binder types in transform editor
AnastaZIuk Apr 4, 2026
7e9fa6a
Rename camera binding layout contracts
AnastaZIuk Apr 4, 2026
5784c79
Separate binding storage from input processing
AnastaZIuk Apr 4, 2026
d36d9aa
Move camera binding layout into a dedicated header
AnastaZIuk Apr 4, 2026
7dc8416
Rename camera controller JSON to bindings
AnastaZIuk Apr 4, 2026
5e02c9b
Rename gimbal controller to input processor
AnastaZIuk Apr 4, 2026
e579f74
Unify camera rig setup across initialization
AnastaZIuk Apr 4, 2026
a6bdd9a
Route camera motion scales through rig config
AnastaZIuk Apr 4, 2026
e459bff
Add camera rig preset reset helpers
AnastaZIuk Apr 4, 2026
abb794b
Decouple camera binding layout from ICamera inheritance
AnastaZIuk Apr 4, 2026
31d3d60
Trim encoder naming from binding layouts
AnastaZIuk Apr 4, 2026
5f4961a
Drop camera binding layout forwarding helpers
AnastaZIuk Apr 4, 2026
f8c0407
Split camera motion and binding config
AnastaZIuk Apr 4, 2026
94093ca
Add scoped camera motion scale overrides
AnastaZIuk Apr 4, 2026
e11d22e
Wrap unit motion overrides in camera helpers
AnastaZIuk Apr 4, 2026
2a70bfe
Drop legacy camera goal aliases
AnastaZIuk Apr 4, 2026
d3f7836
Consolidate preset UI analysis in 61_UI
AnastaZIuk Apr 4, 2026
1fd710d
Surface playback preset apply summaries
AnastaZIuk Apr 4, 2026
1f57030
Unify preset apply status banners
AnastaZIuk Apr 4, 2026
3d8a696
Preview playback scrubbing through preset flow
AnastaZIuk Apr 4, 2026
cccf6a8
Gate preset capture and keyframe authoring
AnastaZIuk Apr 4, 2026
b2b20c9
Promote camera goal utilities into shared camera headers
AnastaZIuk Apr 4, 2026
71a5ddf
Promote camera presets into shared camera headers
AnastaZIuk Apr 4, 2026
a816d32
Improve playback keyframe authoring in 61_UI
AnastaZIuk Apr 4, 2026
b46384c
Add keyframe storage to 61_UI playback
AnastaZIuk Apr 4, 2026
4cb6f6f
Promote camera apply analysis into shared headers
AnastaZIuk Apr 4, 2026
caf6a09
Promote camera keyframe track into shared headers
AnastaZIuk Apr 4, 2026
02c4e33
Document shared camera API and utilities
AnastaZIuk Apr 4, 2026
48ff702
Document shared camera headers
AnastaZIuk Apr 4, 2026
4599661
Promote camera playback timeline into shared headers
AnastaZIuk Apr 4, 2026
3ed609b
Promote camera persistence into shared headers
AnastaZIuk Apr 4, 2026
2e85d7a
Promote camera preset flow into shared headers
AnastaZIuk Apr 4, 2026
c290cb0
Share camera preset apply summaries
AnastaZIuk Apr 4, 2026
60d18bb
Harden shared camera helper smoke coverage
AnastaZIuk Apr 4, 2026
fe333a2
Document and harden shared camera helpers
AnastaZIuk Apr 4, 2026
499dde6
Promote camera manipulation utilities into shared headers
AnastaZIuk Apr 4, 2026
c621aae
Promote camera text utilities into shared headers
AnastaZIuk Apr 4, 2026
5b444ab
Promote camera projection utilities into shared headers
AnastaZIuk Apr 4, 2026
6102574
Share camera analysis text helpers
AnastaZIuk Apr 4, 2026
20224d5
Harden camera helper smoke coverage
AnastaZIuk Apr 4, 2026
e5adb58
Share camera presentation utilities
AnastaZIuk Apr 4, 2026
e2f823c
Share camera presentation badge utilities
AnastaZIuk Apr 4, 2026
7ab899c
Share camera preset comparison helpers
AnastaZIuk Apr 4, 2026
32b4c7e
Share camera presentation data labels
AnastaZIuk Apr 4, 2026
8a996d4
Share camera preset collection comparison
AnastaZIuk Apr 4, 2026
dcd52d1
Compact camera continuity scripting
AnastaZIuk Apr 6, 2026
6b5b463
Add tracked-target camera follow flow
AnastaZIuk Apr 6, 2026
44d258d
Refine tracked target follow integration
AnastaZIuk Apr 6, 2026
3fb7be0
Compile camera sequence policies and follow regressions
AnastaZIuk Apr 6, 2026
dea6ca0
Share scripted runtime camera utilities
AnastaZIuk Apr 7, 2026
1dd16f5
Rewrite camera API documentation
AnastaZIuk Apr 7, 2026
d81c459
Clean camera API naming and docs
AnastaZIuk Apr 7, 2026
705f62a
Polish camera API boundaries and runtime cleanup
AnastaZIuk Apr 7, 2026
1a95be4
Extract camera event contract and hide binding storage
AnastaZIuk Apr 7, 2026
4ae1e9c
Move camera presentation helpers to ui
AnastaZIuk Apr 7, 2026
8fca07e
Move follow labels into ui text helpers
AnastaZIuk Apr 7, 2026
5990235
Move follow regression utilities into system
AnastaZIuk Apr 7, 2026
d8ae9c2
Qualify camera math through hlsl
AnastaZIuk Apr 7, 2026
d660266
Clarify camera namespace split in docs
AnastaZIuk Apr 7, 2026
896901d
Document camera support headers
AnastaZIuk Apr 7, 2026
ea451cd
Tighten camera API cleanup
AnastaZIuk Apr 8, 2026
ac3a6a5
Unify camera rigid math and resource loading
AnastaZIuk Apr 8, 2026
c1014d0
Save camera cleanup work in progress
AnastaZIuk Apr 9, 2026
c836787
Save WIP cleanup checkpoint
AnastaZIuk Apr 9, 2026
5763d91
Refactor camera utility helpers
AnastaZIuk Apr 9, 2026
d6cf91e
Refactor camera track and file helpers
AnastaZIuk Apr 9, 2026
d75344d
Refactor camera preset and scripted utilities
AnastaZIuk Apr 9, 2026
84aab63
Refactor camera math utilities
AnastaZIuk Apr 9, 2026
853998b
Refactor camera overlay utilities
AnastaZIuk Apr 9, 2026
55b4607
Refactor camera orbit vector math
AnastaZIuk Apr 9, 2026
f8a96a7
Deduplicate camera pose structs
AnastaZIuk Apr 9, 2026
51e690a
Deduplicate camera tracked poses
AnastaZIuk Apr 9, 2026
96f4232
Deduplicate camera goal pose
AnastaZIuk Apr 9, 2026
c9c4d61
Refactor path camera to typed state model
AnastaZIuk Apr 9, 2026
eb6422d
Finalize path camera cleanup
AnastaZIuk Apr 9, 2026
ada1b28
Normalize camera API doxygen docs
AnastaZIuk Apr 9, 2026
5c39ff1
Implement reference frame support across cameras
AnastaZIuk Apr 9, 2026
3f3eb23
Refine camera API traits and documentation
AnastaZIuk Apr 9, 2026
873976b
Clarify camera reference frame semantics
AnastaZIuk Apr 9, 2026
3d09c68
Finalize camera API input semantics
AnastaZIuk Apr 9, 2026
0736f23
Move camera stack into Nabla ext module
AnastaZIuk Apr 10, 2026
7f78de4
Adapt 61_UI to cameras ext cleanup
AnastaZIuk Apr 10, 2026
95aec58
Materialize envmaps through NAM
AnastaZIuk Apr 10, 2026
cf16ce7
Final cleanups
AnastaZIuk Apr 10, 2026
1c83dbe
Fix media submodule pointer
AnastaZIuk Apr 10, 2026
49512f2
Fix HLSL path tracer debug build
AnastaZIuk Apr 11, 2026
d3c2f73
Replace legacy example camera wrapper
AnastaZIuk Apr 11, 2026
c693ddb
Merge master into cameraz
AnastaZIuk Apr 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ compiled.spv
*/.vscode/*
*/__main__.py
tmp
/tmp/rtSamples.bin
/runtime/
3 changes: 2 additions & 1 deletion 09_GeometryCreator/include/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


#include "nbl/examples/examples.hpp"
#include "nbl/examples/cameras/CCameraSimpleFPSUtilities.hpp"

using namespace nbl;
using namespace core;
Expand All @@ -15,4 +16,4 @@ using namespace scene;
using namespace nbl::examples;


#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
45 changes: 30 additions & 15 deletions 09_GeometryCreator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes

// camera
{
core::vectorSIMDf cameraPosition(-5.81655884, 2.58630896, -4.23974705);
core::vectorSIMDf cameraTarget(-0.349590302, -0.213266611, 0.317821503);
float32_t4x4 projectionMatrix = hlsl::math::thin_lens::lhPerspectiveFovMatrix<float>(core::radians(60.0f), float(m_initialResolution.x) / m_initialResolution.y, 0.1f, 10000.0f);
camera = Camera(cameraPosition, cameraTarget, projectionMatrix, 1.069f, 0.4f);
const auto cameraPosition = hlsl::float64_t3(-5.81655884, 2.58630896, -4.23974705);
const auto cameraTarget = hlsl::float64_t3(-0.349590302, -0.213266611, 0.317821503);
cameraProjection = hlsl::math::thin_lens::lhPerspectiveFovMatrix<float>(core::radians(60.0f), float(m_initialResolution.x) / m_initialResolution.y, 0.1f, 10000.0f);

camera = CCameraSimpleFPSUtilities::createFromLookAt(cameraPosition, cameraTarget, {1.069, 0.4});
if (!camera)
return logFail("Could not initialize camera orientation!");
ui::CCameraInputBindingUtilities::applyDefaultCameraInputBindingPreset(cameraInputBinder, *camera);
cameraInputRuntime.binder = &cameraInputBinder;
}

onAppInitializedFinish();
Expand All @@ -94,10 +99,18 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
cb->begin(IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
cb->beginDebugMarker("GeometryCreatorApp Frame");
{
camera.beginInputProcessing(nextPresentationTimestamp);
mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void { camera.mouseProcess(events); mouseProcess(events); }, m_logger.get());
keyboard.consumeEvents([&](const IKeyboardEventChannel::range_t& events) -> void { camera.keyboardProcess(events); }, m_logger.get());
camera.endInputProcessing(nextPresentationTimestamp);
std::vector<ui::SMouseEvent> mouseEvents;
std::vector<ui::SKeyboardEvent> keyboardEvents;

mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void { mouseEvents.insert(mouseEvents.end(), events.begin(), events.end()); }, m_logger.get());
keyboard.consumeEvents([&](const IKeyboardEventChannel::range_t& events) -> void { keyboardEvents.insert(keyboardEvents.end(), events.begin(), events.end()); }, m_logger.get());

mouseProcess({ mouseEvents.data(), mouseEvents.size() });

const auto virtualEvents = CCameraSimpleFPSUtilities::collectBasicVirtualEvents(mouseEvents, keyboardEvents, nextPresentationTimestamp, cameraInputRuntime, cameraInputConfig);

if (!virtualEvents.empty())
camera->manipulate(std::span<const core::CVirtualGimbalEvent>(virtualEvents.data(), virtualEvents.size()));
}


Expand Down Expand Up @@ -140,8 +153,8 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
cb->beginRenderPass(info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
}

float32_t3x4 viewMatrix = camera.getViewMatrix();
float32_t4x4 viewProjMatrix = camera.getConcatenatedMatrix();
const auto viewMatrix = hlsl::float32_t3x4(camera->getGimbal().getViewMatrix());
const auto viewProjMatrix = hlsl::math::linalg::promoted_mul(cameraProjection, viewMatrix);
const auto viewParams = CSimpleDebugRenderer::SViewParams(viewMatrix,viewProjMatrix);

// tear down scene every frame
Expand Down Expand Up @@ -247,16 +260,18 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
InputSystem::ChannelReader<IKeyboardEventChannel> keyboard;

//
Camera camera = Camera(core::vectorSIMDf(0, 0, 0), core::vectorSIMDf(0, 0, 0), hlsl::float32_t4x4());
core::smart_refctd_ptr<core::CFPSCamera> camera;
ui::CGimbalInputBinder cameraInputBinder;
CCameraSimpleFPSUtilities::SBasicInputRuntime cameraInputRuntime = {};
CCameraSimpleFPSUtilities::SBasicInputConfig cameraInputConfig = {};
hlsl::float32_t4x4 cameraProjection = hlsl::float32_t4x4(1.0f);

uint16_t gcIndex = {};

void mouseProcess(const nbl::ui::IMouseEventChannel::range_t& events)
void mouseProcess(std::span<const nbl::ui::SMouseEvent> events)
{
for (auto eventIt = events.begin(); eventIt != events.end(); eventIt++)
for (const auto& ev : events)
{
auto ev = *eventIt;

if (ev.type==nbl::ui::SMouseEvent::EET_SCROLL && m_renderer)
{
gcIndex += int16_t(core::sign(ev.scrollEvent.verticalScroll));
Expand Down
54 changes: 37 additions & 17 deletions 0_ImportanceSamplingEnvMaps/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

#define _NBL_STATIC_LIB_
#include <nabla.h>
#include "nbl/examples/cameras/CCameraSimpleFPSUtilities.hpp"
#include "nbl/ext/FullScreenTriangle/FullScreenTriangle.h"
#include "nbl/ext/ScreenShot/ScreenShot.h"
#include "CCamera.hpp"
#include "nbl/ext/Cameras/CCameraInputBindingUtilities.hpp"
#include "nbl/ext/Cameras/CFPSCamera.hpp"
#include "nbl/ext/Cameras/CGimbalInputBinder.hpp"
#include "../common/CommonAPI.h"

using namespace nbl;
Expand Down Expand Up @@ -122,7 +125,11 @@ class ImportanceSamplingEnvMaps : public ApplicationBase

CommonAPI::InputSystem::ChannelReader<IMouseEventChannel> mouse;
CommonAPI::InputSystem::ChannelReader<IKeyboardEventChannel> keyboard;
Camera camera = Camera(vectorSIMDf(0, 0, 0), vectorSIMDf(0, 0, 0), matrix4SIMD());
core::smart_refctd_ptr<core::CFPSCamera> camera;
ui::CGimbalInputBinder cameraInputBinder;
nbl::examples::CCameraSimpleFPSUtilities::SBasicInputRuntime cameraInputRuntime = {};
nbl::examples::CCameraSimpleFPSUtilities::SBasicInputConfig cameraInputConfig = {};
hlsl::float32_t4x4 cameraProjection = hlsl::float32_t4x4(1.0f);

core::smart_refctd_ptr<IGPUGraphicsPipeline> gpuEnvmapPipeline;
core::smart_refctd_ptr<IGPUMeshBuffer> gpuEnvmapMeshBuffer;
Expand Down Expand Up @@ -297,10 +304,14 @@ class ImportanceSamplingEnvMaps : public ApplicationBase
logger = std::move(initOutput.logger);
inputSystem = std::move(initOutput.inputSystem);

core::vectorSIMDf cameraPosition(-0.0889001, 0.678913, -4.01774);
core::vectorSIMDf cameraTarget(1.80119, 0.515374, -0.410544);
matrix4SIMD projectionMatrix = matrix4SIMD::buildProjectionMatrixPerspectiveFovLH(core::radians(60.0f), float(WIN_W) / WIN_H, 0.03125f, 200.0f);
camera = Camera(cameraPosition, cameraTarget, projectionMatrix, 10.f, 1.f);
const auto cameraPosition = hlsl::float64_t3(-0.0889001, 0.678913, -4.01774);
const auto cameraTarget = hlsl::float64_t3(1.80119, 0.515374, -0.410544);
cameraProjection = matrix4SIMD::buildProjectionMatrixPerspectiveFovLH(core::radians(60.0f), float(WIN_W) / WIN_H, 0.03125f, 200.0f);
camera = nbl::examples::CCameraSimpleFPSUtilities::createFromLookAt(cameraPosition, cameraTarget, {10.0, 1.0});
if (!camera)
return logFail("Could not initialize camera orientation!");
ui::CCameraInputBindingUtilities::applyDefaultCameraInputBindingPreset(cameraInputBinder, *camera);
cameraInputRuntime.binder = &cameraInputBinder;

descriptorPool = createDescriptorPool(1u);

Expand Down Expand Up @@ -775,10 +786,10 @@ class ImportanceSamplingEnvMaps : public ApplicationBase

void onAppTerminated_impl() override
{
const core::vectorSIMDf& last_cam_pos = camera.getPosition();
const core::vectorSIMDf& last_cam_target = camera.getTarget();
std::cout << "Last camera position: (" << last_cam_pos.X << ", " << last_cam_pos.Y << ", " << last_cam_pos.Z << ")" << std::endl;
std::cout << "Last camera target: (" << last_cam_target.X << ", " << last_cam_target.Y << ", " << last_cam_target.Z << ")" << std::endl;
const auto& lastCamPos = camera->getGimbal().getPosition();
const auto lastCamTarget = camera->getGimbal().getWorldTarget();
std::cout << "Last camera position: (" << lastCamPos.x << ", " << lastCamPos.y << ", " << lastCamPos.z << ")" << std::endl;
std::cout << "Last camera target: (" << lastCamTarget.x << ", " << lastCamTarget.y << ", " << lastCamTarget.z << ")" << std::endl;
}

void workLoopBody() override
Expand All @@ -802,14 +813,23 @@ class ImportanceSamplingEnvMaps : public ApplicationBase
inputSystem->getDefaultMouse(&mouse);
inputSystem->getDefaultKeyboard(&keyboard);

camera.beginInputProcessing(nextPresentationTimestamp);
mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void { camera.mouseProcess(events); }, logger.get());
keyboard.consumeEvents([&](const IKeyboardEventChannel::range_t& events) -> void { camera.keyboardProcess(events); }, logger.get());
camera.endInputProcessing(nextPresentationTimestamp);
std::vector<SMouseEvent> mouseEvents;
std::vector<SKeyboardEvent> keyboardEvents;
mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void
{
mouseEvents.insert(mouseEvents.end(), events.begin(), events.end());
}, logger.get());
keyboard.consumeEvents([&](const IKeyboardEventChannel::range_t& events) -> void
{
keyboardEvents.insert(keyboardEvents.end(), events.begin(), events.end());
}, logger.get());
const auto virtualEvents = nbl::examples::CCameraSimpleFPSUtilities::collectBasicVirtualEvents(mouseEvents, keyboardEvents, nextPresentationTimestamp, cameraInputRuntime, cameraInputConfig);
if (!virtualEvents.empty())
camera->manipulate(std::span<const core::CVirtualGimbalEvent>(virtualEvents.data(), virtualEvents.size()));
}

const auto& viewMatrix = camera.getViewMatrix();
const auto& viewProjectionMatrix = camera.getConcatenatedMatrix();
const auto viewMatrix = hlsl::float32_t3x4(camera->getGimbal().getViewMatrix());
const auto viewProjectionMatrix = hlsl::math::linalg::promoted_mul(cameraProjection, viewMatrix);

asset::SViewport viewport;
viewport.minDepth = 1.f;
Expand Down Expand Up @@ -883,4 +903,4 @@ class ImportanceSamplingEnvMaps : public ApplicationBase
return windowCb->isWindowOpen();
}
};
NBL_COMMON_API_MAIN(ImportanceSamplingEnvMaps)
NBL_COMMON_API_MAIN(ImportanceSamplingEnvMaps)
7 changes: 6 additions & 1 deletion 12_MeshLoaders/include/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@


#include "nbl/examples/examples.hpp"
#include "nbl/examples/cameras/CCameraSimpleFPSUtilities.hpp"
#include "nbl/ext/Cameras/CCameraInputBindingUtilities.hpp"
#include "nbl/ext/Cameras/CCameraMathUtilities.hpp"
#include "nbl/ext/Cameras/CFPSCamera.hpp"
#include "nbl/ext/Cameras/CGimbalInputBinder.hpp"

using namespace nbl;
using namespace core;
Expand All @@ -15,4 +20,4 @@ using namespace scene;
using namespace nbl::examples;


#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
46 changes: 31 additions & 15 deletions 12_MeshLoaders/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
if (!reloadModel())
return false;

camera.mapKeysToArrows();
ui::CCameraInputBindingUtilities::applyDefaultCameraInputBindingPreset(cameraInputBinder, *camera);
cameraInputRuntime.binder = &cameraInputBinder;

onAppInitializedFinish();
return true;
Expand Down Expand Up @@ -169,8 +170,12 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
// late latch input
{
bool reload = false;
camera.beginInputProcessing(nextPresentationTimestamp);
mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void { camera.mouseProcess(events); }, m_logger.get());
std::vector<SMouseEvent> cameraMouseEvents;
std::vector<SKeyboardEvent> cameraKeyboardEvents;
mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void
{
cameraMouseEvents.insert(cameraMouseEvents.end(), events.begin(), events.end());
}, m_logger.get());
keyboard.consumeEvents([&](const IKeyboardEventChannel::range_t& events) -> void
{
for (const auto& event : events)
Expand All @@ -182,17 +187,19 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
m_drawBBMode = DrawBoundingBoxMode((m_drawBBMode + 1) % DBBM_COUNT);
}
}
camera.keyboardProcess(events);
cameraKeyboardEvents.insert(cameraKeyboardEvents.end(), events.begin(), events.end());
},
m_logger.get()
);
camera.endInputProcessing(nextPresentationTimestamp);
const auto virtualEvents = CCameraSimpleFPSUtilities::collectBasicVirtualEvents(cameraMouseEvents, cameraKeyboardEvents, nextPresentationTimestamp, cameraInputRuntime, cameraInputConfig);
if (!virtualEvents.empty())
camera->manipulate(std::span<const core::CVirtualGimbalEvent>(virtualEvents.data(), virtualEvents.size()));
if (reload)
reloadModel();
}
// draw scene
float32_t3x4 viewMatrix = camera.getViewMatrix();
float32_t4x4 viewProjMatrix = camera.getConcatenatedMatrix();
float32_t3x4 viewMatrix = hlsl::float32_t3x4(camera->getGimbal().getViewMatrixRH());
float32_t4x4 viewProjMatrix = hlsl::math::linalg::promoted_mul(cameraProjection, viewMatrix);
m_renderer->render(cb,CSimpleDebugRenderer::SViewParams(viewMatrix,viewProjMatrix));
#ifdef NBL_BUILD_DEBUG_DRAW
if (m_drawBBMode != DBBM_NONE)
Expand Down Expand Up @@ -521,16 +528,20 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
{
const double distance = 0.05;
const auto diagonal = bound.getExtent();
const auto pos = bound.maxVx + diagonal * distance;
const auto center = (bound.minVx + bound.maxVx) * 0.5;
{
const auto measure = hlsl::length(diagonal);
const auto aspectRatio = float(m_window->getWidth()) / float(m_window->getHeight());
camera.setProjectionMatrix(hlsl::math::thin_lens::rhPerspectiveFovMatrix<float>(1.2f, aspectRatio, distance * measure * 0.1, measure * 4.0));
camera.setMoveSpeed(measure * 0.04);
cameraProjection = hlsl::math::thin_lens::rhPerspectiveFovMatrix<float>(1.2f, aspectRatio, distance * measure * 0.1, measure * 4.0);
camera = CCameraSimpleFPSUtilities::createFromLookAt(
hlsl::float64_t3(pos.x, pos.y, pos.z),
hlsl::float64_t3(center.x, center.y, center.z),
{measure * 0.04, cameraRotateSpeed});
if (!camera)
return logFail("Could not initialize camera orientation!");
cameraInputRuntime.binder = &cameraInputBinder;
}
const auto pos = bound.maxVx + diagonal * distance;
camera.setPosition(vectorSIMDf(pos.x, pos.y, pos.z));
const auto center = (bound.minVx + bound.maxVx) * 0.5;
camera.setTarget(vectorSIMDf(center.x, center.y, center.z));
}

// TODO: write out the geometry
Expand Down Expand Up @@ -560,7 +571,12 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
InputSystem::ChannelReader<IMouseEventChannel> mouse;
InputSystem::ChannelReader<IKeyboardEventChannel> keyboard;
//
Camera camera = Camera(core::vectorSIMDf(0, 0, 0), core::vectorSIMDf(0, 0, 0), hlsl::float32_t4x4());
core::smart_refctd_ptr<core::CFPSCamera> camera;
ui::CGimbalInputBinder cameraInputBinder;
CCameraSimpleFPSUtilities::SBasicInputRuntime cameraInputRuntime = {};
CCameraSimpleFPSUtilities::SBasicInputConfig cameraInputConfig = {};
hlsl::float32_t4x4 cameraProjection = hlsl::float32_t4x4(1.0f);
float cameraRotateSpeed = 1.0f;
// mutables
std::string m_modelPath;

Expand All @@ -578,4 +594,4 @@ class MeshLoadersApp final : public MonoWindowApplication, public BuiltinResourc
nbl::system::path m_saveGeomPrefixPath;
};

NBL_MAIN_FUNC(MeshLoadersApp)
NBL_MAIN_FUNC(MeshLoadersApp)
8 changes: 6 additions & 2 deletions 31_HLSLPathTracer/include/nbl/this_example/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@

// common api
#include "nbl/examples/common/SimpleWindowedApplication.hpp"
#include "nbl/examples/cameras/CCameraSimpleFPSUtilities.hpp"
#include "nbl/examples/examples.hpp"
#include "nbl/examples/cameras/CCamera.hpp"
#include "nbl/ext/Cameras/CCameraInputBindingUtilities.hpp"
#include "nbl/ext/Cameras/CCameraMathUtilities.hpp"
#include "nbl/ext/Cameras/CFPSCamera.hpp"
#include "nbl/ext/Cameras/CGimbalInputBinder.hpp"
#include "nbl/examples/common/CEventCallback.hpp"

// example's own headers
#include "nbl/ui/ICursorControl.h"
#include "nbl/ext/ImGui/ImGui.h"
#include "imgui/imgui_internal.h"

#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
Loading