Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Matrices #760

Open
wants to merge 119 commits into
base: cameraz
Choose a base branch
from
Open

Remove Matrices #760

wants to merge 119 commits into from

Conversation

devshgraphicsprogramming
Copy link
Member

Description

Testing

TODO list:

Fletterio and others added 27 commits September 16, 2024 12:18
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Comment on lines 22 to 42
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>();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 52 to 53
DEFINE_MUL_QUATERNION_BY_SCALAR_OPERATOR(uint32_t)
DEFINE_MUL_QUATERNION_BY_SCALAR_OPERATOR(uint64_t)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a mistake, only provide mul with T

IDENTITY_MATRIX(TYPE, 2, 2)\
IDENTITY_MATRIX(TYPE, 3, 3)\
IDENTITY_MATRIX(TYPE, 4, 4)\
IDENTITY_MATRIX(TYPE, 3, 4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identity matrix is square matrix, requesting 3x4 dimensions for identity is incorrect

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I see we had hlsl::IdentityFloat32_t3x4 - in that case it's up to @devshgraphicsprogramming to decide if we keep this logic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm since we have a diagonal let that provide the diagonals for 4x3 when needed, and keep identity only for squares

struct identity;

template<typename T, uint32_t N, uint32_t M>
struct identity<matrix<T, N, M> >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with your new matrix traits you need now to check

matrix_traits<T, N, M>::Square

with new HLSL concept API

#include "position2d.h"
#include "quaternion.h"
#include "nbl/builtin/hlsl/math/quaternion/quaternion.hlsl"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include it somewhere else later on, no point having it global here

#include <nbl/builtin/hlsl/math/quaternion/quaternion.hlsl>
// TODO: remove this header when deleting vectorSIMDf.hlsl
#include <nbl/core/math/glslFunctions.h>
#include "vectorSIMD.h"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including vectorSIMD.h will give you problems soon

Comment on lines 6 to 11
// TODO: remove this header when deleting vectorSIMDf.hlsl
#include <nbl/core/math/glslFunctions.h>
#include "vectorSIMD.h"
#include <nbl/builtin/hlsl/concepts.hlsl>
#include <nbl/builtin/hlsl/matrix_utils/matrix_traits.hlsl>
#include <nbl/builtin/hlsl/concepts.hlsl>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why on earth do you include concepts.hlsl twice, and whats with vectorSIMD.h ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vectorSIMD.h is for c++ only, will fix it

Comment on lines +160 to +161
template<typename T, int N>
inline void setRotation(NBL_REF_ARG(matrix<T, N, 4>) outMat, NBL_CONST_REF_ARG(nbl::hlsl::quaternion<T>) quat)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this method could work for 3x3 and 4x3 matrix as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants