csgeom/objmodel.h
Go to the documentation of this file.00001 /* 00002 Crystal Space 3D engine 00003 Copyright (C) 2003 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSGEOM_OBJMODEL_H__ 00021 #define __CS_CSGEOM_OBJMODEL_H__ 00022 00031 #include "csextern.h" 00032 00033 #include "csutil/refarr.h" 00034 #include "csutil/scf_implementation.h" 00035 #include "igeom/objmodel.h" 00036 #include "igeom/polymesh.h" 00037 00038 00039 00046 class csObjectModel : public scfImplementation1<csObjectModel,iObjectModel> 00047 { 00048 private: 00049 long shapenr; 00050 iPolygonMesh* polymesh_base; 00051 csRef<iPolygonMesh> polymesh_colldet; 00052 csRef<iPolygonMesh> polymesh_viscull; 00053 csRef<iPolygonMesh> polymesh_shadows; 00054 csRefArray<iObjectModelListener> listeners; 00055 00056 public: 00061 csObjectModel (iBase* parent = 0) 00062 : scfImplementationType (this, parent) 00063 { 00064 shapenr = -1; 00065 polymesh_base = 0; 00066 } 00067 00068 virtual ~csObjectModel () {} 00069 00073 void SetPolygonMeshBase (iPolygonMesh* base) 00074 { 00075 polymesh_base = base; 00076 } 00077 00081 void ShapeChanged () 00082 { 00083 shapenr++; 00084 FireListeners (); 00085 } 00086 00090 void SetShapeNumber (long n) 00091 { 00092 shapenr = n; 00093 } 00094 00098 void FireListeners () 00099 { 00100 size_t i; 00101 for (i = 0 ; i < listeners.Length () ; i++) 00102 listeners[i]->ObjectModelChanged (this); 00103 } 00104 00105 virtual long GetShapeNumber () const { return shapenr; } 00106 virtual iPolygonMesh* GetPolygonMeshBase () { return polymesh_base; } 00107 virtual iPolygonMesh* GetPolygonMeshColldet () { return polymesh_colldet; } 00108 virtual void SetPolygonMeshColldet (iPolygonMesh* polymesh) 00109 { 00110 polymesh_colldet = polymesh; 00111 } 00112 virtual iPolygonMesh* GetPolygonMeshViscull () { return polymesh_viscull; } 00113 virtual void SetPolygonMeshViscull (iPolygonMesh* polymesh) 00114 { 00115 polymesh_viscull = polymesh; 00116 } 00117 virtual iPolygonMesh* GetPolygonMeshShadows () { return polymesh_shadows; } 00118 virtual void SetPolygonMeshShadows (iPolygonMesh* polymesh) 00119 { 00120 polymesh_shadows = polymesh; 00121 } 00122 virtual csPtr<iPolygonMesh> CreateLowerDetailPolygonMesh (float) 00123 { 00124 return 0; 00125 } 00126 virtual void AddListener (iObjectModelListener* listener) 00127 { 00128 RemoveListener (listener); 00129 listeners.Push (listener); 00130 } 00131 virtual void RemoveListener (iObjectModelListener* listener) 00132 { 00133 listeners.Delete (listener); 00134 } 00135 }; 00136 00139 #endif // __CS_CSGEOM_OBJMODEL_H__ 00140
Generated for Crystal Space by doxygen 1.4.6