# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

ig_surface_light_build.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000-2002 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_IG_SURFACE_LIGHT_BUILD_H
00027 #define NL_IG_SURFACE_LIGHT_BUILD_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/vector_2f.h"
00031 #include "3d/surface_light_grid.h"
00032 #include "3d/mesh.h"
00033 
00034 
00035 namespace NL3D 
00036 {
00037 
00038 
00039 // ***************************************************************************
00046 class CIGSurfaceLightBuild
00047 {
00048 public:
00049 
00050         enum    {MaxOverSamples= 16};
00051 
00052 public:
00053 
00056         struct  CCellCorner
00057         {
00058                 // Is this CellCorner in the surface polygon or not?
00059                 bool                            InSurface;
00060                 // Computed by CInstanceLighter
00061                 bool                            Dilated;
00062                 // Copy of SunContribution computed by CInstanceLighter.
00063                 uint8                           SunContribution;
00064                 // Number of overSamples. At least one if InSurface. NB: Put here for packing. 
00065                 uint8                           NumOverSamples;
00066 
00067                 // World Position of this corner.
00068                 NLMISC::CVector         CenterPos;
00069 
00070                 // OverSamples. NB: there can be any number of overSamples (3, 4, 5,7 ...) because
00071                 // some may be out of surface and thus disabled
00072                 NLMISC::CVector         OverSamples[MaxOverSamples];
00073 
00074 
00078                 void                            *LightInfo[CSurfaceLightGrid::NumLightPerCorner];
00079                 void                            *LocalAmbientLight;
00080         };
00081 
00082 
00085         struct  CSurface
00086         {
00087                 // Origin and Size of the grid.
00088                 // NB: The grid must be valid an not empty (ie Width>=2 and Height>=2).
00089                 NLMISC::CVector2f                       Origin;
00090                 uint32                                          Width;
00091                 uint32                                          Height;
00092                 // The CellCorner info.
00093                 std::vector<CCellCorner>        Cells;
00094         };
00095 
00096 
00100         struct  CRetrieverLightGrid
00101         {
00102                 // There is localRetriver.getNumSurfaces() Grids.
00103                 std::vector<CSurface>           Grids;
00104         };
00105         typedef std::map<std::string, CRetrieverLightGrid>              TRetrieverGridMap;
00106         typedef TRetrieverGridMap::iterator                                             ItRetrieverGridMap;
00107 
00108 
00109         // The requested CellSize (setuped by CInstanceLighter)
00110         float                                   CellSize;
00111         // Array of surfaces retrieved in PACS for an IG
00112         TRetrieverGridMap               RetrieverGridMap;
00113 
00114 
00115 public:
00116 
00118         void                    buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos=CVector::Null);
00119 
00120 };
00121 
00122 
00123 } // NL3D
00124 
00125 
00126 #endif // NL_IG_SURFACE_LIGHT_BUILD_H
00127 
00128 /* End of ig_surface_light_build.h */