Esempio n. 1
0
        public Mdl(mdl_t mdlTStruct,
				   texgroup_struct[] tgs,
				   stvert_t[] vertData,
				   dtriangle_t[] triData,
				   frame_struct[] frame
				   )
        {
            this.header = mdlTStruct;
            this.texGroup = tgs;
            this.vertex = vertData;
            this.triangle = triData;
            this.frame = frame;
        }
Esempio n. 2
0
        private texgroup_struct[] readTexGroupStructs(mdl_t mdlTStruct, System.IO.FileStream fstream)
        {
            texgroup_struct[] tgs = new texgroup_struct[ mdlTStruct.num_texgroups ];

            for(int texgroup_num = 0; texgroup_num < mdlTStruct.num_texgroups; texgroup_num++){
                tgs[texgroup_num].type = (aliasskintype_t) readInt(fstream);
                Console.WriteLine("Type for tgs[{0}] is {1}", texgroup_num, tgs[texgroup_num].type);

                if(tgs[texgroup_num].type == aliasskintype_t.ALIAS_SKIN_SINGLE){
                    //if type is ALIAS_SKIN_SINGLE, set number of textures to 1
                    tgs[texgroup_num].numtextures = 1;

                    //and interval[0] to 0
                    tgs[texgroup_num].interval = new float[1];
                    tgs[texgroup_num].interval[0] = 0.0f;
                }else{
                    // Determine how many textures there are in this group
                    tgs[texgroup_num].numtextures = readInt(fstream);
                    Console.WriteLine("numtextures for tgs[{0}] is {1}", texgroup_num, tgs[texgroup_num].numtextures);
                    tgs[texgroup_num].interval = new float[tgs[texgroup_num].numtextures];

                    // Read the intervals between each texture
                    for(int i = 0; i < tgs[texgroup_num].numtextures; i++){
                        tgs[texgroup_num].interval[i] = readSingle(fstream);
                    }
                }

                // Read texture data
                tgs[texgroup_num].texture = new tex_struct[tgs[texgroup_num].numtextures];

                for(int tex_num = 0; tex_num < tgs[texgroup_num].numtextures; tex_num++){
                    tgs[texgroup_num].texture[tex_num].pixel = new byte[mdlTStruct.texheight * mdlTStruct.texwidth];
                    fstream.Read(tgs[texgroup_num].texture[tex_num].pixel, 0, mdlTStruct.texheight * mdlTStruct.texwidth);
                }
            }

            return tgs;
        }