I have this.
Code:
class VertexBuffer
{
private:
core::vector3df vertexData; // <--- This is it.
}
template <class T>
class vector3d
{
public:
T x, y, z;
vector3d() : x(0), y(0),z(0) {}
vector3d(T x, T y, T z)
{
this->x = x;
this->y = y;
this->z = z;
}
vector3d(vector3d& copy)
{
this->x = copy.x;
this->y = copy.y;
this->z = copy.z;
}
void set(T nx, T ny, T nz)
{
this->x = nx;
this->y = ny;
this->z = nz;
}
.
.
.
.
.
.
.
};
typedef vector3d<float> vector3df;
}
By the way, I'm not accessing it at random. I'll just store all the vertices and pass it into the buffer and draw everything stored on the vector3d.
Do you think creating a vector3d class that can insert just like the <vector.h> is good? How can I do that? Can you give me some examples? I didn't experience this problem when I was creating 2D game because most of the variables I created there are all static. What I'm creating right now is an engine meaning I don't know how many vertices the developer will create. Did I make any sense? BTW, I'm sorry for my noobness.