Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
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 00030 #include "csextern.h" 00031 00032 #include "csutil/refarr.h" 00033 00034 #include "igeom/objmodel.h" 00035 #include "igeom/polymesh.h" 00036 00037 00038 00045 class csObjectModel : public iObjectModel 00046 { 00047 private: 00048 long shapenr; 00049 iPolygonMesh* polymesh_base; 00050 csRef<iPolygonMesh> polymesh_colldet; 00051 csRef<iPolygonMesh> polymesh_viscull; 00052 csRef<iPolygonMesh> polymesh_shadows; 00053 csRefArray<iObjectModelListener> listeners; 00054 00055 public: 00060 csObjectModel () 00061 { 00062 shapenr = -1; 00063 polymesh_base = 0; 00064 } 00065 00066 virtual ~csObjectModel () { } 00067 00071 void SetPolygonMeshBase (iPolygonMesh* base) 00072 { 00073 polymesh_base = base; 00074 } 00075 00079 void ShapeChanged () 00080 { 00081 shapenr++; 00082 FireListeners (); 00083 } 00084 00088 void SetShapeNumber (long n) 00089 { 00090 shapenr = n; 00091 } 00092 00096 void FireListeners () 00097 { 00098 size_t i; 00099 for (i = 0 ; i < listeners.Length () ; i++) 00100 listeners[i]->ObjectModelChanged (this); 00101 } 00102 00103 virtual long GetShapeNumber () const { return shapenr; } 00104 virtual iPolygonMesh* GetPolygonMeshBase () { return polymesh_base; } 00105 virtual iPolygonMesh* GetPolygonMeshColldet () { return polymesh_colldet; } 00106 virtual void SetPolygonMeshColldet (iPolygonMesh* polymesh) 00107 { 00108 polymesh_colldet = polymesh; 00109 } 00110 virtual iPolygonMesh* GetPolygonMeshViscull () { return polymesh_viscull; } 00111 virtual void SetPolygonMeshViscull (iPolygonMesh* polymesh) 00112 { 00113 polymesh_viscull = polymesh; 00114 } 00115 virtual iPolygonMesh* GetPolygonMeshShadows () { return polymesh_shadows; } 00116 virtual void SetPolygonMeshShadows (iPolygonMesh* polymesh) 00117 { 00118 polymesh_shadows = polymesh; 00119 } 00120 virtual csPtr<iPolygonMesh> CreateLowerDetailPolygonMesh (float) 00121 { 00122 return 0; 00123 } 00124 virtual void AddListener (iObjectModelListener* listener) 00125 { 00126 RemoveListener (listener); 00127 listeners.Push (listener); 00128 } 00129 virtual void RemoveListener (iObjectModelListener* listener) 00130 { 00131 listeners.Delete (listener); 00132 } 00133 }; 00134 00137 #endif // __CS_CSGEOM_OBJMODEL_H__ 00138
Generated for Crystal Space by doxygen 1.4.4