Skip to content

Commit

Permalink
Allow Metal specific default perspective camera in ShaderRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolassavva-autodesk committed Aug 21, 2023
1 parent 8fc18db commit 169d64a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/MaterialXRender/ShaderRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ ShaderRenderer::ShaderRenderer(unsigned int width, unsigned int height, Image::B
float fW = fH * 1.0f;
_camera = Camera::create();
_camera->setViewMatrix(Camera::createViewMatrix(DEFAULT_EYE_POSITION, DEFAULT_TARGET_POSITION, DEFAULT_UP_VECTOR));
_camera->setProjectionMatrix(Camera::createPerspectiveMatrix(-fW, fW, -fH, fH, DEFAULT_NEAR_PLANE, DEFAULT_FAR_PLANE));

#if defined (__APPLE__)
_camera->setProjectionMatrix(Camera::createPerspectiveMatrixZP(-fW, fW, -fH, fH, DEFAULT_NEAR_PLANE, DEFAULT_FAR_PLANE));
#else
_camera->setProjectionMatrix(Camera::createPerspectiveMatrix(-fW, fW, -fH, fH, DEFAULT_NEAR_PLANE, DEFAULT_FAR_PLANE));
#endif
}

void ShaderRenderer::createProgram(ShaderPtr)
Expand Down

0 comments on commit 169d64a

Please sign in to comment.