MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / Camera

Class Camera

physx/samples/samplebase/SampleCamera.h:58–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 };
57
58 class Camera : public SampleAllocateable
59 {
60 public:
61 Camera();
62 ~Camera();
63
64 ///////////////////////////////////////////////////////////////////////////////
65
66 // Projection part
67
68 PX_FORCE_INLINE PxReal getFOV() const { return mFOV; }
69 PX_FORCE_INLINE PxReal getNearPlane() const { return mNearPlane; }
70 PX_FORCE_INLINE PxReal getFarPlane() const { return mFarPlane; }
71 PX_FORCE_INLINE PxU32 getScreenWidth() const { return mViewport.mClientWidth; }
72 PX_FORCE_INLINE PxU32 getScreenHeight() const { return mViewport.mClientHeight; }
73
74 PX_FORCE_INLINE void setFOV(PxReal fov) { mFOV = fov; mDirtyProj = true; }
75 PX_FORCE_INLINE void setNearPlane(PxReal d) { mNearPlane = d; mDirtyProj = true; }
76 PX_FORCE_INLINE void setFarPlane(PxReal d) { mFarPlane = d; mDirtyProj = true; }
77 PX_FORCE_INLINE void setScreenSize(PxU32 clientWidth, PxU32 clientHeight, PxU32 windowWidth, PxU32 windowHeight)
78 {
79 mViewport.mClientWidth = clientWidth;
80 mViewport.mClientHeight = clientHeight;
81 mViewport.mWindowWidth = windowWidth;
82 mViewport.mWindowHeight = windowHeight;
83 mDirtyProj = true;
84 }
85
86 PX_FORCE_INLINE const SampleRenderer::RendererProjection&
87 getProjMatrix() const
88 {
89 if(mDirtyProj)
90 const_cast<Camera*>(this)->updateInternals();
91
92 return mProjMatrix;
93 }
94
95 ///////////////////////////////////////////////////////////////////////////////
96
97 // View part
98
99 PX_FORCE_INLINE const PxVec3& getPos() const { return mPos; }
100 PX_FORCE_INLINE const PxVec3& getRot() const { return mRot; }
101
102 PX_FORCE_INLINE void setPos(const PxVec3& pos) { mPos = pos; mDirtyView = true; }
103 PX_FORCE_INLINE void setRot(const PxVec3& rot) { mRot = rot; mDirtyView = true; }
104 PX_FORCE_INLINE void setView(const PxTransform& view) { mViewMatrix = view; mPos = view.p; mDirtyView = false; }
105
106 PX_FORCE_INLINE const PxTransform& getViewMatrix() const
107 {
108 if(mDirtyView)
109 const_cast<Camera*>(this)->updateInternals();
110
111 return mViewMatrix;
112 }
113
114 PxVec3 getViewDir() const;
115 void lookAt(const PxVec3& position, const PxVec3& target);

Callers

nothing calls this directly

Calls 1

updateInternalsMethod · 0.80

Tested by

no test coverage detected