Miam-Player  0.8.0
A nice music player
QtAV::Uniform Class Reference

#include <OpenGLTypes.h>

Public Types

enum  { V = 16, Vec = 1<<V, M = 20, Mat = 1<<M }
 
enum  Type {
  Unknown = 0, Bool = 1<<0, Int = 1<<1, UInt = 1<<2,
  Float = 1<<3, Double = 1<<4, Sampler = 1<<5, BVec2 = Bool|Vec|(2<<(V+1)),
  BVec3 = Bool|Vec|(3<<(V+1)), BVec4 = Bool|Vec|(4<<(V+1)), IVec2 = Int|Vec|(2<<(V+1)), IVec3 = Int|Vec|(3<<(V+1)),
  IVec4 = Int|Vec|(4<<(V+1)), UVec2 = UInt|Vec|(2<<(V+1)), UVec3 = UInt|Vec|(3<<(V+1)), UVec4 = UInt|Vec|(4<<(V+1)),
  Vec2 = Float|Vec|(2<<(V+1)), Vec3 = Float|Vec|(3<<(V+1)), Vec4 = Float|Vec|(4<<(V+1)), Mat2 = Float|Mat|(2<<(M+1)),
  Mat3 = Float|Mat|(3<<(M+1)), Mat4 = Float|Mat|(4<<(M+1)), DMat2 = Double|Mat|(2<<(M+1)), DMat3 = Double|Mat|(3<<(M+1)),
  DMat4 = Double|Mat|(4<<(M+1))
}
 

Public Member Functions

bool isBool () const
 
bool isInt () const
 
bool isUInt () const
 
bool isFloat () const
 
bool isDouble () const
 
bool isVec () const
 
bool isMat () const
 
UniformsetType (Type tp, int count=1)
 setType More...
 
 Uniform (Type tp=Float, int count=1)
 
void set (const float &v, int count=0)
 set Set uniform value in host memory. More...
 
void set (const unsigned &v, int count=0)
 
void set (const int &v, int count=0)
 
void set (const float *v, int count=0)
 
void set (const unsigned *v, int count=0)
 
void set (const int *v, int count=0)
 
void set (const QVariant &v)
 set More...
 
bool setGL ()
 setGL Call glUniformXXX to update uniform values that set by set(const T&, int) and mark dirty false. More...
 
bool operator== (const Uniform &other) const
 
Type type () const
 
int tupleSize () const
 tupleSize 2, 3, 4 for vec2, vec3 and vec4; 2^2, 3^2 and 4^2 for mat2, mat3 and mat4 More...
 
int arraySize () const
 arraySize If uniform is an array, it's array size; otherwise 1 More...
 
template<typename T >
QVector< T > value () const
 Return an array of given type. More...
 
template<typename T >
const T * address () const
 

Public Attributes

bool dirty
 
int location
 
QByteArray name
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Vec 
Mat 

◆ Type

Enumerator
Unknown 
Bool 
Int 
UInt 
Float 
Double 
Sampler 
BVec2 
BVec3 
BVec4 
IVec2 
IVec3 
IVec4 
UVec2 
UVec3 
UVec4 
Vec2 
Vec3 
Vec4 
Mat2 
Mat3 
Mat4 
DMat2 
DMat3 
DMat4 

Constructor & Destructor Documentation

◆ Uniform()

QtAV::Uniform::Uniform ( Type  tp = Float,
int  count = 1 
)

Member Function Documentation

◆ address()

template<typename T >
const T* QtAV::Uniform::address ( ) const
inline

◆ arraySize()

int QtAV::Uniform::arraySize ( ) const
inline

arraySize If uniform is an array, it's array size; otherwise 1

◆ isBool()

bool QtAV::Uniform::isBool ( ) const
inline

◆ isDouble()

bool QtAV::Uniform::isDouble ( ) const
inline

◆ isFloat()

bool QtAV::Uniform::isFloat ( ) const
inline

◆ isInt()

bool QtAV::Uniform::isInt ( ) const
inline

◆ isMat()

bool QtAV::Uniform::isMat ( ) const
inline

◆ isUInt()

bool QtAV::Uniform::isUInt ( ) const
inline

◆ isVec()

bool QtAV::Uniform::isVec ( ) const
inline

◆ operator==()

bool QtAV::Uniform::operator== ( const Uniform other) const
inline

◆ set() [1/7]

void QtAV::Uniform::set ( const float &  v,
int  count = 0 
)

set Set uniform value in host memory.

This will mark dirty if value is changed

Parameters
vthe value
countnumber of element T to set. 0: depending on type and array size, the number is arrySize()*tupleSize(); TODO: Sampler

◆ set() [2/7]

void QtAV::Uniform::set ( const unsigned &  v,
int  count = 0 
)

◆ set() [3/7]

void QtAV::Uniform::set ( const int &  v,
int  count = 0 
)

◆ set() [4/7]

void QtAV::Uniform::set ( const float *  v,
int  count = 0 
)

◆ set() [5/7]

void QtAV::Uniform::set ( const unsigned *  v,
int  count = 0 
)

◆ set() [6/7]

void QtAV::Uniform::set ( const int *  v,
int  count = 0 
)

◆ set() [7/7]

void QtAV::Uniform::set ( const QVariant &  v)

set

Parameters
vthe type T is limited to OpenGL basic types float, int, unsigned(ES3.0) and QVector<T> TODO: Qt types

◆ setGL()

bool QtAV::Uniform::setGL ( )

setGL Call glUniformXXX to update uniform values that set by set(const T&, int) and mark dirty false.

Currently only use OpenGL ES2 supported functions, i.e. uint, double types are not supported.

Returns
false if location is invalid, or if uniform type is not supported by QOpenGLFunctions TODO: Sampler

◆ setType()

Uniform& QtAV::Uniform::setType ( Type  tp,
int  count = 1 
)

setType

Parameters
countarray size, or 1 if not array

◆ tupleSize()

int QtAV::Uniform::tupleSize ( ) const
inline

tupleSize 2, 3, 4 for vec2, vec3 and vec4; 2^2, 3^2 and 4^2 for mat2, mat3 and mat4

◆ type()

Type QtAV::Uniform::type ( ) const
inline

◆ value()

template<typename T >
QVector<T> QtAV::Uniform::value ( ) const
inline

Return an array of given type.

the type T must match type(), for example T is float for Float, VecN, MatN and array of them

Member Data Documentation

◆ dirty

bool QtAV::Uniform::dirty

◆ location

int QtAV::Uniform::location

◆ name

QByteArray QtAV::Uniform::name

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