# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Attributes

# vl::ArrayAbstract Class Reference

The ArrayAbstract class defines an abstract interface to conveniently manipulate data stored in a GLBufferObject. More...

`#include <Array.hpp>`

Inheritance diagram for vl::ArrayAbstract:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| ArrayAbstract ()
| Default constructor.
| ArrayAbstract (const ArrayAbstract &other)
| Copies only the local data and not the VBO related fields.
void | operator= (const ArrayAbstract &other)
| Copies only the local data and not the VBO related fields.
virtual ref< ArrayAbstract > | clone () const =0
const GLBufferObject * | gpuBuffer () const
GLBufferObject * | gpuBuffer ()
void | clear ()
const unsigned char * | ptr () const
| Returns the pointer to the first element of the local buffer. Equivalent to gpuBuffer()->ptr()
unsigned char * | ptr ()
| Returns the pointer to the first element of the local buffer. Equivalent to gpuBuffer()->ptr()
virtual size_t | bytesUsed () const
| Returns the amount of memory in bytes used by an array. Equivalent to gpuBuffer()->bytesUsed().
virtual size_t | glSize () const =0
| Returns the number of scalar components for the array, ie 3 for ArrayFloat3, 1 for ArrayUInt1 etc.
virtual int | glType () const =0
| Returns the OpenGL type for the array, ie GL_FLOAT for ArrayFloat3, GL_UNSIGNED_INT for ArrayUInt1 etc.
virtual size_t | size () const =0
| Returns the number of elements of an array.
virtual Sphere | computeBoundingSphere () const =0
| Computes the bounding sphere enclosing the vectors contained in the buffer.
virtual AABB | computeBoundingBox () const =0
| Computes the axis aligned bounding box enclosing the vectors contained in the buffer.
virtual void | transform (const mat4 &m)=0
| Transforms the vectors contained in the buffer.
virtual void | normalize ()=0
| Normalizes the vectors contained in the buffer.
virtual vec4 | vectorAsVec4 (size_t vector_index) const =0
| Returns a vector from the buffer as a `vec4` value.
virtual vec3 | vectorAsVec3 (size_t vector_index) const =0
| Returns a vector from the buffer as a `vec3` value.
virtual int | compare (int a, int b) const =0
| Compares two vectors.
bool | isVBODirty () const
| true by default
void | setVBODirty (bool dirty)
| true by default
EGLBufferUsage | usage () const
| BU_STATIC_DRAW by default.
void | setUsage (EGLBufferUsage usage)
| BU_STATIC_DRAW by default.
void | updateVBO (bool discard_local_storage=false)

## Protected Attributes

ref< GLBufferObject > | mBufferGPU
EGLBufferUsage | mVBOUsage
bool | mVBODirty

## Detailed Description

The ArrayAbstract class defines an abstract interface to conveniently manipulate data stored in a GLBufferObject.

See also:

- vl::Array
- vl::ArrayFloat1, vl::ArrayFloat2, vl::ArrayFloat3, vl::ArrayFloat4
- vl::ArrayDouble1, vl::ArrayDouble2, vl::ArrayDouble3, vl::ArrayDouble4
- vl::ArrayInt1, vl::ArrayInt2, vl::ArrayInt3, vl::ArrayInt4
- vl::ArrayUInt1, vl::ArrayUInt2, vl::ArrayUInt3, vl::ArrayUInt4
- vl::ArrayByte1, vl::ArrayByte2, vl::ArrayByte3, vl::ArrayByte4
- vl::ArrayUByte1, vl::ArrayUByte2, vl::ArrayUByte3, vl::ArrayUByte4
- vl::ArrayShort1, vl::ArrayShort2, vl::ArrayShort3, vl::ArrayShort4
- vl::ArrayUShort1, vl::ArrayUShort2, vl::ArrayUShort3, vl::ArrayUShort4

Definition at line 60 of file Array.hpp.

## Constructor & Destructor Documentation

vl::ArrayAbstract::ArrayAbstract | ( | ) | `[inline]`

Default constructor.

Definition at line 66 of file Array.hpp.

References vl::BU_STATIC_DRAW, mBufferGPU, mVBODirty, mVBOUsage, and VL_DEBUG_SET_OBJECT_NAME.

vl::ArrayAbstract::ArrayAbstract | ( | const ArrayAbstract & | other ) | `[inline]`

Copies only the local data and not the VBO related fields.

Definition at line 75 of file Array.hpp.

References operator=().

## Member Function Documentation

virtual const char* vl::ArrayAbstract::className | ( | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Definition at line 63 of file Array.hpp.

void vl::ArrayAbstract::operator= | ( | const ArrayAbstract & | other ) | `[inline]`

Copies only the local data and not the VBO related fields.

Definition at line 80 of file Array.hpp.

References bytesUsed(), vl::Buffer::bytesUsed(), gpuBuffer(), ptr(), vl::Buffer::resize(), and setVBODirty().

Referenced by ArrayAbstract().

virtual ref<ArrayAbstract> vl::ArrayAbstract::clone | ( | ) | const`[pure virtual]`

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

const GLBufferObject* vl::ArrayAbstract::gpuBuffer | ( | ) | const`[inline]`

Definition at line 89 of file Array.hpp.

References vl::ref< T >::get(), and mBufferGPU.

Referenced by vl::OpenGLContext::bindVAS(), bytesUsed(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::clear(), clear(), vl::Geometry::deleteVBOs(), operator=(), ptr(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::sizeGPU(), and updateVBO().

GLBufferObject* vl::ArrayAbstract::gpuBuffer | ( | ) | `[inline]`

Definition at line 90 of file Array.hpp.

References vl::ref< T >::get(), and mBufferGPU.

void vl::ArrayAbstract::clear | ( | ) | `[inline]`

Reimplemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Definition at line 92 of file Array.hpp.

References vl::Buffer::clear(), and gpuBuffer().

const unsigned char* vl::ArrayAbstract::ptr | ( | ) | const`[inline]`

Returns the pointer to the first element of the local buffer. Equivalent to gpuBuffer()->ptr()

Definition at line 95 of file Array.hpp.

References gpuBuffer(), and vl::Buffer::ptr().

Referenced by vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::clone(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::operator=(), and operator=().

unsigned char* vl::ArrayAbstract::ptr | ( | ) | `[inline]`

Returns the pointer to the first element of the local buffer. Equivalent to gpuBuffer()->ptr()

Definition at line 98 of file Array.hpp.

References gpuBuffer(), and vl::Buffer::ptr().

virtual size_t vl::ArrayAbstract::bytesUsed | ( | ) | const`[inline, virtual]`

Returns the amount of memory in bytes used by an array. Equivalent to gpuBuffer()->bytesUsed().

Definition at line 101 of file Array.hpp.

References vl::Buffer::bytesUsed(), and gpuBuffer().

Referenced by vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::clone(), operator=(), and vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size().

virtual size_t vl::ArrayAbstract::glSize | ( | ) | const`[pure virtual]`

Returns the number of scalar components for the array, ie 3 for ArrayFloat3, 1 for ArrayUInt1 etc.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::OpenGLContext::bindVAS(), vl::Geometry::setColorArray(), vl::Geometry::setFogCoordArray(), vl::Geometry::setNormalArray(), vl::Geometry::setSecondaryColorArray(), vl::Geometry::setTexCoordArray(), and vl::Geometry::setVertexArray().

virtual int vl::ArrayAbstract::glType | ( | ) | const`[pure virtual]`

Returns the OpenGL type for the array, ie GL_FLOAT for ArrayFloat3, GL_UNSIGNED_INT for ArrayUInt1 etc.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::OpenGLContext::bindVAS(), vl::Geometry::setColorArray(), vl::Geometry::setFogCoordArray(), vl::Geometry::setNormalArray(), vl::Geometry::setSecondaryColorArray(), and vl::Geometry::setTexCoordArray().

virtual size_t vl::ArrayAbstract::size | ( | ) | const`[pure virtual]`

Returns the number of elements of an array.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::Geometry::computeNormals(), and vl::DoubleVertexRemover::removeDoubles().

virtual Sphere vl::ArrayAbstract::computeBoundingSphere | ( | ) | const`[pure virtual]`

Computes the bounding sphere enclosing the vectors contained in the buffer.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

virtual AABB vl::ArrayAbstract::computeBoundingBox | ( | ) | const`[pure virtual]`

Computes the axis aligned bounding box enclosing the vectors contained in the buffer.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

virtual void vl::ArrayAbstract::transform | ( | const mat4 & | m ) | `[pure virtual]`

Transforms the vectors contained in the buffer.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::Geometry::transform().

virtual void vl::ArrayAbstract::normalize | ( | ) | `[pure virtual]`

Normalizes the vectors contained in the buffer.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::Geometry::transform().

virtual vec4 vl::ArrayAbstract::vectorAsVec4 | ( | size_t | vector_index ) | const`[pure virtual]`

Returns a vector from the buffer as a `vec4` value.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::Geometry::computeNormals().

virtual vec3 vl::ArrayAbstract::vectorAsVec3 | ( | size_t | vector_index ) | const`[pure virtual]`

Returns a vector from the buffer as a `vec3` value.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

Referenced by vl::Geometry::computeBounds_Implementation().

virtual int vl::ArrayAbstract::compare | ( | int | a,
|  | int | b
| ) |  | const`[pure virtual]`

Compares two vectors.

Implemented in vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >.

bool vl::ArrayAbstract::isVBODirty | ( | ) | const`[inline]`

true by default

Definition at line 134 of file Array.hpp.

References mVBODirty.

Referenced by updateVBO().

void vl::ArrayAbstract::setVBODirty | ( | bool | dirty ) | `[inline]`

true by default

Definition at line 137 of file Array.hpp.

References mVBODirty.

Referenced by operator=(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), and updateVBO().

EGLBufferUsage vl::ArrayAbstract::usage | ( | ) | const`[inline]`

BU_STATIC_DRAW by default.

Definition at line 140 of file Array.hpp.

References mVBOUsage.

Referenced by setUsage(), and updateVBO().

void vl::ArrayAbstract::setUsage | ( | EGLBufferUsage | usage ) | `[inline]`

BU_STATIC_DRAW by default.

Definition at line 143 of file Array.hpp.

References mVBOUsage, and usage().

void vl::ArrayAbstract::updateVBO | ( | bool | discard_local_storage = `false` ) | `[inline]`

Definition at line 145 of file Array.hpp.

References gpuBuffer(), isVBODirty(), vl::GLBufferObject::setBufferData(), setVBODirty(), and usage().

Referenced by vl::Geometry::updateVBOs().

## Member Data Documentation

ref<GLBufferObject> vl::ArrayAbstract::mBufferGPU`[protected]`

Definition at line 155 of file Array.hpp.

Referenced by ArrayAbstract(), and gpuBuffer().

EGLBufferUsage vl::ArrayAbstract::mVBOUsage`[protected]`

Definition at line 156 of file Array.hpp.

Referenced by ArrayAbstract(), setUsage(), and usage().

bool vl::ArrayAbstract::mVBODirty`[protected]`

Definition at line 157 of file Array.hpp.

Referenced by ArrayAbstract(), isVBODirty(), and setVBODirty().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Array.hpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:32.
Permission is granted to use this page to write and publish articles regarding Visualization Library.