D:/Zythum/DinoKod/Bsp/BspDraw.h

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : BspDraw.h
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 07/09/2002
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #ifndef __BSPDRAW_H__
00012 #define __BSPDRAW_H__
00013 
00014 #include "Bsp/BspDll.h"
00015 #include "Common/Plane.h"
00016 #include "Bsp/Bsp.h"
00017 
00018 class KRender;
00019 class KCamera;
00020 class KVertexBuffer;
00021 class KIndexBuffer;
00022 class KBmp;
00023 class KLVertex2;
00024 class KBezierPatch;
00025 class KSkyDraw;
00026 class KSunDraw;
00027 
00028 #define BSP_MAXVERTEX                           32768
00029 
00030 #define BSP_ERROR_CREATEVB                      10
00031 
00032 //---------------------------------------------------------------------------------------------------------------------
00033 class BSP_API KBspDraw : public KBsp
00034 {
00035 protected:
00036         KTEXTURE*                                       m_pLightMapId;
00037         KSHADER*                                        m_pShaderId;
00038 
00039         KRender*                                        m_pRender;
00040         u32                                                     m_nVertex;
00041         bool                                            m_bUseLightMaps;
00042         bool                                            m_bWireFrame;
00043         KLVertex2*                                      m_pVBuffer;
00044         bool                                            m_bSwapRgb;
00045 
00046         u32                                                     m_CurrentShaderId;
00047         u32                                                     m_CurrentLightMapId;
00048 
00049         KCamera*                                        m_pCamera;
00050         KPlane                                          m_pCameraPlane[6];
00051         KRenderFace*                            m_pRenderFaces;
00052         KBspFaceList*                           m_pSortedFaceList;
00053         KSkyDraw*                                       m_pSkyDraw;
00054         KSunDraw*                                       m_pSunDraw;
00055         s32                                                     m_CurrentLoadedShader;
00056 
00057         void                                            DrawLeaf( u32 Leaf );
00058 
00059         bool*                                           m_pVisibleFace;
00060         void                                            DrawFaces();
00061         void                                            DrawVisiblesLeaves( u32 CurrentLeaf );
00062         static int                                      CumpareFunc( const void* pElem1, const void* pElem2 );
00063         void                                            SortFacesByTextures();
00064 
00065         bool                                            CheckLeafCollision( u32 LeafId, KVector& StartPos, KVector& EndPos, KVector* pPoint , KVector* pNormal );
00066 
00067         void                                            DisplayLeaf( u32 LeafId );
00068 
00069         s32                                                     LoadShaders( KRender* pRender );
00070         s32                                                     LoadLightMaps( KRender* pRender );
00071         void                                            DestroyShaders();
00072         void                                            DestroyLightMaps();
00073         
00074         bool                                            IsBBoxInsideFrustum( KVector& Min, KVector Max );
00075 
00076 public:
00077                                                                 KBspDraw();
00078         virtual                                         ~KBspDraw();
00079                                                                 
00080         s32                                                     Init( KRender* pRender );
00081         void                                            End();
00082                                                                 
00083         virtual s32                                     LoadBSP( const char* pFileName );
00084         virtual s32                                     CloseBSP();
00085                                                                 
00086         void                                            Draw();
00087 
00088         void                                            ActiveLightMaps( bool bActive );
00089         bool                                            IsActiveLightMaps()                                     { return m_bUseLightMaps;               }
00090         void                                            ActiveWireFrame( bool bActive )         { m_bWireFrame = bActive;               }
00091         bool                                            IsActiveWireFrame()                                     { return m_bWireFrame;                  }
00092 
00093         s32                                                     LoadShader( KRender* pRender );
00094         s32                                                     GetCurrentLoadedShader()                        { return m_CurrentLoadedShader; }
00095         s32                                                     FinishLoad();
00096 };
00097 
00098 #endif  __BSPDRAW_H__

Generated on Sun Mar 25 20:02:10 2007 for Zythum Project by  doxygen 1.5.1-p1