Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

shadow.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                       shadow.h  -  Shadow generator base
00003                              -------------------
00004     begin                : Wed Apr 30 2003
00005     copyright            : (C) 2003 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, shadow.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2003
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NESHADOW_H
00028 #define __NESHADOW_H
00029 
00030 
00038 #include "base.h"
00039 #include "renderprimitive.h"
00040 #include "vertex.h"
00041 #include "polygon.h"
00042 #include "callback.h"
00043 #include "program.h"
00044 #include "nemath.h"
00045 #include "activator.h"
00046 
00047 #include <vector>
00048 
00049 namespace NeoEngine
00050 {
00051 
00052 
00054 class BoundingVolume;
00055 
00056 
00057 
00058 
00059 
00068 class NEOENGINE_API ShadowGenerator : public virtual Activator
00069 {
00070     public:
00071 
00074                                                       ShadowGenerator() : Activator() {}
00075 
00078         virtual                                      ~ShadowGenerator() {}
00079 
00088         virtual void                                  GenerateShadow( VertexBufferPtr &pkVertexBuffer, PolygonBufferPtr &pkPolygonBuffer, BoundingVolume *pkBoundingVolume, const Matrix &rkTransform, const Matrix &rkInvTransform ) = 0;
00089 };
00090 
00091 
00092 
00093 
00094 
00102 class NEOENGINE_API ShadowOp
00103 {
00104     public:
00105 
00107         VertexBufferPtr                             m_pkVertexBuffer;
00108 
00110         PolygonBufferPtr                            m_pkPolygonBuffer;
00111 
00113         BoundingVolume                             *m_pkBoundingVolume;
00114 
00116         Matrix                                      m_kTransform;
00117 
00119         Matrix                                      m_kInvTransform;
00120 
00121         /* Final render op */
00122         RenderPrimitive                             m_kPrimitive;
00123 };
00124 
00125 
00126 
00127 #ifdef WIN32
00128 
00129 #  ifdef _MSC_VER
00130 #    pragma warning( disable : 4231 )
00131 #  endif
00132 
00133 #  ifndef __HAVE_VECTOR_NESHADOWOP
00134      UDTVectorEXPIMP( class ShadowOp* );
00135 #    define __HAVE_VECTOR_NESHADOWOP
00136 #  endif
00137 
00138 #endif
00139 
00140 
00141 
00142 
00150 class NEOENGINE_API StencilShadowGenerator : public ShadowGenerator, public FrameCallback
00151 {
00152     protected:
00153 
00155         std::vector< ShadowOp* >                      m_vpkOps;
00156 
00158         unsigned int                                  m_uiNumUsedOps;
00159 
00161         float                                         m_fShadowLength;
00162 
00164         Vertex                                       *m_pkVertices;
00165 
00167         Polygon                                      *m_pkPolygons;
00168 
00170         unsigned int                                  m_uiMaxVertices;
00171 
00173         unsigned int                                  m_uiMaxPolygons;
00174 
00176         MaterialPtr                                   m_pkStencilMat;
00177 
00179         MaterialPtr                                   m_pkFrameBufferMat;
00180 
00181 
00182     public:
00183 
00188                                                       StencilShadowGenerator( float fShadowLength = 100.0f );
00189 
00193         virtual                                      ~StencilShadowGenerator();
00194 
00203         virtual void                                  GenerateShadow( VertexBufferPtr &pkVertexBuffer, PolygonBufferPtr &pkPolygonBuffer, BoundingVolume *pkBoundingVolume, const Matrix &rkTransform, const Matrix &rkInvTransform );
00204 
00210         virtual void                                  FrameEvent( FrameCallback::FRAMECALLBACKTYPE eType, void *pData );
00211 };
00212 
00213 
00214 
00215 //Disabled
00216 #if 0
00217 
00218 
00225 class NEOENGINE_API VertexProgramStencilShadowGenerator : public ShadowGenerator, public FrameCallback
00226 {
00227     protected:
00228 
00230         std::vector< ShadowOp* >                      m_vpkOps;
00231 
00233         unsigned int                                  m_uiNumUsedOps;
00234 
00236         float                                         m_fShadowLength;
00237 
00239         MaterialPtr                                   m_pkStencilMat;
00240 
00242         MaterialPtr                                   m_pkFrameBufferMat;
00243 
00245         Program                                      *m_pkVertexProgramPos;
00246 
00248         ProgramParam                                 *m_pkLightParamPos;
00249 
00251         ProgramParam                                 *m_pkExtrudeParamPos;
00252 
00254         ProgramParam                                 *m_pkTransformParamPos;
00255 
00257         ProgramParam                                 *m_pkInvTransformParamPos;
00258 
00260         Program                                      *m_pkVertexProgramDir;
00261 
00263         ProgramParam                                 *m_pkLightParamDir;
00264 
00266         ProgramParam                                 *m_pkExtrudeParamDir;
00267 
00269         ProgramParam                                 *m_pkTransformParamDir;
00270 
00272         ProgramParam                                 *m_pkInvTransformParamDir;
00273 
00274 
00275     public:
00276 
00282                                                       VertexProgramStencilShadowGenerator( float fShadowLength = 100.0f, float fOffset = 0.0f );
00283 
00287         virtual                                      ~VertexProgramStencilShadowGenerator();
00288 
00297         virtual void                                  GenerateShadow( VertexBufferPtr &pkVertexBuffer, PolygonBufferPtr &pkPolygonBuffer, BoundingVolume *pkBoundingVolume, const Matrix &rkTransform, const Matrix &rkInvTransform );
00298 
00304         virtual void                                  FrameEvent( FrameCallback::FRAMECALLBACKTYPE eType, void *pData );
00305 };
00306 
00307 #endif
00308 
00309 
00310 };
00311 
00312 
00313 #endif

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5