Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GLUP::VectorStateVariable Class Reference

A GLUP state variable that contains a vector. More...

#include <geogram_gfx/GLUP/GLUP_context.h>

Inheritance diagram for GLUP::VectorStateVariable:
GLUP::FloatsArrayStateVariable GLUP::StateVariableBase

Public Member Functions

 VectorStateVariable ()
 VectorStateVariable default constructor.
 
 VectorStateVariable (Context *context, const char *name, index_t dimension)
 VectorStateVariable constructor. More...
 
void initialize (Context *context, const char *name, index_t dimension)
 Initializes a VectorStateVariable. More...
 
index_t dimension () const
 Gets the dimension. More...
 
void get (GLUPfloat *x) const
 Gets the value. More...
 
void set (const GLUPfloat *x)
 Sets the value. More...
 
void clear ()
 clears the vector to its default value. More...
 
- Public Member Functions inherited from GLUP::FloatsArrayStateVariable
 FloatsArrayStateVariable ()
 FloatsArrayStateVariable default constructor.
 
 FloatsArrayStateVariable (Context *context, const char *name)
 FloatsArrayStateVariable constructor. More...
 
const GLUPfloat * get_pointer () const
 Gets a pointer to the variable. More...
 
GLUPfloat * get_pointer ()
 Gets a modifiable pointer to the variable. More...
 
- Public Member Functions inherited from GLUP::StateVariableBase
 StateVariableBase ()
 StateVariableBase default constructor.
 
 StateVariableBase (Context *context, const char *name)
 StateVariableBase constructor. More...
 
void initialize (Context *context, const char *name)
 Initializes a StateVariableBase. More...
 
const std::string & name () const
 Gets the name of this StateVariableBase. More...
 

Protected Attributes

index_t dimension_
 
- Protected Attributes inherited from GLUP::StateVariableBase
Memory::pointer address_
 
Contextcontext_
 
std::string name_
 

Additional Inherited Members

- Protected Member Functions inherited from GLUP::StateVariableBase
Memory::pointer address () const
 Gets the address of the StateVariableBase. More...
 
void flag_uniform_buffer_as_dirty ()
 Indicates that the variables in the context need to be sent to OpenGL.
 

Detailed Description

A GLUP state variable that contains a vector.

This corresponds to vec2, vec3, vec4 GLSL types.

Definition at line 892 of file GLUP_context.h.

Constructor & Destructor Documentation

◆ VectorStateVariable()

GLUP::VectorStateVariable::VectorStateVariable ( Context context,
const char *  name,
index_t  dimension 
)
inline

VectorStateVariable constructor.

Parameters
[in]contexta pointer to the GLUP Context
[in]namethe name of the variable, without "GLUPStateBlock." (it is prepended automatically)
[in]dimension2 for vec2, 3 for vec3, 4 for vec4

Definition at line 908 of file GLUP_context.h.

Member Function Documentation

◆ clear()

void GLUP::VectorStateVariable::clear ( )
inline

clears the vector to its default value.

For vec2, default value is (0.0, 0.0), for vec3, it is (0.0, 0.0, 0.0) and for vec4 it is (0.0, 0.0, 0.0, 1.0)

Definition at line 960 of file GLUP_context.h.

◆ dimension()

index_t GLUP::VectorStateVariable::dimension ( ) const
inline

Gets the dimension.

Returns
the number of components of this vector

Definition at line 931 of file GLUP_context.h.

◆ get()

void GLUP::VectorStateVariable::get ( GLUPfloat *  x) const
inline

Gets the value.

Parameters
[out]xa pointer to an array of dimension() GLfloats, where to store the value

Definition at line 940 of file GLUP_context.h.

◆ initialize()

void GLUP::VectorStateVariable::initialize ( Context context,
const char *  name,
index_t  dimension 
)
inline

Initializes a VectorStateVariable.

Parameters
[in]contexta pointer to the GLUP Context
[in]namethe name of the variable, without "GLUPStateBlock." (it is prepended automatically)
[in]dimension2 for vec2, 3 for vec3, 4 for vec4

Definition at line 921 of file GLUP_context.h.

◆ set()

void GLUP::VectorStateVariable::set ( const GLUPfloat *  x)
inline

Sets the value.

Parameters
[in]xa const pointer to an array of dimension() GLfloats that contains the new value

Definition at line 949 of file GLUP_context.h.


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