V-Gears 0
Free Final Fantasy VII engine.
VGears::ManualObject Class Reference

A manually handled object. More...

#include <VGearsManualObject.h>

Public Types

enum  BufferBinding {
  BB_POSITION , BB_NORMAL , BB_COLOUR , BB_TEXTURE ,
  BINDING_COUNT
}
 Buffer indexes for object properties. More...
 

Public Member Functions

 ManualObject (Ogre::Mesh *mesh)
 Constructor. More...
 
virtual ~ManualObject ()
 Destructor. More...
 
virtual void begin (const String &name, const String &material_name, size_t vertex_count, size_t index_count)
 Begins creating a object section. More...
 
virtual void position (const Ogre::Vector3 &position)
 Sets the object position. More...
 
virtual void normal (const Ogre::Vector3 &normal)
 Sets the object normal vector. More...
 
virtual void colour (const Ogre::ColourValue &colour)
 Sets the object colour. More...
 
virtual void textureCoord (const Ogre::Vector2 &texture_coordinate)
 Sets the object texture coordinates. More...
 
virtual void index (const uint32 idx)
 Sets the object index. More...
 
virtual void bone (const uint32 idx, const uint16 bone_handle, const Ogre::Real weight=1)
 Adds a bone to the object. More...
 
virtual void end ()
 End the current section. More...
 

Protected Member Functions

template<typename BufferType >
BufferType * createBuffer (const BufferBinding binding, Ogre::VertexElementType type, Ogre::VertexElementSemantic semantic)
 Creates a buffer. More...
 
virtual void createPositionBuffer ()
 Creates a position buffer in {. More...
 
virtual void createNormalBuffer ()
 Creates a normal buffer in {. More...
 
virtual void createColourBuffer ()
 Creates a colour buffer in {. More...
 
virtual void createTextureCoordinateBuffer ()
 Creates a texture coordinate buffer in {. More...
 
virtual void createIndexBuffer ()
 Creates a index buffer in {. More...
 
virtual void resetBuffers ()
 Resets all buffers in {. More...
 
template<typename BufferSharedPtr >
void resetBuffer (BufferSharedPtr &buffer) const
 Resets any of the buffers in {. More...
 

Private Types

typedef Ogre::HardwareVertexBufferSharedPtr VertexBuffer
 
typedef Ogre::HardwareIndexBufferSharedPtr IndexBuffer
 

Private Attributes

Ogre::Mesh * _mesh
 The object mesh. More...
 
Ogre::SubMesh * _section
 The currently open section. More...
 
Ogre::AxisAlignedBox _bbox
 
Ogre::Real _radius
 
VertexBuffer _vertex_buffers [BINDING_COUNT]
 The object vetex buffer. More...
 
IndexBuffer _indexbuffer_
 The index buffer. More...
 
Ogre::Vector3 * _position
 The position buffer. More...
 
Ogre::Vector3 * _normal
 The normal buffer. More...
 
uint32colour_
 The colour buffer. More...
 
Ogre::Vector2 * _texture_coordinate
 The texture buffer. More...
 
uint16_index
 The object index. More...
 
const Ogre::VertexElementType colour_type_
 The colour type. More...
 

Detailed Description

A manually handled object.

When parsing files this is used to create the rendering engine object. E.g. when a bone is found in the file being parsed, then bone() is called to add it.

Member Typedef Documentation

◆ IndexBuffer

typedef Ogre::HardwareIndexBufferSharedPtr VGears::ManualObject::IndexBuffer
private

◆ VertexBuffer

typedef Ogre::HardwareVertexBufferSharedPtr VGears::ManualObject::VertexBuffer
private

Member Enumeration Documentation

◆ BufferBinding

Buffer indexes for object properties.

Enumerator
BB_POSITION 

Object position.

BB_NORMAL 

Object normal.

BB_COLOUR 

Object colour.

BB_TEXTURE 

Object texture.

BINDING_COUNT 

Number of binds for the object.

Constructor & Destructor Documentation

◆ ManualObject()

VGears::ManualObject::ManualObject ( Ogre::Mesh *  mesh)
explicit

Constructor.

Parameters
[in]meshThe object mesh

◆ ~ManualObject()

VGears::ManualObject::~ManualObject ( )
virtual

Destructor.

Member Function Documentation

◆ begin()

void VGears::ManualObject::begin ( const String name,
const String material_name,
size_t  vertex_count,
size_t  index_count 
)
virtual

Begins creating a object section.

It doesn't set position, normal or texture.

Parameters
[in]nameName for the object.
[in]material_nameName of the object's material.
[in]vertex_countNumber of vertices in the object.
[in]index_count
Todo:
Undestand and document index_count.

◆ bone()

void VGears::ManualObject::bone ( const uint32  idx,
const uint16  bone_handle,
const Ogre::Real  weight = 1 
)
virtual

Adds a bone to the object.

Parameters
[in]idxIndex of the vertex index to add the bone to.
[in]bone_handleIndex of the bone objct.
[in]weightBone weight. In most cases, 1 is ok.
Todo:
It applies to the object or the current section?

◆ colour()

void VGears::ManualObject::colour ( const Ogre::ColourValue &  colour)
virtual

Sets the object colour.

Parameters
[in]colourObject colour.
Todo:
It applies to the object or the current section?

◆ createBuffer()

template<typename BufferType >
BufferType * VGears::ManualObject::createBuffer ( const BufferBinding  binding,
Ogre::VertexElementType  type,
Ogre::VertexElementSemantic  semantic 
)
protected

Creates a buffer.

Parameters
[in]bindingBuffer binding.
[in]typeType Buffer type.
[in]semanticBuffer semantic.
Todo:
I'm no really sure what this function does...

◆ createColourBuffer()

void VGears::ManualObject::createColourBuffer ( )
protectedvirtual

Creates a colour buffer in {.

See also
BB_COLOUR}.

◆ createIndexBuffer()

void VGears::ManualObject::createIndexBuffer ( )
protectedvirtual

Creates a index buffer in {.

See also
BB_INDEX}.

◆ createNormalBuffer()

void VGears::ManualObject::createNormalBuffer ( )
protectedvirtual

Creates a normal buffer in {.

See also
BB_NORMAL}.

◆ createPositionBuffer()

void VGears::ManualObject::createPositionBuffer ( )
protectedvirtual

Creates a position buffer in {.

See also
BB_POSITION}.

◆ createTextureCoordinateBuffer()

void VGears::ManualObject::createTextureCoordinateBuffer ( )
protectedvirtual

Creates a texture coordinate buffer in {.

See also
BB_TEXTURE}.

◆ end()

void VGears::ManualObject::end ( )
virtual

End the current section.

A section must have been started with {

See also
begin}
Exceptions
Ogre::Exception::ERR_INVALIDPARAMSif a section has not been started.

◆ index()

void VGears::ManualObject::index ( const uint32  idx)
virtual

Sets the object index.

Parameters
[in]idxObject index.
Todo:
It applies to the object or the current section?

◆ normal()

void VGears::ManualObject::normal ( const Ogre::Vector3 &  normal)
virtual

Sets the object normal vector.

Parameters
[in]normalNormal vector.
Todo:
It applies to the object or the current section?

◆ position()

void VGears::ManualObject::position ( const Ogre::Vector3 &  position)
virtual

Sets the object position.

Parameters
[in]positionPosition vector.
Todo:
It applies to the object or the current section?

◆ resetBuffer()

template<typename BufferSharedPtr >
void VGears::ManualObject::resetBuffer ( BufferSharedPtr &  buffer) const
protected

Resets any of the buffers in {.

See also
BufferBinding}.
Parameters
[in]bufferBuffer to reset.

◆ resetBuffers()

void VGears::ManualObject::resetBuffers ( )
protectedvirtual

Resets all buffers in {.

See also
BufferBinding}.

◆ textureCoord()

void VGears::ManualObject::textureCoord ( const Ogre::Vector2 &  texture_coordinate)
virtual

Sets the object texture coordinates.

Parameters
[in]texture_coordinateCoordinate vector.
Todo:
It applies to the object or the current section?

Member Data Documentation

◆ _bbox

Ogre::AxisAlignedBox VGears::ManualObject::_bbox
private

◆ _index

uint16* VGears::ManualObject::_index
private

The object index.

◆ _indexbuffer_

IndexBuffer VGears::ManualObject::_indexbuffer_
private

The index buffer.

◆ _mesh

Ogre::Mesh* VGears::ManualObject::_mesh
private

The object mesh.

◆ _normal

Ogre::Vector3* VGears::ManualObject::_normal
private

The normal buffer.

◆ _position

Ogre::Vector3* VGears::ManualObject::_position
private

The position buffer.

◆ _radius

Ogre::Real VGears::ManualObject::_radius
private

◆ _section

Ogre::SubMesh* VGears::ManualObject::_section
private

The currently open section.

◆ _texture_coordinate

Ogre::Vector2* VGears::ManualObject::_texture_coordinate
private

The texture buffer.

◆ _vertex_buffers

VertexBuffer VGears::ManualObject::_vertex_buffers[BINDING_COUNT]
private

The object vetex buffer.

◆ colour_

uint32* VGears::ManualObject::colour_
private

The colour buffer.

◆ colour_type_

const Ogre::VertexElementType VGears::ManualObject::colour_type_
private

The colour type.


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