Beatmup
Beatmup::GL::VariablesBundle::MatrixParameter Class Reference

Public Types

enum  Type { INT , FLOAT , UNDEFINED }
 

Public Member Functions

 MatrixParameter ()
 
 ~MatrixParameter ()
 
MatrixParameteroperator= (MatrixParameter &&)
 
void configure (Type type, unsigned short int width, unsigned short int height=1, unsigned int count=1)
 
template<typename T >
T * getData (int index=0) const
 
int getCount () const
 
int getWidth () const
 
int getHeight () const
 
Type getType () const
 

Private Attributes

void * data
 
unsigned short int width
 
unsigned short int height
 
unsigned int count
 
Type type
 

Detailed Description

Definition at line 36 of file variables_bundle.h.

Member Enumeration Documentation

◆ Type

Constructor & Destructor Documentation

◆ MatrixParameter()

VariablesBundle::MatrixParameter::MatrixParameter ( )

◆ ~MatrixParameter()

VariablesBundle::MatrixParameter::~MatrixParameter ( )

Definition at line 58 of file variables_bundle.cpp.

58  {
59  free(data);
60 }

Member Function Documentation

◆ operator=()

VariablesBundle::MatrixParameter & VariablesBundle::MatrixParameter::operator= ( VariablesBundle::MatrixParameter &&  src)

Definition at line 26 of file variables_bundle.cpp.

26  {
27  data = src.data;
28  type = src.type;
29  width = src.width;
30  height = src.height;
31  count = src.count;
32  src.data = NULL;
33  return *this;
34 }
return(jlong) new Beatmup jlong jstring src

◆ configure()

void VariablesBundle::MatrixParameter::configure ( Type  type,
unsigned short int  width,
unsigned short int  height = 1,
unsigned int  count = 1 
)

Definition at line 40 of file variables_bundle.cpp.

40  {
41  free(data);
42  this->width = width;
43  this->height = height;
44  this->count = count;
45  this->type = type;
46  switch (type) {
47  case MatrixParameter::Type::INT:
48  data = malloc(sizeof(GLint) * width*height*count);
49  break;
50  case MatrixParameter::Type::FLOAT:
51  data = malloc(sizeof(GLfloat) * width*height*count);
52  break;
53  default:
54  Insanity::insanity("Invalid data type when construction matrix parameter");
55  }
56 }
static void insanity(const char *message)
Definition: exception.h:136

◆ getData()

template<typename T >
T* Beatmup::GL::VariablesBundle::MatrixParameter::getData ( int  index = 0) const
inline

Definition at line 56 of file variables_bundle.h.

56  {
57  return (T*)data + width * height * index;
58  }
jlong jint index

◆ getCount()

int Beatmup::GL::VariablesBundle::MatrixParameter::getCount ( ) const
inline

Definition at line 60 of file variables_bundle.h.

60 { return count; }

◆ getWidth()

int Beatmup::GL::VariablesBundle::MatrixParameter::getWidth ( ) const
inline

Definition at line 61 of file variables_bundle.h.

61 { return width; }

◆ getHeight()

int Beatmup::GL::VariablesBundle::MatrixParameter::getHeight ( ) const
inline

Definition at line 62 of file variables_bundle.h.

62 { return height; }

◆ getType()

Type Beatmup::GL::VariablesBundle::MatrixParameter::getType ( ) const
inline

Definition at line 63 of file variables_bundle.h.

63 { return type; }

Member Data Documentation

◆ data

void* Beatmup::GL::VariablesBundle::MatrixParameter::data
private

Definition at line 44 of file variables_bundle.h.

◆ width

unsigned short int Beatmup::GL::VariablesBundle::MatrixParameter::width
private

Definition at line 45 of file variables_bundle.h.

◆ height

unsigned short int Beatmup::GL::VariablesBundle::MatrixParameter::height
private

Definition at line 45 of file variables_bundle.h.

◆ count

unsigned int Beatmup::GL::VariablesBundle::MatrixParameter::count
private

Definition at line 46 of file variables_bundle.h.

◆ type

Type Beatmup::GL::VariablesBundle::MatrixParameter::type
private

Definition at line 47 of file variables_bundle.h.


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