Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# deCamera_priv.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file deCamera_priv.hpp
    00003 ///
    00004 /// @brief Viewport & Rendering Data, private header
    00005 ///
    00006 /// @author Assassin
    00007 ///
    00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
    00009 /// contents of this file is subject to the Destiny3D Member License which
    00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
    00011 ///
    00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
    00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
    00014 /// for any particular purpose.
    00015 ///
    00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
    00017 ///
    00018 /// <hr>
    00019 ///                                 Change History
    00020 /// <hr>
    00021 ///
    00022 /// @date Jan 2002
    00023 /// @author Assassin
    00024 /// @remarks Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DECAMERA_PRIV_HPP
    00029 #define DECAMERA_PRIV_HPP
    00030
    00031 #include "deCamera.hpp"
    00032 #include "deArray.hpp"
    00033
    00034 // this class is essentially a storage class to interface deRender & deScene
    00035 class deCamera : public IdeCamera
    00036 {
    00037 public:
    00038     deCamera(void);
    00039     deCamera(const deCamera &ref);
    00040     ~deCamera(void);
    00041     long Release();
    00042
    00043     void SetWindow(HWND window);
    00044     void SetRect(deRect rect);
    00045     void SetFOV(deDouble Degrees);
    00046     void SetScreenAspect(long PixelWidth, long PixelHeight, deDouble AspectRatio);
    00047     void SetClip(deDouble Near, deDouble Far);
    00048     void FogEnable(deBoolean Enable);
    00049     void SetFog(deFloat Near, deFloat Far, deARGB Color, deBoolean RangeFog);
    00050     void SetOrthoWidth(deDouble Width);
    00051     void EnableOrtho(deBoolean OrthoEnable);
    00052 //  void BuildRootFrustum(deFrustum &f);
    00053     deBoolean BuildRootFrustum(IdePlaneFrustum * pFrustum);
    00054     // returns a unit vector from the current camera translation
    00055     // that extends along the ray corresponding to screen coord (x,y)
    00056     deVec3d ScreenPointToWorldVec(int x, int y, deVec3d *StartPosition);
    00057     // transforms a 3D world position into an (x,y) pair on the screen
    00058     deBoolean WorldPosToScreenPos(const deVec3d &pos, int &x, int &y);
    00059 //  deBoolean FrustumRect(const deFrustum & f, deRect & r);
    00060     deBoolean FrustumRect(const IdePlaneFrustum* f, deRect & r);
    00061
    00062     HWND GetWindow();
    00063     deRect GetRect();
    00064     deDouble GetFOV();
    00065     deDouble GetFOVy(deDouble &Aspect);
    00066     deDouble GetNearClip();
    00067     deDouble GetFarClip();
    00068     deDouble GetOrthoWidth();
    00069     deBoolean IsOrtho();
    00070     deBoolean GetFog(deFloat& Near, deFloat& Far, deARGB& Color, deBoolean& RangeFog);
    00071
    00072     void LockAspect(deDouble Aspect);
    00073
    00074     deTransformInfo&    Position();
    00075
    00076 private:
    00077     HWND        m_hWnd;
    00078     deBoolean   m_IsOrtho;
    00079     deBoolean   m_FogEnable;
    00080     deBoolean   m_RangeFog;
    00081     deBoolean   m_AspectLocked;
    00082     deARGB      m_FogColor;
    00083     deFloat     m_NearFog, m_FarFog;
    00084     deDouble    m_OrthoWidth;
    00085     deDouble    m_NearClip, m_FarClip;
    00086     deDouble    m_FOV, m_FOVy;
    00087     deDouble    m_LastAspect;
    00088     deDouble    m_PixelAspect;
    00089     deRect      m_Viewport;
    00090     deTransform m_Position;
    00091 };
    00092
    00093 class dePlaneFrustum : public IdePlaneFrustum
    00094 {
    00095 private:
    00096     deTArray <dePlane> m_Planes;
    00097     deVec3d m_InVec, m_PosVec;
    00098     deDouble m_Min, m_Max;
    00099     deBoolean m_Ortho;
    00100 public:
    00101     dePlaneFrustum();
    00102     ~dePlaneFrustum();
    00103
    00104     long Release();
    00105
    00106     deBoolean CreateFromPolygon(const deVec3d * PointArray, long NumPoints, const deVec3d & Position);
    00107     deBoolean CopyFromFrustum(const IdePlaneFrustum* Ref);
    00108
    00109     deBoolean Optimize();
    00110
    00111     deBoolean IsOrtho() const;
    00112     void SetOrtho(deBoolean Ortho);
    00113
    00114     u32  GetNumPlanes() const;
    00115     void SetNumPlanes(u32 NumPlanes);
    00116
    00117     void AddPlane(const dePlane & plane);
    00118
    00119     void GetPlane(u32 index, dePlane & plane) const;
    00120     void SetPlane(u32 index, const dePlane & plane);
    00121
    00122     void SetInVec(const deVec3d & InVec);
    00123     void SetPosVec(const deVec3d & PosVec);
    00124     void SetDists(const deDouble & Min, const deDouble & Max);
    00125     deDouble GetMinDist() const;
    00126     deDouble GetMaxDist() const;
    00127
    00128     deBoolean TestSphereInside(const deBoundSphere& Sphere, const deVec3d& WorldPos, deBoolean & AllInside) const;
    00129     deBoolean TestAABBInside(const deAABB& BBox, const deVec3d& WorldPos, deBoolean & AllInside) const;
    00130 };
    00131
    00132 #endif