17SCamera::SCamera() : SNode(0,
"", SNode::CAMERA_TYPE_ID)
22SCamera::SCamera(
SScene* parent,
const std::string& cameraName) :
SNode(parent, cameraName,
SNode::CAMERA_TYPE_ID)
26 O3Camera->setNearClipDistance(0.1f);
27 O3Camera->setFarClipDistance(1000.0f);
30 O3Camera->setAutoAspectRatio(
true);
35 O3Camera->setUseMinPixelSize(
true);
43 if (currentViewport != 0)
57 return currentViewport;
62 currentViewport = mViewPort;
69 O3Camera->_notifyViewport(0);
75 O3Camera->setAutoAspectRatio(
false);
76 O3Camera->setAspectRatio(ratio);
77 if (O3Camera->getViewport())
78 O3Camera->getViewport()->_updateDimensions();
86 return O3Camera->getAspectRatio();
91 O3Camera->setAutoAspectRatio(state);
92 if (O3Camera->getViewport())
93 O3Camera->getViewport()->_updateDimensions();
101 O3Camera->setFrustumOffset(x, y);
106 return O3Camera->getFrustumOffset();
111 O3Camera->setCustomProjectionMatrix(state, projmat);
118 Ogre::Plane cameraPlane = Ogre::Plane(Ogre::Vector3(O3Camera->getDerivedOrientation().zAxis()), O3Camera->getDerivedPosition());
119 return (cameraPlane.getSide(point) != Ogre::Plane::NEGATIVE_SIDE);
124 return O3Camera->getProjectionMatrix() * (O3Camera->getViewMatrix() * point);
129 return O3Camera->setRenderingDistance(distance);
134 return O3Camera->getRenderingDistance();
142 return O3Camera->getBoundingBox().getSize();
147 return O3Camera->getBoundingBox().getCenter();
155 return O3Camera->getWorldBoundingBox(
true).getSize();
160 return O3Camera->getWorldBoundingBox(
true).getCenter();
165 O3Camera->setNearClipDistance(std::max(0.001f, distance));
167 if (currentViewport != 0)
176 return O3Camera->getNearClipDistance();
181 if (distance <= 0.0f)
182 O3Camera->setFarClipDistance(10000.0f);
184 O3Camera->setFarClipDistance(std::max(0.002f, std::min(10000000.0f, distance)));
186 if (currentViewport != 0)
195 return O3Camera->getFarClipDistance();
200 return O3Camera->getProjectionMatrix();
206 return O3Camera->getViewMatrix();
211 return O3Camera->getFocalLength();
216 if (focalLength > 0.0f)
218 O3Camera->setFocalLength(focalLength);
220 if (currentViewport != 0)
230 return O3Camera->getFOVy().valueRadians();
235 Ogre::Radian fov(newFovY);
236 if (fov.valueDegrees() >= 180.0f)
237 fov = Ogre::Degree(179.0f);
239 O3Camera->setFOVy(fov);
241 if (currentViewport != 0)
250 return O3Camera->getLodBias();
258 O3Camera->setLodBias(bias);
265 O3Camera->setProjectionType(type);
272 return O3Camera->getProjectionType();
277 O3Camera->setOrthoWindowWidth(size.
x);
278 O3Camera->setOrthoWindowHeight(size.
y);
284 size.
x = O3Camera->getOrthoWindowWidth();
285 size.
y = O3Camera->getOrthoWindowHeight();
293 return O3Camera->_getNumRenderedFaces();
301 return O3Camera->_getNumRenderedBatches();
void SetCurrentViewPort(SViewPort *mViewPort)
virtual float GetRenderingDistance()
Ogre::Vector2 GetFrustumOffset()
void SetAutoAspectRatio(bool state)
unsigned int GetNumRenderedBatches()
void SetFOVy(const float &newFovY)
void SetFocalLength(const Ogre::Real &focalLength)
virtual Ogre::Vector3 GetWorldBoundingBoxSize(const bool &childs=false)
Ogre::Camera * GetOgreCameraPointer()
Ogre::ProjectionType GetProjectionType()
void SetNearClipDistance(const float &distance)
virtual Ogre::Vector3 GetBoundingBoxSize(const bool &childs=false)
float GetNearClipDistance()
void SetCustomProjectionMatrix(bool state, Ogre::Matrix4 projmat=Ogre::Matrix4::IDENTITY)
bool IsFacingPoint(const Ogre::Vector3 &point)
void SetProjectionType(const Ogre::ProjectionType &type)
void SetAspectRatio(const float &ratio)
virtual void SetRenderingDistance(const float &distance)
unsigned int GetNumRenderedFaces()
virtual Ogre::Vector3 GetBoundingBoxCenter(const bool &childs=false)
Ogre::Vector3 ToScreenSpace(const Ogre::Vector3 &point)
SViewPort * getCurrentViewPort()
const Ogre::Matrix4 & GetProjectionMatrix()
SPoint< float > GetOrthoWindow()
void SetLODbias(const float &bias)
void SetOrthoWindow(const SPoint< float > &size)
virtual Ogre::Vector3 GetWorldBoundingBoxCenter(const bool &childs=false)
float GetFarClipDistance()
void SetFarClipDistance(const float &distance)
const Ogre::Real GetFocalLength()
void SetFrustumOffset(const float &x, const float &y)
const Ogre::Affine3 & GetViewMatrix()
void UnregisterCamera(Ogre::Camera *cam)
Ogre::SceneNode * O3SceneNode
Ogre::MovableObject * ogreMovableObject
Ogre::Vector3 GetSonsBoundingBox()
void SetProgramCameraParameter(float fov, float znear, float zfar, float focalLength)
static SRoot * getSingletonPtr()
SEnvironment * GetEnvironment() const
Ogre::SceneManager * GetOgreScenePointer()
bool IsStereoViewportRegistered()
void UpdateStereoCamera(Ogre::Camera *camera)
Ogre::Viewport * GetOgreViewPortPointer()
void UpdateStereoCameraMatrix(Ogre::Camera *camera)
void SetCamera(SCamera *camera)