Planeshift
pseffectobjspire.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Robberts
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef PS_EFFECT_OBJ_SPIRE_HEADER
21 #define PS_EFFECT_OBJ_SPIRE_HEADER
22 
23 #include "pseffectobj.h"
24 #include <imesh/genmesh.h>
25 
26 class psEffect2DRenderer;
27 
33 {
34 public:
35  struct MeshAnimControl : public scfImplementation1<MeshAnimControl, iGenMeshAnimationControl>
36  {
37  private:
38  psEffectObjSpire* parent;
39 
40  public:
41  MeshAnimControl(psEffectObjSpire* parent) : scfImplementationType(this)
42  {
43  this->parent = parent;
44  }
45 
46  virtual ~MeshAnimControl()
47  {
48  parent = 0;
49  }
50 
51  void Update(csTicks /*current*/, int /*num_verts*/, uint32 /*version_id*/)
52  {
53  }
54 
55  // genmesh animation control
56  bool AnimatesVertices() const
57  {
58  return true;
59  }
60  bool AnimatesTexels() const
61  {
62  return true;
63  }
64  bool AnimatesNormals() const
65  {
66  return false;
67  }
68  bool AnimatesColors()const
69  {
70  return true;
71  }
72  bool AnimatesBBoxRadius() const
73  {
74  return false;
75  }
76 
77  const csBox3 &UpdateBoundingBox(csTicks /*current*/, uint32 /*version_id*/, const csBox3 &bbox)
78  {
79  return bbox;
80  }
81  const float UpdateRadius(csTicks /*current*/, uint32 /*version_id*/, const float radius)
82  {
83  return radius;
84  }
85  const csBox3* UpdateBoundingBoxes(csTicks /*current*/, uint32 /*version_id*/)
86  {
87  return nullptr;
88  }
89  const csVector3* UpdateVertices(csTicks current, const csVector3* verts, int num_verts, uint32 version_id);
90  const csVector2* UpdateTexels(csTicks current, const csVector2* texels, int num_texels, uint32 version_id);
91  const csVector3* UpdateNormals(csTicks /*current*/, const csVector3* normals,
92  int /*num_normals*/, uint32 /*version_id*/)
93  {
94  return normals;
95  }
96  const csColor4* UpdateColors(csTicks current, const csColor4* colors, int num_colors, uint32 version_id);
97  };
98  csRef<MeshAnimControl> meshControl;
99  friend struct MeshAnimControl;
100 
101 
102 
103  psEffectObjSpire(iView* parentView, psEffect2DRenderer* renderer2d);
104  virtual ~psEffectObjSpire();
105 
106  // inheritted function overloads
107  bool Load(iDocumentNode* node, iLoaderContext* ldr_context);
108  bool Render(const csVector3 &up);
109  bool Update(csTicks elapsed);
110  psEffectObj* Clone() const;
111 
112 
114  {
120 
122  };
123 
124 private:
125 
135  static void CalculateData(int shape, int segments, csVector3* verts, csVector2* texels, float topScale=1, float height=1, float padding=1);
136 
140  bool PostSetup();
141 
142  csRef<iGeneralMeshState> genState;
143 
144  int shape;
145  int segments;
146 
147  csVector3* vert;
148  csVector2* texel;
149  csColor4* colour;
150  int vertCount;
151 };
152 
155 #endif
const csColor4 * UpdateColors(csTicks current, const csColor4 *colors, int num_colors, uint32 version_id)
The manager of all 2D effect elements.
void Update(csTicks, int, uint32)
const csVector3 * UpdateNormals(csTicks, const csVector3 *normals, int, uint32)
bool Render(const csVector3 &up)
Renders the effect.
const csBox3 & UpdateBoundingBox(csTicks, uint32, const csBox3 &bbox)
const csBox3 * UpdateBoundingBoxes(csTicks, uint32)
csRef< MeshAnimControl > meshControl
bool Load(iDocumentNode *node, iLoaderContext *ldr_context)
Loads the effect object from an xml node.
psEffectObj * Clone() const
Clones the effect object.
const csVector3 * UpdateVertices(csTicks current, const csVector3 *verts, int num_verts, uint32 version_id)
const float UpdateRadius(csTicks, uint32, const float radius)
An effect is not much more than a collection of effect objects.
Definition: pseffectobj.h:207
MeshAnimControl(psEffectObjSpire *parent)
virtual ~psEffectObjSpire()
const csVector2 * UpdateTexels(csTicks current, const csVector2 *texels, int num_texels, uint32 version_id)
psEffectObjSpire(iView *parentView, psEffect2DRenderer *renderer2d)
psEffect2DRenderer * renderer2d
Definition: pseffectobj.h:529