330 float width_half = tan(hfov/2.0);
331 float height_half = 0.0f;
336 height_half = tan(vfov/2.0);
340 ViewPlane.Min.Set(-width_half,-height_half);
341 ViewPlane.Max.Set(width_half,height_half);
410 if (cam_point.
Z > -
ZNear) {
416 float oow = 1.0f / view_point.
W;
417 dest.
X = view_point.
X * oow;
418 dest.
Y = view_point.
Y * oow;
419 dest.
Z = view_point.
Z * oow;
425 if ((dest.
X < -1.0f) || (dest.
X > 1.0f) || (dest.
Y < -1.0f) || (dest.
Y > 1.0f)) {
459 float oow = 1.0f / view_point.
W;
460 dest.
X = view_point.
X * oow;
461 dest.
Y = view_point.
Y * oow;
462 dest.
Z = view_point.
Z * oow;
468 if ((dest.
X < -1.0f) || (dest.
X > 1.0f) || (dest.
Y < -1.0f) || (dest.
Y > 1.0f)) {
502 point.
X =
ViewPlane.Min.X + vpdx * (view_point.
X + 1.0f) * 0.5f;
503 point.
Y =
ViewPlane.Min.Y + vpdy * (view_point.
Y + 1.0f) * 0.5f;
605 float znear_dist,zfar_dist;
617 Frustum.Init(cam_mat,vpmin,vpmax,znear,zfar);
621#ifdef ALLOW_TEMPORARIES
638 vpmin.
Y*znear_dist, vpmax.
Y*znear_dist,
639 znear_dist, zfar_dist );
672 ndev.
X = device_coord.
X / (float)res_width;
673 ndev.
Y = device_coord.
Y / (float)res_height;
723 int width,height,bits;
792 (*set_tm)[2][2] = -(
ZFar) * oozdiff;
793 (*set_tm)[2][3] = -(
ZFar*
ZNear) * oozdiff;
795 (*set_tm)[2][2] = -oozdiff;
796 (*set_tm)[2][3] = -
ZNear * oozdiff;
829 return result.
X / result.
W;
virtual ~CameraClass(void)
virtual void Set_Position(const Vector3 &v)
const Matrix3D & Get_View_Matrix(void)
float Compute_Projected_Sphere_Radius(float dist, float radius)
void Device_To_World_Space(const Vector2 &device_coord, Vector3 *world_coord)
void Set_Aspect_Ratio(float width_to_height)
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
void Set_Clip_Planes(float znear, float zfar)
void Get_View_Plane(Vector2 &set_min, Vector2 &set_max) const
ProjectionResType Project(Vector3 &dest, const Vector3 &ws_point) const
Matrix4x4 ProjectionTransform
void Rotate_To_View_Space(Vector3 &dest, const Vector3 &ws_vector) const
virtual RenderObjClass * Clone(void) const
bool Cull_Box(const AABoxClass &box) const
CameraClass & operator=(const CameraClass &)
const OBBoxClass & Get_Near_Clip_Bounding_Box(void) const
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
void Set_View_Plane(const Vector2 &min, const Vector2 &max)
void Un_Project(Vector3 &dest, const Vector2 &view_point) const
float Get_Horizontal_FOV(void) const
void Get_Clip_Planes(float &znear, float &zfar) const
virtual void Set_Transform(const Matrix3D &m)
Matrix3D CameraInvTransform
static void Convert_Old(Vector3 &pos)
const FrustumClass & Get_Frustum(void) const
void Transform_To_View_Space(Vector3 &dest, const Vector3 &ws_point) const
void Device_To_View_Space(const Vector2 &device_coord, Vector3 *view_coord)
const Matrix4x4 & Get_Projection_Matrix(void)
void Get_D3D_Projection_Matrix(Matrix4x4 *set_tm)
ProjectionType Projection
FrustumClass ViewSpaceFrustum
void Update_Frustum(void) const
float Get_Aspect_Ratio(void) const
ProjectionResType Project_Camera_Space_Point(Vector3 &dest, const Vector3 &cam_point) const
float Get_Vertical_FOV(void) const
static OverlapType Overlap_Test(const AAPlaneClass &plane, const Vector3 &point)
static void Set_Projection_Transform_With_Z_Bias(const Matrix4x4 &matrix, float znear, float zfar)
static void Set_Viewport(CONST D3DVIEWPORT8 *pViewport)
static void Set_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
Vector3 Rotate_Vector(const Vector3 &vect) const
void mulVector3(const Vector3 &in, Vector3 &out) const
static WWINLINE void Transform_Vector(const Matrix3D &tm, const Vector3 &in, Vector3 *out)
virtual void Set_Transform(const Matrix3D &m)
virtual void Set_Position(const Vector3 &v)
RenderObjClass & operator=(const RenderObjClass &)
const Matrix3D & Get_Transform(void) const
WWINLINE void Set(float x, float y, float z)
static void Get_Render_Target_Resolution(int &set_w, int &set_h, int &get_bits, bool &get_windowed)
static float Atan2(float y, float x)