Home | nevrax.com |
|
instance_user.hGo 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_USER_H 00027 #define NL_INSTANCE_USER_H 00028 00029 #include "nel/misc/types_nl.h" 00030 #include "nel/3d/u_instance.h" 00031 #include "3d/scene.h" 00032 #include "3d/transform_user.h" 00033 #include "3d/transform.h" 00034 #include "3d/transform_shape.h" 00035 #include "3d/mesh_base_instance.h" 00036 #include "3d/instance_material_user.h" 00037 00038 00039 namespace NL3D { 00040 00041 00042 // *************************************************************************** 00049 class CInstanceUser : virtual public UInstance, public CTransformUser 00050 { 00051 public: 00053 CTransformShape *_Instance; 00054 00056 std::vector<CInstanceMaterialUser> _Materials; 00057 00058 00059 public: 00060 00062 // @{ 00064 CInstanceUser(CScene *scene, IModel *trans); 00065 virtual ~CInstanceUser() 00066 { 00067 // deleted in CTransformUser. 00068 _Instance= NULL; 00069 // user mats are auto deleted. 00070 } 00071 // @} 00072 00073 00074 virtual void getShapeAABBox(NLMISC::CAABBox &bbox) const; 00075 00076 virtual void setBlendShapeFactor (const std::string &blendShapeName, float factor, bool dynamic); 00077 00078 00080 // @{ 00081 virtual uint getNumMaterials() const 00082 { 00083 return _Materials.size(); 00084 } 00085 virtual UInstanceMaterial &getMaterial(uint materialId) 00086 { 00087 if(materialId>=_Materials.size()) 00088 nlerror("getMaterial(): bad materialId"); 00089 return dynamic_cast<UInstanceMaterial&>(_Materials[materialId]); 00090 } 00091 00092 virtual void selectTextureSet(uint id) 00093 { 00094 CMeshBaseInstance *mbi = NLMISC::safe_cast<CMeshBaseInstance *>(_Instance); 00095 mbi->selectTextureSet(id); 00096 } 00097 // @} 00098 00099 00100 virtual void changeMRMDistanceSetup(float distanceFinest, float distanceMiddle, float distanceCoarsest); 00101 virtual void setShapeDistMax(float distMax); 00102 virtual float getShapeDistMax() const; 00103 00104 00105 virtual bool canStartStop() { return _Instance->canStartStop(); } 00106 virtual void start() { _Instance->start(); } 00107 virtual void stop() { _Instance->stop(); } 00108 virtual bool isStarted() const { return _Instance->isStarted(); } 00109 00110 }; 00111 00112 00113 } // NL3D 00114 00115 00116 #endif // NL_INSTANCE_USER_H 00117 00118 /* End of instance_user.h */ |