Game Development Reference
In-Depth Information
flipped and the direction of the z component is inverted. Orientation in 3DS
is stored in angle axis format. Since Toon3D uses Euler angles we need to
convert angle axis to Euler using the function AngleAxisToEuler.
BOOL C3DSAscii::ReadNodeTM(CStdioFile &file, CToon3DObject *obj)
CString line;
int start,end;
TOKEN tokens[5];
VECTOR rotaxis;
double rotangle;
start = file.GetPosition();
end = GetSectionEnd(file);
if (line.Find("TM_POS ")!=-1){
if (ParseTokens(line,tokens,5)<4) return FALSE;
//Swap z andy and flip the z
obj->spos.x = atof(tokens[1].name);
obj->spos.y = atof(tokens[3].name);
obj->spos.z =-atof(tokens[2].name);
if (line.Find("TM_SCALE ")!=-1){
if (ParseTokens(line,tokens,5)<4) return FALSE;
obj->sscale.x = atof(tokens[1].name);
obj->sscale.y = atof(tokens[3].name);
obj->sscale.z = atof(tokens[2].name);
if (line.Find("TM_ROTAXIS ")!=-1){
if (ParseTokens(line,tokens,5)<4) return FALSE;
rotaxis.x = atof(tokens[1].name);
rotaxis.y = atof(tokens[3].name);
rotaxis.z = atof(tokens[2].name);
if (line.Find("TM_ROTANGLE")!=-1){
if (ParseTokens(line,tokens,5)<2) return FALSE;
rotangle = atof(tokens[1].name);
AngleAxisToEuler(rotaxis, rotangle, obj->srot);
return TRUE;
Search Nedrilad ::

Custom Search