OgreBillboardChain.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 // Thanks to Vincent Cantin (karmaGfa) for the original implementation of this
30 // class, although it has now been mostly rewritten
31 
32 #ifndef _BillboardChain_H__
33 #define _BillboardChain_H__
34 
35 #include "OgrePrerequisites.h"
36 
37 #include "OgreMovableObject.h"
38 #include "OgreRenderable.h"
40 #include "OgreHeaderPrefix.h"
41 
42 namespace Ogre {
43 
78  {
79 
80  public:
81 
85  {
86 
87  public:
88 
89  Element();
90 
91  Element(const Vector3 &position,
92  Real width,
93  Real texCoord,
94  const ColourValue &colour,
95  const Quaternion &orientation);
96 
102 
105  };
107 
116  BillboardChain(const String& name, size_t maxElements = 20, size_t numberOfChains = 1,
117  bool useTextureCoords = true, bool useColours = true, bool dynamic = true);
119  virtual ~BillboardChain();
120 
123  virtual void setMaxChainElements(size_t maxElements);
126  virtual size_t getMaxChainElements(void) const { return mMaxElementsPerChain; }
130  virtual void setNumberOfChains(size_t numChains);
134  virtual size_t getNumberOfChains(void) const { return mChainCount; }
135 
142  virtual void setUseTextureCoords(bool use);
146  virtual bool getUseTextureCoords(void) const { return mUseTexCoords; }
147 
152  {
156  TCD_V
157  };
162  virtual void setTextureCoordDirection(TexCoordDirection dir);
166  virtual TexCoordDirection getTextureCoordDirection(void) { return mTexCoordDir; }
167 
173  virtual void setOtherTextureCoordRange(Real start, Real end);
177  virtual const Real* getOtherTextureCoordRange(void) const { return mOtherTexCoordRange; }
178 
185  virtual void setUseVertexColours(bool use);
189  virtual bool getUseVertexColours(void) const { return mUseVertexColour; }
190 
194  virtual void setDynamic(bool dyn);
195 
199  virtual bool getDynamic(void) const { return mDynamic; }
200 
209  virtual void addChainElement(size_t chainIndex,
210  const Element& billboardChainElement);
214  virtual void removeChainElement(size_t chainIndex);
221  virtual void updateChainElement(size_t chainIndex, size_t elementIndex,
222  const Element& billboardChainElement);
228  virtual const Element& getChainElement(size_t chainIndex, size_t elementIndex) const;
229 
231  virtual size_t getNumChainElements(size_t chainIndex) const;
232 
234  virtual void clearChain(size_t chainIndex);
236  virtual void clearAllChains(void);
237 
254  void setFaceCamera( bool faceCamera, const Vector3 &normalVector=Vector3::UNIT_X );
255 
257  virtual const String& getMaterialName(void) const { return mMaterialName; }
259  virtual void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
260 
261 
262  // Overridden members follow
263  Real getSquaredViewDepth(const Camera* cam) const;
264  Real getBoundingRadius(void) const;
265  const AxisAlignedBox& getBoundingBox(void) const;
266  const MaterialPtr& getMaterial(void) const;
267  const String& getMovableType(void) const;
268  void _updateRenderQueue(RenderQueue *);
269  void getRenderOperation(RenderOperation &);
270  virtual bool preRender(SceneManager* sm, RenderSystem* rsys);
271  void getWorldTransforms(Matrix4 *) const;
272  const LightList& getLights(void) const;
274  void visitRenderables(Renderable::Visitor* visitor,
275  bool debugRenderables = false);
276 
277 
278 
279  protected:
280 
284  size_t mChainCount;
290  bool mDynamic;
300  mutable bool mBoundsDirty;
308  mutable Real mRadius;
315  Real mOtherTexCoordRange[2];
324 
325 
328 
337  {
339  size_t start;
341  size_t head;
343  size_t tail;
344  };
347 
349  virtual void setupChainContainers(void);
351  virtual void setupVertexDeclaration(void);
353  virtual void setupBuffers(void);
355  virtual void updateVertexBuffer(Camera* cam);
357  virtual void updateIndexBuffer(void);
358  virtual void updateBoundingBox(void) const;
359 
361  static const size_t SEGMENT_EMPTY;
362  };
363 
364 
367  {
368  protected:
369  MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
370  public:
373 
375 
376  const String& getType(void) const;
377  void destroyInstance( MovableObject* obj);
378 
379  };
380 
384 } // namespace
385 
386 #include "OgreHeaderSuffix.h"
387 
388 #endif
389 
390 

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Oct 23 2013 06:57:23