md2 loading

Started by
4 comments, last by Ainokea 19 years, 6 months ago
I am reading a tutorial on md2 loading and all the structores for the md2 look like this:

typedef struct MD2_TEXTCOORD_TYP
{
     short u,v;
}MD2_TEXTCOORD, *MD2_TEXTCOORD_PTR;


and the tutorials also says that the data types must be identical to this. However I was wondering if I could do it like this:

struct MD2_TEXTCOORD
{
    short u,v;   //texture coodinate
};


and when I need a pointer I just declare that type as a pointer. I.E instead of this: foo(MD2_TEXTCOORD_PTR); I could do this: foo(MD2_TEXTCOORD *md2);
______________________________________________________________________________________With the flesh of a cow.
Advertisement

that should be fine, they are equivalent
Quote:Original post by nts

that should be fine, they are equivalent

thanks. rating up up for you.
______________________________________________________________________________________With the flesh of a cow.
Quote:Original post by Ainokea
Quote:Original post by nts

that should be fine, they are equivalent

thanks. rating up up for you.


Wow all it took was 7 words, :D

Thanks, now i hope i wasn't horribly wrong somehow :D

their equivalent assuming your programming in c++. if your in c, the typedef helps you. You see, when you declare a struct in c, it looks like this

//DEFINITION
struct MyStruct
{
int Content1;
int Content2;
};

int main()
{
struct MyStruct WhateverImGonnaCallThisVar; //the actual DECLARATION

WhateverImGonnaCallThisVar.Content1 = 0;

return 0;
}

******************************

with c++, the struct is optional, however, the typedef version, eliminates the need for the struct in the declaration (in both c and c++) but if your programming in c++, dont do the typedef

EDIT: to clarify, no matter what you do (in c or c++), you need the struct keyword before the definition of the class

hope that helps
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
My only problem was knowing if I had to use the same name or not. Thanks any ways and rating up for you.
______________________________________________________________________________________With the flesh of a cow.

This topic is closed to new replies.

Advertisement