The following is a simplified version of what I'm trying to do, because I'm sure you don't want to wade through an entire set of structs and function prototypes for a particle system.
float const materials[24][4][4] = {{{...}}};
typedef struct EmitterStruct { float *material[4][4]; } Emitter;
typedef struct ParticleStruct { float material[4][4]; } Particle;
Emitter *myEmitter;
Emitter * createEmitter(float *material[4][4])
{
Emitter * newEmitter;
newEmitter = (Emitter *)malloc(sizeof(Emitter));
newEmitter->material = materal; /* Returns "incompatable types in assignment" */
return newEmitter; /* I also tried newEmitter->material = &material */
}
int main(char *argv, int argc)
{
myEmitter = createEmitter(materials[0]);
}
In essence, as the comment shows, I get a compile error. I've tried this several different ways, even using "float material[4][4]" in the Emitter struct and the signature of createEmitter. However, then later on when I try to copy values into a particle for modificaitons using:
for (i=0; i++; i<4)
{
for (j=0; j++; j<4)
{
particle->material[i][j] = emitter->material[i][j];
}
}
I get another type mismatch when copying, even though everything is declared as type float[4][4]. In essence, I want to get a 4x4 array out of an array of 4x4 arrays, keep note of it in the emitter struct, then copy it into the particle struct. But I only want to actually copy the values one time.