Example #1
0
 const cst::gl_constant_base get(std::uint32_t value) {
   switch (value) {
     case gl_float::value:
       return gl_float();
     case gl_float_vec2::value:
       return gl_float_vec2();
     case gl_float_vec3::value:
       return gl_float_vec3();
     case gl_float_vec4::value:
       return gl_float_vec4();
     case gl_int::value:
       return gl_int();
     case gl_int_vec2::value:
       return gl_int_vec2();
     case gl_int_vec3::value:
       return gl_int_vec3();
     case gl_int_vec4::value:
       return gl_int_vec4();
     case gl_unsigned_int::value:
       return gl_unsigned_int();
     case gl_unsigned_int_vec2::value:
       return gl_unsigned_int_vec2();
     case gl_unsigned_int_vec3::value:
       return gl_unsigned_int_vec3();
     case gl_unsigned_int_vec4::value:
       return gl_unsigned_int_vec4();
     case gl_float_mat2::value:
       return gl_float_mat2();
     case gl_float_mat3::value:
       return gl_float_mat3();
     case gl_float_mat4::value:
       return gl_float_mat4();
     case gl_float_mat2x3::value:
       return gl_float_mat2x3();
     case gl_float_mat2x4::value:
       return gl_float_mat2x4();
     case gl_float_mat3x2::value:
       return gl_float_mat3x2();
     case gl_float_mat3x4::value:
       return gl_float_mat3x4();
     case gl_float_mat4x2::value:
       return gl_float_mat4x2();
     case gl_float_mat4x3::value:
       return gl_float_mat4x3();
     default:
       return cst::invalid_constant();
   }
 }
Example #2
0
 const cst::gl_constant_base get(std::string type_name) {
   if (type_name == static_cast< std::string const& >(gl_float::get())) {
     return gl_float();
   } else if (type_name == static_cast< std::string const& >(gl_float_vec2::get())) {
     return gl_float_vec2();
   } else if (type_name == "vec2") {
     return gl_float_vec2();
   } else if (type_name == static_cast< std::string const& >(gl_float_vec3::get())) {
     return gl_float_vec3();
   } else if (type_name == "vec3") {
     return gl_float_vec3();
   } else if (type_name == static_cast< std::string const& >(gl_float_vec4::get())) {
     return gl_float_vec4();
   } else if (type_name == "vec4") {
     return gl_float_vec4();
   } else if (type_name == static_cast< std::string const& >(gl_int::get())) {
     return gl_int();
   } else if (type_name == static_cast< std::string const& >(gl_int_vec2::get())) {
     return gl_int_vec2();
   } else if (type_name == "ivec2") {
     return gl_int_vec2();
   } else if (type_name == static_cast< std::string const& >(gl_int_vec3::get())) {
     return gl_int_vec3();
   } else if (type_name == "ivec3") {
     return gl_int_vec2();
   } else if (type_name == static_cast< std::string const& >(gl_int_vec4::get())) {
     return gl_int_vec4();
   } else if (type_name == "ivec4") {
     return gl_int_vec2();
   } else if (type_name == static_cast< std::string const& >(gl_unsigned_int::get())) {
     return gl_unsigned_int();
   } else if (type_name == static_cast< std::string const& >(gl_unsigned_int_vec2::get())) {
     return gl_unsigned_int_vec2();
   } else if (type_name == "uvec2") {
     return gl_int_vec2();
   } else if (type_name == static_cast< std::string const& >(gl_unsigned_int_vec3::get())) {
     return gl_unsigned_int_vec3();
   } else if (type_name == "uvec3") {
     return gl_int_vec2();
   } else if (type_name == static_cast< std::string const& >(gl_unsigned_int_vec4::get())) {
     return gl_unsigned_int_vec4();
   } else if (type_name == "uvec4") {
     return gl_int_vec2();
   } else {
     return cst::invalid_constant();
   }
 }