Eidolon
Public Types | Public Member Functions | Public Attributes | List of all members
CallbackVertexBuffer< Ctx > Class Template Reference

#include <RenderTypes.h>

Inheritance diagram for CallbackVertexBuffer< Ctx >:
Inheritance graph
Collaboration diagram for CallbackVertexBuffer< Ctx >:
Collaboration graph

Public Types

typedef vec3(* vecfunc) (Ctx, int)
 
typedef color(* colfunc) (Ctx, int)
 

Public Member Functions

 CallbackVertexBuffer (Ctx context, sval numvertices, vecfunc vertfunc, vecfunc normalfunc=NULL, colfunc colorfunc=NULL, vecfunc uvwfunc=NULL)
 
virtual vec3 getVertex (int i) const
 Returns the i'th vertex, i<numVertices() More...
 
virtual vec3 getNormal (int i) const
 Returns the i'th normal, i<numVertices() More...
 
virtual color getColor (int i) const
 Returns the i'th color, i<numVertices() More...
 
virtual vec3 getUVWCoord (int i) const
 Returns the i'th UVW texture coord, i<numVertices() More...
 
virtual sval numVertices () const
 Returns number of total vertices. More...
 
virtual bool hasNormal () const
 Returns true if the buffer contains normal data. More...
 
virtual bool hasColor () const
 Returns true if the buffer contains color data. More...
 
virtual bool hasUVWCoord () const
 Returns true if the buffer contains texture coord data. More...
 
- Public Member Functions inherited from VertexBuffer
virtual ~VertexBuffer ()
 

Public Attributes

vecfunc vertfunc
 
vecfunc normalfunc
 
colfunc colorfunc
 
vecfunc uvwfunc
 
sval numvertices
 
Ctx context
 

Detailed Description

template<typename Ctx>
class RenderTypes::CallbackVertexBuffer< Ctx >

This buffer uses callback functions passed to its constructor as the sources of data rather than storing matrices. The purpose is to allow the callback functions to be defined in Cython to adapt Python code/objects to C++. This allows a VertexBuffer subtype to be defined with Python code but callable in C++. The Ctx value is the context the callback functions are given when called which is typically going to be `this' cast to a different type in Cython such as void*.

Member Typedef Documentation

◆ colfunc

typedef color(* colfunc) (Ctx, int)

◆ vecfunc

typedef vec3(* vecfunc) (Ctx, int)

Constructor & Destructor Documentation

◆ CallbackVertexBuffer()

CallbackVertexBuffer ( Ctx  context,
sval  numvertices,
vecfunc  vertfunc,
vecfunc  normalfunc = NULL,
colfunc  colorfunc = NULL,
vecfunc  uvwfunc = NULL 
)
inline

Member Function Documentation

◆ getColor()

virtual color getColor ( int  i) const
inlinevirtual

Returns the i'th color, i<numVertices()

Reimplemented from VertexBuffer.

◆ getNormal()

virtual vec3 getNormal ( int  i) const
inlinevirtual

Returns the i'th normal, i<numVertices()

Reimplemented from VertexBuffer.

◆ getUVWCoord()

virtual vec3 getUVWCoord ( int  i) const
inlinevirtual

Returns the i'th UVW texture coord, i<numVertices()

Reimplemented from VertexBuffer.

◆ getVertex()

virtual vec3 getVertex ( int  i) const
inlinevirtual

Returns the i'th vertex, i<numVertices()

Reimplemented from VertexBuffer.

◆ hasColor()

virtual bool hasColor ( ) const
inlinevirtual

Returns true if the buffer contains color data.

Reimplemented from VertexBuffer.

◆ hasNormal()

virtual bool hasNormal ( ) const
inlinevirtual

Returns true if the buffer contains normal data.

Reimplemented from VertexBuffer.

◆ hasUVWCoord()

virtual bool hasUVWCoord ( ) const
inlinevirtual

Returns true if the buffer contains texture coord data.

Reimplemented from VertexBuffer.

◆ numVertices()

virtual sval numVertices ( ) const
inlinevirtual

Returns number of total vertices.

Reimplemented from VertexBuffer.

Member Data Documentation

◆ colorfunc

colfunc colorfunc

◆ context

Ctx context

◆ normalfunc

vecfunc normalfunc

◆ numvertices

sval numvertices

◆ uvwfunc

vecfunc uvwfunc

◆ vertfunc

vecfunc vertfunc

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