neo::scene::Geometry Class Reference

#include <scene/geometry.h>

Inheritance diagram for neo::scene::Geometry:

Inheritance graph
[legend]
Collaboration diagram for neo::scene::Geometry:

Collaboration graph
[legend]
List of all members.

Detailed Description

Geometry data base class. A geometry can be used for any or all of the features supported; rendering, shadow casting and collision detection. This base class also acts as a static geometry with no LOD control.

Todo:
Look into improved caching of combined parameter bindings per technique
Author:
Mattias Jansson (mattias@realityrift.com)


Public Types

enum  Pass { RENDER = 0x01, COLLISION = 0x02, OCCLUSION = 0x04, SHADOW = 0x08 }
 Geometry passes. More...

Public Member Functions

 Geometry (unsigned int passes=(RENDER|COLLISION|OCCLUSION|SHADOW), const std::string &name="")
 Initialize geometry.
virtual ~Geometry ()
 Free resources.
virtual void setPasses (unsigned int passes)
 Set geometry passes.
virtual void setVertices (const render::VertexBufferPtr &p_vertices)
 Set vertex buffer.
virtual void setIndices (const render::IndexBufferPtr &p_indices, unsigned int primitive=render::Primitive::TRIANGLES)
 Set index buffer.
virtual void setMaterial (const MaterialPtr &p_material)
 Set material.
void setName (const std::string &name)
 Set name.
unsigned int getPasses () const
 Get geometry passes,.
unsigned int getPrimitiveType ()
 Get primitive type.
unsigned int getNumPrimitives ()
 Get number of primitives.
render::VertexBufferPtr & getVertices ()
 Get vertex buffer.
render::IndexBufferPtr & getIndices ()
 Get index buffer.
MaterialPtr & getMaterial ()
 Get material.
const std::string & getName () const
 Get name.
ObjectgetObject ()
 Get object.
void getParameters (core::Array< render::Parameter * > *p_params, bool all=false)
 Get render pipeline parameters.
bool isOpaque () const
 Query if geometry is opaque.
bool render (unsigned int pass, render::Primitive *p_prim)
 Render geometry.
void setDirty ()
 Set dirty flag.
void setSort (unsigned int sort)
 Set sorting value.
unsigned int getSort () const
 Get sorting value.
const core::Array< render::Edge > & getEdges () const
 Get edges.
void generateEdges ()
 Generate edges.
const core::Array< math::Vector3 > & getNormals () const
 Get polygon normals.
void generateNormals ()
 Generate polygon normals.
virtual Geometryclone () const
 Clone geometry.
virtual void notifyBind (const core::HashString &name, render::ParameterData *p_data, render::ParameterBinder *p_binder)
 Notification of changed parameter binding value.
virtual void notifyUnbind (const core::HashString &name, render::ParameterBinder *p_binder)
 Notification of unbound parameter value.

Protected Member Functions

 Geometry (const Geometry &geom)
 Copy geometry.
virtual void updateBuffers ()
void setObject (Object *p_obj)
void invalidateRenderCache ()
 Invalidate the render cache.
void buildRenderCache (unsigned int pass)
 Build the render cache.

Protected Attributes

unsigned int _passes
 Geometry passes.
unsigned int _prim
 Primitive type.
unsigned int _num
 Primitive count.
render::VertexBufferPtr _p_vertices
 Vertex buffer.
render::IndexBufferPtr _p_indices
 Index buffer.
MaterialPtr _p_material
 Material.
bool _dirty
 Dirty flag indicating buffers needs to be updates.
bool _opaque
 Opaque flags.
unsigned int _sort
 Sort value.
Object_p_obj
 Object.
std::string _name
 Name.
core::HashTable< unsigned
int, PassData > 
_passMap
 Cached parameter bindings for each pass.
core::Array< render::Edge_edges
 Edges.
core::Array< math::Vector3_normals
 Polygon normals.


Member Enumeration Documentation

enum neo::scene::Geometry::Pass

Enumerator:
RENDER  Rendering.
COLLISION  Collision.
OCCLUSION  Occlusion.
SHADOW  Shadow casting.


Constructor & Destructor Documentation

neo::scene::Geometry::Geometry ( unsigned int  passes = (RENDER|COLLISION|OCCLUSION|SHADOW),
const std::string &  name = "" 
)

Parameters:
passes Geometry passes this geometry is used in, default to all (RENDER, COLLISION, OCCLUSION and SHADOW)
name Name

neo::scene::Geometry::Geometry ( const Geometry geom  )  [protected]

Create a copy of geometry

Parameters:
geom Geometry to copy


Member Function Documentation

virtual void neo::scene::Geometry::setPasses ( unsigned int  passes  )  [virtual]

Set the geometry passes in which this geometry is used,

See also:
Geometry::Pass
Parameters:
passes Geometry passes

virtual void neo::scene::Geometry::setVertices ( const render::VertexBufferPtr &  p_vertices  )  [virtual]

Set vertex buffer

Parameters:
p_vertices New vertex buffer

Reimplemented in neo::scene::LODGeometry, and neo::scene::SkinnedGeometry.

virtual void neo::scene::Geometry::setIndices ( const render::IndexBufferPtr &  p_indices,
unsigned int  primitive = render::Primitive::TRIANGLES 
) [virtual]

Set index buffer

Parameters:
p_indices New index buffer
primitive Primitive type, default triangle list

Reimplemented in neo::scene::LODGeometry.

virtual void neo::scene::Geometry::setMaterial ( const MaterialPtr &  p_material  )  [virtual]

Set material for geometry

Parameters:
p_material New material

Reimplemented in neo::scene::SkinnedGeometry.

void neo::scene::Geometry::setName ( const std::string &  name  ) 

Parameters:
name New name

unsigned int neo::scene::Geometry::getPasses (  )  const [inline]

Returns:
Geometry passes this geometry is used in

unsigned int neo::scene::Geometry::getPrimitiveType (  )  [inline]

Returns:
Primitive type

unsigned int neo::scene::Geometry::getNumPrimitives (  )  [inline]

Returns:
Primitive count

render::VertexBufferPtr & neo::scene::Geometry::getVertices (  )  [inline]

Returns:
Vertex buffer

render::IndexBufferPtr & neo::scene::Geometry::getIndices (  )  [inline]

Returns:
Index buffer

MaterialPtr & neo::scene::Geometry::getMaterial (  )  [inline]

Returns:
Material

const std::string & neo::scene::Geometry::getName (  )  const [inline]

Returns:
Geometry name

Object * neo::scene::Geometry::getObject (  )  [inline]

Returns:
Owner scene object

void neo::scene::Geometry::getParameters ( core::Array< render::Parameter * > *  p_params,
bool  all = false 
)

Get the render pipeline parameters used by this geometry, optionally for all targets even for compiled resources. The parameters must not be deallocated or modified!

Parameters:
p_params Receiving parameter array
all Flag to get parameters for all targets, even if compiled

bool neo::scene::Geometry::isOpaque (  )  const [inline]

A geometry is opaque if all techniques in all used materials are opaque (blend mode not using frame buffer)

Returns:
true if opaque, false if semi-transparent

bool neo::scene::Geometry::render ( unsigned int  pass,
render::Primitive p_prim 
) [inline]

Render geometry with the given primitive. The primitive should have the object parameters set (model, invmodel matrices, object flags).

Parameters:
pass Scene pass
p_prim Primitive
Returns:
true if rendered, false if not

void neo::scene::Geometry::setDirty (  )  [inline]

Set dirty flag

void neo::scene::Geometry::setSort ( unsigned int  sort  )  [inline]

Set sorting value for sorting on geometry level within a single scene object Setting a sorting value prevents backend from sorting primitives for minimizing state changes and might hurt performance, but must sometimes be used to order blended primitives. A higher sort value means rendering later in the queue.

Parameters:
sort Sort value in [0..255] range

unsigned int neo::scene::Geometry::getSort (  )  const [inline]

Returns:
Sort value in [0..255] range
See also:
setSort

const core::Array< render::Edge > & neo::scene::Geometry::getEdges (  )  const [inline]

Returns:
Edge array

const core::Array< math::Vector3 > & neo::scene::Geometry::getNormals (  )  const [inline]

Returns:
Edge array

virtual Geometry* neo::scene::Geometry::clone (  )  const [virtual]

Create a new copy of this geometry

Returns:
New copy of this object

Reimplemented in neo::scene::LODGeometry, and neo::scene::SkinnedGeometry.

virtual void neo::scene::Geometry::notifyBind ( const core::HashString name,
render::ParameterData p_data,
render::ParameterBinder p_binder 
) [virtual]

Parameters:
name Parameter name
p_data New bound data
p_binder Parameter binder

Implements neo::render::ParameterBindCallback.

virtual void neo::scene::Geometry::notifyUnbind ( const core::HashString name,
render::ParameterBinder p_binder 
) [virtual]

Parameters:
name Parameter name
p_binder Parameter binder

Implements neo::render::ParameterBindCallback.

void neo::scene::Geometry::updateBuffers (  )  [inline, protected, virtual]

Update geometry buffers

Reimplemented in neo::scene::LODGeometry, and neo::scene::SkinnedGeometry.

void neo::scene::Geometry::setObject ( Object p_obj  )  [protected]

Set owner object

Parameters:
p_obj Object


The documentation for this class was generated from the following file:
Generated on Sat Feb 17 20:51:07 2007 for NeoEngine 2 - Evolution by  doxygen 1.5.1