| 29 | } |
| 30 | |
| 31 | void VertexFormat::Bind(VASemantic semantic, DFType type, uint32_t unit) |
| 32 | { |
| 33 | // Validate the inputs. |
| 34 | LogAssert(0 <= mNumAttributes && mNumAttributes < VAConstant::MAX_ATTRIBUTES, "Exceeded maximum attributes."); |
| 35 | if (semantic == VASemantic::COLOR) |
| 36 | { |
| 37 | LogAssert(unit < VAConstant::MAX_COLOR_UNITS, "Invalid color unit."); |
| 38 | } |
| 39 | else if (semantic == VASemantic::TEXCOORD) |
| 40 | { |
| 41 | LogAssert(unit < VAConstant::MAX_TCOORD_UNITS, "Invalid texture unit."); |
| 42 | } |
| 43 | else |
| 44 | { |
| 45 | LogAssert(unit == 0, "Invalid semantic unit."); |
| 46 | } |
| 47 | |
| 48 | // Accept the attribute. |
| 49 | Attribute& attribute = mAttributes[mNumAttributes]; |
| 50 | attribute.semantic = semantic; |
| 51 | attribute.type = type; |
| 52 | attribute.unit = unit; |
| 53 | attribute.offset = mVertexSize; |
| 54 | ++mNumAttributes; |
| 55 | |
| 56 | // Advance the offset. |
| 57 | mVertexSize += DataFormat::GetNumBytesPerStruct(type); |
| 58 | } |
| 59 | |
| 60 | void VertexFormat::GetAttribute(int32_t i, VASemantic& semantic, DFType& type, |
| 61 | uint32_t& unit, uint32_t& offset) const |
no outgoing calls
no test coverage detected