From de4b3f271685f65f592e3cf5beb00c4ef8bd61e2 Mon Sep 17 00:00:00 2001 From: Nicolas Savva Date: Fri, 18 Aug 2023 15:00:43 -0700 Subject: [PATCH] Remove MSLRenderer Camera initialization (enables client ShaderRender camera modification). --- source/MaterialXRenderMsl/MslRenderer.h | 8 ------- source/MaterialXRenderMsl/MslRenderer.mm | 28 ------------------------ 2 files changed, 36 deletions(-) diff --git a/source/MaterialXRenderMsl/MslRenderer.h b/source/MaterialXRenderMsl/MslRenderer.h index bf968078fe..1c54bdbc6a 100644 --- a/source/MaterialXRenderMsl/MslRenderer.h +++ b/source/MaterialXRenderMsl/MslRenderer.h @@ -126,9 +126,6 @@ class MX_RENDERMSL_API MslRenderer : public ShaderRenderer protected: MslRenderer(unsigned int width, unsigned int height, Image::BaseType baseType); - - virtual void updateViewInformation(); - virtual void updateWorldInformation(); void triggerProgrammaticCapture(); void stopProgrammaticCapture(); @@ -146,11 +143,6 @@ class MX_RENDERMSL_API MslRenderer : public ShaderRenderer bool _initialized; - const Vector3 _eye; - const Vector3 _center; - const Vector3 _up; - float _objectScale; - SimpleWindowPtr _window; Color3 _screenColor; }; diff --git a/source/MaterialXRenderMsl/MslRenderer.mm b/source/MaterialXRenderMsl/MslRenderer.mm index f6de188b2f..0c9a6db336 100644 --- a/source/MaterialXRenderMsl/MslRenderer.mm +++ b/source/MaterialXRenderMsl/MslRenderer.mm @@ -14,13 +14,6 @@ MATERIALX_NAMESPACE_BEGIN -const float PI = std::acos(-1.0f); - -// View information -const float FOV_PERSP = 45.0f; // degrees -const float NEAR_PLANE_PERSP = 0.05f; -const float FAR_PLANE_PERSP = 100.0f; - // // MslRenderer methods // @@ -38,10 +31,6 @@ MslRenderer::MslRenderer(unsigned int width, unsigned int height, Image::BaseType baseType) : ShaderRenderer(width, height, baseType), _initialized(false), - _eye(0.0f, 0.0f, 3.0f), - _center(0.0f, 0.0f, 0.0f), - _up(0.0f, 1.0f, 0.0f), - _objectScale(1.0f), _screenColor(DEFAULT_SCREEN_COLOR_LIN_REC709) { _program = MslProgram::create(); @@ -160,20 +149,6 @@ } -void MslRenderer::updateViewInformation() -{ - float fH = std::tan(FOV_PERSP / 360.0f * PI) * NEAR_PLANE_PERSP; - float fW = fH * 1.0f; - - _camera->setViewMatrix(Camera::createViewMatrix(_eye, _center, _up)); - _camera->setProjectionMatrix(Camera::createPerspectiveMatrixZP(-fW, fW, -fH, fH, NEAR_PLANE_PERSP, FAR_PLANE_PERSP)); -} - -void MslRenderer::updateWorldInformation() -{ - _camera->setWorldMatrix(Matrix44::createScale(Vector3(_objectScale))); -} - void MslRenderer::triggerProgrammaticCapture() { MTLCaptureManager* captureManager = [MTLCaptureManager sharedCaptureManager]; @@ -217,9 +192,6 @@ [renderCmdEncoder setCullMode:MTLCullModeBack]; - - updateViewInformation(); - updateWorldInformation(); try {