From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/vegetable__manager_8h-source.html | 375 +++++++++++++++++++++ 1 file changed, 375 insertions(+) create mode 100644 docs/doxygen/nel/vegetable__manager_8h-source.html (limited to 'docs/doxygen/nel/vegetable__manager_8h-source.html') diff --git a/docs/doxygen/nel/vegetable__manager_8h-source.html b/docs/doxygen/nel/vegetable__manager_8h-source.html new file mode 100644 index 00000000..0ee7e948 --- /dev/null +++ b/docs/doxygen/nel/vegetable__manager_8h-source.html @@ -0,0 +1,375 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

vegetable_manager.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2001 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_VEGETABLE_MANAGER_H
+00027 #define NL_VEGETABLE_MANAGER_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/misc/matrix.h"
+00031 #include "nel/misc/rgba.h"
+00032 #include "nel/misc/block_memory.h"
+00033 #include "nel/misc/vector_2f.h"
+00034 #include "nel/misc/smart_ptr.h"
+00035 #include "3d/vegetable_clip_block.h"
+00036 #include "3d/vegetable_sort_block.h"
+00037 #include "3d/vegetable_instance_group.h"
+00038 #include "3d/vegetable_shape.h"
+00039 #include "3d/vegetablevb_allocator.h"
+00040 #include "3d/material.h"
+00041 #include "3d/driver.h"
+00042 #include "3d/vegetable_uv8.h"
+00043 
+00044 
+00045 namespace NL3D 
+00046 {
+00047 
+00048 
+00049 class   CVegetableBlendLayerModel;
+00050 class   CScene;
+00051 class   CVegetableLightEx;
+00052 
+00053 
+00054 // ***************************************************************************
+00055 // By default there is 20 layers.
+00056 #define NL3D_VEGETABLE_DEFAULT_NUM_BLEND_LAYER  20
+00057 // default distance is 60 meters.
+00058 #define NL3D_VEGETABLE_DEFAULT_DIST_MAX                 60.f
+00059 
+00060 
+00061 // ***************************************************************************
+00075 class CVegetableManager
+00076 {
+00077 public:
+00079         enum TVegetableWater { AboveWater = 0, UnderWater, IntersectWater, VegetInfoLast };
+00080 
+00081 public:
+00082 
+00089         CVegetableManager(uint maxVertexVbHardUnlit, uint maxVertexVbHardLighted, 
+00090                 uint nbBlendLayers= NL3D_VEGETABLE_DEFAULT_NUM_BLEND_LAYER, 
+00091                 float blendLayerDistMax= NL3D_VEGETABLE_DEFAULT_DIST_MAX);
+00092         ~CVegetableManager();
+00093 
+00097         void                                            createVegetableBlendLayersModels(CScene *scene);
+00098 
+00099 
+00101         // @{
+00102 
+00104         CVegetableShape                         *getVegetableShape(const std::string &shape);
+00105 
+00106         // @}
+00107 
+00108 
+00110         // @{
+00111 
+00113         CVegetableClipBlock                     *createClipBlock();
+00115         void                                            deleteClipBlock(CVegetableClipBlock *clipBlock);
+00116 
+00124         CVegetableSortBlock                     *createSortBlock(CVegetableClipBlock *clipBlock, const CVector &center, float radius);
+00126         void                                            deleteSortBlock(CVegetableSortBlock *sortBlock);
+00127 
+00131         CVegetableInstanceGroup         *createIg(CVegetableSortBlock *sortBlock);
+00136         void                                            deleteIg(CVegetableInstanceGroup *ig);
+00137 
+00138         // @}
+00139 
+00140 
+00142 
+00159         // @{
+00160 
+00166         void                    reserveIgAddInstances(CVegetableInstanceGroupReserve &vegetIgReserve, CVegetableShape *shape, TVegetableWater vegetWaterState, uint numInstances);
+00171         void                    reserveIgCompile(CVegetableInstanceGroup *ig, const CVegetableInstanceGroupReserve &vegetIgReserve);
+00172 
+00173 
+00187         void                                            addInstance(CVegetableInstanceGroup *ig, 
+00188                 CVegetableShape *shape, const NLMISC::CMatrix &mat, 
+00189                 const NLMISC::CRGBAF &ambientColor, const NLMISC::CRGBAF &diffuseColor, 
+00190                 float   bendFactor, float bendPhase, float bendFreqFactor, float blendDistMax,
+00191                 TVegetableWater vegetWaterState, CVegetableUV8 dlmUV);
+00192 
+00193         // @}
+00194 
+00195 
+00197         // @{
+00198 
+00200         void                    updateDriver(IDriver *driver);
+00201 
+00203         void                    loadTexture(const std::string &texName);
+00205         void                    loadTexture(ITexture *itex);
+00207         void                    setDirectionalLight(const CRGBA &ambient, const CRGBA &diffuse, const CVector &light);
+00208         
+00213         void                    lockBuffers();
+00215         void                    unlockBuffers();
+00216 
+00221         void                    render(const CVector &viewCenter, const CVector &frontVector, const std::vector<CPlane> &pyramid, 
+00222                 ITexture *textureDLM, IDriver *driver);
+00223 
+00224         // @}
+00225 
+00226 
+00228         // @{
+00229 
+00239         void            setWind(const CVector &windDir, float windFreq, float windPower, float windBendMin);
+00240 
+00243         void            setTime(double time);
+00244 
+00245         // @}
+00246 
+00247 
+00249         // @{
+00250 
+00254         void            setUpdateLightingTime(double time);
+00255 
+00259         void            updateLighting();
+00260 
+00265         void            setUpdateLightingFrequency(float freq);
+00266 
+00270         void            updateLightingAll();
+00271 
+00272         // @}
+00273 
+00274 
+00276         // @{
+00277 
+00279         void            resetNumVegetableFaceRendered();
+00281         uint            getNumVegetableFaceRendered() const;
+00282 
+00283         // @}
+00284 
+00285 // *********************
+00286 private:
+00287         friend class    CVegetableBlendLayerModel;
+00288 
+00289         NLMISC::CBlockMemory<CVegetableClipBlock>               _ClipBlockMemory;
+00290         NLMISC::CBlockMemory<CVegetableSortBlock>               _SortBlockMemory;
+00291         NLMISC::CBlockMemory<CVegetableInstanceGroup>   _InstanceGroupMemory;
+00292 
+00293         // List of ClipBlock not empty. tested for clipping
+00294         CTessList<CVegetableClipBlock>                                  _ClipBlockList;
+00295         // List of ClipBlock created, with no Ig, so not tested for clipping
+00296         CTessList<CVegetableClipBlock>                                  _EmptyClipBlockList;
+00297 
+00298 
+00299         // Vegetable Shape map.
+00300         typedef std::map<std::string, CVegetableShape>  TShapeMap;
+00301         typedef TShapeMap::iterator                                             ItShapeMap;
+00302         TShapeMap                                                                               _ShapeMap;
+00303 
+00304 
+00305         // Vertex Buffers for display. One allocator for Lighted and Unlit mode.
+00306         CVegetableVBAllocator                                                   _VBHardAllocator[CVegetableVBAllocator::VBTypeCount];
+00307         // The same, but no VBHard.
+00308         CVegetableVBAllocator                                                   _VBSoftAllocator[CVegetableVBAllocator::VBTypeCount];
+00309         // Vertex Program. One VertexProgram for each rdrPass
+00310         CVertexProgram                                                                  *_VertexProgram[NL3D_VEGETABLE_NRDRPASS];
+00311 
+00312 
+00313         // Material. Usefull for texture and alphaTest
+00314         CMaterial                                                                               _VegetableMaterial;
+00315         // Norm
+00316         CVector                                                                                 _DirectionalLight;
+00317         NLMISC::CRGBA                                                                   _GlobalAmbient;
+00318         NLMISC::CRGBA                                                                   _GlobalDiffuse;
+00319 
+00320 
+00322         uint                                                                                    _NumVegetableFaceRendered;
+00323 
+00324 
+00325         // return true if the ith rdrPass is 2Sided.
+00326         static  bool    doubleSidedRdrPass(uint rdrPass);
+00327 
+00328 
+00330         uint                    getRdrPassInfoForShape(CVegetableShape *shape, TVegetableWater vegetWaterState, 
+00331                 bool &instanceLighted, bool &instanceDoubleSided, bool &instanceZSort,
+00332                 bool &destLighted, bool &precomputeLighting);
+00333 
+00334 
+00336         CVegetableVBAllocator   &getVBAllocatorForRdrPassAndVBHardMode(uint rdrPass, uint vbHardMode);
+00337 
+00338 
+00340         void                                    initVertexProgram(uint vpType);
+00341 
+00342 
+00344         void                                    setupVertexProgramConstants(IDriver *driver);
+00345 
+00346 
+00350         void                                    swapIgRdrPassHardMode(CVegetableInstanceGroup *, uint rdrPass);
+00351 
+00352 
+00354         // @{
+00355         CVector                                                                                 _WindDirection;
+00356         float                                                                                   _WindFrequency;
+00357         float                                                                                   _WindPower;
+00358         float                                                                                   _WindBendMin;
+00359         // nb: used for wind animation 
+00360         double                                                                                  _Time;
+00361         double                                                                                  _WindPrecRenderTime;
+00362         // updated at each render().
+00363         double                                                                                  _WindAnimTime;
+00364 
+00365         // Constant LUT.
+00366         float                                                                                   _CosTable[NL3D_VEGETABLE_VP_LUT_SIZE];
+00367         // computed at each render().
+00368         NLMISC::CVector2f                                                               _WindTable[NL3D_VEGETABLE_VP_LUT_SIZE];
+00369         NLMISC::CVector2f                                                               _WindDeltaTable[NL3D_VEGETABLE_VP_LUT_SIZE];
+00370 
+00371 
+00372         // @}
+00373 
+00374 
+00376         // @{
+00377 
+00378         CVector                                 _AngleAxis;
+00379         CVector                                 _ViewCenter;
+00380         bool                                    _BkupFog;
+00381         // NB: the manager matrix may not be Identity, for ZBuffer precision reason.
+00382         NLMISC::CMatrix                 _ManagerMatrix;
+00383 
+00384         // @}
+00385 
+00386 
+00388         // @{
+00389 
+00390 
+00392         uint                                    _NumZSortBlendLayers;
+00393         float                                   _ZSortLayerDistMax;
+00394         CScene                                  *_ZSortScene;
+00395         std::vector<CVegetableBlendLayerModel*>         _ZSortModelLayers;
+00396         // The same but under water
+00397         std::vector<CVegetableBlendLayerModel*>         _ZSortModelLayersUW;
+00398 
+00399 
+00401         void                                    setupRenderStateForBlendLayerModel(IDriver *driver);
+00402         void                                    exitRenderStateForBlendLayerModel(IDriver *driver);
+00403 
+00404         // @}
+00405 
+00406 
+00408 
+00411         // @{
+00412 
+00413         // Last update time.
+00414         double                                  _ULPrecTime;
+00415         bool                                    _ULPrecTimeInit;
+00416         double                                  _ULTime;
+00417 
+00419         float                                   _ULFrequency;
+00421         float                                   _ULNVerticesToUpdate;
+00423         uint                                    _ULNTotalVertices;
+00425         CVegetableInstanceGroup *_ULRootIg;
+00427         uint                                    _ULCurrentIgRdrPass;
+00428         uint                                    _ULCurrentIgInstance;
+00429 
+00431         void            doUpdateLighting();
+00432 
+00436         bool            updateLightingIGPart();
+00437 
+00438 
+00442         uint            updateInstanceLighting(CVegetableInstanceGroup *ig, uint rdrPassId, uint instanceId);
+00443 
+00444 
+00445         // @}
+00446 
+00447         // last driver setupped with a call to update driver
+00448         NLMISC::CRefPtr<IDriver> _LastDriver;
+00449 
+00450 
+00451 };
+00452 
+00453 
+00454 } // NL3D
+00455 
+00456 
+00457 #endif // NL_VEGETABLE_MANAGER_H
+00458 
+00459 /* End of vegetable_manager.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1