equal
deleted
inserted
replaced
221 * \retval M3G_TRUE get ok |
221 * \retval M3G_TRUE get ok |
222 * \retval M3G_FALSE no such vertex |
222 * \retval M3G_FALSE no such vertex |
223 */ |
223 */ |
224 static M3Gbool m3gGetVertex(const VertexBuffer *buffer, M3Gint idx, M3GVec3 *v) |
224 static M3Gbool m3gGetVertex(const VertexBuffer *buffer, M3Gint idx, M3GVec3 *v) |
225 { |
225 { |
226 return m3gGetCoordinates(buffer->vertices, 3, idx, &v->x); |
226 M3Gfloat vert[3]; |
|
227 M3Gbool res = m3gGetCoordinates(buffer->vertices, 3, idx, vert); |
|
228 if (res == M3G_TRUE) |
|
229 v->x = vert[0]; v->y = vert[1]; v->z = vert[2]; |
|
230 |
|
231 return res; |
227 } |
232 } |
228 |
233 |
229 /*! |
234 /*! |
230 * \internal |
235 * \internal |
231 * \brief Gets a normal coordinate. |
236 * \brief Gets a normal coordinate. |
236 * \retval M3G_TRUE get ok |
241 * \retval M3G_TRUE get ok |
237 * \retval M3G_FALSE no such vertex |
242 * \retval M3G_FALSE no such vertex |
238 */ |
243 */ |
239 static M3Gbool m3gGetNormal(const VertexBuffer *buffer, M3Gint idx, M3GVec3 *v) |
244 static M3Gbool m3gGetNormal(const VertexBuffer *buffer, M3Gint idx, M3GVec3 *v) |
240 { |
245 { |
241 return m3gGetCoordinates(buffer->normals, 3, idx, &v->x); |
246 M3Gfloat norm[3]; |
|
247 M3Gbool res = m3gGetCoordinates(buffer->normals, 3, idx, norm); |
|
248 if (res == M3G_TRUE) |
|
249 v->x = norm[0]; v->y = norm[1]; v->z = norm[2]; |
|
250 |
|
251 return res; |
242 } |
252 } |
243 |
253 |
244 /*! |
254 /*! |
245 * \internal |
255 * \internal |
246 * \brief Gets a texture coordinate, used in pick routines. |
256 * \brief Gets a texture coordinate, used in pick routines. |
253 * \retval M3G_TRUE get ok |
263 * \retval M3G_TRUE get ok |
254 * \retval M3G_FALSE no such vertex |
264 * \retval M3G_FALSE no such vertex |
255 */ |
265 */ |
256 static M3Gbool m3gGetTexCoord(const VertexBuffer *buffer, M3Gint idx, M3Gint unit, M3GVec3 *v) |
266 static M3Gbool m3gGetTexCoord(const VertexBuffer *buffer, M3Gint idx, M3Gint unit, M3GVec3 *v) |
257 { |
267 { |
258 M3Gbool res; |
268 M3Gfloat texcoord[2]; |
259 res = m3gGetCoordinates(buffer->texCoords[unit], 2, idx, &v->x); |
269 M3Gbool res = m3gGetCoordinates(buffer->texCoords[unit], 2, idx, texcoord); |
|
270 |
|
271 if (res == M3G_TRUE) |
|
272 v->x = texcoord[0]; v->y = texcoord[1]; |
260 |
273 |
261 v->x = m3gMul(v->x, buffer->texCoordScale[unit]); |
274 v->x = m3gMul(v->x, buffer->texCoordScale[unit]); |
262 v->y = m3gMul(v->y, buffer->texCoordScale[unit]); |
275 v->y = m3gMul(v->y, buffer->texCoordScale[unit]); |
263 |
276 |
264 v->x = m3gAdd(v->x, buffer->texCoordBias[unit][0]); |
277 v->x = m3gAdd(v->x, buffer->texCoordBias[unit][0]); |