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

# de2D_priv.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file de2D_priv.hpp
    00003 ///
    00004 /// @brief private header for de2D library
    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 May 2002
    00023 /// @author Assassin
    00024 /// @remarks Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DE2D_PRIV_HPP
    00029 #define DE2D_PRIV_HPP
    00030
    00031 #include "de2D.hpp"
    00032 #include "deList.hpp"
    00033 #include "deRenderStates.hpp"
    00034
    00035 class de2DObject : public Ide2DObject, public deRefCountBase
    00036 {
    00037 protected:
    00038     virtual ~de2DObject();
    00039 public:
    00040     de2DObject( IdeVertexBuffer * VBuffer,
    00041         IdeRenderTexture * Texture, deFloat Depth,
    00042         deBoolean ExpireNow = DE_FALSE);
    00043
    00044     IdeVertexBuffer * GetVBuffer() const;
    00045     IdeRenderTexture* GetTexture() const;
    00046     deBoolean HasExpired() const;
    00047     deFloat GetDepth() const;
    00048
    00049     void MakeExpire();
    00050     deBoolean SetDepth(deFloat Depth);
    00051
    00052     deBoolean Move(deVertex DeltaXY);
    00053     deBoolean Update(deDouble DeltaTime);
    00054
    00055 private:
    00056     IdeVertexBuffer *   m_VBuffer;
    00057     IdeRenderTexture *  m_Texture;
    00058     deBoolean           m_Expire;
    00059     IdeDriver *         m_Driver;
    00060     deFloat             m_Depth;
    00061
    00062 protected:
    00063     virtual deBoolean UpdateObject(deDouble DeltaTime);
    00064     void SetVBuffer(IdeVertexBuffer * VBuffer);
    00065     void SetTexture(IdeRenderTexture * Texture);
    00066 };
    00067
    00068 class de2DOverlay : public de2DObject
    00069 {
    00070 public:
    00071     de2DOverlay(deRect *ScreenRect, deFloatRect *TexCoords,
    00072         IdeRenderTexture * Texture, deFloat Depth = 10.0f,
    00073         deARGB color = 0xFFFFFFFF, deDouble FadePerSecond = 0.0);
    00074
    00075 protected:
    00076     virtual ~de2DOverlay();
    00077
    00078     virtual deBoolean UpdateObject(deDouble DeltaTime);
    00079
    00080     deDouble m_Alpha, m_FadePerSecond;
    00081 };
    00082
    00083 class de2DCorona : public de2DOverlay
    00084 {
    00085 public:
    00086     de2DCorona( deRect *SizeRect, deFloatRect *TexCoords,
    00087         IdeRenderTexture * Texture, IdeCamera * ScreenCamera,
    00088         deFloat Depth = 10.0f, deARGB color = 0xFFFFFFFF);
    00089
    00090     void SetPosition(deVec3d WorldPosition);
    00091
    00092 protected:
    00093     virtual ~de2DCorona();
    00094
    00095     virtual deBoolean UpdateObject(deDouble DeltaTime);
    00096
    00097     deVec3d m_WorldPosition;
    00098     deVertex m_ScreenPosition;
    00099     deBoolean m_OnScreen;
    00100     IdeCamera * m_Camera;
    00101 };
    00102
    00103 class de2DLine : public de2DObject
    00104 {
    00105 public:
    00106     de2DLine(   deVec3d PointList[], long NumPoints,
    00107         deARGB color = 0xFFFFFFFF,
    00108         deDouble FadePerSecond = 0.0, deFloat Depth = 10.0f);
    00109     de2DLine(   deVec3d Start, deVec3d End,
    00110         deARGB color = 0xFFFFFFFF,
    00111         deDouble FadePerSecond = 0.0, deFloat Depth = 10.0f);
    00112     de2DLine(   deRect & LineRect,
    00113         deARGB color = 0xFFFFFFFF,
    00114         deDouble FadePerSecond = 0.0, deFloat Depth = 10.0f);
    00115 protected:
    00116     virtual ~de2DLine();
    00117
    00118     virtual deBoolean UpdateObject(deDouble DeltaTime);
    00119
    00120     deDouble m_Alpha, m_FadePerSecond;
    00121 };
    00122
    00123 class de2DCollection : public Ide2DCollection, public deRefCountBase
    00124 {
    00125 protected:
    00126     virtual ~de2DCollection();
    00127 public:
    00128     de2DCollection();
    00129
    00130     void        SetParent(Ide2DCollection* ParentCollection);
    00131
    00132     const deRect&   GetRect() const;
    00133     void        SetRect(deRect & rect);
    00134
    00135     void        SetBGColor(deARGB color);
    00136     deARGB      GetBGColor();
    00137
    00138     void        SetEnabled(deBoolean Enable);
    00139     deBoolean   IsEnabled() const;
    00140
    00141     void        GetScrollValue(deVec3d & scroll) const;
    00142     void        SetScrollValue(const deVec3d & scroll);
    00143
    00144     deBoolean   AddObject(Ide2DObject * object);
    00145     deBoolean   RemoveObject(Ide2DObject * object);
    00146     deBoolean   AdjustObjectDepth(Ide2DObject * object, deFloat Depth);
    00147
    00148     deBoolean   AddSubCollection(Ide2DCollection * collection);
    00149     deBoolean   RemoveSubCollection(Ide2DCollection * collection);
    00150     deFloat     GetDepth() const;
    00151     deBoolean   SetDepth(deFloat Depth);
    00152
    00153     deBoolean   Render( IdeDriver * Driver, deDouble DeltaTime,
    00154                         IdeRenderTexture *NullTex, IdeRender::deRenderStats * RenderStats,
    00155                         deBoolean DoOcclusion);
    00156
    00157     void        DestroyAllObjects(deBoolean SubCollectionsAlso);
    00158
    00159     static IdeVertexBuffer*     s_CompositeFor2D;
    00160 private:
    00161     static long                 s_NumCollections;
    00162     static IdeVertexBuffer*     s_BackdropQuad;
    00163     static IdeRenderTexture*    s_BackdropTexture;
    00164
    00165     // for storing things in our list
    00166     struct de2DObjectUnion
    00167     {
    00168         union
    00169         {
    00170             Ide2DObject     *Object;
    00171             Ide2DCollection *Collection;
    00172         };
    00173         deBoolean IsObject;
    00174     };
    00175     deBoolean   AddItem(const de2DObjectUnion & NewItem);
    00176     deBoolean   Set2DViewport(short FullWidth, short FullHeight, const deRect & SubRect, IdeDriver * pDriver);
    00177     deBoolean   FillBGColor(IdeDriver * pDriver, const deRect & Rect, const deVec3d & Scroll, deARGB BGColor, IdeRenderTexture* &PrevTexture);
    00178
    00179     // used in the Render function
    00180     struct CollectionState_t
    00181     {
    00182         deTList <de2DObjectUnion>   *List;
    00183         void                        *Entry;
    00184         deRect                      ViewRect;
    00185         deVec3d                     Scroll;
    00186         deARGB                      BGColor;
    00187     };
    00188     struct RenderStateValue_t
    00189     {
    00190         IdeDriver::RenderState      State;
    00191         long                        Value;
    00192     };
    00193
    00194     deTList < de2DObjectUnion > m_ChildList;
    00195
    00196     // the rect we clip to
    00197     deRect              m_ClipRect;
    00198     deVec3d             m_Scroll;
    00199
    00200     Ide2DCollection*    m_pParent;
    00201     deFloat             m_Depth;
    00202     deARGB              m_BGColor;
    00203     deBoolean           m_Enabled;
    00204
    00205 };
    00206
    00207 #endif
    00208