6 #ifndef MATERIALX_CAMERA_H
7 #define MATERIALX_CAMERA_H
25 _projectionMatrix(
Matrix44::IDENTITY),
26 _arcballActive(false),
67 _projectionMatrix = mat;
73 return _projectionMatrix;
79 return _worldMatrix * _viewMatrix * _projectionMatrix;
86 return Vector3(invView[3][0], invView[3][1], invView[3][2]);
93 return Vector3(invView[2][0], invView[2][1], invView[2][2]);
103 _viewportSize =
size;
109 return _viewportSize;
115 v = transformPointPerspective(getWorldViewProjMatrix(), v);
117 v[0] *= _viewportSize[0];
118 v[1] *= _viewportSize[1];
125 v[0] /= _viewportSize[0];
126 v[1] /= _viewportSize[1];
128 v = transformPointPerspective(getWorldViewProjMatrix().getInverse(), v);
137 void arcballButtonEvent(
const Vector2& pos,
bool pressed);
140 bool applyArcballMotion(
const Vector2& pos);
145 return (_arcballDelta * _arcballQuat).toMatrix();
160 float nearP,
float farP);
165 float nearP,
float farP);
170 float nearP,
float farP);
175 float nearP,
float farP);
182 return Vector3(res[0], res[1], res[2]) / res[3];
const Matrix44 & getProjectionMatrix() const
Return the projection matrix.
std::shared_ptr< class Camera > CameraPtr
Shared pointer to a Camera.
static IMATH_HOSTDEVICE void multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &c) IMATH_NOEXCEPT
Matrix-matrix multiplication: compute c = a * b.
#define MATERIALX_NAMESPACE_BEGIN
Matrix44 _projectionMatrix
const Matrix44 & getWorldMatrix() const
Return the world matrix.
void setProjectionMatrix(const Matrix44 &mat)
Set the projection matrix.
static Vector3 transformPointPerspective(const Matrix44 &m, const Vector3 &v)
Matrix44 getInverse() const
Return the inverse of the matrix.
Matrix44 getWorldViewProjMatrix() const
Compute our full model-view-projection matrix.
void setViewportSize(const Vector2 &size)
Set the size of the viewport window.
Matrix44 arcballMatrix() const
Return the arcball matrix.
void setWorldMatrix(const Matrix44 &mat)
Set the world matrix.
Vector3 unprojectFromViewport(Vector3 v)
Unproject a position from viewport to object space.
GA_API const UT_StringHolder up
Vector3 getViewPosition() const
Derive viewer position from the view matrix.
Vector3 getViewDirection() const
Derive viewer direction from the view matrix.
GLdouble GLdouble GLdouble top
#define MATERIALX_NAMESPACE_END
void setViewMatrix(const Matrix44 &mat)
Set the view matrix.
const Vector2 & getViewportSize() const
Return the size of the viewport window.
const Matrix44 & getViewMatrix() const
Return the view matrix.
Vector3 projectToViewport(Vector3 v)
Project a position from object to viewport space.
static CameraPtr create()
Create a new camera.