Here is data structures: typedef unsigned char uint8; class MD2Mesh { struct Vertex { uint8 coord[3], normalIdx; }; struct Frame { float translation[3], rotation[3]; char name[16]; Mesh::Vertex* vertices; }; };
At first I tried to do something like : MD2Mesh::Frame* md2Frame = (MD2Mesh::Frame*)buffer
to get the values from the buffer without initializing the pointer and I managed to get the values of translation, rotation and name but the vertices address didn't point to the "buffer + 40(size of translation + rotation + name)" so i just pass the the address of vtx which is buffer + 40
anbluemoon
Posts
-
Strange problem with pointers -
Strange problem with pointersI wrote something like this :
MD2Mesh::Frame* md2Frame = (MD2Mesh::Frame*)buffer; uint8* tmp = buffer + 40; MD2Mesh::Vertex* vtx = (MD2Mesh::Vertex*)tmp; md2Frame->vertices = vtx;
The value of "vtx" is changed after the line "mdFrame->vertices = vtx" U can look at the following debugging table:vtx
0x00434140 {v=0x00434140 "ÐBÄ" normIdx=0 }
origin::MD2Mesh::Vertex *
after line "mdFrame->vertices = vtx" it becomes like this :
vtx
0x00434140 {v=0x00434140 "@AC" normIdx=0 }
origin::MD2Mesh::Vertex *
md2Frame->vertices
0x00434140 {v=0x00434140 "@AC" normIdx=0 }
origin::MD2Mesh::Vertex *
Do u have any ideas ?
-
Need help with member function pointerBut i did have a private static instance of Test class , and i use that to call the function pointer
-
Need help with member function pointerI define a class like this :
class Test { private: static Test* instance; private: typedef void (Test::*SayHello)(char*); SayHello sayHello; void Say(char* name) { cout<< "Hello " <<name; } static void test() { instance->*sayHello("hello"); // this where i got the error notification } public: Test() { sayHello = &Test::Say; } ~Test() { } static Test* getInstance() { if(instance == NULL) instance = new Test(); return instance; } };
When compiling i receive some error messages :error C2597: illegal reference to non-static member 'Test::sayHello' error C3867: 'Test::sayHello': function call missing argument list; use '&Test::sayHello' to create a pointer to member error C2568: '->*' : unable to resolve function overload
If you have any ideas plz tell me Thanks in advance -
How can i get special folder icon ?Can anyone tell me how to get special folder icon (eg . My Computer , Network place,My Picture...) ?
-
How to open file using it defualt program using C# ?Can anyone tell me how to open any file using its default program ?
-
plz, help me with Window Media SDKi create a MFC(Dialog Based) project and insert the WMP ActiveX control in it , now i want to change the skin of WMP AciveX control , but i don't know how to do that , can anybody help me ? (the sample in the SDK using ATL/COM)
-
help with fstreamcan anybody tell me how to read hex number in IDX file (foxpro) by using fstream::read ?