Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 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
c71dffd
Merge branch 'master' into cameraz
Erfan-Ahmadi Sep 15, 2026
18b6da1
Use new hlsl::approx and improve/fix cppcompat tests
Erfan-Ahmadi Sep 16, 2026
92d60b2
camera namespace fixes
Erfan-Ahmadi Sep 16, 2026
b324126
cleanup math utilities, use hlsl:: as much as possible and remove red…
Erfan-Ahmadi Sep 17, 2026
a398143
fixes after refactor
Erfan-Ahmadi Sep 17, 2026
832a43e
changes afrer refactor/renames
Erfan-Ahmadi Sep 17, 2026
44e0605
Move 61_UI specific camera extension files to the example itself
Erfan-Ahmadi Sep 18, 2026
1f18791
bring back builtin app resource for 61_ui example
Erfan-Ahmadi Sep 18, 2026
fde313b
61_UI fix matrix conventions imguizmo (col major) vs nbl (row major)
Erfan-Ahmadi Sep 18, 2026
42a6498
new input processing and camera controls
Erfan-Ahmadi Sep 18, 2026
cb9af84
example 09 bring up to date with new camera ext
Erfan-Ahmadi Sep 18, 2026
8540d78
Bring 61_UI example up to date with new camera changes:
Erfan-Ahmadi Sep 18, 2026
8d1e26f
Fix Examples InputSystem underflow when switching devices and add mor…
Erfan-Ahmadi Sep 19, 2026
cde8d67
Fix example 100 camera usage and other examples wrong input processin…
Erfan-Ahmadi Sep 19, 2026
e3d004e
move more files from camera extension to 61_UI example
Erfan-Ahmadi Sep 19, 2026
3659773
adjust example 61 to new projection changes in camera extension
Erfan-Ahmadi Sep 19, 2026
592091c
update readme of 61_UI
Erfan-Ahmadi Sep 19, 2026
39fe5dd
update 61_UI with recent camera changes
Erfan-Ahmadi Sep 19, 2026
b536f13
quaternion and camera math utils unit tests
Erfan-Ahmadi Sep 19, 2026
d2f9cd6
rename quaternion from lookat function
Erfan-Ahmadi Sep 19, 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/
6 changes: 5 additions & 1 deletion 09_GeometryCreator/include/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@


#include "nbl/examples/examples.hpp"
#include "nbl/ext/Cameras/CCameraMathUtilities.hpp"
#include "nbl/ext/Cameras/CCameraMouseKeyboardController.hpp"
#include "nbl/ext/Cameras/CCameraMouseKeyboardPresets.hpp"
#include "nbl/ext/Cameras/CFPSCamera.hpp"

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


#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
#endif // __NBL_THIS_EXAMPLE_COMMON_H_INCLUDED__
50 changes: 35 additions & 15 deletions 09_GeometryCreator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,24 @@ 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, 10000.0f, 0.1f);
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, 10000.0f, 0.1f);

hlsl::math::quaternion<hlsl::float64_t> cameraOrientation;
if (!ext::cameras::CCameraMathUtilities::tryCreateQuaternionFromLookAt(cameraPosition, cameraTarget, hlsl::float64_t3(0.0, 1.0, 0.0), cameraOrientation))
return logFail("Could not initialize camera orientation!");
camera = core::make_smart_refctd_ptr<ext::cameras::CFPSCamera>(cameraPosition, cameraOrientation);

// WASD moves, the mouse looks while the left button is held
{
using namespace ext::cameras;
auto& binding = cameraController.binding;
binding = CCameraMouseKeyboardPresets::makeDefaultBinding(ICamera::CameraKind::FPS);
binding.scaleSensitivity(ECameraControlAxis::Translate, 1.069);
binding.scaleSensitivity(ECameraControlAxis::Rotate, 0.4);
binding.setMouseMovementGate(ECameraControlAxis::Rotate, ui::EMB_LEFT_BUTTON);
}
}

onAppInitializedFinish();
Expand All @@ -94,10 +108,16 @@ 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 controls = cameraController.collect(nextPresentationTimestamp, keyboardEvents, mouseEvents);
camera->manipulate(controls);
}


Expand Down Expand Up @@ -138,8 +158,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().getViewMatrixLH());
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 @@ -245,16 +265,16 @@ 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<ext::cameras::CFPSCamera> camera;
ext::cameras::CCameraMouseKeyboardController cameraController;
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
59 changes: 42 additions & 17 deletions 0_ImportanceSamplingEnvMaps/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#include <nabla.h>
#include "nbl/ext/FullScreenTriangle/FullScreenTriangle.h"
#include "nbl/ext/ScreenShot/ScreenShot.h"
#include "CCamera.hpp"
#include "nbl/ext/Cameras/CCameraMathUtilities.hpp"
#include "nbl/ext/Cameras/CCameraMouseKeyboardController.hpp"
#include "nbl/ext/Cameras/CCameraMouseKeyboardPresets.hpp"
#include "nbl/ext/Cameras/CFPSCamera.hpp"
#include "../common/CommonAPI.h"

using namespace nbl;
Expand Down Expand Up @@ -122,7 +125,9 @@ 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<ext::cameras::CFPSCamera> camera;
ext::cameras::CCameraMouseKeyboardController cameraController;
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 +302,22 @@ 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);
hlsl::math::quaternion<hlsl::float64_t> cameraOrientation;
if (!ext::cameras::CCameraMathUtilities::tryCreateQuaternionFromLookAt(cameraPosition, cameraTarget, hlsl::float64_t3(0.0, 1.0, 0.0), cameraOrientation))
return logFail("Could not initialize camera orientation!");
camera = core::make_smart_refctd_ptr<ext::cameras::CFPSCamera>(cameraPosition, cameraOrientation);

// WASD moves, the mouse looks while the left button is held
{
using namespace ext::cameras;
auto& binding = cameraController.binding;
binding = CCameraMouseKeyboardPresets::makeDefaultBinding(ICamera::CameraKind::FPS);
binding.scaleSensitivity(ECameraControlAxis::Translate, 10.0);
binding.setMouseMovementGate(ECameraControlAxis::Rotate, ui::EMB_LEFT_BUTTON);
}

descriptorPool = createDescriptorPool(1u);

Expand Down Expand Up @@ -775,10 +792,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().getPosition() + camera->getGimbal().getForward();
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 +819,22 @@ 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 controls = cameraController.collect(nextPresentationTimestamp, keyboardEvents, mouseEvents);
camera->manipulate(controls);
}

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

asset::SViewport viewport;
viewport.minDepth = 1.f;
Expand Down Expand Up @@ -883,4 +908,4 @@ class ImportanceSamplingEnvMaps : public ApplicationBase
return windowCb->isWindowOpen();
}
};
NBL_COMMON_API_MAIN(ImportanceSamplingEnvMaps)
NBL_COMMON_API_MAIN(ImportanceSamplingEnvMaps)
4 changes: 4 additions & 0 deletions 100_PhotonCaustics/include/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#define _NBL_THIS_EXAMPLE_COMMON_H_INCLUDED_

#include "nbl/examples/examples.hpp"
#include "nbl/ext/Cameras/CCameraMathUtilities.hpp"
#include "nbl/ext/Cameras/CCameraMouseKeyboardController.hpp"
#include "nbl/ext/Cameras/CCameraMouseKeyboardPresets.hpp"
#include "nbl/ext/Cameras/CFPSCamera.hpp"

using namespace nbl;
using namespace nbl::core;
Expand Down
84 changes: 56 additions & 28 deletions 100_PhotonCaustics/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
constexpr static inline float EmitterHalfExtent = 0.5f;
constexpr static inline float SphereRadius = 0.75f;
constexpr static inline float SceneHalfExtent = 2.f;
static inline const core::vectorSIMDf InitialCamPos = core::vectorSIMDf(0, 3, 8);
static inline const core::vectorSIMDf InitialCamTarget = core::vectorSIMDf(0, 1, 0);
static inline const hlsl::float64_t3 InitialCamPos = hlsl::float64_t3(0, 3, 8);
static inline const hlsl::float64_t3 InitialCamTarget = hlsl::float64_t3(0, 1, 0);
static inline const hlsl::float64_t3 CamUp = hlsl::float64_t3(0, 1, 0);

public:
inline PhotonCausticsApp(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD)
Expand Down Expand Up @@ -373,15 +374,18 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
// Camera Init position and matrices
//-------------------------------------
{
hlsl::float32_t4x4 proj = hlsl::math::thin_lens::rhPerspectiveFovMatrix(
m_cameraProjection = hlsl::math::thin_lens::rhPerspectiveFovMatrix(
core::radians(m_cameraSetting.fov),
float(WIN_W) / float(WIN_H),
m_cameraSetting.zNear, m_cameraSetting.zFar);
// Initial position of the camera
m_camera = Camera(InitialCamPos, InitialCamTarget, proj);
m_camera = core::make_smart_refctd_ptr<ext::cameras::CFPSCamera>(InitialCamPos);
if (!resetCameraPose())
return logFail("Could not initialize camera orientation!");
// WASD moves, the mouse looks while the left button is held
updateCameraBinding();
// cache this to reset it
m_InitialMVP = m_camera.getConcatenatedMatrix();
m_camera.mapKeysToWASD();
m_InitialMVP = getViewProjectionMatrix();
}

// show the window (and start presentation time recording?)
Expand Down Expand Up @@ -459,7 +463,7 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
cmdbuf->begin(IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
cmdbuf->beginDebugMarker("PhotonCaustics Frame");

const auto& viewProjectionMatrix = m_camera.getConcatenatedMatrix();
const auto viewProjectionMatrix = getViewProjectionMatrix();
// reset accumulation when we move the camera
if (m_cachedMVP != viewProjectionMatrix)
{
Expand Down Expand Up @@ -575,8 +579,8 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin

SPushConstants pc = {};
pc.invMVP = invMVP;
const auto camPos = m_camera.getPosition().getAsVector3df();
pc.camPos = float32_t3(camPos.X, camPos.Y, camPos.Z);
const auto camPos = m_camera->getGimbal().getPosition();
pc.camPos = float32_t3(float(camPos.x), float(camPos.y), float(camPos.z));
pc.accumulatedFrames = m_accumulatedFrames;
pc.geomInfoBuffer = m_geomInfoBuffer->getDeviceAddress();
pc.lightBuffer = m_lightBuffer->getDeviceAddress();
Expand Down Expand Up @@ -669,12 +673,35 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
}
}

inline void update()
// the view matrix is the camera's, the projection is ours, so the concatenation is built here every time it's needed
inline hlsl::float32_t4x4 getViewProjectionMatrix() const
{
m_camera.setMoveSpeed(m_cameraSetting.moveSpeed);
m_camera.setRotateSpeed(m_cameraSetting.rotateSpeed);
const auto viewMatrix = hlsl::float32_t3x4(m_camera->getGimbal().getViewMatrixRH());
return hlsl::math::linalg::promoted_mul(m_cameraProjection, viewMatrix);
}

static std::chrono::microseconds previousEventTimestamp{};
// the UI owns the speeds, so the binding is rebuilt from the default and scaled instead of being compounded
inline void updateCameraBinding()
{
using namespace ext::cameras;
auto& binding = m_cameraController.binding;
binding = CCameraMouseKeyboardPresets::makeDefaultBinding(ICamera::CameraKind::FPS);
binding.scaleSensitivity(ECameraControlAxis::Translate, m_cameraSetting.moveSpeed);
binding.scaleSensitivity(ECameraControlAxis::Rotate, m_cameraSetting.rotateSpeed);
binding.setMouseMovementGate(ECameraControlAxis::Rotate, ui::EMB_LEFT_BUTTON);
}

inline bool resetCameraPose()
{
hlsl::math::quaternion<hlsl::float64_t> orientation;
if (!ext::cameras::CCameraMathUtilities::tryCreateQuaternionFromLookAt(InitialCamPos, InitialCamTarget, CamUp, orientation))
return false;
return m_camera->setPose(ext::cameras::SCameraRigPose{ .position = InitialCamPos, .orientation = orientation });
}

inline void update()
{
updateCameraBinding();

m_inputSystem->getDefaultMouse(&m_mouse);
m_inputSystem->getDefaultKeyboard(&m_keyboard);
Expand All @@ -692,32 +719,29 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
struct {
std::vector<SMouseEvent> mouse{};
std::vector<SKeyboardEvent> keyboard{};
std::vector<SMouseEvent> cameraMouse{};
std::vector<SKeyboardEvent> cameraKeyboard{};
} capturedEvents;

m_camera.beginInputProcessing(nextPresentationTimestamp);
{
const auto& io = ImGui::GetIO();

m_mouse.consumeEvents([&](const IMouseEventChannel::range_t& events) -> void
{
// Note: When the cursor is over ImGui, the camera must not also see the event
if (!io.WantCaptureMouse)
m_camera.mouseProcess(events);
for (const auto& e : events) {
if (e.timeStamp < previousEventTimestamp) continue;
previousEventTimestamp = e.timeStamp;
capturedEvents.mouse.emplace_back(e);
// Note: When the cursor is over ImGui, the camera must not also see the event
if (!io.WantCaptureMouse)
capturedEvents.cameraMouse.emplace_back(e);
}
}, m_logger.get());

m_keyboard.consumeEvents([&](const IKeyboardEventChannel::range_t& events) -> void
{
if (!io.WantCaptureKeyboard)
m_camera.keyboardProcess(events);
for (const auto& e : events) {
if (e.timeStamp < previousEventTimestamp) continue;
previousEventTimestamp = e.timeStamp;
capturedEvents.keyboard.emplace_back(e);
if (!io.WantCaptureKeyboard)
capturedEvents.cameraKeyboard.emplace_back(e);

//if (e.keyCode == EKC_ESCAPE)
//{
Expand All @@ -726,7 +750,10 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
}
}, m_logger.get());
}
m_camera.endInputProcessing(nextPresentationTimestamp);
{
const auto controls = m_cameraController.collect(nextPresentationTimestamp, capturedEvents.cameraKeyboard, capturedEvents.cameraMouse);
m_camera->manipulate(controls);
}

const core::SRange<const nbl::ui::SMouseEvent> mouseEvents(capturedEvents.mouse.data(), capturedEvents.mouse.data() + capturedEvents.mouse.size());
const core::SRange<const nbl::ui::SKeyboardEvent> keyboardEvents(capturedEvents.keyboard.data(), capturedEvents.keyboard.data() + capturedEvents.keyboard.size());
Expand Down Expand Up @@ -763,7 +790,7 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
hlsl::float32_t3x4 transform;
if (degrees != 0.f)
{
const auto rotation = hlsl::math::quaternion<hlsl::float32_t>::create(axis, core::radians(degrees));
const auto rotation = hlsl::math::quaternion<hlsl::float32_t>::createFromAxisAngle(axis, core::radians(degrees));
transform = hlsl::math::linalg::promote_affine<3, 4, 3, 3>(hlsl::_static_cast<hlsl::float32_t3x3>(rotation));
}
else
Expand Down Expand Up @@ -1525,8 +1552,7 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
ImGui::SliderFloat("Rotate speed", &m_cameraSetting.rotateSpeed, 0.1f, 10.f);
if (ImGui::Button("Reset Camera"))
{
m_camera.setPosition(InitialCamPos);
m_camera.setTarget(InitialCamTarget);
resetCameraPose();
m_cachedMVP = m_InitialMVP;
m_accumulatedFrames = 0;
}
Expand Down Expand Up @@ -1628,7 +1654,9 @@ class PhotonCausticsApp final : public SimpleWindowedApplication, public Builtin
} m_ui;

struct CameraSettings { float moveSpeed = 1.f, rotateSpeed = 1.f, fov = 60.f, zNear = 0.01f, zFar = 500.f; } m_cameraSetting;
Camera m_camera;
core::smart_refctd_ptr<ext::cameras::CFPSCamera> m_camera;
ext::cameras::CCameraMouseKeyboardController m_cameraController;
hlsl::float32_t4x4 m_cameraProjection = hlsl::float32_t4x4(1.f);
hlsl::float32_t4x4 m_cachedMVP;
hlsl::float32_t4x4 m_InitialMVP;
uint32_t m_accumulatedFrames = 0;
Expand Down
Loading