Remove Matrices - #760
Remove Matrices#760devshgraphicsprogramming wants to merge 465 commits into
Conversation
| template<typename T> | ||
| inline T radians(NBL_CONST_REF_ARG(T) degrees) | ||
| { | ||
| static_assert( | ||
| is_floating_point<T>::value, | ||
| "This code expects the type to be either a double or a float." | ||
| ); | ||
|
|
||
| return degrees * PI<T>() / T(180); | ||
| } | ||
|
|
||
| template<typename T> | ||
| inline T degrees(NBL_CONST_REF_ARG(T) radians) | ||
| { | ||
| static_assert( | ||
| is_floating_point<T>::value, | ||
| "This code expects the type to be either a double or a float." | ||
| ); | ||
|
|
||
| return radians * T(180) / PI<T>(); | ||
| } |
There was a problem hiding this comment.
we have numbers ot something like that for PI and friends.
Also the _HLSL_VERSION case should forward to the inline SPIR-V from the std450 extended set
| DEFINE_MUL_QUATERNION_BY_SCALAR_OPERATOR(uint32_t) | ||
| DEFINE_MUL_QUATERNION_BY_SCALAR_OPERATOR(uint64_t) |
There was a problem hiding this comment.
this is a mistake, only provide mul with T
…H (ambiguity dependent type issues), reference #760
…ng/Nabla/pull/760/files#r1816728485 for #760 PR, update examples_tests submodule
|
|
||
| // TODO: if `IdentityFloat32_t3x4` and `IdentityFloat32_t3x4` constexprs are ok, then I can expand them into templated struct, not doing it untill the concept is approved | ||
| //template<typename T, uint32_t N, uint32_t M> | ||
| //struct IdentityMatrix |
There was a problem hiding this comment.
add
template<typename T>
concept MatrixType = requires
{
typename T::Base::row_type;
typename T::Base::col_type;
typename T::Base::value_type;
} && std::is_base_of_v<glm::mat<T::Base::row_type::length(), T::Base::col_type::length(), typename T::Base::value_type>, typename T::Base>;to matrix.hlsl just after definition (but ask @devshgraphicsprogramming if it should be named MatrixType)
then create diagonal utility
template<MatrixType Matrix>
constexpr inline Matrix diagonal(float scalar)
{
return Matrix(scalar);
}you can also template the scalar actually and make it value_type of the Matrix, now note that
matrix<T, N, M>(scalar)creates a diagonal matrix withscalarput on thediagonal- if your
N == Mthenmatrix<T, N, M>(1.f)is the identity matrix you need
so following diagonal create identity function (not struct!), you should be able to
using any_square_matrix_t = float32_t3x3;
constexpr auto bruh = hlsl::identity<any_square_matrix_t>()have constraints on the template parameter, let's allow only for square matrices
There was a problem hiding this comment.
but this is not C++ only file
There was a problem hiding this comment.
so we can't use concepts..
There was a problem hiding this comment.
typename T::Base::row_type;
typename T::Base::col_type;
typename T::Base::value_type;this is specific to GLM and won't pass in plain HLSL
| //{ | ||
| // | ||
| //}; | ||
| NBL_CONSTEXPR hlsl::float32_t3x4 IdentityFloat32_t3x4 = |
| //}; | ||
| NBL_CONSTEXPR hlsl::float32_t3x4 IdentityFloat32_t3x4 = | ||
| hlsl::float32_t3x4(hlsl::float32_t4(1, 0, 0, 0), hlsl::float32_t4(0, 0, 1, 0), hlsl::float32_t4(0, 0, 1, 0)); | ||
| NBL_CONSTEXPR hlsl::float32_t4x4 IdentityFloat32_t4x4 = |
| // TODO: this is temporary function, delete when removing vectorSIMD | ||
| template<typename T> | ||
| matrix<T, 4, 4> getMatrix3x4As4x4(const matrix<T, 3, 4>& mat) | ||
| inline core::vectorSIMDf transformVector(const matrix<T, 4, 4>& mat, const core::vectorSIMDf& vec) |
There was a problem hiding this comment.
shouldn't we also remove SIMD vectors?
| matrix<T, 4, 4> getMatrix3x4As4x4(const matrix<T, 3, 4>& mat) | ||
| inline core::vectorSIMDf transformVector(const matrix<T, 4, 4>& mat, const core::vectorSIMDf& vec) | ||
| { | ||
| core::vectorSIMDf output; |
There was a problem hiding this comment.
There was a problem hiding this comment.
I will remove every occurance of the simd vector when I work on it, no need to spam xd
| namespace transformation_matrix_utils_impl | ||
| { | ||
| template<typename T> | ||
| inline T determinant_helper(const matrix<T, 3, 3>& mat, vector<T, 3>& r1crossr2) |
There was a problem hiding this comment.
please document that your returned determinant is yielded by scalar triple product
| const vector<T, 3> zaxis = glm::normalize(position - target); | ||
| const vector<T, 3> xaxis = glm::normalize(hlsl::cross(upVector, zaxis)); | ||
| const vector<T, 3> yaxis = hlsl::cross(zaxis, xaxis); | ||
| static_assert(N >= 3 && M >= 3); |
There was a problem hiding this comment.
instead of doing static_assert lets have it in requires clause
There was a problem hiding this comment.
can't do since it is not C++ only file
| const vector<T, 3>& target, | ||
| const vector<T, 3>& upVector) | ||
| template<typename T, uint32_t N, uint32_t M> | ||
| inline matrix<T, 3, 3> getSub3x3TransposeCofactors(const matrix<T, N, M>& mat) |
There was a problem hiding this comment.
please document it returns adjugate (transpose of the cofactor matrix) of sub 3x3 mat matrix
| NBL_FORCE_INLINE T dot(const T& a, const T& b); | ||
| NBL_FORCE_INLINE T dot(const T& a, const T& b) | ||
| { | ||
| static_assert(!(std::is_same_v<T, hlsl::float32_t2> || std::is_same_v<T, hlsl::float32_t3> || std::is_same_v<T, hlsl::float32_t4>)); |
There was a problem hiding this comment.
can't do since it is not C++ only file
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
blake3: add reset()
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Prefix sum box blur
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
video: update profiles
Fix false positive aspect mask error raising
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
video: free command buffers when destroyed
* add operator= for glm:: matrices corresponding to our at home matrices - we were never be able to do ourMatrixT = glmMatrixT and its important since a lot of utils create glmMatrixT actually * I'm stupid, I have explicit at home matrix constructor taking glm:: matrix xD remove the = operator glm -> to ours * steal include/nbl/builtin/hlsl/matrix_utils/transformation_matrix_utils.hlsl from #760 * fix getMatrix3x4As4x4 (return type issues) & buildCameraLookAtMatrixRH (ambiguity dependent type issues), reference #760 * update examples_tests submodule * actually *this* addresses https://github.com/Devsh-Graphics-Programming/Nabla/pull/760/files#r1816728485 for #760 PR, update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * forgot to commit projection build methods, update examples_tests submodule * add is_smart_refctd_ptr_v, update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * create ui::E_MOUSE_CODE & constexpr ui::mouseCodeToString - we really were missing an equivalent of E_KEY_CODE. Update examples_tests submodule * @alichraghi small homework - read https://en.cppreference.com/w/cpp/language/inline and afterwards https://gudok.xyz/inline/ please * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update imguizmo with its upstream * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * add getCastedMatrix & getCastedVector, update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * add examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * add constexpr stringToKeyCode & stringToMouseCode * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * update examples_tests submodule * a comment for glslFunctions, update examples_tests submodule * small temporary updates to transformation_matrix_utils.hlsl, update examples_tests submodule * introduce reference frame concept to imguizmo - commit submodule update * update examples_tests submodule * update examples_tests submodule * imgui log polish * Update camera module and async dispatcher exit * Restore transformation matrix utils compatibility * Update examples_tests submodule pointer * Update examples_tests submodule pointer * Update examples_tests pointer for world axis fix * Update examples tests camera smoke integration * Add frustum extension and camera smoke updates * Update examples tests continuity frustum script * Update camera test submodule revision * Update examples_tests submodule revision * Update examples_tests for cameraz smoke fixes * Update examples_tests after master merge * Update examples_tests after json alias fix * Update examples_tests checkpoint * Update examples_tests after goal solver rename * Update examples_tests after camera goal cleanup * Update examples_tests after camera goal solver changes * Update examples_tests after preset compatibility changes * Update examples_tests after preset policy changes * Update examples_tests after Chase and Dolly preset flow checks * Update examples_tests after planar binding cleanup * Update examples_tests after camera contract cleanup * Update examples_tests after input binding helper cleanup * Update examples_tests after transform editor cleanup * Update examples_tests after binding layout rename * Update examples_tests after binding storage split * Update examples_tests after binding layout header split * Update examples_tests after JSON binding rename * Update examples_tests after input processor rename * Update examples_tests after camera rig setup cleanup * Update examples_tests after rig config routing * Update examples_tests after rig preset helper cleanup * Update examples_tests after camera binding layout decoupling * Update examples_tests after binding naming cleanup * Update examples_tests after camera binding cleanup * Update examples_tests after motion config split * Update examples_tests after scoped motion overrides * Update examples_tests after unit motion wrapper * Update examples_tests after goal alias cleanup * Update examples_tests after preset UI cleanup * Update examples_tests after playback summary changes * Update examples_tests after preset banner cleanup * Update examples_tests after playback scrub preview * Update examples_tests after capture gating * Update examples_tests after shared goal API cleanup * Update examples_tests after shared preset API cleanup * Update examples_tests after playback keyframe authoring cleanup * Update examples_tests after keyframe storage changes * Update examples_tests after shared analysis cleanup * Update examples_tests after shared keyframe track cleanup * Update examples_tests after camera docs * Update examples_tests after header docs * Update examples_tests after playback timeline cleanup * Update examples_tests after camera persistence cleanup * Update examples_tests after preset flow cleanup * Update examples_tests after preset apply summary cleanup * Update examples_tests after camera helper smoke hardening * Update examples_tests after camera helper polish * Update examples_tests after camera manipulation cleanup * Update examples_tests after camera text cleanup * Update examples_tests after camera projection cleanup * Update examples_tests after analysis text cleanup * Update examples_tests after helper smoke hardening * Update examples_tests after presentation cleanup * Update examples_tests after presentation badge cleanup * Update examples_tests after preset comparison cleanup * Update examples_tests after presentation label cleanup * Update examples_tests after preset collection cleanup * Update examples_tests after continuity scripting cleanup * Update examples_tests after follow integration * Update examples_tests after follow integration * Update examples_tests after sequence policy cleanup * Update examples_tests after scripted runtime cleanup * Update examples_tests after camera docs rewrite * Update examples_tests after camera API cleanup * Update examples_tests after camera cleanup * Update examples_tests after camera contract cleanup * Update examples_tests after ui presentation cleanup * Update examples_tests after follow label cleanup * Update examples_tests after system follow cleanup * Update examples_tests after hlsl cleanup * Update examples_tests after docs cleanup * Update examples_tests after header docs * Polish hlsl transform utility cleanup * Update examples_tests after camera cleanup * Update examples_tests after camera cleanup * Move cameras module into ext * Clean up cameras ext module * Polish cameras README * Trim non-camera drift from cameras ext * Use shared quaternion cast in cameras * Restore dxc submodule pointer * Split cameras utilities into source files * Move gimbal input processing into source files * Revert shared quaternion cast change * Restore shared quaternion cast * Use bitmask helpers for goal solver issues * Update examples_tests submodule * Refresh examples cameraz submodule * Refresh examples cameraz submodule * Fix GitHub math in cameras README * Fix Path Rig math rendering * Refresh examples cameraz submodule * Refresh examples cameraz submodule * Refresh examples cameraz submodule * Fix camera scaling and view accessors * bug fixes and minor typo fixes to input system * update examples after merge with master * new hlsl::approx helpers and ieee754 fixes and improvements + update README * camera namespace changes + minor fixes + remove useless classes * cleanup math utilities, use hlsl:: as much as possible and remove redundant math util functions, consistent matrix conventions (mat4x4 vs new CameraBasis). * more cleanups and refactors, better names, remove ReferenceTransform and replace with RigPose, seperate mat4x4 from manipulate calls into a `setPose` function. a bit more documentations. remove passthrough functions that add to confusion and bloat the codebase. * cleanup gimball and manipulation counters, a little cleanip on camera follow utils. move stuff to cpp * The layer that captured one camera's state into a `CCameraGoal` and applied it to another camera, plus everything built on it (presets, keyframe tracks, playback, persistence, follow, sequence scripts, the scripted runtime and its checks), now lives in `examples_tests/61_UI/include/camera/` * update examples * update examples * update examples * new camera controls and input processing * update examples * update examples + fix wrong input pruning * Move files from camera extension to UI example and update Copyright years * update README * cleanup projection stuff in camera extension, proper names (distinction between projection and cameraWithProjection) * update readme of camera ext * Camera extension math utils cleanups and refactors * update examples_tests --------- Co-authored-by: Erfan Ahmadi <ahmadierfan99@gmail.com>
Description
Testing
TODO list: