J
Jon Bell
would someone please be so kind as to explain:
struct Vertex
{
Vertex(){}
Vertex(float x, float y, float z,
float nx, float ny, float nz, float u, float v)
{
_x = x; _y = y; _z = z;
_nx = nx; _ny = ny; _nz = nz;
_u = u; _v = v;
}
float _x, _y, _z, _nx, _ny, _nz, _u, _v;
static const DWORD FVF;
}; [snip]
is vertex(){} a function?
It's a constructor that takes no arguments/parameters, and does nothing.
It allows you to declare a variable of type Vertex without specifying
values for the data:
Vertex thisVertex;
in which case all the data members are default-initialized. In this case,
the data members are all floats, so they are not initialized at all and
contain whatever bit-patterns happened to be in those memory locations.
If you define no constructors at all, the compiler generates such a
default constructor for you automatically. However, if you define any
constructors of your own (as is the case here), you must define the
default constructor, too, if you want one.