1// 2// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6// VertexAttribute.inl: Inline vertex attribute methods 7// 8 9namespace gl 10{ 11 12inline VertexAttribCurrentValueData::VertexAttribCurrentValueData() 13 : Type(GL_FLOAT) 14{ 15 FloatValues[0] = 0.0f; 16 FloatValues[1] = 0.0f; 17 FloatValues[2] = 0.0f; 18 FloatValues[3] = 1.0f; 19} 20 21inline void VertexAttribCurrentValueData::setFloatValues(const GLfloat floatValues[4]) 22{ 23 for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++) 24 { 25 FloatValues[valueIndex] = floatValues[valueIndex]; 26 } 27 Type = GL_FLOAT; 28} 29 30inline void VertexAttribCurrentValueData::setIntValues(const GLint intValues[4]) 31{ 32 for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++) 33 { 34 IntValues[valueIndex] = intValues[valueIndex]; 35 } 36 Type = GL_INT; 37} 38 39inline void VertexAttribCurrentValueData::setUnsignedIntValues(const GLuint unsignedIntValues[4]) 40{ 41 for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++) 42 { 43 UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex]; 44 } 45 Type = GL_UNSIGNED_INT; 46} 47 48inline bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b) 49{ 50 return (a.Type == b.Type && memcmp(a.FloatValues, b.FloatValues, sizeof(float) * 4) == 0); 51} 52 53inline bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b) 54{ 55 return !(a == b); 56} 57 58} // namespace gl 59