| 113 | } |
| 114 | |
| 115 | float VertexAttributeDataTypeToFloat(const dmGraphics::VertexAttribute::DataType data_type, const uint8_t* value_ptr) |
| 116 | { |
| 117 | switch (data_type) |
| 118 | { |
| 119 | case dmGraphics::VertexAttribute::TYPE_BYTE: |
| 120 | { |
| 121 | int8_t typed_value; |
| 122 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 123 | return (float) typed_value; |
| 124 | } |
| 125 | case dmGraphics::VertexAttribute::TYPE_UNSIGNED_BYTE: |
| 126 | { |
| 127 | uint8_t typed_value; |
| 128 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 129 | return (float) typed_value; |
| 130 | } |
| 131 | case dmGraphics::VertexAttribute::TYPE_SHORT: |
| 132 | { |
| 133 | int16_t typed_value; |
| 134 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 135 | return (float) typed_value; |
| 136 | } |
| 137 | case dmGraphics::VertexAttribute::TYPE_UNSIGNED_SHORT: |
| 138 | { |
| 139 | uint16_t typed_value; |
| 140 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 141 | return (float) typed_value; |
| 142 | } |
| 143 | case dmGraphics::VertexAttribute::TYPE_INT: |
| 144 | { |
| 145 | int32_t typed_value; |
| 146 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 147 | return (float) typed_value; |
| 148 | } |
| 149 | case dmGraphics::VertexAttribute::TYPE_UNSIGNED_INT: |
| 150 | { |
| 151 | uint32_t typed_value; |
| 152 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 153 | return (float) typed_value; |
| 154 | } |
| 155 | case dmGraphics::VertexAttribute::TYPE_FLOAT: |
| 156 | { |
| 157 | float typed_value; |
| 158 | memcpy(&typed_value, value_ptr, sizeof(typed_value)); |
| 159 | return typed_value; |
| 160 | } |
| 161 | default:break; |
| 162 | } |
| 163 | return 0; |
| 164 | } |
| 165 | |
| 166 | static inline bool VectorTypeIsMatrix(VertexAttribute::VectorType vector_type) |
| 167 | { |
no outgoing calls
no test coverage detected