42 float fov()
const {
return _fov; }
43 void setFov(
float value) { _fov = value; }
55 void setNearClip(
const float value) { _nearClip = value; _projMatDirty =
true; }
57 float farClip()
const {
return _farClip; }
58 void setFarClip(
const float value) { _farClip = value; _projMatDirty =
true; }
61 void setOrthoHeight(
const float value) { _orthoHeight = value; _projMatDirty =
true; }
67 evaluateProjectionMatrix();
72 evaluateProjectionMatrix();
73 return _projMatSkybox;
76 float jitter()
const {
return _jitter; }
77 void setJitter(
const float value) { _jitter = value; }
81 const std::array<float, 4>&
jitters()
const {
return _jitters; }
84 const std::vector<std::shared_ptr<RenderPass>>&
renderPasses()
const {
return _renderPasses; };
86 const std::shared_ptr<RenderTarget>&
renderTarget()
const {
return _renderTarget; }
87 void setRenderTarget(
const std::shared_ptr<RenderTarget>& value) { _renderTarget = value;}
102 const std::unique_ptr<GraphNode>&
node()
const {
return _node; }
128 const float fovRad = _fov * (std::numbers::pi_v<float> / 180.0f);
129 float xNear, yNear, xFar, yFar;
132 if (_horizontalFov) {
133 xNear = nearDist * std::tan(fovRad * 0.5f);
134 yNear = xNear / _aspectRatio;
135 xFar = farDist * std::tan(fovRad * 0.5f);
136 yFar = xFar / _aspectRatio;
138 yNear = nearDist * std::tan(fovRad * 0.5f);
139 xNear = yNear * _aspectRatio;
140 yFar = farDist * std::tan(fovRad * 0.5f);
141 xFar = yFar * _aspectRatio;
144 yNear = yFar = _orthoHeight;
145 xNear = xFar = _orthoHeight * _aspectRatio;
149 Vector3( xNear, -yNear, -nearDist),
150 Vector3( xNear, yNear, -nearDist),
151 Vector3(-xNear, yNear, -nearDist),
152 Vector3(-xNear, -yNear, -nearDist),
153 Vector3( xFar, -yFar, -farDist),
154 Vector3( xFar, yFar, -farDist),
155 Vector3(-xFar, yFar, -farDist),
156 Vector3(-xFar, -yFar, -farDist),
160 void evaluateProjectionMatrix();
164 float _aspectRatio = 16 / 9.0f;
168 float _nearClip = 0.1f;
169 float _farClip = 1000.0f;
171 float _orthoHeight = 10.0f;
175 bool _horizontalFov =
false;
178 bool _projMatDirty =
true;
183 float _jitter = 0.0f;
184 int _shaderMatricesVersion = -1;
188 std::array<float, 4> _jitters = {0.0f, 0.0f, 0.0f, 0.0f};
189 bool _hasViewProjCurrent =
false;
192 std::vector<std::shared_ptr<RenderPass>> _renderPasses;
194 std::shared_ptr<RenderTarget> _renderTarget;
196 Color _clearColor = Color(0.75f, 0.75f, 0.75f, 1.0f);
197 Vector4 _rect = Vector4(0.0f, 0.0f, 1.0f, 1.0f);
198 Vector4 _scissorRect = Vector4(0.0f, 0.0f, 1.0f, 1.0f);
200 std::unique_ptr<GraphNode> _node;
202 bool _scissorRectClear =
false;
204 bool _clearDepthBuffer =
true;
206 bool _clearStencilBuffer =
true;
208 bool _clearColorBuffer =
true;
210 std::shared_ptr<RenderPassColorGrab> _renderPassColorGrab;
212 std::shared_ptr<RenderPass> _renderPassDepthGrab;
217 bool _planarReflectionDepthPass =
false;
Perspective or orthographic camera with projection matrix, jitter (TAA), and render target binding.
float aspectRatio() const
AspectRatioMode aspectRatioMode() const
void setProjection(ProjectionType value)
const std::vector< std::shared_ptr< RenderPass > > & renderPasses() const
const std::shared_ptr< RenderPassColorGrab > & renderPassColorGrab() const
void setRenderTarget(const std::shared_ptr< RenderTarget > &value)
void setJitter(const float value)
void setPlanarReflectionDepthPass(bool v)
const Matrix4 & viewProjectionInverse() const
const Matrix4 & viewProjectionPrevious() const
std::array< Vector3, 8 > getFrustumCorners(const float nearDist, const float farDist) const
const Vector4 & rect() const
void setOrthoHeight(const float value)
void _enableRenderPassColorGrab(const std::shared_ptr< GraphicsDevice > &device, bool enable)
void setScissorRectClear(bool value)
const std::shared_ptr< RenderPass > & renderPassDepthGrab() const
ProjectionType projection() const
void setRect(const Vector4 &value)
void _enableRenderPassDepthGrab(const std::shared_ptr< GraphicsDevice > &device, bool enable)
bool clearDepthBufferEnabled() const
void setAspectRatio(float value)
void setClearColorBuffer(bool value)
void setClearStencilBuffer(bool value)
void setNode(GraphNode *value)
bool horizontalFov() const
bool planarReflectionDepthPass() const
const Matrix4 & projectionMatrix()
const std::unique_ptr< GraphNode > & node() const
void setScissorRect(const Vector4 &value)
const std::shared_ptr< RenderTarget > & renderTarget() const
const Vector4 & scissorRect() const
bool clearStencilBufferEnabled() const
const std::array< float, 4 > & jitters() const
bool clearColorBufferEnabled() const
float orthoHeight() const
void setClearColor(const Color &value)
void setAspectRatioMode(AspectRatioMode value)
const Color & clearColor() const
const Matrix4 & projectionMatrixSkybox()
void setFarClip(const float value)
void setClearDepthBuffer(bool value)
void setNearClip(const float value)
void storeShaderMatrices(const Matrix4 &viewProjection, float jitterX, float jitterY, int renderVersion)
Hierarchical scene graph node with local/world transforms and parent-child relationships.
RGBA color with floating-point components in [0, 1].
4x4 column-major transformation matrix with SIMD acceleration.
static Matrix4 identity()
3D vector for positions, directions, and normals with multi-backend SIMD acceleration.
4D vector for homogeneous coordinates, color values, and SIMD operations.