00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef NL_INSTANCE_GROUP_USER_H
00027 #define NL_INSTANCE_GROUP_USER_H
00028
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/3d/u_instance_group.h"
00031 #include "3d/scene_group.h"
00032
00033
00034 namespace NLMISC
00035 {
00036 class CVector;
00037 class CQuat;
00038 }
00039
00040 namespace NL3D
00041 {
00042
00043 class UScene;
00044 class UInstanceGroup;
00045 class CInstanceUser;
00046
00054 class CInstanceGroupUser : public UInstanceGroup
00055 {
00056 public:
00057 CInstanceGroupUser ();
00058
00059
00060
00061
00062 bool init (const std::string &instanceGroup);
00063
00064
00065 private:
00066
00067 void setTransformNameCallback (ITransformName *pTN);
00068 void setAddRemoveInstanceCallback(IAddRemoveInstance *callback);
00069 void setIGAddBeginCallback(IIGAddBegin *callback);
00070
00071
00072 void addToScene (class UScene& scene, UDriver *driver);
00073 void addToScene (class CScene& scene, IDriver *driver);
00074
00075 void addToSceneAsync (class UScene& scene, UDriver *driver);
00076 TState getAddToSceneState ();
00077 void stopAddToSceneAsync ();
00078
00079
00080 void removeFromScene (class UScene& scene);
00081 uint getNumInstance () const;
00082 const std::string& getShapeName (uint instanceNb) const;
00083 const std::string& getInstanceName (uint instanceNb) const;
00084 virtual void getInstanceMatrix(uint instanceNb, NLMISC::CMatrix &dest) const;
00085 const NLMISC::CVector& getInstancePos (uint instanceNb) const;
00086 const NLMISC::CQuat& getInstanceRot (uint instanceNb) const;
00087 const NLMISC::CVector& getInstanceScale (uint instanceNb) const;
00088 UInstance *getByName (std::string& name);
00089 const UInstance *getByName (std::string& name) const;
00090
00091 void setLightFactor (const std::string &LightName, NLMISC::CRGBA nFactor);
00092 void setBlendShapeFactor (const std::string &bsName, float rFactor);
00093
00094 void createRoot (UScene &scene);
00095 void setClusterSystem (UInstanceGroup *pClusterSystem);
00096 bool linkToParentCluster(UInstanceGroup *father);
00097 void getDynamicPortals (std::vector<std::string> &names);
00098 void setDynamicPortal (std::string& name, bool opened);
00099 bool getDynamicPortal (std::string& name);
00100
00101
00102 void setPos (const NLMISC::CVector &pos);
00103 void setRotQuat (const NLMISC::CQuat &q);
00104
00105 void setPointLightFactor(const std::string &lightGroupName, NLMISC::CRGBA nFactor);
00106 bool getStaticLightSetup(const std::string &retrieverIdentifier, sint surfaceId, const NLMISC::CVector &localPos,
00107 std::vector<CPointLightInfluence> &pointLightList, uint8 &sunContribution, NLMISC::CRGBA &localAmbient);
00108
00109 NLMISC::CVector getPos ();
00110 NLMISC::CQuat getRotQuat ();
00111
00112
00113 CInstanceGroup _InstanceGroup;
00114 std::map<std::string,CInstanceUser*> _Instances;
00115
00116 TState _AddToSceneState;
00117 UScene *_AddToSceneTempScene;
00118 UDriver *_AddToSceneTempDriver;
00119
00120 virtual void freezeHRC();
00121 virtual void unfreezeHRC();
00122
00123 friend class CTransformUser;
00124 friend class CSceneUser;
00125
00126 public:
00127
00128 CInstanceGroup &getInternalIG() {return _InstanceGroup;}
00129 };
00130
00131
00132 }
00133
00134
00135 #endif // NL_INSTANCE_GROUP_USER_H
00136
00137