00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef NL_MESH_BASE_INSTANCE_H
00027 #define NL_MESH_BASE_INSTANCE_H
00028
00029 #include "nel/misc/types_nl.h"
00030 #include "3d/transform_shape.h"
00031 #include "3d/material.h"
00032 #include "3d/animated_material.h"
00033 #include "3d/animated_lightmap.h"
00034 #include "3d/animated_morph.h"
00035 #include "3d/async_texture_block.h"
00036
00037
00038 namespace NL3D
00039 {
00040
00041
00042 class CMeshBase;
00043 class CMesh;
00044 class CMeshMRM;
00045 class CMeshBaseInstanceAnimDetailObs;
00046 class CAnimatedLightmap;
00047 class CAsyncTextureManager;
00048
00049
00050
00051
00052 const NLMISC::CClassId MeshBaseInstanceId=NLMISC::CClassId(0xef44331, 0x739f6bcf);
00053
00054
00055
00064 class CMeshBaseInstance : public CTransformShape
00065 {
00066 public:
00068 static void registerBasic();
00069
00070 public:
00071
00072
00077 std::vector<CMaterial> Materials;
00078
00084 std::vector<CAsyncTextureBlock> AsyncTextures;
00085
00086
00088
00089 enum TAnimValues
00090 {
00091 OwnerBit= CTransformShape::AnimValueLast,
00092
00093 AnimValueLast,
00094 };
00095
00096
00097 virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
00098
00099
00100
00102
00103 virtual uint getNumMaterial () const;
00104 virtual const CMaterial *getMaterial (uint materialId) const;
00105 virtual CMaterial *getMaterial (uint materialId);
00106
00107
00109
00111
00112
00113
00115
00116 uint32 getNbLightMap();
00117 void getLightMapName( uint32 nLightMapNb, std::string &LightMapName );
00118 void setLightMapFactor( const std::string &LightMapName, CRGBA nFactor );
00119
00120
00121
00122 void setAnimatedLightmap (CAnimatedLightmap *alm);
00123
00125
00126
00127 uint32 getNbBlendShape();
00128 void getBlendShapeName (uint32 nBlendShapeNb, std::string &BlendShapeName );
00129 void setBlendShapeFactor (const std::string &BlendShapeName, float rFactor);
00130
00131
00132 std::vector<CAnimatedMorph>* getBlendShapeFactors()
00133 {
00134 return &_AnimatedMorphFactor;
00135 }
00136
00137
00138
00140 CScene *getScene() const {return _OwnerScene;}
00141
00142
00150 virtual void changeMRMDistanceSetup(float distanceFinest, float distanceMiddle, float distanceCoarsest) {}
00151
00155 void selectTextureSet(uint id);
00156
00157
00159
00169 void enableAsyncTextureMode(bool enable);
00170 bool getAsyncTextureMode() const {return _AsyncTextureMode;}
00176 void startAsyncTextureLoading();
00182 bool isAsyncTextureReady();
00183
00186 void setAsyncTextureDistance(float dist) {_AsyncTextureDistance= dist;}
00187 float getAsyncTextureDistance() const {return _AsyncTextureDistance;}
00188
00193 void setAsyncTextureDirty(bool flag) {_AsyncTextureDirty= flag;}
00195 bool isAsyncTextureDirty() const {return _AsyncTextureDirty;}
00196
00201 sint getAsyncTextureId(uint matId, uint stage) const;
00202
00203
00204
00205
00206 protected:
00208 CMeshBaseInstance();
00210 virtual ~CMeshBaseInstance();
00211
00212
00213 private:
00214 static IModel *creator() {return new CMeshBaseInstance;}
00215 friend class CMeshBase;
00216 friend class CMeshBaseInstanceAnimDetailObs;
00217
00218
00221 std::vector<CAnimatedMaterial> _AnimatedMaterials;
00222
00223 std::vector<CAnimatedLightmap*> _AnimatedLightmap;
00224
00225 std::vector<CAnimatedMorph> _AnimatedMorphFactor;
00226
00228 CScene *_OwnerScene;
00229
00231
00233
00234 sint _AsyncTextureToLoadRefCount;
00235 bool _AsyncTextureDirty;
00236 bool _AsyncTextureMode;
00237 bool _AsyncTextureReady;
00238
00239 std::vector<CAsyncTextureBlock> _CurrentAsyncTextures;
00240
00241 float _AsyncTextureDistance;
00242
00243 void releaseCurrentAsyncTextures();
00244
00245
00246
00248 public:
00249
00251 float _VPWindTreePhase;
00252
00253 };
00254
00255
00256
00267 class CMeshBaseInstanceAnimDetailObs : public CTransformAnimDetailObs
00268 {
00269 public:
00270
00275 virtual void traverse(IObs *caller);
00276
00277
00278 public:
00279 static IObs *creator() {return new CMeshBaseInstanceAnimDetailObs;}
00280 };
00281
00282
00283
00284 }
00285
00286
00287 #endif // NL_MESH_BASE_INSTANCE_H
00288
00289