Skip to content

Commit

Permalink
Remove MSLRenderer Camera initialization (enables client ShaderRender…
Browse files Browse the repository at this point in the history
… camera modification).
  • Loading branch information
nicolassavva-autodesk committed Aug 18, 2023
1 parent b23de80 commit de4b3f2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
8 changes: 0 additions & 8 deletions source/MaterialXRenderMsl/MslRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
};
Expand Down
28 changes: 0 additions & 28 deletions source/MaterialXRenderMsl/MslRenderer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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();
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -217,9 +192,6 @@


[renderCmdEncoder setCullMode:MTLCullModeBack];

updateViewInformation();
updateWorldInformation();

try
{
Expand Down

0 comments on commit de4b3f2

Please sign in to comment.