Planeshift
pseffectobjstar.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_STAR_HEADER
21 #define PS_EFFECT_OBJ_STAR_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  psEffectObjStar* parent;
39 
40  public:
41  // genmesh animation control
42  bool AnimatesVertices() const
43  {
44  return true;
45  }
46  bool AnimatesTexels() const
47  {
48  return false;
49  }
50  bool AnimatesNormals() const
51  {
52  return false;
53  }
54  bool AnimatesColors()const
55  {
56  return true;
57  }
58  bool AnimatesBBoxRadius() const
59  {
60  return false;
61  }
62 
63  MeshAnimControl(psEffectObjStar* parent) : scfImplementationType(this)
64  {
65  this->parent = parent;
66  }
67  virtual ~MeshAnimControl()
68  {
69  parent = 0;
70  }
71 
72  void Update(csTicks /*elapsed*/, int /*num_verts*/, uint32 /*version_id*/)
73  {
74  }
75 
76  const csBox3 &UpdateBoundingBox(csTicks /*current*/, uint32 /*version_id*/, const csBox3 &bbox)
77  {
78  return bbox;
79  }
80  const float UpdateRadius(csTicks /*current*/, uint32 /*version_id*/, const float radius)
81  {
82  return radius;
83  }
84  const csBox3* UpdateBoundingBoxes(csTicks /*current*/, uint32 /*version_id*/)
85  {
86  return nullptr;
87  }
88  const csVector3* UpdateVertices(csTicks current, const csVector3* verts, int num_verts, uint32 version_id);
89  const csVector2* UpdateTexels(csTicks /*current*/, const csVector2* texels,
90  int /*num_texels*/, uint32 /*version_id*/)
91  {
92  return texels;
93  }
94  const csVector3* UpdateNormals(csTicks /*current*/, const csVector3* normals,
95  int /*num_normals*/, uint32 /*version_id*/)
96  {
97  return normals;
98  }
99  const csColor4* UpdateColors(csTicks current, const csColor4* colors, int num_colors, uint32 version_id);
100  };
101  csRef<MeshAnimControl> meshControl;
102  friend struct MeshAnimControl;
103 
104  psEffectObjStar(iView* parentView, psEffect2DRenderer* renderer2d);
106 
107  // inheritted function overloads
108  bool Load(iDocumentNode* node, iLoaderContext* ldr_context);
109  bool Render(const csVector3 &up);
110  bool Update(csTicks elapsed);
111  psEffectObj* Clone() const;
112 
113 private:
114 
117  void GenerateRays();
118 
122  bool PostSetup();
123 
124  csRef<iGeneralMeshState> genState;
125 
126  int segments;
127 
128  csVector3* rays;
129  csVector3* perp;
130 
131  csVector3* vert;
132  csColor4* colour;
133 };
134 
137 #endif
const csBox3 * UpdateBoundingBoxes(csTicks, uint32)
psEffectObj * Clone() const
Clones the effect object.
const float UpdateRadius(csTicks, uint32, const float radius)
The manager of all 2D effect elements.
bool Render(const csVector3 &up)
Renders the effect.
MeshAnimControl(psEffectObjStar *parent)
const csColor4 * UpdateColors(csTicks current, const csColor4 *colors, int num_colors, uint32 version_id)
const csVector3 * UpdateVertices(csTicks current, const csVector3 *verts, int num_verts, uint32 version_id)
const csBox3 & UpdateBoundingBox(csTicks, uint32, const csBox3 &bbox)
An effect is not much more than a collection of effect objects.
Definition: pseffectobj.h:207
const csVector2 * UpdateTexels(csTicks, const csVector2 *texels, int, uint32)
psEffectObjStar(iView *parentView, psEffect2DRenderer *renderer2d)
const csVector3 * UpdateNormals(csTicks, const csVector3 *normals, int, uint32)
bool Load(iDocumentNode *node, iLoaderContext *ldr_context)
Loads the effect object from an xml node.
void Update(csTicks, int, uint32)
csRef< MeshAnimControl > meshControl
psEffect2DRenderer * renderer2d
Definition: pseffectobj.h:529