int per = reader. ReadUInt16 ();

                       tesRead += 2;

                       tesRead += tesRead;

                       return per;

               }

               Entity ProcessObjectChunk ( ThreeDSChunk chunk )

               {

                       return ProcessObjectChunk ( chunk, new Entity() );

               }

               Entity ProcessObjectChunk ( ThreeDSChunk chunk, Entity e )

               {

                       while ( tesRead < chunk. Length )

                       {

                               ThreeDSChunk child = new ThreeDSChunk ( reader );

                               switch ((Groups) child. ID)

НЕ нашли? Не то? Что вы ищете?

                               {

                                       case Groups. C_OBJECT_MESH:

                                               ProcessObjectChunk ( child, e );

                                               break;

                                       case Groups. C_OBJECT_VERTICES:

                                               e. vertices = ReadVertices ( child );

                                               break;

                                       case Groups. C_OBJECT_FACES:

                                               e. indices = ReadIndices ( child );

                                               if ( tesRead < child. Length )

                                                       ProcessObjectChunk ( child, e );

                                               break;

                                       case Groups. C_OBJECT_MATERIAL:

                                               string name2 = ProcessString ( child );

                                               Material mat;

                                               if ( materials. TryGetValue ( name2, out mat ) )

                                               {

                                                       MaterialFaces m = new MaterialFaces();

                                                       m. Material = mat;

                                               

                                                       int nfaces = reader. ReadUInt16 ();

                                                       tesRead += 2;

                                                       m. Faces = new UInt16[nfaces];

                                                       

                                                       for ( int ii=0; ii<nfaces; ii++)

                                                       {

                                                               m. Faces[ii] = reader. ReadUInt16 ();

                                                               tesRead += 2;

                                                       }

                                                       e. MaterialFaces. Add(m);

                                               }

                                               else

                                               {

                                                       

                                                       SkipChunk ( child );

                                               }

                                       

                                               break;

                                       case Groups. C_OBJECT_UV:

                                               int cnt = reader. ReadUInt16 ();

                                               tesRead += 2;

                                               e. texcoords = new TexCoord [ cnt ];

                                               for ( int ii=0; ii<cnt; ii++ )

                                                       e. texcoords [ii] = new TexCoord ( reader. ReadSingle (), reader. ReadSingle () );

Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21