/usr/include/OGRE/OgreBillboard.h is in libogre-1.9-dev 1.9.0+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __Billboard_H__
#define __Billboard_H__
#include "OgrePrerequisites.h"
#include "OgreVector3.h"
#include "OgreColourValue.h"
#include "OgreCommon.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup Effects
* @{
*/
/** A billboard is a primitive which always faces the camera in every frame.
@remarks
Billboards can be used for special effects or some other trickery which requires the
triangles to always facing the camera no matter where it is. Ogre groups billboards into
sets for efficiency, so you should never create a billboard on it's own (it's ok to have a
set of one if you need it).
@par
Billboards have their geometry generated every frame depending on where the camera is. It is most
beneficial for all billboards in a set to be identically sized since Ogre can take advantage of this and
save some calculations - useful when you have sets of hundreds of billboards as is possible with special
effects. You can deviate from this if you wish (example: a smoke effect would probably have smoke puffs
expanding as they rise, so each billboard will legitimately have it's own size) but be aware the extra
overhead this brings and try to avoid it if you can.
@par
Billboards are just the mechanism for rendering a range of effects such as particles. It is other classes
which use billboards to create their individual effects, so the methods here are quite generic.
@see
BillboardSet
*/
class _OgreExport Billboard : public FXAlloc
{
friend class BillboardSet;
friend class BillboardParticleRenderer;
protected:
bool mOwnDimensions;
bool mUseTexcoordRect;
uint16 mTexcoordIndex; /// Index into the BillboardSet array of texture coordinates
FloatRect mTexcoordRect; /// Individual texture coordinates
Real mWidth;
Real mHeight;
public:
// Note the intentional public access to main internal variables used at runtime
// Forcing access via get/set would be too costly for 000's of billboards
Vector3 mPosition;
/// Normalised direction vector
Vector3 mDirection;
BillboardSet* mParentSet;
ColourValue mColour;
Radian mRotation;
/** Default constructor.
*/
Billboard();
/** Default destructor.
*/
~Billboard();
/** Normal constructor as called by BillboardSet.
*/
Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour = ColourValue::White);
/** Get the rotation of the billboard.
@remarks
This rotation is relative to the center of the billboard.
*/
const Radian& getRotation(void) const { return mRotation; }
/** Set the rotation of the billboard.
@remarks
This rotation is relative to the center of the billboard.
*/
void setRotation(const Radian& rotation);
/** Set the position of the billboard.
@remarks
This position is relative to a point on the quad which is the billboard. Depending on the BillboardSet,
this may be the center of the quad, the top-left etc. See BillboardSet::setBillboardOrigin for more info.
*/
void setPosition(const Vector3& position);
/** Set the position of the billboard.
@remarks
This position is relative to a point on the quad which is the billboard. Depending on the BillboardSet,
this may be the center of the quad, the top-left etc. See BillboardSet::setBillboardOrigin for more info.
*/
void setPosition(Real x, Real y, Real z);
/** Get the position of the billboard.
@remarks
This position is relative to a point on the quad which is the billboard. Depending on the BillboardSet,
this may be the center of the quad, the top-left etc. See BillboardSet::setBillboardOrigin for more info.
*/
const Vector3& getPosition(void) const;
/** Sets the width and height for this billboard.
@remarks
Note that it is most efficient for every billboard in a BillboardSet to have the same dimensions. If you
choose to alter the dimensions of an individual billboard the set will be less efficient. Do not call
this method unless you really need to have different billboard dimensions within the same set. Otherwise
just call the BillboardSet::setDefaultDimensions method instead.
*/
void setDimensions(Real width, Real height);
/** Resets this Billboard to use the parent BillboardSet's dimensions instead of it's own. */
void resetDimensions(void) { mOwnDimensions = false; }
/** Sets the colour of this billboard.
@remarks
Billboards can be tinted based on a base colour. This allows variations in colour irrespective of the
base colour of the material allowing more varied billboards. The default colour is white.
The tinting is effected using vertex colours.
*/
void setColour(const ColourValue& colour);
/** Gets the colour of this billboard.
*/
const ColourValue& getColour(void) const;
/** Returns true if this billboard deviates from the BillboardSet's default dimensions (i.e. if the
Billboard::setDimensions method has been called for this instance).
@see
Billboard::setDimensions
*/
bool hasOwnDimensions(void) const;
/** Retrieves the billboard's personal width, if hasOwnDimensions is true. */
Real getOwnWidth(void) const;
/** Retrieves the billboard's personal height, if hasOwnDimensions is true. */
Real getOwnHeight(void) const;
/** Internal method for notifying the billboard of it's owner.
*/
void _notifyOwner(BillboardSet* owner);
/** Returns true if this billboard use individual texture coordinate rect (i.e. if the
Billboard::setTexcoordRect method has been called for this instance), or returns
false if use texture coordinates defined in the parent BillboardSet's texture
coordinates array (i.e. if the Billboard::setTexcoordIndex method has been called
for this instance).
@see
Billboard::setTexcoordIndex()
Billboard::setTexcoordRect()
*/
bool isUseTexcoordRect(void) const { return mUseTexcoordRect; }
/** setTexcoordIndex() sets which texture coordinate rect this billboard will use
when rendering. The parent billboard set may contain more than one, in which
case a billboard can be textured with different pieces of a larger texture
sheet very efficiently.
@see
BillboardSet::setTextureCoords()
*/
void setTexcoordIndex(uint16 texcoordIndex);
/** getTexcoordIndex() returns the previous value set by setTexcoordIndex().
The default value is 0, which is always a valid texture coordinate set.
@remarks
This value is useful only when isUseTexcoordRect return false.
*/
uint16 getTexcoordIndex(void) const { return mTexcoordIndex; }
/** setTexcoordRect() sets the individual texture coordinate rect of this billboard
will use when rendering. The parent billboard set may contain more than one, in
which case a billboard can be textured with different pieces of a larger texture
sheet very efficiently.
*/
void setTexcoordRect(const FloatRect& texcoordRect);
/** setTexcoordRect() sets the individual texture coordinate rect of this billboard
will use when rendering. The parent billboard set may contain more than one, in
which case a billboard can be textured with different pieces of a larger texture
sheet very efficiently.
*/
void setTexcoordRect(Real u0, Real v0, Real u1, Real v1);
/** getTexcoordRect() returns the previous value set by setTexcoordRect().
@remarks
This value is useful only when isUseTexcoordRect returns true.
*/
const FloatRect& getTexcoordRect(void) const { return mTexcoordRect; }
};
/** @} */
/** @} */
}
#include "OgreHeaderSuffix.h"
#endif
|