[657] | 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-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | You may use this sample code for anything you like, it is not covered by the
|
---|
| 11 | LGPL like the rest of the engine.
|
---|
| 12 | -----------------------------------------------------------------------------
|
---|
| 13 | */
|
---|
| 14 | #ifndef H_THINGRENDERABLE
|
---|
| 15 | #define H_THINGRENDERABLE
|
---|
| 16 |
|
---|
| 17 | #include <OgrePrerequisites.h>
|
---|
| 18 | #include <OgreSimpleRenderable.h>
|
---|
| 19 | #include <OgreQuaternion.h>
|
---|
| 20 | #include <OgreVector3.h>
|
---|
| 21 |
|
---|
| 22 | /** Quad fragments that rotate around origin (0,0,0) in a random orbit, always oriented to 0,0,0.
|
---|
| 23 | @author W.J. van der Laan
|
---|
| 24 | */
|
---|
| 25 | class ThingRenderable: public Ogre::SimpleRenderable {
|
---|
| 26 | public:
|
---|
| 27 | /** Create one this object.
|
---|
| 28 | @param radius Radius of orbits
|
---|
| 29 | @param count Number of quads
|
---|
| 30 | @param qsize Size of quads
|
---|
| 31 | */
|
---|
| 32 | ThingRenderable(float radius, size_t count, float qsize);
|
---|
| 33 | ~ThingRenderable();
|
---|
| 34 | /**
|
---|
| 35 | * Retrieves ratios of the origin-centered bounding sphere for this
|
---|
| 36 | * object.
|
---|
| 37 | */
|
---|
| 38 | Ogre::Real getBoundingRadius() const;
|
---|
| 39 | /**
|
---|
| 40 | * Returns the camera-relative squared depth of this renderable.
|
---|
| 41 | */
|
---|
| 42 | Ogre::Real getSquaredViewDepth(const Ogre::Camera*) const;
|
---|
| 43 | /**
|
---|
| 44 | * Notify that t seconds have elapsed.
|
---|
| 45 | */
|
---|
| 46 | void addTime(float t);
|
---|
| 47 | protected:
|
---|
| 48 | void initialise();
|
---|
| 49 | void fillBuffer();
|
---|
| 50 |
|
---|
| 51 | Ogre::HardwareVertexBufferSharedPtr vbuf;// Our vertex buffer
|
---|
| 52 | float mRadius;
|
---|
| 53 | size_t mCount;
|
---|
| 54 | float mQSize;
|
---|
| 55 | std::vector <Ogre::Quaternion> things;
|
---|
| 56 | std::vector <Ogre::Quaternion> orbits;
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | #endif
|
---|