# Visualization Library

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

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

Public Types | Public Member Functions | Static Public Attributes

# vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type > Class Template Reference

The Array class is a template array used to conveniently manipulate data stored in a BufferObject. More...

`#include <Array.hpp>`

Inheritance diagram for vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >:

List of all members.

## Public Types

typedef T_Scalar | scalar_type
typedef T_VectorType | vector_type

## Public Member Functions

virtual size_t | glSize () const
| Returns the number of scalar components for the array, ie 3 for ArrayFloat3, 1 for ArrayUInt1 etc.
virtual GLenum | glType () const
| Returns the OpenGL type for the array, ie GL_FLOAT for ArrayFloat3, GL_UNSIGNED_INT for ArrayUInt1 etc.
virtual size_t | bytesPerVector () const
void | clear ()
void | resize (size_t dim)
size_t | size () const
| Returns the number of elements of an array.
size_t | sizeBufferObject () const
size_t | scalarCount () const
size_t | scalarCountBufferObject () const
const T_VectorType * | begin () const
T_VectorType * | begin ()
const T_VectorType * | end () const
T_VectorType * | end ()
T_VectorType & | at (size_t i)
const T_VectorType & | at (size_t i) const
T_VectorType & | operator[] (size_t i)
const T_VectorType & | operator[] (size_t i) const
virtual ref< ArrayAbstract > | createArray () const
virtual ref< ArrayAbstract > | clone () const
Sphere | computeBoundingSphere () const
| Computes the bounding sphere enclosing the vectors contained in the buffer.
AABB | computeBoundingBox () const
| Computes the axis aligned bounding box enclosing the vectors contained in the buffer.
void | transform (const mat4 &m)
| Transforms the vectors contained in the buffer.
void | normalize ()
| Normalizes the vectors contained in the buffer.
vec4 | getAsVec4 (size_t vector_index) const
| Returns a vector from the buffer as a `vec4` value.
vec3 | getAsVec3 (size_t vector_index) const
| Returns a vector from the buffer as a `vec3` value.
vec2 | getAsVec2 (size_t vector_index) const
| Returns a vector from the buffer as a `vec2` value.
int | compare (int a, int b) const
| Compares two vectors.
void | initFrom (const std::vector< T_VectorType > &vector)

## Static Public Attributes

static const size_t | gl_size = T_GL_Size
static const GLenum | gl_type = T_GL_Type

## Detailed Description

### template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>
class vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >

The Array class is a template array used to conveniently manipulate data stored in a BufferObject.

See also:

- ArrayAbstract
- 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
- vl::ArrayHFloat1, vl::ArrayHFloat2, vl::ArrayHFloat3, vl::ArrayHFloat4
- vl::ArrayFixed1, vl::ArrayFixed2, vl::ArrayFixed3, vl::ArrayFixed4
- vl::ArrayInt_2_10_10_10_REV1, ArrayInt_2_10_10_10_REV2, ArrayInt_2_10_10_10_REV3, ArrayInt_2_10_10_10_REV4
- vl::ArrayUInt_2_10_10_10_REV1, ArrayUInt_2_10_10_10_REV2, ArrayUInt_2_10_10_10_REV3, ArrayUInt_2_10_10_10_REV4

Definition at line 180 of file Array.hpp.

## Member Typedef Documentation

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

typedef T_Scalar vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::scalar_type

Definition at line 185 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

typedef T_VectorType vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::vector_type

Definition at line 186 of file Array.hpp.

## Member Function Documentation

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

virtual size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::glSize | ( | ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 190 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

virtual GLenum vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::glType | ( | ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 192 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

virtual size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::bytesPerVector | ( | ) | const`[inline, virtual]`

Definition at line 194 of file Array.hpp.

Referenced by vl::Array< bvec2, GLbyte, 2, GL_BYTE >::resize(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::size(), and vl::Array< bvec2, GLbyte, 2, GL_BYTE >::sizeBufferObject().

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

void vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::clear | ( | ) | `[inline]`

Reimplemented from vl::ArrayAbstract.

Definition at line 198 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

void vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize | ( | size_t | dim ) | `[inline]`

Definition at line 200 of file Array.hpp.

Referenced by vl::Array< bvec2, GLbyte, 2, GL_BYTE >::clear(), vl::Geometry::fixTriangleWinding(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::initFrom(), vl::loadMD2(), and vl::Geometry::mergeDrawCallsWithTriangles().

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size | ( | ) | const`[inline, virtual]`

Returns the number of elements of an array.

Implements vl::ArrayAbstract.

Definition at line 202 of file Array.hpp.

Referenced by vl::Array< bvec2, GLbyte, 2, GL_BYTE >::at(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::clone(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::computeBoundingBox(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::computeBoundingSphere(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::end(), vl::Geometry::fixTriangleWinding(), vl::Geometry::flipNormals(), vl::loadMD2(), vl::Geometry::mergeDrawCallsWithTriangles(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::normalize(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::scalarCount(), vl::Geometry::sortVertices(), and vl::Array< bvec2, GLbyte, 2, GL_BYTE >::transform().

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::sizeBufferObject | ( | ) | const`[inline]`

Definition at line 204 of file Array.hpp.

Referenced by vl::Array< bvec2, GLbyte, 2, GL_BYTE >::scalarCountBufferObject().

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::scalarCount | ( | ) | const`[inline]`

Definition at line 206 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::scalarCountBufferObject | ( | ) | const`[inline]`

Definition at line 208 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

const T_VectorType* vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin | ( | ) | const`[inline]`

Definition at line 212 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

T_VectorType* vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin | ( | ) | `[inline]`

Definition at line 214 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

const T_VectorType* vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end | ( | ) | const`[inline]`

Definition at line 216 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

T_VectorType* vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end | ( | ) | `[inline]`

Definition at line 218 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

T_VectorType& vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at | ( | size_t | i ) | `[inline]`

Definition at line 222 of file Array.hpp.

Referenced by vl::Array< bvec2, GLbyte, 2, GL_BYTE >::compare(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::computeBoundingBox(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::computeBoundingSphere(), vl::Geometry::flipNormals(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::getAsVec2(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::getAsVec3(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::getAsVec4(), vl::loadMD2(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::normalize(), vl::Array< bvec2, GLbyte, 2, GL_BYTE >::operator[](), vl::Geometry::sortVertices(), and vl::Array< bvec2, GLbyte, 2, GL_BYTE >::transform().

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

const T_VectorType& vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at | ( | size_t | i ) | const`[inline]`

Definition at line 224 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

T_VectorType& vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::operator[] | ( | size_t | i ) | `[inline]`

Definition at line 226 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

const T_VectorType& vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::operator[] | ( | size_t | i ) | const`[inline]`

Definition at line 228 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

virtual ref<ArrayAbstract> vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::createArray | ( | ) | const`[inline, virtual]`

Definition at line 232 of file Array.hpp.

Referenced by vl::Array< bvec2, GLbyte, 2, GL_BYTE >::clone().

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

virtual ref<ArrayAbstract> vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::clone | ( | ) | const`[inline, virtual]`

Implements vl::ArrayAbstract.

Definition at line 234 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

Sphere vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::computeBoundingSphere | ( | ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 247 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

AABB vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::computeBoundingBox | ( | ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 274 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

void vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::transform | ( | const mat4 & | m ) | `[inline, virtual]`

Transforms the vectors contained in the buffer.

Implements vl::ArrayAbstract.

Definition at line 289 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

void vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::normalize | ( | ) | `[inline, virtual]`

Normalizes the vectors contained in the buffer.

Implements vl::ArrayAbstract.

Definition at line 306 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

vec4 vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::getAsVec4 | ( | size_t | vector_index ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 323 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

vec3 vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::getAsVec3 | ( | size_t | vector_index ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 332 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

vec2 vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::getAsVec2 | ( | size_t | vector_index ) | const`[inline, virtual]`

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

Implements vl::ArrayAbstract.

Definition at line 342 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

int vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::compare | ( | int | a,
|  | int | b
| ) |  | const`[inline, virtual]`

Compares two vectors.

Implements vl::ArrayAbstract.

Definition at line 352 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

void vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::initFrom | ( | const std::vector< T_VectorType > & | vector ) | `[inline]`

Definition at line 362 of file Array.hpp.

## Member Data Documentation

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

const size_t vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::gl_size = T_GL_Size`[static]`

Definition at line 187 of file Array.hpp.

template<typename T_VectorType, typename T_Scalar, size_t T_GL_Size, GLenum T_GL_Type>

const GLenum vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::gl_type = T_GL_Type`[static]`

Definition at line 188 of file Array.hpp.

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

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

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:24.
Permission is granted to use this page to write and publish articles regarding Visualization Library.