# 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  

instance_group_user.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_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         // Init with a scene.
00059         //bool load (const std::string &instanceGroup);
00060 
00061         // Init without a scene
00062         bool init (const std::string &instanceGroup);
00063         //bool init (const std::string &instanceGroup, CScene &scene, UDriver *driver);
00064 
00065 private:
00066         // From UInstanceGroup
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         // The real instance group
00113         CInstanceGroup  _InstanceGroup;
00114         std::map<std::string,CInstanceUser*> _Instances;
00115         // Async stuff
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         // Debug purpose only.
00128         CInstanceGroup  &getInternalIG() {return _InstanceGroup;}
00129 };
00130 
00131 
00132 } // NL3D
00133 
00134 
00135 #endif // NL_INSTANCE_GROUP_USER_H
00136 
00137 /* End of instance_group_user.h */