OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::v1::PatchSurface Class Reference

A surface which is defined by curves of some kind to form a patch, e.g. More...

#include <OgrePatchSurface.h>

+ Inheritance diagram for Ogre::v1::PatchSurface:

Public Types

enum  { AUTO_LEVEL = -1 }
 Constant for indicating automatic determination of subdivision level for patches. More...
 
enum  PatchSurfaceType { PST_BEZIER }
 
enum  VisibleSide { VS_FRONT, VS_BACK, VS_BOTH }
 

Public Member Functions

 PatchSurface ()
 
 ~PatchSurface ()
 
void build (v1::HardwareVertexBufferSharedPtr destVertexBuffer, size_t vertexStart, v1::HardwareIndexBufferSharedPtr destIndexBuffer, size_t indexStart)
 Tells the system to build the mesh relating to the surface into externally created buffers. More...
 
void defineSurface (void *controlPointBuffer, v1::VertexDeclaration *declaration, size_t width, size_t height, PatchSurfaceType pType=PST_BEZIER, size_t uMaxSubdivisionLevel=AUTO_LEVEL, size_t vMaxSubdivisionLevel=AUTO_LEVEL, VisibleSide visibleSide=VS_FRONT)
 Sets up the surface by defining it's control points, type and initial subdivision level. More...
 
Real getBoundingSphereRadius (void) const
 Gets the radius of the bounding sphere for this patch, only valid after defineSurface has been called. More...
 
const AxisAlignedBoxgetBounds (void) const
 Gets the bounds of this patch, only valid after calling defineSurface. More...
 
void * getControlPointBuffer (void) const
 
size_t getCurrentIndexCount (void) const
 Gets the current index count based on the current subdivision level. More...
 
size_t getIndexOffset (void) const
 Returns the index offset used by this buffer to write data into the buffer. More...
 
size_t getRequiredIndexCount (void) const
 Based on a previous call to defineSurface, establishes the number of indexes required to hold this patch at the maximum detail level. More...
 
size_t getRequiredVertexCount (void) const
 Based on a previous call to defineSurface, establishes the number of vertices required to hold this patch at the maximum detail level. More...
 
Real getSubdivisionFactor (void) const
 Gets the current level of subdivision. More...
 
size_t getVertexOffset (void) const
 Returns the vertex offset used by this buffer to write data into the buffer. More...
 
void notifyControlPointBufferDeallocated (void)
 Convenience method for telling the patch that the control points have been deleted, since once the patch has been built they are not required. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
void setSubdivisionFactor (Real factor)
 Alters the level of subdivision for this surface. More...
 

Detailed Description

A surface which is defined by curves of some kind to form a patch, e.g.

a Bezier patch.

Remarks
This object will take a list of control points with various assorted data, and will subdivide it into a patch mesh. Currently only Bezier curves are supported for defining the surface, but other techniques such as NURBS would follow the same basic approach.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Constant for indicating automatic determination of subdivision level for patches.

Enumerator
AUTO_LEVEL 

◆ PatchSurfaceType

Enumerator
PST_BEZIER 

A patch defined by a set of bezier curves.

◆ VisibleSide

Enumerator
VS_FRONT 

The side from which u goes right and v goes up (as in texture coords)

VS_BACK 

The side from which u goes right and v goes down (reverse of texture coords)

VS_BOTH 

Both sides are visible - warning this creates 2x the number of triangles and adds extra overhead for calculating normals.

Constructor & Destructor Documentation

◆ PatchSurface()

Ogre::v1::PatchSurface::PatchSurface ( )

◆ ~PatchSurface()

Ogre::v1::PatchSurface::~PatchSurface ( )

Member Function Documentation

◆ build()

void Ogre::v1::PatchSurface::build ( v1::HardwareVertexBufferSharedPtr  destVertexBuffer,
size_t  vertexStart,
v1::HardwareIndexBufferSharedPtr  destIndexBuffer,
size_t  indexStart 
)

Tells the system to build the mesh relating to the surface into externally created buffers.

Remarks
The VertexDeclaration of the vertex buffer must be identical to the one passed into defineSurface. In addition, there must be enough space in the buffer to accommodate the patch at full detail level; you should call getRequiredVertexCount and getRequiredIndexCount to determine this. This method does not create an internal mesh for this patch and so getMesh will return null if you call it after building the patch this way.
Parameters
destVertexBufferThe destination vertex buffer in which to build the patch.
vertexStartThe offset at which to start writing vertices for this patch
destIndexBufferThe destination index buffer in which to build the patch.
indexStartThe offset at which to start writing indexes for this patch

◆ defineSurface()

void Ogre::v1::PatchSurface::defineSurface ( void *  controlPointBuffer,
v1::VertexDeclaration declaration,
size_t  width,
size_t  height,
PatchSurfaceType  pType = PST_BEZIER,
size_t  uMaxSubdivisionLevel = AUTO_LEVEL,
size_t  vMaxSubdivisionLevel = AUTO_LEVEL,
VisibleSide  visibleSide = VS_FRONT 
)

Sets up the surface by defining it's control points, type and initial subdivision level.

Remarks
This method initialises the surface by passing it a set of control points. The type of curves to be used are also defined here, although the only supported option currently is a bezier patch. You can also specify a global subdivision level here if you like, although it is recommended that the parameter is left as AUTO_LEVEL, which means the system decides how much subdivision is required (based on the curvature of the surface)
Parameters
controlPointBufferA pointer to a buffer containing the vertex data which defines control points of the curves rather than actual vertices. Note that you are expected to provide not just position information, but potentially normals and texture coordinates too. The format of the buffer is defined in the VertexDeclaration parameter
declarationVertexDeclaration describing the contents of the buffer. Note this declaration must only draw on buffer source 0!
widthSpecifies the width of the patch in control points.
heightSpecifies the height of the patch in control points.
pTypeThe type of surface - currently only PST_BEZIER is supported
uMaxSubdivisionLevel,vMaxSubdivisionLevelIf you want to manually set the top level of subdivision, do it here, otherwise let the system decide.
visibleSideDetermines which side of the patch (or both) triangles are generated for.

◆ getBoundingSphereRadius()

Real Ogre::v1::PatchSurface::getBoundingSphereRadius ( void  ) const

Gets the radius of the bounding sphere for this patch, only valid after defineSurface has been called.

◆ getBounds()

const AxisAlignedBox& Ogre::v1::PatchSurface::getBounds ( void  ) const

Gets the bounds of this patch, only valid after calling defineSurface.

◆ getControlPointBuffer()

void* Ogre::v1::PatchSurface::getControlPointBuffer ( void  ) const
inline

◆ getCurrentIndexCount()

size_t Ogre::v1::PatchSurface::getCurrentIndexCount ( void  ) const

Gets the current index count based on the current subdivision level.

◆ getIndexOffset()

size_t Ogre::v1::PatchSurface::getIndexOffset ( void  ) const
inline

Returns the index offset used by this buffer to write data into the buffer.

◆ getRequiredIndexCount()

size_t Ogre::v1::PatchSurface::getRequiredIndexCount ( void  ) const

Based on a previous call to defineSurface, establishes the number of indexes required to hold this patch at the maximum detail level.

Remarks
This is useful when you wish to build the patch into external vertex / index buffers.

◆ getRequiredVertexCount()

size_t Ogre::v1::PatchSurface::getRequiredVertexCount ( void  ) const

Based on a previous call to defineSurface, establishes the number of vertices required to hold this patch at the maximum detail level.

Remarks
This is useful when you wish to build the patch into external vertex / index buffers.

◆ getSubdivisionFactor()

Real Ogre::v1::PatchSurface::getSubdivisionFactor ( void  ) const

Gets the current level of subdivision.

◆ getVertexOffset()

size_t Ogre::v1::PatchSurface::getVertexOffset ( void  ) const
inline

Returns the vertex offset used by this buffer to write data into the buffer.

◆ notifyControlPointBufferDeallocated()

void Ogre::v1::PatchSurface::notifyControlPointBufferDeallocated ( void  )
inline

Convenience method for telling the patch that the control points have been deleted, since once the patch has been built they are not required.

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ setSubdivisionFactor()

void Ogre::v1::PatchSurface::setSubdivisionFactor ( Real  factor)

Alters the level of subdivision for this surface.

Remarks
This method changes the proportionate detail level of the patch; since the U and V directions can have different subdivision levels, this method takes a single Real value where 0 is the minimum detail (the control points) and 1 is the maximum detail level as supplied to the original call to defineSurface.

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