Array behaving as a variable

70 Views Asked by At

Have encountered an interesting and frustrating problem with using the Vector3 as an array.

Ogre::Vector3* vertices;
...
vertices = new Ogre::Vector3[vertex_data->vertexCount];
...
for (size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
{
    ...
    vertices[current_offset + j] = (orient * (pt * scale)) + position;
}
...
vbuf->writeData(0, vertex_count, vertices, true);

In the final line, and above; the 'vertices' variable is a simple Vector3 (x,y,z) rather than an array of such.

The code compiles fine but obviously there is only 1 triangle rendered. The iterator runs as expected, and j iterates, in this case vertexCount is 72.

Vector3 is defined as:

typedef Vector<3, Real> Vector3;

Has anyone run into a similar problem? Any help would be much appreciated.

0

There are 0 best solutions below