Planeshift
|
00001 /* 00002 * Author: Andrew Robberts 00003 * 00004 * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program 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 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #ifndef PS_EFFECT_OBJ_QUAD_HEADER 00021 #define PS_EFFECT_OBJ_QUAD_HEADER 00022 00023 #include "pseffectobj.h" 00024 #include <imesh/genmesh.h> 00025 #include <csutil/cscolor.h> 00026 00027 class psEffect2DRenderer; 00028 00029 class psEffectObjQuad : public psEffectObj 00030 { 00031 public: 00032 struct MeshAnimControl : public scfImplementation1<MeshAnimControl, iGenMeshAnimationControl> 00033 { 00034 private: 00035 psEffectObjQuad* parent; 00036 00037 public: 00038 MeshAnimControl(psEffectObjQuad* parent) : scfImplementationType(this) 00039 { 00040 this->parent = parent; 00041 } 00042 00043 virtual ~MeshAnimControl() 00044 { 00045 parent = 0; 00046 } 00047 00048 void Update(csTicks /*elapsed*/, int /*num_verts*/, uint32 /*version_id*/) 00049 { 00050 } 00051 00052 // genmesh animation control 00053 bool AnimatesVertices() const 00054 { 00055 return false; 00056 } 00057 bool AnimatesTexels() const 00058 { 00059 return true; 00060 } 00061 bool AnimatesNormals() const 00062 { 00063 return false; 00064 } 00065 bool AnimatesColors() const 00066 { 00067 return false; 00068 } 00069 bool AnimatesBBoxRadius() const 00070 { 00071 return false; 00072 } 00073 00074 const csBox3 &UpdateBoundingBox(csTicks /*current*/, uint32 /*version_id*/, const csBox3 &bbox) 00075 { 00076 return bbox; 00077 } 00078 const float UpdateRadius(csTicks /*current*/, uint32 /*version_id*/, const float radius) 00079 { 00080 return radius; 00081 } 00082 const csBox3* UpdateBoundingBoxes(csTicks /*current*/, uint32 /*version_id*/) 00083 { 00084 return nullptr; 00085 } 00086 const csVector3* UpdateVertices(csTicks current, const csVector3* verts, int num_verts, uint32 version_id); 00087 const csVector2* UpdateTexels(csTicks current, const csVector2* texels, int num_texels, uint32 version_id); 00088 const csVector3* UpdateNormals(csTicks /*current*/, const csVector3* normals, int /*num_normals*/, 00089 uint32 /*version_id*/) 00090 { 00091 return normals; 00092 } 00093 const csColor4* UpdateColors(csTicks /*current*/, const csColor4* colors, int /*num_colors*/, 00094 uint32 /*version_id*/) 00095 { 00096 return colors; 00097 } 00098 }; 00099 csRef<MeshAnimControl> meshControl; 00100 friend struct MeshAnimControl; 00101 00102 psEffectObjQuad(iView* parentView, psEffect2DRenderer* renderer2d); 00103 virtual ~psEffectObjQuad(); 00104 00105 // inheritted function overloads 00106 virtual bool Load(iDocumentNode* node, iLoaderContext* ldr_context); 00107 virtual bool Render(const csVector3 &up); 00108 virtual bool Update(csTicks elapsed); 00109 virtual void CloneBase(psEffectObj* newObj) const; 00110 virtual psEffectObj* Clone() const; 00111 00112 00113 protected: 00114 00118 virtual bool PostSetup(); 00119 00122 virtual bool CreateMeshFact(); 00123 00128 virtual bool UseUniqueMeshFact() const; 00129 00130 csRef<iGeneralMeshState> genState; 00131 00132 csVector3 vert[4]; 00133 csVector2 texel[4]; 00134 00135 csRef<iMaterialWrapper> mat; 00136 00137 float quadAspect; 00138 }; 00139 00140 #endif