Blender V2.61 - r43446
|
#include <KX_Camera.h>
Definition at line 51 of file KX_Camera.h.
anonymous enum |
Definition at line 148 of file KX_Camera.h.
KX_Camera::KX_Camera | ( | void * | sgReplicationInfo, |
SG_Callbacks | callbacks, | ||
const RAS_CameraData & | camdata, | ||
bool | frustum_culling = true , |
||
bool | delete_node = false |
||
) |
Definition at line 40 of file KX_Camera.cpp.
References m_modelview_matrix, KX_GameObject::m_name, and m_projection_matrix.
Referenced by GetReplica().
KX_Camera::~KX_Camera | ( | ) | [virtual] |
Definition at line 62 of file KX_Camera.cpp.
References m_delete_node, KX_GameObject::m_pSGNode, and NULL.
int KX_Camera::BoxInsideFrustum | ( | const MT_Point3 * | box | ) |
Tests the given eight corners of a box with the view frustum.
box | a pointer to eight MT_Point3 representing the world coordinates of the corners of the box. |
Definition at line 398 of file KX_Camera.cpp.
References ExtractClipPlanes(), INSIDE, INTERSECT, m_planes, OUTSIDE, and p.
Referenced by KX_Scene::MarkVisible().
void KX_Camera::CorrectLookUp | ( | MT_Scalar | speed | ) |
Not implemented.
Definition at line 107 of file KX_Camera.cpp.
void KX_Camera::EnableViewport | ( | bool | viewport | ) |
Sets this camera's viewport status.
Definition at line 461 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_viewport.
void KX_Camera::ExtractClipPlanes | ( | ) | [protected] |
Extracts the camera clip frames from the projection and world-to-camera matrices.
Definition at line 248 of file KX_Camera.cpp.
References m_dirty, m_modelview_matrix, m_normalized, m_planes, and m_projection_matrix.
Referenced by BoxInsideFrustum(), GetNormalizedClipPlanes(), PointInsideFrustum(), and SphereInsideFrustum().
void KX_Camera::ExtractFrustumSphere | ( | ) | [protected] |
Extracts the bound sphere of the view frustum.
Definition at line 286 of file KX_Camera.cpp.
References MT_Point3::distance(), MT_Vector3::dot(), credits_svn_gen::e, F, fabs(), GetCameraToWorld(), i, len(), MT_Vector2::length(), m_frustum_center, m_frustum_radius, m_projection_matrix, m_set_frustum_center, N, KX_GameObject::NodeGetWorldScaling(), MT_Tuple4::setValue(), and MT_Tuple3::setValue().
Referenced by SphereInsideFrustum().
RAS_CameraData * KX_Camera::GetCameraData | ( | ) |
Gets all camera data.
Definition at line 243 of file KX_Camera.cpp.
References m_camdata.
Referenced by KX_LightObject::BindShadowBuffer(), ImageRender::Render(), KX_Dome::RotateCamera(), and KX_CameraIpoSGController::Update().
float KX_Camera::GetCameraFar | ( | ) | const |
Gets the far clip distance.
Definition at line 231 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_clipend.
Referenced by BL_ConvertBlenderObjects(), KX_Dome::CalculateFrustum(), and ImageRender::Render().
const MT_Point3 KX_Camera::GetCameraLocation | ( | ) | const |
Definition at line 113 of file KX_Camera.cpp.
References KX_GameObject::NodeGetWorldPosition().
Referenced by KX_Scene::MarkVisible().
float KX_Camera::GetCameraNear | ( | ) | const |
Gets the near clip distance.
Definition at line 224 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_clipstart.
Referenced by BL_ConvertBlenderObjects(), KX_Dome::CalculateFrustum(), and ImageRender::Render().
const MT_Quaternion KX_Camera::GetCameraOrientation | ( | ) | const |
Definition at line 128 of file KX_Camera.cpp.
References KX_GameObject::NodeGetWorldOrientation().
MT_Transform KX_Camera::GetCameraToWorld | ( | ) | const |
Definition at line 100 of file KX_Camera.cpp.
References KX_GameObject::NodeGetWorldOrientation(), and KX_GameObject::NodeGetWorldPosition().
Referenced by ExtractFrustumSphere().
float KX_Camera::GetFocalLength | ( | ) | const |
Gets the focal length (only used for stereo rendering)
Definition at line 236 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_focallength.
bool KX_Camera::GetFrustumCulling | ( | ) | const |
Gets this camera's culling status.
Definition at line 456 of file KX_Camera.cpp.
References m_frustum_culling.
Referenced by KX_Scene::MarkVisible().
virtual int KX_Camera::GetGameObjectType | ( | ) | [inline, virtual] |
Reimplemented from SCA_IObject.
Definition at line 278 of file KX_Camera.h.
References SCA_IObject::OBJ_CAMERA.
float KX_Camera::GetLens | ( | ) | const |
Gets the aperture.
Definition at line 193 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_lens.
Referenced by ImageRender::Render().
const MT_Matrix4x4 & KX_Camera::GetModelviewMatrix | ( | ) | const |
Gets the modelview matrix that is used by the rasterizer.
Gets the modelview matrix that is used by the rasterizer.
Definition at line 173 of file KX_Camera.cpp.
References m_modelview_matrix.
MT_Vector4* KX_Camera::GetNormalizedClipPlanes | ( | ) | [inline, protected] |
return the clip plane
Definition at line 139 of file KX_Camera.h.
References ExtractClipPlanes(), m_planes, and NormalizeClipPlanes().
Referenced by KX_Scene::CalculateVisibleMeshes().
const MT_Matrix4x4 & KX_Camera::GetProjectionMatrix | ( | ) | const |
Gets the projection matrix that is used by the rasterizer.
Definition at line 163 of file KX_Camera.cpp.
References m_projection_matrix.
Referenced by ImageRender::Render(), and KX_Dome::RenderDomeFrame().
CValue * KX_Camera::GetReplica | ( | void | ) | [virtual] |
Inherited from CValue -- return a new copy of this instance allocated on the heap. Ownership of the new object belongs with the caller.
Reimplemented from KX_GameObject.
Definition at line 73 of file KX_Camera.cpp.
References KX_Camera(), and ProcessReplica().
float KX_Camera::GetScale | ( | ) | const |
Gets the ortho scale.
Definition at line 198 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_scale.
Referenced by ImageRender::Render().
short KX_Camera::GetSensorFit | ( | ) | const |
Gets the mode FOV is calculating from sensor dimensions
Definition at line 219 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_sensor_fit.
Referenced by ImageRender::Render().
float KX_Camera::GetSensorHeight | ( | ) | const |
Gets the vertical size of the sensor - for camera matching
Definition at line 214 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_sensor_y.
Referenced by ImageRender::Render().
float KX_Camera::GetSensorWidth | ( | ) | const |
Gets the horizontal size of the sensor - for camera matching
Definition at line 206 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_sensor_x.
Referenced by ImageRender::Render().
bool KX_Camera::GetViewport | ( | ) | const |
Gets this camera's viewport status.
Definition at line 474 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_viewport.
Referenced by ImageRender::calcImage(), KX_KetsjiEngine::GetSceneViewport(), KX_KetsjiEngine::Render(), and KX_KetsjiEngine::RenderDome().
int KX_Camera::GetViewportBottom | ( | ) | const |
Gets this camera's viewport bottom.
Definition at line 484 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_viewportbottom.
Referenced by KX_KetsjiEngine::GetSceneViewport().
int KX_Camera::GetViewportLeft | ( | ) | const |
Gets this camera's viewport left.
Definition at line 479 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_viewportleft.
Referenced by KX_KetsjiEngine::GetSceneViewport().
int KX_Camera::GetViewportRight | ( | ) | const |
Gets this camera's viewport right.
Definition at line 489 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_viewportright.
Referenced by KX_KetsjiEngine::GetSceneViewport().
int KX_Camera::GetViewportTop | ( | ) | const |
Gets this camera's viewport top.
Definition at line 494 of file KX_Camera.cpp.
References m_camdata, and RAS_CameraData::m_viewporttop.
Referenced by KX_KetsjiEngine::GetSceneViewport().
MT_Transform KX_Camera::GetWorldToCamera | ( | ) | const |
Definition at line 90 of file KX_Camera.cpp.
References MT_Transform::invert(), KX_GameObject::NodeGetWorldOrientation(), and KX_GameObject::NodeGetWorldPosition().
Referenced by ImageRender::Render(), KX_Dome::RenderDomeFrame(), and KX_Dome::RotateCamera().
bool KX_Camera::hasValidProjectionMatrix | ( | ) | const |
returns true if this camera has been set a projection matrix.
Definition at line 179 of file KX_Camera.cpp.
References m_set_projection_matrix.
Referenced by ImageRender::Render().
void KX_Camera::InvalidateProjectionMatrix | ( | bool | valid = false | ) |
Sets the validity of the projection matrix. Call this if you change camera data (eg lens, near plane, far plane) and require the projection matrix to be recalculated.
Definition at line 184 of file KX_Camera.cpp.
References m_set_projection_matrix.
Referenced by KX_CameraIpoSGController::Update().
void KX_Camera::NormalizeClipPlanes | ( | ) | [protected] |
Normalize the camera clip frames.
Definition at line 271 of file KX_Camera.cpp.
References m_normalized, m_planes, MT_fuzzyZero(), p, and sqrt().
Referenced by GetNormalizedClipPlanes(), and SphereInsideFrustum().
bool KX_Camera::PointInsideFrustum | ( | const MT_Point3 & | x | ) |
Tests the given point against the view frustum.
Definition at line 386 of file KX_Camera.cpp.
References ExtractClipPlanes(), i, and m_planes.
void KX_Camera::ProcessReplica | ( | ) | [virtual] |
Inherited from CValue -- Makes sure any internal data owned by this class is deep copied. Called internally
Reimplemented from KX_GameObject.
Definition at line 83 of file KX_Camera.cpp.
References m_delete_node.
Referenced by GetReplica().
void KX_Camera::SetModelviewMatrix | ( | const MT_Matrix4x4 & | mat | ) |
Sets the modelview matrix that is used by the rasterizer.
Definition at line 151 of file KX_Camera.cpp.
References m_dirty, m_modelview_matrix, and m_set_frustum_center.
Referenced by KX_LightObject::BindShadowBuffer(), ImageRender::Render(), KX_Dome::RenderDomeFrame(), and KX_Dome::RotateCamera().
void KX_Camera::SetProjectionMatrix | ( | const MT_Matrix4x4 & | mat | ) |
Sets the projection matrix that is used by the rasterizer.
Definition at line 138 of file KX_Camera.cpp.
References m_dirty, m_projection_matrix, m_set_frustum_center, and m_set_projection_matrix.
Referenced by KX_LightObject::BindShadowBuffer(), ImageRender::Render(), and KX_Dome::RenderDomeFrame().
void KX_Camera::SetViewport | ( | int | left, |
int | bottom, | ||
int | right, | ||
int | top | ||
) |
Sets this camera's viewport.
Definition at line 466 of file KX_Camera.cpp.
References left(), m_camdata, RAS_CameraData::m_viewportbottom, RAS_CameraData::m_viewportleft, RAS_CameraData::m_viewportright, and RAS_CameraData::m_viewporttop.
Tests if the given sphere is inside this camera's view frustum.
center | The center of the sphere, in world coordinates. |
radius | The radius of the sphere. |
Definition at line 430 of file KX_Camera.cpp.
References distance(), MT_Point3::distance2(), ExtractClipPlanes(), ExtractFrustumSphere(), fabs(), INSIDE, intersect(), INTERSECT, m_frustum_center, m_frustum_radius, m_planes, NormalizeClipPlanes(), OUTSIDE, and p.
Referenced by KX_Scene::MarkVisible().
friend class KX_Scene [friend] |
Definition at line 55 of file KX_Camera.h.
RAS_CameraData KX_Camera::m_camdata [protected] |
Camera parameters (clips distances, focal length). These params are closely tied to Blender. In the gameengine, only the projection and modelview matrices are relevant. There's a conversion being done in the engine class. Why is it stored here? It doesn't really have a function here.
Definition at line 61 of file KX_Camera.h.
Referenced by EnableViewport(), GetCameraData(), GetCameraFar(), GetCameraNear(), GetFocalLength(), GetLens(), GetScale(), GetSensorFit(), GetSensorHeight(), GetSensorWidth(), GetViewport(), GetViewportBottom(), GetViewportLeft(), GetViewportRight(), GetViewportTop(), and SetViewport().
bool KX_Camera::m_delete_node [protected] |
whether the camera should delete the node itself (only for shadow camera)
Definition at line 122 of file KX_Camera.h.
Referenced by ProcessReplica(), and ~KX_Camera().
bool KX_Camera::m_dirty [protected] |
true if the view frustum (modelview/projection matrix) has changed - the clip planes (m_planes) will have to be regenerated.
Definition at line 90 of file KX_Camera.h.
Referenced by ExtractClipPlanes(), SetModelviewMatrix(), and SetProjectionMatrix().
MT_Point3 KX_Camera::m_frustum_center [protected] |
The center point of the frustum.
Definition at line 115 of file KX_Camera.h.
Referenced by ExtractFrustumSphere(), and SphereInsideFrustum().
bool KX_Camera::m_frustum_culling [protected] |
This camera is frustum culling. Some cameras (ie if the game was started from a non camera view should not cull.)
Definition at line 105 of file KX_Camera.h.
Referenced by GetFrustumCulling().
MT_Scalar KX_Camera::m_frustum_radius [protected] |
Definition at line 116 of file KX_Camera.h.
Referenced by ExtractFrustumSphere(), and SphereInsideFrustum().
MT_Matrix4x4 KX_Camera::m_modelview_matrix [protected] |
Storage for the modelview matrix that is passed to the rasterizer.
Definition at line 83 of file KX_Camera.h.
Referenced by ExtractClipPlanes(), GetModelviewMatrix(), KX_Camera(), and SetModelviewMatrix().
bool KX_Camera::m_normalized [protected] |
true if the frustum planes have been normalized.
Definition at line 94 of file KX_Camera.h.
Referenced by ExtractClipPlanes(), and NormalizeClipPlanes().
MT_Vector4 KX_Camera::m_planes[6] [protected] |
View Frustum clip planes.
Definition at line 99 of file KX_Camera.h.
Referenced by BoxInsideFrustum(), ExtractClipPlanes(), GetNormalizedClipPlanes(), NormalizeClipPlanes(), PointInsideFrustum(), and SphereInsideFrustum().
MT_Matrix4x4 KX_Camera::m_projection_matrix [protected] |
Storage for the projection matrix that is passed to the rasterizer.
Definition at line 77 of file KX_Camera.h.
Referenced by ExtractClipPlanes(), ExtractFrustumSphere(), GetProjectionMatrix(), KX_Camera(), and SetProjectionMatrix().
bool KX_Camera::m_set_frustum_center [protected] |
Definition at line 117 of file KX_Camera.h.
Referenced by ExtractFrustumSphere(), SetModelviewMatrix(), and SetProjectionMatrix().
bool KX_Camera::m_set_projection_matrix [protected] |
true if this camera has a valid projection matrix.
Definition at line 110 of file KX_Camera.h.
Referenced by hasValidProjectionMatrix(), InvalidateProjectionMatrix(), and SetProjectionMatrix().