--- a/m3g/m3gcore11/src/m3g_vertexbuffer.c Thu Sep 09 10:13:45 2010 +0300
+++ b/m3g/m3gcore11/src/m3g_vertexbuffer.c Fri Sep 17 17:00:49 2010 +0300
@@ -223,7 +223,12 @@
*/
static M3Gbool m3gGetVertex(const VertexBuffer *buffer, M3Gint idx, M3GVec3 *v)
{
- return m3gGetCoordinates(buffer->vertices, 3, idx, &v->x);
+ M3Gfloat vert[3];
+ M3Gbool res = m3gGetCoordinates(buffer->vertices, 3, idx, vert);
+ if (res == M3G_TRUE)
+ v->x = vert[0]; v->y = vert[1]; v->z = vert[2];
+
+ return res;
}
/*!
@@ -238,7 +243,12 @@
*/
static M3Gbool m3gGetNormal(const VertexBuffer *buffer, M3Gint idx, M3GVec3 *v)
{
- return m3gGetCoordinates(buffer->normals, 3, idx, &v->x);
+ M3Gfloat norm[3];
+ M3Gbool res = m3gGetCoordinates(buffer->normals, 3, idx, norm);
+ if (res == M3G_TRUE)
+ v->x = norm[0]; v->y = norm[1]; v->z = norm[2];
+
+ return res;
}
/*!
@@ -255,8 +265,11 @@
*/
static M3Gbool m3gGetTexCoord(const VertexBuffer *buffer, M3Gint idx, M3Gint unit, M3GVec3 *v)
{
- M3Gbool res;
- res = m3gGetCoordinates(buffer->texCoords[unit], 2, idx, &v->x);
+ M3Gfloat texcoord[2];
+ M3Gbool res = m3gGetCoordinates(buffer->texCoords[unit], 2, idx, texcoord);
+
+ if (res == M3G_TRUE)
+ v->x = texcoord[0]; v->y = texcoord[1];
v->x = m3gMul(v->x, buffer->texCoordScale[unit]);
v->y = m3gMul(v->y, buffer->texCoordScale[unit]);