3DS文件结构(5)

2019-08-31 09:11

---------*/

unsigned long ReadLightChunk (void) {

unsigned char end_found=FALSE,boolean; unsigned int temp_int;

unsigned long current_pointer; unsigned long temp_pointer;

unsigned long tellertje=6L; // 2 id + 4 pointer float light_coors [3];

current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer ();

fread (&(light_coors [0]),sizeof (float),1,bin3ds); fread (&(light_coors [1]),sizeof (float),1,bin3ds); fread (&(light_coors [2]),sizeof (float),1,bin3ds);

#ifdef __DEBUG__

printf (\light at coordinates: X: %5.2f, Y: %5.2f,Z: %5.2f\\n\ light_coors [0], light_coors [1], light_coors [2]); #endif

while (end_found==FALSE) {

temp_int=ReadInt ();

switch (temp_int) {

case LIT_UNKNWN01 :

#ifdef __DEBUG__

printf (\of %0X\\n\ #endif

tellertje+=ReadUnknownChunk (LIT_UNKNWN01); break; case LIT_OFF :

#ifdef __DEBUG__

printf (\chunk: %0X\\n\ #endif

tellertje+=ReadBooleanChunk (&boolean); #ifdef __DEBUG__

if (boolean==TRUE)

printf (\ else

printf (\ #endif break; case LIT_SPOT :

#ifdef __DEBUG__ printf (\SpotLight: %0X\\n\ #endif

tellertje+=ReadSpotChunk (); break; case COL_RGB :

#ifdef __DEBUG__

printf (\of %0X\\n\

#endif

tellertje+=ReadRGBColor (); break; case COL_TRU :

#ifdef __DEBUG__

printf (\of %0X\\n\

#endif

tellertje+=ReadTrueColor (); break; default :break; }

tellertje+=2;

if (tellertje=temp_pointer) end_found=TRUE; }

ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); }

/*----------------------------------------------------------------------------*/

unsigned long ReadCameraChunk (void) {

unsigned long current_pointer;

unsigned long temp_pointer; float camera_eye [3]; float camera_focus [3]; float rotation,lens;

current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer ();

fread (&(camera_eye [0]),sizeof (float),1,bin3ds); fread (&(camera_eye [1]),sizeof (float),1,bin3ds); fread (&(camera_eye [2]),sizeof (float),1,bin3ds);

#ifdef __DEBUG__

printf (\Y: %5.2f,Z: %5.2f\\n\ camera_eye [0], camera_eye [1], camera_eye [2]); #endif

fread (&(camera_focus [0]),sizeof (float),1,bin3ds); fread (&(camera_focus [1]),sizeof (float),1,bin3ds); fread (&(camera_focus [2]),sizeof (float),1,bin3ds);

#ifdef __DEBUG__

printf (\Y: %5.2f,Z: %5.2f\\n\ camera_focus [0], camera_focus [1], camera_focus [2]); #endif

fread (&rotation,sizeof (float),1,bin3ds); fread (&lens,sizeof (float),1,bin3ds); #ifdef __DEBUG__

printf (\ printf (\ #endif

if ((temp_pointer-38)0) // this means more chunks are to follow {

#ifdef __DEBUG__

printf (\ #endif

if (ReadInt ()==CAM_UNKNWN01) {

#ifdef __DEBUG__

printf (\ #endif

ReadUnknownChunk (CAM_UNKNWN01); }

if (ReadInt ()==CAM_UNKNWN02) {

#ifdef __DEBUG__

printf (\ #endif

ReadUnknownChunk (CAM_UNKNWN02); } }

ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); }

/*----------------------------------------------------------------------------*/

unsigned long ReadVerticesChunk (void) {

unsigned long current_pointer; unsigned long temp_pointer; float vertices [3]; // x,y,z unsigned int numb_v;

current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); numb_vertices =ReadInt ();

#ifdef __DEBUG__

printf (\ #endif

for (int i=0;i

fread (&(vertices [0]),sizeof (float),1,bin3ds); fread (&(vertices [1]),sizeof (float),1,bin3ds); fread (&(vertices [2]),sizeof (float),1,bin3ds);

#ifdef __DEBUG__

printf (\ i,

vertices [0], vertices [1], vertices [2]); #endif }

ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); }

/*----------------------------------------------------------------------------*/

unsigned long ReadSmoothingChunk () {

unsigned long current_pointer; unsigned long temp_pointer; unsigned long smoothing;

current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer ();

for (int i=0;i

smoothing=ReadLong();

smoothing=smoothing; // compiler warnig depressor *:) #ifdef __DEBUG__

printf (\smoothing group for face []] is %d\\n\ #endif }

ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); }

/*----------------------------------------------------------------------------*/

unsigned long ReadFacesChunk (void) {

unsigned long current_pointer; unsigned long temp_pointer; unsigned int temp_diff;

unsigned int faces [6]; // a,b,c,Diff (Diff= AB: BC: CA: )


3DS文件结构(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:第五章 脂类代谢(试题与答案)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: