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

# deOccludeRaster.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file deOccludeRaster.hpp
    00003 ///
    00004 /// @brief software rasterizer for doing occlusion culling with
    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 2003
    00023 /// @author Assassin
    00024 /// @remarks Initial Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DEOCCLUDERASTER_HPP
    00029 #define DEOCCLUDERASTER_HPP
    00030
    00031 #include "deGlobalTypes.hpp"
    00032 #include "deMath.hpp"
    00033
    00034 #define OCCLUDE_16BIT       (1) // faster when enabled
    00035 #define OCCLUDE_MINBUFFER   (0) // faster when disabled
    00036
    00037 class deOccludeRasterizer
    00038 {
    00039 public:
    00040 #if OCCLUDE_16BIT
    00041     typedef u16 BufferType;
    00042 #else
    00043     typedef u32 BufferType;
    00044 #endif
    00045
    00046     deOccludeRasterizer();
    00047     ~deOccludeRasterizer();
    00048
    00049     void SetBufferSize(short Width, short Height);
    00050     void SetViewport(const deRect& ViewRect);
    00051     void SetScissorRect(const deRect& ScissorRect);
    00052     void SetGradientCutoff(deFloat Cutoff);
    00053     void SetPixelCounting(deBoolean CountPixels);
    00054     void SetWorldTransform(const deTransformInfo & World);
    00055     void SetViewTransform(const deTransformInfo & View);
    00056     void SetFOVClipping(float FOVY, float Aspect, float ClipNear, float ClipFar, deFloatRect* FSubRect = NULL);
    00057     void SetOrthoClipping(float Width, float Height, float ClipNear, float ClipFar, deBoolean Invert, deFloatRect* FSubRect = NULL);
    00058
    00059     void ClearBuffer();
    00060     int RenderIndexedTriangles(deBoolean TestOnly, const deVertex * Vertices, long NumVertices, const WORD * Indices = NULL, long NumIndices = 0);
    00061
    00062     const BufferType* GetBuffer(long level = -1, deBoolean MinNotMax = deFALSE) const;
    00063     long GetBufferDepth() const;
    00064     void GetBufferSize(short& Width, short& Height,long level = -1) const;
    00065     void GetViewport(deRect & ViewRect) const;
    00066     void GetScissorRect(deRect & ScissorRect) const;
    00067     deFloat GetGradientCutoff() const;
    00068
    00069 private:
    00070     void ConcatenateMatrices();
    00071     void ResizeBuffer();
    00072     void BuildHierarchy(deBoolean ForceTearDown = deFALSE);
    00073     deBoolean TestScreenExtentsVisible(const deFloatRect& FullExtents, DWORD MinZ, int MaxLevel);
    00074
    00075     struct BufferLevel_t
    00076     {
    00077         short Width, Height;
    00078         BufferType* MaxBuffer;
    00079 #if OCCLUDE_MINBUFFER
    00080         BufferType* MinBuffer;
    00081 #endif
    00082     };
    00083
    00084     deTransform m_WorldTransform;
    00085     deTransform m_ViewPosTransform;
    00086     deTransform m_ViewportTransform;
    00087     deMatrix44 m_ProjectionTransform;
    00088     //deTransform m_ConcatenatedTransform;
    00089     deMatrix44 m_ConcatenatedTransform;
    00090     deFloat m_LastProjectionColumn[4];
    00091     deFloat m_NearClip, m_FarClip;
    00092     deRect m_Viewport;
    00093     deRect m_ScissorRect;
    00094     deFloat m_GradientCutoff;
    00095     BufferType* m_Buffer;
    00096     BufferLevel_t* m_Hierarchy;
    00097     short m_Width, m_Height;
    00098     short m_HierarchyDepth;
    00099     deBoolean m_TransformsChanged;
    00100     deBoolean m_BufferSizeChanged;
    00101     deBoolean m_DirtyBuffer;
    00102     deBoolean m_CountPixels;
    00103 };
    00104
    00105 #endif // DEOCCLUDERASTER_HPP