# 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  

lod_character_manager.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_LOD_CHARACTER_MANAGER_H
00027 #define NL_LOD_CHARACTER_MANAGER_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/vector.h"
00031 #include "nel/misc/rgba.h"
00032 #include "3d/vertex_buffer.h"
00033 #include "3d/vertex_buffer_hard.h"
00034 #include "3d/material.h"
00035 
00036 
00037 namespace NLMISC
00038 {
00039 class   CMatrix;
00040 }
00041 
00042 
00043 namespace NL3D 
00044 {
00045 
00046 
00047 using NLMISC::CRGBA;
00048 using NLMISC::CMatrix;
00049 
00050 class   IDriver;
00051 class   CLodCharacterShapeBank;
00052 class   CLodCharacterShape;
00053 
00054 
00055 // ***************************************************************************
00062 class CLodCharacterManager
00063 {
00064 public:
00065 
00067         CLodCharacterManager();
00068         ~CLodCharacterManager();
00069 
00070 
00072         // @{
00073 
00075         void                    reset();
00076 
00081         uint32                  createShapeBank();
00082 
00084         const CLodCharacterShapeBank    *getShapeBank(uint32 bankId) const;
00085 
00087         CLodCharacterShapeBank  *getShapeBank(uint32 bankId);
00088 
00090         void                    deleteShapeBank(uint32 bankId);
00091 
00092 
00096         sint32                  getShapeIdByName(const std::string &name) const;
00097 
00099         const CLodCharacterShape        *getShape(uint32 shapeId) const;
00100 
00104         bool                    compile();
00105 
00106         // @}
00107 
00108 
00110         // @{
00111 
00115         void                    setMaxVertex(uint32 maxVertex);
00116 
00118         uint32                  getMaxVertex() const {return _MaxNumVertices;}
00119 
00129         void                    beginRender(IDriver *driver, const CVector &managerPos);
00130 
00145         bool                    addRenderCharacterKey(uint shapeId, uint animId, TGlobalAnimationTime time, bool wrapMode, 
00146                 const CMatrix &worldMatrix, const std::vector<CRGBA> &colorVertex, CRGBA globalLighting);
00147 
00152         void                    endRender();
00153 
00155         bool                    isRendering() const {return _Rendering;}
00156 
00157         // @}
00158 
00159 
00160 // ******************************
00161 private:
00163         typedef std::map<std::string, uint32>   TStrIdMap;
00164         typedef TStrIdMap::iterator                             ItStrIdMap;
00165         typedef TStrIdMap::const_iterator               CstItStrIdMap;
00166 
00167 
00168 private:
00169 
00171         std::vector<CLodCharacterShapeBank*>    _ShapeBankArray;
00172 
00174         TStrIdMap                                               _ShapeMap;
00175 
00176 
00178         // @{
00179 
00180         CVector                                                 _ManagerMatrixPos;
00181 
00182         CMaterial                                               _Material;
00183 
00184         uint                                                    _CurrentVertexId;
00185         uint                                                    _MaxNumVertices;
00186         CVertexBuffer                                   _VBuffer;
00187         NLMISC::CRefPtr<IDriver>                _Driver;
00188         NLMISC::CRefPtr<IVertexBufferHard>      _VBHard;
00189         bool                                                    _VBHardOk;
00190         uint8                                                   *_VertexData;
00191         uint                                                    _VertexSize;
00192         bool                                                    _Rendering;
00193 
00194         // list of triangles
00195         uint                                                    _CurrentTriId;
00196         std::vector<uint32>                             _Triangles;
00197 
00198         
00199         void                    deleteVertexBuffer();
00200 
00201         // @}
00202 
00203 };
00204 
00205 
00206 } // NL3D
00207 
00208 
00209 #endif // NL_LOD_CHARACTER_MANAGER_H
00210 
00211 /* End of lod_character_manager.h */