So, I'm not sure if I understand, but I suppose this means if you do more than 64 calls to vector( ... ) something bad happens? Or is it supposed to just cycle back through and re-use them?
Could I do something like this, alternatively?
VECTOR* tmpVec = { x=0; y=0; z=0; }
function vector_tmp(var x,var y,var z)
{
tmpVec.x = x;
tmpVec.y = y;
tmpVec.z = z;
return tmpVec;
}
function camera_follow(ENTITY* ent)
{
while(1)
{
vec_set(camera.x,vector_tmp(-150,10,50)); // camera position relative to the player
vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
vec_add(camera.x,ent.x); // add player position
vec_set(camera.pan,vector_tmp(ent.pan,-10,0)); // look in player direction, slighty down
wait(1);
}
}
Or this...
function camera_follow(ENTITY* ent)
{
VECTOR* camOffset = {x=-150; y=10; z=50;}
VECTOR* camAng = {z=ent.pan; y=-10; z=0;}
while(1)
{
vec_set(camera.x,camOffset); // camera position relative to the player
vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
vec_add(camera.x,ent.x); // add player position
vec_set(camera.pan,camAng); // look in player direction, slighty down
wait(1);
}
}
(Also, by the way, does this code make sense? 'VECTOR t = vector(1,2,3); and then VECTOR* r = &t;' I'm wondering if I can use & like that there.)
I guess my biggest concern though is that although I am glad that I haven't seen any more blue screen crashes I am still noticing that the memory usage is growing in my program. It grows more slowly, but every time I move my mouse or press a key the memory usage goes up a little more. (Note, I am also moving entities or rotating bones when these things happen.) It starts out at around 42 meg and increases. The highest I've let it go is to 60 or 70 before terminating it, but I've never seen the memory usage go back down on its own. I guess I can post my entire set of code if that would help. I copied the code for earthball.c to start with as a template and made some tweaks... when I watch its memory usage it starts at 20 something jumps to 32 and then levels out somewhere around 33 megs.
@CoburnDomain... Do you happen to know a link to a page or post with these optimization techniques that I could look over?
Thanks for the help...