Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::TerrainRenderable Class Reference

Represents a terrain tile. More...

#include <OgreTerrainRenderable.h>

Inheritance diagram for Ogre::TerrainRenderable:

Inheritance graph
[legend]
Collaboration diagram for Ogre::TerrainRenderable:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Neighbor {
  NORTH = 0, SOUTH = 1, EAST = 2, WEST = 3,
  HERE = 4
}

Public Methods

 TerrainRenderable ()
 ~TerrainRenderable ()
void deleteGeometry ()
void init (TerrainOptions &options)
 Initializes the TerrainRenderable with the given options.

virtual const StringgetName (void) const
 Returns the name of the TerrainRenderable.

virtual const StringgetMovableType (void) const
 Returns the type of the movable.

const AxisAlignedBoxgetBoundingBox (void) const
 Returns the bounding box of this TerrainRenderable.

virtual void _notifyCurrentCamera (Camera *cam)
 Updates the level of detail to be used for rendering this TerrainRenderable based on the passed in Camera.

virtual void _updateRenderQueue (RenderQueue *queue)
 Internal method by which the movable object must add Renderable subclass instances to the rendering queue.

virtual void getRenderOperation (RenderOperation &rend)
 Constructs a RenderOperation to render the TerrainRenderable.

virtual MaterialgetMaterial (void) const
 Retrieves a pointer to the material this renderable object uses.

virtual void getWorldTransforms (Matrix4 *xform) const
 Gets the world transform matrix / matrices for this renderable object.

virtual const QuaterniongetWorldOrientation (void) const
 Gets the worldspace orientation of this renderable; this is used in order to more efficiently update parameters to vertex & fragment programs, since inverting Quaterion and Vector in order to derive object-space positions / directions for cameras and lights is much more efficient than inverting a complete 4x4 matrix, and also eliminates problems introduced by scaling.

virtual const Vector3getWorldPosition (void) const
 Gets the worldspace orientation of this renderable; this is used in order to more efficiently update parameters to vertex & fragment programs, since inverting Quaterion and Vector in order to derive object-space positions / directions for cameras and lights is much more efficient than inverting a complete 4x4 matrix, and also eliminates problems introduced by scaling.

int getSize ()
 Returns the size of the TerrainRenderable.

int getRenderLevel ()
 Returns the mipmap level that will be rendered for this frame.

void setForcedRenderLevel (int i)
 Forces the LOD to the given level from this point on.

int getNumMipMaps () const
 Returns the maximum number of mipmaps used for LOD.

void _getNormalAt (float x, float y, Vector3 *result)
 Calculates the normal at the given location.

float getHeightAt (float x, float y)
 Returns the terrain height at the given coordinates.

bool intersectSegment (const Vector3 &start, const Vector3 &end, Vector3 *result)
 Intersects the segment witht he terrain tile.

void _setNeighbor (Neighbor n, TerrainRenderable *t)
 Sets the appropriate neighbor for this TerrainRenderable.

TerrainRenderable * _getNeighbor (Neighbor n)
 Returns the neighbor TerrainRenderable.

void setMaterial (Material *m)
void _alignNeighbors ()
 Aligns mipmap levels between neighbors so that only 1 LOD level separates neighbors.

void _calculateNormals ()
 Calculates static normals for lighting the terrain.

void _generateVertexLighting (const Vector3 &sun, ColourValue ambient)
 Generates terrain shadows and lighting using vertex colors.

Real getSquaredViewDepth (const Camera *cam) const
 Overridden, see Renderable.

Real getBoundingRadius (void) const
 Overridden from MovableObject.

const LightListgetLights (void) const
 @copydoc Renderable::getLights

virtual TechniquegetTechnique (void) const
 Retrieves a pointer to the Material Technique this renderable object uses.

virtual unsigned short getNumWorldTransforms (void) const
 Returns the number of world transform matrices this renderable requires.

virtual bool useIdentityProjection (void) const
 Returns whether or not to use an 'identity' projection.

virtual bool useIdentityView (void) const
 Returns whether or not to use an 'identity' projection.

virtual SceneDetailLevel getRenderDetail () const
 Returns the preferred rasterisation mode of this renderable.

virtual bool getNormaliseNormals (void) const
 Returns whether or not this Renderable wishes the hardware to normalise normals.

virtual NodegetParentNode (void) const
 Returns the node to which this object is attached.

virtual void _notifyAttached (Node *parent, bool isTagPoint=false)
 Internal method called to notify the object that it has been attached to a node.

virtual bool isAttached (void) const
 Returns true if this object is attached to a SceneNode or TagPoint.

virtual const AxisAlignedBoxgetWorldBoundingBox (bool derive=false) const
 Retrieves the axis-aligned bounding box for this object in world coordinates.

virtual const SpheregetWorldBoundingSphere (bool derive=false) const
 Retrieves the worldspace bounding sphere for this object.

virtual void setVisible (bool visible)
 Tells this object whether to be visible or not, if it has a renderable component.

virtual bool isVisible (void) const
 Returns whether or not this object is supposed to be visible or not.

virtual void setUserObject (UserDefinedObject *obj)
 Call this to associate your own custom user object instance with this MovableObject.

virtual UserDefinedObjectgetUserObject (void)
 Retrieves a pointer to a custom application object associated with this movable by an earlier call to setUserObject.

virtual void setRenderQueueGroup (RenderQueueGroupID queueID)
 Sets the render queue group this entity will be rendered through.

virtual RenderQueueGroupID getRenderQueueGroup (void) const
 Gets the queue group for this entity, see setRenderQueueGroup for full details.

virtual Matrix4 _getParentNodeFullTransform (void) const
 return the full transformation of the parent sceneNode or the attachingPoint node

virtual void setQueryFlags (unsigned long flags)
 Sets the query flags for this object.

virtual void addQueryFlags (unsigned long flags)
 As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object.

virtual void removeQueryFlags (unsigned long flags)
 As setQueryFlags, except the flags passed as parameters are removed from the existing flags on this object.

virtual unsigned long getQueryFlags (void) const
 Returns the query flags relevant for this object.


Static Public Attributes

size_t mRenderedTris = 0

Protected Methods

int _index (int x, int z)
 Returns the index into the height array for the given coords.

float _vertex (int x, int z, int n)
 Returns the vertex coord for the given coordinates.

int _numNeighbors ()
bool _hasNeighborRenderLevel (int i)
void _adjustRenderLevel (int i)
void _initLevelIndexes ()
bool _checkSize (int n)
void _calculateMinLevelDist2 (Real C)
Real _calculateCFactor ()

Protected Attributes

VertexDatamTerrain
int mNumMipMaps
int mRenderLevel
RealmMinLevelDistSqr
TerrainRenderable * mNeighbors [4]
AxisAlignedBox mBounds
Vector3 mCenter
Vector3 mScale
int mSize
int mWorldSize
String mName
MaterialmMaterial
bool mRenderLevelChanged
bool mInit
int mNearPlane
int mMaxPixelError
int mVertResolution
Real mTopCoord
Real old_L
Real current_L
bool mColored
bool mLit
int mForcedRenderLevel
NodemParentNode
 node to which this object is attached

bool mParentIsTagPoint
bool mVisible
 Is this object visible?

UserDefinedObjectmUserObject
 User defined object which is linked to this object.

RenderQueueGroupID mRenderQueueID
 The render queue to use when rendering this object.

unsigned long mQueryFlags
 Flags determining whether this object is included / excluded from scene queries.

AxisAlignedBox mWorldAABB
 Cached world AABB of this object.

Sphere mWorldBoundingSphere

Static Protected Attributes

String mType = "TerrainMipMap"
LevelArray mLevelIndex
bool mLevelInit = false

Detailed Description

Represents a terrain tile.

Remarks:
A TerrainRenderable represents a tile used to render a block of terrain using the geomipmap approach for LOD.
Author:
Jon Anderson

Definition at line 123 of file OgreTerrainRenderable.h.


Member Enumeration Documentation

enum Ogre::TerrainRenderable::Neighbor
 

Enumeration values:
NORTH 
SOUTH 
EAST 
WEST 
HERE 

Definition at line 132 of file OgreTerrainRenderable.h.

Referenced by _getNeighbor(), and _setNeighbor().


Constructor & Destructor Documentation

Ogre::TerrainRenderable::TerrainRenderable  
 

Definition at line 42 of file OgreTerrainRenderable.cpp.

References _initLevelIndexes(), mColored, mForcedRenderLevel, mInit, mLit, mMinLevelDistSqr, mNeighbors, and mRenderLevelChanged.

Ogre::TerrainRenderable::~TerrainRenderable  
 

Definition at line 64 of file OgreTerrainRenderable.cpp.

References deleteGeometry().


Member Function Documentation

void Ogre::TerrainRenderable::_adjustRenderLevel int    i [protected]
 

Definition at line 706 of file OgreTerrainRenderable.cpp.

References _alignNeighbors(), and mRenderLevel.

Referenced by _alignNeighbors().

void Ogre::TerrainRenderable::_alignNeighbors  
 

Aligns mipmap levels between neighbors so that only 1 LOD level separates neighbors.

Definition at line 714 of file OgreTerrainRenderable.cpp.

References _adjustRenderLevel(), mNeighbors, and mRenderLevel.

Referenced by _adjustRenderLevel().

Real Ogre::TerrainRenderable::_calculateCFactor   [protected]
 

Definition at line 736 of file OgreTerrainRenderable.cpp.

References mMaxPixelError, mNearPlane, mTopCoord, mVertResolution, and Ogre::Real.

Referenced by init().

void Ogre::TerrainRenderable::_calculateMinLevelDist2 Real    C [protected]
 

Definition at line 621 of file OgreTerrainRenderable.cpp.

References _vertex(), mMinLevelDistSqr, mNumMipMaps, mSize, and Ogre::Real.

Referenced by init().

void Ogre::TerrainRenderable::_calculateNormals  
 

Calculates static normals for lighting the terrain.

Definition at line 282 of file OgreTerrainRenderable.cpp.

References _getNormalAt(), _vertex(), Ogre::VertexBufferBinding::getBuffer(), mSize, mTerrain, NORMAL_BINDING, Ogre::Real, Ogre::VertexData::vertexBufferBinding, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by init().

bool Ogre::TerrainRenderable::_checkSize int    n [protected]
 

Definition at line 609 of file OgreTerrainRenderable.cpp.

Referenced by init().

void Ogre::TerrainRenderable::_generateVertexLighting const Vector3   sun,
ColourValue    ambient
 

Generates terrain shadows and lighting using vertex colors.

Definition at line 903 of file OgreTerrainRenderable.cpp.

References _getNormalAt(), _index(), _vertex(), Ogre::ColourValue::b, COLOUR_BINDING, Ogre::Vector3::dotProduct(), Ogre::ColourValue::g, Ogre::VertexBufferBinding::getBuffer(), intersectSegment(), mColored, mSize, mTerrain, Ogre::Vector3::normalise(), Ogre::ColourValue::r, Ogre::RGBA, Ogre::VertexData::vertexBufferBinding, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

TerrainRenderable* Ogre::TerrainRenderable::_getNeighbor Neighbor    n
 

Returns the neighbor TerrainRenderable.

Definition at line 232 of file OgreTerrainRenderable.h.

References mNeighbors, and Neighbor.

void Ogre::TerrainRenderable::_getNormalAt float    x,
float    y,
Vector3   result
 

Calculates the normal at the given location.

Definition at line 251 of file OgreTerrainRenderable.cpp.

References Ogre::Vector3::crossProduct(), getHeightAt(), Ogre::Vector3::normalise(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by _calculateNormals(), and _generateVertexLighting().

Matrix4 Ogre::MovableObject::_getParentNodeFullTransform void    const [virtual, inherited]
 

return the full transformation of the parent sceneNode or the attachingPoint node

Definition at line 92 of file OgreMovableObject.cpp.

References Ogre::Node::_getFullTransform(), and Ogre::MovableObject::mParentNode.

Referenced by Ogre::Entity::cacheBoneMatrices(), Ogre::TagPoint::getParentEntityTransform(), Ogre::MovableObject::getWorldBoundingBox(), Ogre::SubEntity::getWorldTransforms(), and Ogre::BillboardSet::getWorldTransforms().

bool Ogre::TerrainRenderable::_hasNeighborRenderLevel int    i [protected]
 

Definition at line 307 of file OgreTerrainRenderable.h.

References mNeighbors, and mRenderLevel.

int Ogre::TerrainRenderable::_index int    x,
int    z
[protected]
 

Returns the index into the height array for the given coords.

Definition at line 272 of file OgreTerrainRenderable.h.

References mSize.

Referenced by _generateVertexLighting(), and getRenderOperation().

void Ogre::TerrainRenderable::_initLevelIndexes   [protected]
 

Definition at line 680 of file OgreTerrainRenderable.cpp.

References Ogre::IndexArray, mLevelIndex, and mLevelInit.

Referenced by TerrainRenderable().

void Ogre::MovableObject::_notifyAttached Node   parent,
bool    isTagPoint = false
[virtual, inherited]
 

Internal method called to notify the object that it has been attached to a node.

Definition at line 54 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mParentIsTagPoint, and Ogre::MovableObject::mParentNode.

Referenced by Ogre::SceneNode::attachObject(), Ogre::Entity::attachObjectImpl(), Ogre::SceneNode::detachAllObjects(), Ogre::SceneNode::detachObject(), and Ogre::SceneNode::~SceneNode().

void Ogre::TerrainRenderable::_notifyCurrentCamera Camera   cam [virtual]
 

Updates the level of detail to be used for rendering this TerrainRenderable based on the passed in Camera.

Implements Ogre::MovableObject.

Definition at line 308 of file OgreTerrainRenderable.cpp.

References current_L, mCenter, mForcedRenderLevel, mMinLevelDistSqr, mNumMipMaps, mRenderLevel, Ogre::Real, and Ogre::Vector3::squaredLength().

int Ogre::TerrainRenderable::_numNeighbors   [protected]
 

Definition at line 294 of file OgreTerrainRenderable.h.

References mNeighbors.

void Ogre::TerrainRenderable::_setNeighbor Neighbor    n,
TerrainRenderable *    t
 

Sets the appropriate neighbor for this TerrainRenderable.

Neighbors are necessary to know when to bridge between LODs.

Definition at line 225 of file OgreTerrainRenderable.h.

References mNeighbors, and Neighbor.

void Ogre::TerrainRenderable::_updateRenderQueue RenderQueue   queue [virtual]
 

Internal method by which the movable object must add Renderable subclass instances to the rendering queue.

Remarks:
The engine will call this method when this object is to be rendered. The object must then create one or more Renderable subclass instances which it places on the passed in Queue for rendering.

Implements Ogre::MovableObject.

Definition at line 347 of file OgreTerrainRenderable.cpp.

References Ogre::RenderQueue::addRenderable().

float Ogre::TerrainRenderable::_vertex int    x,
int    z,
int    n
[protected]
 

Returns the vertex coord for the given coordinates.

Definition at line 278 of file OgreTerrainRenderable.h.

References Ogre::VertexBufferBinding::getBuffer(), mSize, mTerrain, Ogre::Real, and Ogre::VertexData::vertexBufferBinding.

Referenced by _calculateMinLevelDist2(), _calculateNormals(), _generateVertexLighting(), and getHeightAt().

virtual void Ogre::MovableObject::addQueryFlags unsigned long    flags [virtual, inherited]
 

As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object.

Definition at line 168 of file OgreMovableObject.h.

void Ogre::TerrainRenderable::deleteGeometry  
 

Definition at line 70 of file OgreTerrainRenderable.cpp.

References mMinLevelDistSqr, and mTerrain.

Referenced by init(), and ~TerrainRenderable().

const AxisAlignedBox& Ogre::TerrainRenderable::getBoundingBox void    const [virtual]
 

Returns the bounding box of this TerrainRenderable.

Implements Ogre::MovableObject.

Definition at line 160 of file OgreTerrainRenderable.h.

References mBounds.

Referenced by intersectSegment().

Real Ogre::TerrainRenderable::getBoundingRadius void    const [virtual]
 

Overridden from MovableObject.

Implements Ogre::MovableObject.

Definition at line 262 of file OgreTerrainRenderable.h.

References Ogre::Real.

float Ogre::TerrainRenderable::getHeightAt float    x,
float    y
 

Returns the terrain height at the given coordinates.

Definition at line 747 of file OgreTerrainRenderable.cpp.

References _vertex(), EAST, mNeighbors, mSize, NORTH, SOUTH, WEST, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by _getNormalAt(), and intersectSegment().

const LightList & Ogre::TerrainRenderable::getLights void    const [virtual]
 

@copydoc Renderable::getLights

Implements Ogre::Renderable.

Definition at line 986 of file OgreTerrainRenderable.cpp.

References Ogre::Node::getLights(), Ogre::LightList, and Ogre::MovableObject::mParentNode.

virtual Material* Ogre::TerrainRenderable::getMaterial void    const [virtual]
 

Retrieves a pointer to the material this renderable object uses.

Remarks:
Note that the Renderable also has the option to override the getTechnique method to specify a particular Technique to use instead of the best one available.

Implements Ogre::Renderable.

Definition at line 178 of file OgreTerrainRenderable.h.

References mMaterial.

virtual const String& Ogre::TerrainRenderable::getMovableType void    const [virtual]
 

Returns the type of the movable.

Implements Ogre::MovableObject.

Definition at line 154 of file OgreTerrainRenderable.h.

References mType.

virtual const String& Ogre::TerrainRenderable::getName void    const [virtual]
 

Returns the name of the TerrainRenderable.

Implements Ogre::MovableObject.

Definition at line 148 of file OgreTerrainRenderable.h.

References mName.

virtual bool Ogre::Renderable::getNormaliseNormals void    const [virtual, inherited]
 

Returns whether or not this Renderable wishes the hardware to normalise normals.

Reimplemented in Ogre::SubEntity.

Definition at line 132 of file OgreRenderable.h.

Referenced by Ogre::SceneManager::renderSingleObject().

int Ogre::TerrainRenderable::getNumMipMaps void    const
 

Returns the maximum number of mipmaps used for LOD.

Definition at line 207 of file OgreTerrainRenderable.h.

References mNumMipMaps.

virtual unsigned short Ogre::Renderable::getNumWorldTransforms void    const [virtual, inherited]
 

Returns the number of world transform matrices this renderable requires.

Remarks:
When a renderable uses vertex blending, it uses multiple world matrices instead of a single one. Each vertex sent to the pipeline can reference one or more matrices in this list with given weights. If a renderable does not use vertex blending this method returns 1, which is the default for simplicity.

Reimplemented in Ogre::SubEntity, and Ogre::BorderRenderable.

Definition at line 98 of file OgreRenderable.h.

Referenced by Ogre::SceneManager::renderSingleObject().

Node * Ogre::MovableObject::getParentNode void    const [virtual, inherited]
 

Returns the node to which this object is attached.

Remarks:
An object is not visible in the scene unless attached to a SceneNode.

Attaching an object is done via the SceneNode::attachObject method.

Definition at line 60 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mParentNode.

Referenced by Ogre::TagPoint::_updateFromParent(), Ogre::BspIntersectionSceneQuery::execute(), Ogre::TagPoint::getLights(), Ogre::SubEntity::getLights(), Ogre::SubEntity::getSquaredViewDepth(), Ogre::TagPoint::needUpdate(), and Ogre::BspSceneManager::processVisibleLeaf().

virtual unsigned long Ogre::MovableObject::getQueryFlags void    const [virtual, inherited]
 

Returns the query flags relevant for this object.

Definition at line 175 of file OgreMovableObject.h.

Referenced by Ogre::BspIntersectionSceneQuery::execute().

virtual SceneDetailLevel Ogre::Renderable::getRenderDetail   const [virtual, inherited]
 

Returns the preferred rasterisation mode of this renderable.

Reimplemented in Ogre::SubEntity.

Definition at line 129 of file OgreRenderable.h.

References Ogre::SceneDetailLevel, and Ogre::SDL_SOLID.

Referenced by Ogre::SceneManager::renderSingleObject().

int Ogre::TerrainRenderable::getRenderLevel  
 

Returns the mipmap level that will be rendered for this frame.

Definition at line 195 of file OgreTerrainRenderable.h.

References mRenderLevel.

void Ogre::TerrainRenderable::getRenderOperation RenderOperation   rend [virtual]
 

Constructs a RenderOperation to render the TerrainRenderable.

Remarks:
Each TerrainRenderable has a block of vertices that represent the terrain. Index arrays are dynamically created for mipmap level, and then cached.

Implements Ogre::Renderable.

Definition at line 352 of file OgreTerrainRenderable.cpp.

References _index(), EAST, Ogre::IndexData::indexBuffer, Ogre::IndexData::indexCount, Ogre::RenderOperation::indexData, Ogre::IndexData::indexStart, Ogre::TerrainBufferCache::mCache, mInit, mLevelIndex, mNeighbors, mRenderedTris, mRenderLevel, mRenderLevelChanged, mSize, mTerrain, NORTH, Ogre::RenderOperation::operationType, SOUTH, TILE_EAST, TILE_NORTH, TILE_SOUTH, TILE_WEST, Ogre::RenderOperation::useIndexes, Ogre::RenderOperation::vertexData, and WEST.

RenderQueueGroupID Ogre::MovableObject::getRenderQueueGroup void    const [virtual, inherited]
 

Gets the queue group for this entity, see setRenderQueueGroup for full details.

Definition at line 87 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mRenderQueueID, and Ogre::RenderQueueGroupID.

int Ogre::TerrainRenderable::getSize void   
 

Returns the size of the TerrainRenderable.

Definition at line 189 of file OgreTerrainRenderable.h.

References mSize.

Real Ogre::TerrainRenderable::getSquaredViewDepth const Camera   cam const [virtual]
 

Overridden, see Renderable.

Implements Ogre::Renderable.

Definition at line 978 of file OgreTerrainRenderable.cpp.

References Ogre::Camera::getDerivedPosition(), mCenter, Ogre::Real, and Ogre::Vector3::squaredLength().

virtual Technique* Ogre::Renderable::getTechnique void    const [virtual, inherited]
 

Retrieves a pointer to the Material Technique this renderable object uses.

Remarks:
This is to allow Renderables to use a chosen Technique if they wish, otherwise they will use the best Technique available for the Material they are using.

Reimplemented in Ogre::SubEntity.

Definition at line 63 of file OgreRenderable.h.

References Ogre::Material::getBestTechnique().

Referenced by Ogre::RenderPriorityGroup::addRenderable().

virtual UserDefinedObject* Ogre::MovableObject::getUserObject void    [virtual, inherited]
 

Retrieves a pointer to a custom application object associated with this movable by an earlier call to setUserObject.

Definition at line 136 of file OgreMovableObject.h.

const AxisAlignedBox & Ogre::MovableObject::getWorldBoundingBox bool    derive = false const [virtual, inherited]
 

Retrieves the axis-aligned bounding box for this object in world coordinates.

Definition at line 104 of file OgreMovableObject.cpp.

References Ogre::MovableObject::_getParentNodeFullTransform(), Ogre::MovableObject::getBoundingBox(), Ogre::MovableObject::mWorldAABB, and Ogre::AxisAlignedBox::transform().

Referenced by Ogre::BspIntersectionSceneQuery::execute(), and Ogre::BspSceneManager::processVisibleLeaf().

const Sphere & Ogre::MovableObject::getWorldBoundingSphere bool    derive = false const [virtual, inherited]
 

Retrieves the worldspace bounding sphere for this object.

Definition at line 116 of file OgreMovableObject.cpp.

References Ogre::Node::_getDerivedPosition(), Ogre::MovableObject::getBoundingRadius(), Ogre::MovableObject::mParentNode, Ogre::MovableObject::mWorldBoundingSphere, Ogre::Sphere::setCenter(), and Ogre::Sphere::setRadius().

const Quaternion & Ogre::TerrainRenderable::getWorldOrientation void    const [virtual]
 

Gets the worldspace orientation of this renderable; this is used in order to more efficiently update parameters to vertex & fragment programs, since inverting Quaterion and Vector in order to derive object-space positions / directions for cameras and lights is much more efficient than inverting a complete 4x4 matrix, and also eliminates problems introduced by scaling.

Implements Ogre::Renderable.

Definition at line 600 of file OgreTerrainRenderable.cpp.

References Ogre::Node::_getDerivedOrientation(), and Ogre::MovableObject::mParentNode.

const Vector3 & Ogre::TerrainRenderable::getWorldPosition void    const [virtual]
 

Gets the worldspace orientation of this renderable; this is used in order to more efficiently update parameters to vertex & fragment programs, since inverting Quaterion and Vector in order to derive object-space positions / directions for cameras and lights is much more efficient than inverting a complete 4x4 matrix, and also eliminates problems introduced by scaling.

Implements Ogre::Renderable.

Definition at line 604 of file OgreTerrainRenderable.cpp.

References Ogre::Node::_getDerivedPosition(), and Ogre::MovableObject::mParentNode.

void Ogre::TerrainRenderable::getWorldTransforms Matrix4   xform const [virtual]
 

Gets the world transform matrix / matrices for this renderable object.

Remarks:
If the object has any derived transforms, these are expected to be up to date as long as all the SceneNode structures have been updated before this is called.

This method will populate xform with 1 matrix if it does not use vertex blending. If it does use vertex blending it will fill the passed in pointer with an array of matrices, the length being the value returned from getNumWorldTransforms.

Implements Ogre::Renderable.

Definition at line 595 of file OgreTerrainRenderable.cpp.

References Ogre::Node::_getFullTransform(), and Ogre::MovableObject::mParentNode.

void Ogre::TerrainRenderable::init TerrainOptions   options
 

Initializes the TerrainRenderable with the given options.

Definition at line 79 of file OgreTerrainRenderable.cpp.

References _calculateCFactor(), _calculateMinLevelDist2(), _calculateNormals(), _checkSize(), Ogre::TerrainOptions::_worldheight(), Ogre::VertexDeclaration::addElement(), Ogre::TerrainOptions::colored, COLOUR_BINDING, deleteGeometry(), Ogre::TerrainOptions::detail_tile, Ogre::VertexBufferBinding::getBuffer(), Ogre::VertexDeclaration::getVertexSize(), Ogre::TerrainOptions::lit, Ogre::TerrainOptions::max_mipmap, Ogre::TerrainOptions::max_pixel_error, mBounds, mCenter, mColored, mInit, mLit, mMaxPixelError, mMinLevelDistSqr, mNearPlane, mNumMipMaps, mRenderLevel, mScale, mSize, mTerrain, mTopCoord, mVertResolution, mWorldSize, Ogre::TerrainOptions::near_plane, NORMAL_BINDING, POSITION_BINDING, Ogre::Real, Ogre::RGBA, Ogre::TerrainOptions::scalex, Ogre::TerrainOptions::scaley, Ogre::TerrainOptions::scalez, Ogre::VertexBufferBinding::setBinding(), Ogre::AxisAlignedBox::setExtents(), Ogre::TerrainOptions::size, Ogre::TerrainOptions::startx, Ogre::TerrainOptions::startz, TEXCOORD_BINDING, Ogre::TerrainOptions::top_coord, Ogre::TerrainOptions::vert_res, Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexCount, Ogre::VertexData::vertexDeclaration, Ogre::VertexData::vertexStart, Ogre::VES_DIFFUSE, Ogre::VES_NORMAL, Ogre::VES_POSITION, Ogre::VES_TEXTURE_COORDINATES, Ogre::VET_COLOUR, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::TerrainOptions::world_size, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

bool Ogre::TerrainRenderable::intersectSegment const Vector3   start,
const Vector3   end,
Vector3   result
 

Intersects the segment witht he terrain tile.

Definition at line 833 of file OgreTerrainRenderable.cpp.

References EAST, Ogre::AxisAlignedBox::getAllCorners(), getBoundingBox(), getHeightAt(), mNeighbors, Ogre::Vector3::normalise(), NORTH, SOUTH, WEST, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by _generateVertexLighting().

bool Ogre::MovableObject::isAttached void    const [virtual, inherited]
 

Returns true if this object is attached to a SceneNode or TagPoint.

Definition at line 65 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mParentNode.

Referenced by Ogre::Entity::attachObjectToBone().

bool Ogre::MovableObject::isVisible void    const [virtual, inherited]
 

Returns whether or not this object is supposed to be visible or not.

Definition at line 76 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mVisible.

Referenced by Ogre::OctreeNode::_addToRenderQueue(), Ogre::SceneManager::_populateLightList(), and Ogre::BspSceneManager::processVisibleLeaf().

virtual void Ogre::MovableObject::removeQueryFlags unsigned long    flags [virtual, inherited]
 

As setQueryFlags, except the flags passed as parameters are removed from the existing flags on this object.

Definition at line 172 of file OgreMovableObject.h.

void Ogre::TerrainRenderable::setForcedRenderLevel int    i
 

Forces the LOD to the given level from this point on.

Definition at line 201 of file OgreTerrainRenderable.h.

References mForcedRenderLevel.

void Ogre::TerrainRenderable::setMaterial Material   m
 

Definition at line 238 of file OgreTerrainRenderable.h.

References mMaterial.

virtual void Ogre::MovableObject::setQueryFlags unsigned long    flags [virtual, inherited]
 

Sets the query flags for this object.

Remarks:
When performing a scene query, this object will be included or excluded according to flags on the object and flags on the query. This is a bitwise value, so only when a bit on these flags is set, will it be included in a query asking for that flag. The meaning of the bits is application-specific.

Definition at line 164 of file OgreMovableObject.h.

void Ogre::MovableObject::setRenderQueueGroup RenderQueueGroupID    queueID [virtual, inherited]
 

Sets the render queue group this entity will be rendered through.

Remarks:
Render queues are grouped to allow you to more tightly control the ordering of rendered objects. If you do not call this method, all Entity objects default to RENDER_QUEUE_MAIN which is fine for most objects. You may want to alter this if you want this entity to always appear in front of other objects, e.g. for a 3D menu system or such.

See RenderQueue for more details.

Parameters:
queueID  Enumerated value of the queue group to use.

Definition at line 82 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mRenderQueueID, and Ogre::RenderQueueGroupID.

virtual void Ogre::MovableObject::setUserObject UserDefinedObject   obj [virtual, inherited]
 

Call this to associate your own custom user object instance with this MovableObject.

Remarks:
By simply making your game / application object a subclass of UserDefinedObject, you can establish a link between an OGRE instance of MovableObject and your own application classes. Call this method to establish the link.

Definition at line 132 of file OgreMovableObject.h.

void Ogre::MovableObject::setVisible bool    visible [virtual, inherited]
 

Tells this object whether to be visible or not, if it has a renderable component.

Reimplemented in Ogre::Light.

Definition at line 71 of file OgreMovableObject.cpp.

References Ogre::MovableObject::mVisible.

virtual bool Ogre::Renderable::useIdentityProjection void    const [virtual, inherited]
 

Returns whether or not to use an 'identity' projection.

Remarks:
Usually Renderable objects will use a projection matrix as determined by the active camera. However, if they want they can cancel this out and use an identity projection, which effectively projects in 2D using a {-1, 1} view space. Useful for overlay rendering. Normal renderables need not override this.

Reimplemented in Ogre::GuiElement, and Ogre::BorderRenderable.

Definition at line 108 of file OgreRenderable.h.

Referenced by Ogre::SceneManager::useRenderableViewProjMode().

virtual bool Ogre::Renderable::useIdentityView void    const [virtual, inherited]
 

Returns whether or not to use an 'identity' projection.

Remarks:
Usually Renderable objects will use a view matrix as determined by the active camera. However, if they want they can cancel this out and use an identity matrix, which means all geometry is assumed to be relative to camera space already. Useful for overlay rendering. Normal renderables need not override this.

Reimplemented in Ogre::GuiElement, and Ogre::BorderRenderable.

Definition at line 118 of file OgreRenderable.h.

Referenced by Ogre::SceneManager::useRenderableViewProjMode().


Member Data Documentation

Real Ogre::TerrainRenderable::current_L [protected]
 

Definition at line 363 of file OgreTerrainRenderable.h.

Referenced by _notifyCurrentCamera().

AxisAlignedBox Ogre::TerrainRenderable::mBounds [protected]
 

Definition at line 338 of file OgreTerrainRenderable.h.

Referenced by getBoundingBox(), and init().

Vector3 Ogre::TerrainRenderable::mCenter [protected]
 

Definition at line 339 of file OgreTerrainRenderable.h.

Referenced by _notifyCurrentCamera(), getSquaredViewDepth(), and init().

bool Ogre::TerrainRenderable::mColored [protected]
 

Definition at line 365 of file OgreTerrainRenderable.h.

Referenced by _generateVertexLighting(), init(), and TerrainRenderable().

int Ogre::TerrainRenderable::mForcedRenderLevel [protected]
 

Definition at line 368 of file OgreTerrainRenderable.h.

Referenced by _notifyCurrentCamera(), setForcedRenderLevel(), and TerrainRenderable().

bool Ogre::TerrainRenderable::mInit [protected]
 

Definition at line 351 of file OgreTerrainRenderable.h.

Referenced by getRenderOperation(), init(), and TerrainRenderable().

LevelArray Ogre::TerrainRenderable::mLevelIndex [static, protected]
 

Definition at line 39 of file OgreTerrainRenderable.cpp.

Referenced by _initLevelIndexes(), and getRenderOperation().

bool Ogre::TerrainRenderable::mLevelInit = false [static, protected]
 

Definition at line 40 of file OgreTerrainRenderable.cpp.

Referenced by _initLevelIndexes().

bool Ogre::TerrainRenderable::mLit [protected]
 

Definition at line 366 of file OgreTerrainRenderable.h.

Referenced by init(), and TerrainRenderable().

Material* Ogre::TerrainRenderable::mMaterial [protected]
 

Definition at line 348 of file OgreTerrainRenderable.h.

Referenced by getMaterial(), and setMaterial().

int Ogre::TerrainRenderable::mMaxPixelError [protected]
 

Definition at line 357 of file OgreTerrainRenderable.h.

Referenced by _calculateCFactor(), and init().

Real* Ogre::TerrainRenderable::mMinLevelDistSqr [protected]
 

Definition at line 334 of file OgreTerrainRenderable.h.

Referenced by _calculateMinLevelDist2(), _notifyCurrentCamera(), deleteGeometry(), init(), and TerrainRenderable().

String Ogre::TerrainRenderable::mName [protected]
 

Definition at line 345 of file OgreTerrainRenderable.h.

Referenced by getName().

int Ogre::TerrainRenderable::mNearPlane [protected]
 

Definition at line 356 of file OgreTerrainRenderable.h.

Referenced by _calculateCFactor(), and init().

TerrainRenderable* Ogre::TerrainRenderable::mNeighbors[ 4 ] [protected]
 

Definition at line 336 of file OgreTerrainRenderable.h.

Referenced by _alignNeighbors(), _getNeighbor(), _hasNeighborRenderLevel(), _numNeighbors(), _setNeighbor(), getHeightAt(), getRenderOperation(), intersectSegment(), and TerrainRenderable().

int Ogre::TerrainRenderable::mNumMipMaps [protected]
 

Definition at line 331 of file OgreTerrainRenderable.h.

Referenced by _calculateMinLevelDist2(), _notifyCurrentCamera(), getNumMipMaps(), and init().

bool Ogre::MovableObject::mParentIsTagPoint [protected, inherited]
 

Definition at line 48 of file OgreMovableObject.h.

Referenced by Ogre::MovableObject::_notifyAttached(), Ogre::MovableObject::MovableObject(), and Ogre::MovableObject::~MovableObject().

Node* Ogre::MovableObject::mParentNode [protected, inherited]
 

node to which this object is attached

Definition at line 47 of file OgreMovableObject.h.

Referenced by Ogre::MovableObject::_getParentNodeFullTransform(), Ogre::MovableObject::_notifyAttached(), Ogre::Entity::_notifyCurrentCamera(), Ogre::ParticleSystem::_triggerEmitters(), Ogre::ParticleSystem::_updateBounds(), Ogre::BillboardSet::_updateBounds(), Ogre::Camera::Camera(), Ogre::Frustum::Frustum(), Ogre::BillboardSet::genBillboardAxes(), Ogre::Entity::getBoundingBox(), Ogre::Entity::getBoundingRadius(), getLights(), Ogre::SimpleRenderable::getLights(), Ogre::BillboardSet::getLights(), Ogre::MovableObject::getParentNode(), Ogre::Frustum::getSquaredViewDepth(), Ogre::BillboardSet::getSquaredViewDepth(), Ogre::MovableObject::getWorldBoundingSphere(), getWorldOrientation(), Ogre::SubEntity::getWorldOrientation(), Ogre::SimpleRenderable::getWorldOrientation(), Ogre::ParticleSystem::getWorldOrientation(), Ogre::Frustum::getWorldOrientation(), Ogre::BillboardSet::getWorldOrientation(), getWorldPosition(), Ogre::SubEntity::getWorldPosition(), Ogre::SimpleRenderable::getWorldPosition(), Ogre::ParticleSystem::getWorldPosition(), Ogre::Frustum::getWorldPosition(), Ogre::BillboardSet::getWorldPosition(), getWorldTransforms(), Ogre::SimpleRenderable::getWorldTransforms(), Ogre::Frustum::getWorldTransforms(), Ogre::MovableObject::isAttached(), Ogre::Frustum::isViewOutOfDate(), Ogre::Camera::isViewOutOfDate(), Ogre::Light::Light(), Ogre::MovableObject::MovableObject(), Ogre::SimpleRenderable::SimpleRenderable(), Ogre::Light::update(), and Ogre::MovableObject::~MovableObject().

unsigned long Ogre::MovableObject::mQueryFlags [protected, inherited]
 

Flags determining whether this object is included / excluded from scene queries.

Definition at line 56 of file OgreMovableObject.h.

Referenced by Ogre::MovableObject::MovableObject().

size_t Ogre::TerrainRenderable::mRenderedTris = 0 [static]
 

Definition at line 35 of file OgreTerrainRenderable.cpp.

Referenced by getRenderOperation().

int Ogre::TerrainRenderable::mRenderLevel [protected]
 

Definition at line 332 of file OgreTerrainRenderable.h.

Referenced by _adjustRenderLevel(), _alignNeighbors(), _hasNeighborRenderLevel(), _notifyCurrentCamera(), getRenderLevel(), getRenderOperation(), and init().

bool Ogre::TerrainRenderable::mRenderLevelChanged [protected]
 

Definition at line 350 of file OgreTerrainRenderable.h.

Referenced by getRenderOperation(), and TerrainRenderable().

RenderQueueGroupID Ogre::MovableObject::mRenderQueueID [protected, inherited]
 

The render queue to use when rendering this object.

Definition at line 54 of file OgreMovableObject.h.

Referenced by Ogre::Entity::_updateRenderQueue(), Ogre::BillboardSet::_updateRenderQueue(), Ogre::MovableObject::getRenderQueueGroup(), Ogre::MovableObject::MovableObject(), and Ogre::MovableObject::setRenderQueueGroup().

Vector3 Ogre::TerrainRenderable::mScale [protected]
 

Definition at line 340 of file OgreTerrainRenderable.h.

Referenced by init().

int Ogre::TerrainRenderable::mSize [protected]
 

Definition at line 342 of file OgreTerrainRenderable.h.

Referenced by _calculateMinLevelDist2(), _calculateNormals(), _generateVertexLighting(), _index(), _vertex(), getHeightAt(), getRenderOperation(), getSize(), and init().

VertexData* Ogre::TerrainRenderable::mTerrain [protected]
 

Definition at line 329 of file OgreTerrainRenderable.h.

Referenced by _calculateNormals(), _generateVertexLighting(), _vertex(), deleteGeometry(), getRenderOperation(), and init().

Real Ogre::TerrainRenderable::mTopCoord [protected]
 

Definition at line 359 of file OgreTerrainRenderable.h.

Referenced by _calculateCFactor(), and init().

String Ogre::TerrainRenderable::mType = "TerrainMipMap" [static, protected]
 

Definition at line 37 of file OgreTerrainRenderable.cpp.

Referenced by getMovableType().

UserDefinedObject* Ogre::MovableObject::mUserObject [protected, inherited]
 

User defined object which is linked to this object.

Definition at line 52 of file OgreMovableObject.h.

Referenced by Ogre::MovableObject::MovableObject().

int Ogre::TerrainRenderable::mVertResolution [protected]
 

Definition at line 358 of file OgreTerrainRenderable.h.

Referenced by _calculateCFactor(), and init().

bool Ogre::MovableObject::mVisible [protected, inherited]
 

Is this object visible?

Definition at line 50 of file OgreMovableObject.h.

Referenced by Ogre::Frustum::Frustum(), Ogre::MovableObject::isVisible(), Ogre::MovableObject::MovableObject(), and Ogre::MovableObject::setVisible().

AxisAlignedBox Ogre::MovableObject::mWorldAABB [protected, inherited]
 

Cached world AABB of this object.

Definition at line 58 of file OgreMovableObject.h.

Referenced by Ogre::MovableObject::getWorldBoundingBox(), and Ogre::MovableObject::MovableObject().

Sphere Ogre::MovableObject::mWorldBoundingSphere [protected, inherited]
 

Definition at line 60 of file OgreMovableObject.h.

Referenced by Ogre::MovableObject::getWorldBoundingSphere().

int Ogre::TerrainRenderable::mWorldSize [protected]
 

Definition at line 343 of file OgreTerrainRenderable.h.

Referenced by init().

Real Ogre::TerrainRenderable::old_L [protected]
 

Definition at line 361 of file OgreTerrainRenderable.h.


The documentation for this class was generated from the following files:

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:13:43 2004