GL Studio C++ Runtime API
|
#include <gls_geometry_resource.h>
Classes | |
class | Observer |
class | TypeDesc |
Public Types | |
enum | BadId { BAD_ID = 0xffffffff } |
Public Member Functions | |
void | AddObserver (Observer *observer) |
void | RemoveObserver (Observer *observer) |
virtual void | DrawSetup (VertexAttribIndexLookup *shaderProgram)=0 |
virtual void | DrawIndexBuffer (unsigned int bufferNumber)=0 |
virtual void | DrawCleanup (VertexAttribIndexLookup *shaderProgram)=0 |
virtual void | FreeOpenGLBuffers ()=0 |
virtual unsigned int | GetDataChangedCounter () const =0 |
virtual void | GetExtents (Vector &min, Vector &max, const GlsMatrixType *matrix=NULL)=0 |
virtual void | UpdateBoundingVolume ()=0 |
virtual bool | BoundingVolumeHit (const Vector &point, const Vector &direction)=0 |
virtual bool | HitTest (unsigned char pickType, const Vector &pickLinePoint, const Vector &pickLineDirection, Vector &collisionPoint)=0 |
virtual unsigned int | StatsIndexBufferVertexCount (unsigned int bufferNumber)=0 |
virtual unsigned int | StatsIndexBufferPolygonCount (unsigned int bufferNumber)=0 |
const TypeDesc & | Type () |
void | IncrementReference () |
void | DecrementReference () |
unsigned int | NumIndexBuffers () const |
const Vector & | BoundingVolumeCenter () const |
float | BoundingVolumeRadius () const |
void | SetResourceId (unsigned int id) |
unsigned int | GetResourceId () |
Static Public Member Functions | |
static void | SetCreateInstanceMakesHalfFloat (bool value) |
static GlsGeometryResource * | CreateInstance (const TypeDesc &type=GlsGeometryResource::TypeDesc()) |
static GlsGeometryResource * | CreateInstance (GlsResourceFileMgr::ResourceRef *resource) |
Static Public Attributes | |
static const unsigned int | MAX_TEXTURE_COORDS = 2 |
GL_MAX_TEXTURE_COORDS. GlsGeometryResource currently only supports two sets of texture coordinates. | |
static const unsigned int | MAX_VERTEX_ATTRIBS = 16 |
GL_MAX_VERTEX_ATTRIBS. | |
static const unsigned int | VERTEX_ATTRIBUTE_SIZE = 3 * sizeof( float ) |
Size of vertex storage, in bytes. | |
static const unsigned int | NORMAL_ATTRIBUTE_SIZE = 3 * sizeof( float ) |
Size of normal storage, in bytes. | |
static const unsigned int | COLOR_ATTRIBUTE_SIZE = 4 * sizeof( unsigned char ) |
Size of color storage, in bytes. | |
static const unsigned int | SECONDARY_COLOR_ATTRIBUTE_SIZE = 3 * sizeof( unsigned char ) |
Size of secondary color storage, in bytes. | |
static const unsigned int | TEXTURE_COORDINATE_ATTRIBUTE_SIZE = 2 * sizeof( float ) |
Size of texture coordinate storage, in bytes. | |
static const unsigned int | TANGENT_ATTRIBUTE_SIZE = 3 * sizeof( float ) |
Size of tangent storage, in bytes. | |
static const unsigned int | BINORMAL_ATTRIBUTE_SIZE = 3 * sizeof( float ) |
Size of binormal storage, in bytes. | |
static const unsigned int | s_invalidDataChangedCounter = 0 |
Protected Member Functions | |
void | OnGeometryResourceChanged () |
Called to call all observer callbacks when the attribute changes. | |
virtual void | Destroy ()=0 |
Protected Attributes | |
DynamicArray< Observer * > | _observers |
The held list of observers w/ callbacks. | |
unsigned int | _resourceID |
unsigned int | _referenceCount |
TypeDesc | _type |
unsigned int | _numIndexBuffers |
Vector | _boundingVolumeCenter |
Center location of the bounding volume. | |
float | _boundingVolumeRadius |
Radius of the bounding volume. | |
Static Protected Attributes | |
static bool | _enableVBO |
If true, OpenGL supports vertex buffer objects (1.5 or greater). | |
The geometry resource abstract base class
enum BadId |
Something that we can initialize the Resource ID to and then check for to see if we have initialized the resource.
|
inline |
Adds a new observer to the list.
observer | The new observer to add. |
|
inline |
Determines if the given ray hits the geometry bounding volume. Note: All parameters should be in this object's coordinates.
point | The starting point of the ray. |
direction | The direction vector of the ray. |
Implemented in GlsGeometry_Generic.
|
inline |
|
static |
Construct an empty GlsGeometryResource with the given type. The initial reference count is 1. Call DecrementReference to free the resource when you are done with it.
type | A description of the initial Structure. |
|
static |
Construct a GlsGeometryResource from a binary resource. The initial reference count is 1. Call DecrementReference to free the GlsGeometryResource when you are done with it.
resource | A pointer to a ResourceRef containing geometry data. |
|
inline |
Decrement the Reference count to this instance.
|
protectedpure virtual |
Deletes this object from the heap that it was allocated on
Implemented in GlsGeometry_Generic.
|
pure virtual |
Restore the OpenGL state after rendering.
shaderProgram | Must be the same value that was passed to DrawSetup |
Implemented in GlsGeometry_Generic.
|
pure virtual |
Draw the geometry specified by the given index buffer This method should only be called between calls to DrawSetup and DrawCleanup.
bufferNumber | Which index buffer to draw |
Implemented in GlsGeometry_Generic.
|
pure virtual |
Setup the OpenGL state for rendering this geometry. To draw, call DrawIndexBuffer for each index buffer in the resource. After drawing, call DrawCleanup to restore the OpenGL state.
shaderProgram | interface to the shader program, used to lookup correct VertexAttrib index values (may be NULL) |
Implemented in GlsGeometry_Generic.
|
pure virtual |
Force the GlsGeometryResource to free any buffers it has allocated in the current OpenGL context.
Implemented in GlsGeometry_Generic.
|
pure virtual |
Since calculating metrics like the extents can be an expensive operation, the user can call this function to see if the geometry resource has changed. Caching the expensive-to-calculate values is the responsibility of the caller.
Implemented in GlsGeometry_Generic.
|
pure virtual |
Calculate and return the geometry extents
min | Returns the minimum x,y,z values |
max | Returns the maximum x,y,z values |
matrix | (Optional) matrix to transform the vertices into the desired coordinate system |
Implemented in GlsGeometry_Generic.
|
inline |
|
pure virtual |
Hit test the geometry against a picking line. All values are in geometry space.
pickType | The type of picking (see PickableType_e), must be PICK_FIRST or PICK_BEST |
pickLinePoint | A point on the pick line. |
pickLineDirection | The direction of the pick line. |
collisionPoint | If the method returns true, this contains the point that was hit. |
Implemented in GlsGeometry_Generic.
|
inline |
Increment the Reference count to this instance.
|
inline |
|
inline |
Removes the specified observer from the list.
observer | The observer to remove. |
|
static |
When enabled, GlsGeometryResource::CreateInstance will instantiate GlsGeometry_HalfFloat objects when possible.
value | Whether or not to use half floats. |
|
inline |
Sets a new resource ID
id | The new ID |
|
pure virtual |
bufferNumber | The index of the buffer to count up. |
Implemented in GlsGeometry_Generic.
|
pure virtual |
bufferNumber | The index of the buffer to count up. |
Implemented in GlsGeometry_Generic.
|
pure virtual |
Updates the bounding volume of this object This method should be called if the vertices change for picking and culling to work correctly.
Implemented in GlsGeometry_Generic.
|
protected |
The number of index buffers in this mesh
|
protected |
The number of Parent Objects using this object. Once the number reaches zero, the object self deletes.
|
protected |
Give this Resource a unique id so we can get it.
|
static |
A sentinel value for clients to initialize their counts with. GetDataChangedCounter() will never return this value.