internal representation of struct
lenochware
lenochware at gmail.com
Fri Mar 18 09:34:19 PDT 2011
Hello, I have array of type vertex_t vertices[] where vertex_t is:
struct vertex_t {
float[3] xyz;
ubyte[4] color;
...
}
Now, I would like use instead of array "float[3] xyz" "vec3f xyz", where vec3f is:
struct vec3f {
float x, y, z;
...some functions...
}
where I have defined some operators for adding and multipliing vectors etc.
Is it possible? "xyz" must be exactly 3 floats in memory because I am sending
vertices array pointer into OpenGL rendering pipeline.
Will be struct vec3f represented just like 3 floats - aren't here some
additional metadata - because structure contains also some functions?
My additional question: What about effectivity? I would like keep struct
vertex_t as simple as possible, because I need do calculations fast. Will have
replacing float array to structure some impact on speed?
Thank you.
More information about the Digitalmars-d
mailing list