Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
buffertoattributebinder.cc
Go to the documentation of this file.
1 
19 
20 #include "base/integral_types.h"
21 #include "ion/base/logging.h"
22 #include "ion/math/vector.h"
23 
24 namespace ion {
25 namespace gfxutils {
26 
27 #define DefineComponentFunctionPair(c_type, bo_type, count) \
28  template <> \
29  ION_API gfx::BufferObject::ComponentType \
30  GetComponentType<c_type>() { \
31  return gfx::BufferObject::bo_type; \
32  } \
33  template <> \
34  ION_API size_t GetComponentCount<c_type>() { \
35  return count; \
36  }
37 
38 #define DefineComponentFunctions(c_type, bo_type, suffix) \
39  DefineComponentFunctionPair(c_type, bo_type, 1U); \
40  DefineComponentFunctionPair(math::VectorBase1##suffix, bo_type, 1U); \
41  DefineComponentFunctionPair(math::VectorBase2##suffix, bo_type, 2U); \
42  DefineComponentFunctionPair(math::VectorBase3##suffix, bo_type, 3U); \
43  DefineComponentFunctionPair(math::VectorBase4##suffix, bo_type, 4U);
44 
45 DefineComponentFunctions(char, kByte, i8);
46 DefineComponentFunctions(unsigned char, kUnsignedByte, ui8);
47 DefineComponentFunctions(int16, kShort, i16);
48 DefineComponentFunctions(uint16, kUnsignedShort, ui16);
49 DefineComponentFunctions(int32, kInt, i);
50 DefineComponentFunctions(uint32, kUnsignedInt, ui);
51 DefineComponentFunctions(float, kFloat, f);
52 DefineComponentFunctionPair(math::Matrix2f, kFloatMatrixColumn2, 2U);
53 DefineComponentFunctionPair(math::Matrix3f, kFloatMatrixColumn3, 3U);
54 DefineComponentFunctionPair(math::Matrix4f, kFloatMatrixColumn4, 4U);
55 
56 #undef DefineComponentFunctions
57 #undef DefineComponentFunctionPair
58 
59 } // namespace gfxutils
60 } // namespace ion
Matrix< 4, float > Matrix4f
Definition: matrix.h:371
Matrix< 3, float > Matrix3f
Definition: matrix.h:369
DefineComponentFunctions(char, kByte, i8)
DefineComponentFunctionPair(math::Matrix2f, kFloatMatrixColumn2, 2U)
Copyright 2016 Google Inc.
Matrix< 2, float > Matrix2f
Dimension- and type-specific typedefs.
Definition: matrix.h:367