@@ -28,7 +28,7 @@ enum class FLAG_BITS : uint16_t
28
28
};
29
29
30
30
// define everything else in terms of this
31
- float32_t2x2 transformMatrix (const FLAG_BITS transform)
31
+ inline float32_t2x2 transformMatrix (const FLAG_BITS transform)
32
32
{
33
33
switch (transform)
34
34
{
@@ -65,7 +65,7 @@ float32_t2x2 transformMatrix(const FLAG_BITS transform)
65
65
66
66
// ! [width,height] might switch to [height, width] in orientations such as 90°CW
67
67
// ! Usecase: Find out how big the viewport has to be after or before a tranform is applied
68
- uint16_t2 transformedExtents (const FLAG_BITS transform, const uint16_t2 screenSize)
68
+ inline uint16_t2 transformedExtents (const FLAG_BITS transform, const uint16_t2 screenSize)
69
69
{
70
70
switch (transform)
71
71
{
@@ -85,7 +85,7 @@ uint16_t2 transformedExtents(const FLAG_BITS transform, const uint16_t2 screenSi
85
85
return uint16_t2 (0 );
86
86
}
87
87
88
- float transformedAspectRatio (const FLAG_BITS transform, const uint16_t2 screenSize)
88
+ inline float transformedAspectRatio (const FLAG_BITS transform, const uint16_t2 screenSize)
89
89
{
90
90
const uint16_t2 newExtents = transformedExtents (transform,screenSize);
91
91
return float (newExtents[1 ])/float (newExtents[0 ]);
@@ -98,7 +98,7 @@ float transformedAspectRatio(const FLAG_BITS transform, const uint16_t2 screenSi
98
98
// ! Warnings:
99
99
// ! - You don't need to consider this using in your raytracing shaders if you apply the forward transformation to your projection matrix.
100
100
// ! - Be aware that almost always you'd want to do a single transform in your rendering pipeline.
101
- uint16_t2 applyInverseToScreenSpaceCoordinate (const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
101
+ inline uint16_t2 applyInverseToScreenSpaceCoordinate (const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
102
102
{
103
103
// TODO: use inverse(transformMatrix(transform)) somehow
104
104
const uint16_t2 lastTexel = screenSize - uint16_t2 (1 ,1 );
@@ -130,7 +130,7 @@ uint16_t2 applyInverseToScreenSpaceCoordinate(const FLAG_BITS transform, const u
130
130
// ! Usecase = [Scatter]:
131
131
// ! When directly writing to your swapchain using `imageStore` in order to match the orientation of the device relative to it's natural orientation.
132
132
// ! Warning: Be aware that almost always you'd want to do a single transform in your rendering pipeline.
133
- uint16_t2 applyToScreenSpaceCoordinate (const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
133
+ inline uint16_t2 applyToScreenSpaceCoordinate (const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
134
134
{
135
135
// TODO: use transformMatrix(transform) somehow
136
136
const uint16_t2 lastTexel = screenSize - uint16_t2 (1 , 1 );
@@ -162,7 +162,7 @@ uint16_t2 applyToScreenSpaceCoordinate(const FLAG_BITS transform, const uint16_t
162
162
// ! If rendering to the swapchain, you may use this function to transform the NDC coordinates directly
163
163
// ! to be fed into gl_Position in vertex shading
164
164
// ! Warning: Be aware that almost always you'd want to do a single transform in your rendering pipeline.
165
- float32_t2 applyToNDC (const FLAG_BITS transform, const float32_t2 ndc)
165
+ inline float32_t2 applyToNDC (const FLAG_BITS transform, const float32_t2 ndc)
166
166
{
167
167
return mul (transformMatrix (transform),ndc);
168
168
}
0 commit comments