72
75
VERTEXELEMENT IOpenGLVertexDeclaration::GetUsage (ATTRIB_USAGE_DECL usage)
74
77
VERTEXELEMENT vtxelt;
75
vtxelt.Stream = 0xFF; // invalid stream;
77
for (unsigned int i = 0; _declarations_array.size(); i++)
79
if (_declarations_array[i].Usage == usage)
81
vtxelt = _declarations_array[i];
79
// vtxelt.Stream = 0xFF; // invalid stream;
81
// for (unsigned int i = 0; _declarations_array.size(); i++)
83
// if (_declarations_array[i].Usage == usage)
85
// vtxelt = _declarations_array[i];
89
93
// This is a simple check to comply with the documentation of DrawPrimitiveUP in DirectX
107
int IOpenGLVertexDeclaration::GetStride(int vertex_input_number)
109
NUX_RETURN_VALUE_IF_FALSE(vertex_input_number >= 0, 0);
110
NUX_RETURN_VALUE_IF_FALSE(vertex_input_number < 8, 0);
112
return _stride[vertex_input_number];
116
void IOpenGLVertexDeclaration::SetVertexBuffer(int input_index, ObjectPtr<IOpenGLVertexBuffer> vertex_buffer)
118
NUX_RETURN_IF_FALSE(input_index >= 0);
119
NUX_RETURN_IF_FALSE(input_index < 8);
121
vertex_buffer_array[input_index] = vertex_buffer;
124
ObjectPtr<IOpenGLVertexBuffer> IOpenGLVertexDeclaration::GetVertexBuffer(int input_index)
126
NUX_RETURN_VALUE_IF_FALSE(input_index >= 0, ObjectPtr<IOpenGLVertexBuffer>(NULL));
127
NUX_RETURN_VALUE_IF_FALSE(input_index < 8, ObjectPtr<IOpenGLVertexBuffer>(NULL));
129
return vertex_buffer_array[input_index];
132
void IOpenGLVertexDeclaration::SetVertexShaderAttributeLocation(int input_index, int shader_attribute_location)
134
NUX_RETURN_IF_FALSE(input_index >= 0);
135
NUX_RETURN_IF_FALSE(input_index < 8);
137
shader_attribute_location_array[input_index] = shader_attribute_location;
140
int IOpenGLVertexDeclaration::GetVertexShaderAttributeLocation(int input_index)
142
NUX_RETURN_VALUE_IF_FALSE(input_index >= 0, -1);
143
NUX_RETURN_VALUE_IF_FALSE(input_index < 8, -1);
145
return shader_attribute_location_array[input_index];