Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] Diff of /trunk/sml3d/examples/md3-viewer/load-md3.sml
ViewVC logotype

Diff of /trunk/sml3d/examples/md3-viewer/load-md3.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 401, Wed Jan 14 17:17:39 2009 UTC revision 402, Wed Jan 14 17:18:27 2009 UTC
# Line 6  Line 6 
6   * A loader for "Quake 3: Arena" model files (MD3 files).  This code is based on the   * A loader for "Quake 3: Arena" model files (MD3 files).  This code is based on the
7   * description at   * description at
8   *   *
9   *      http://linux.ucla.edu/~phaethon/q3/formats/md3format.html   *      http://icculus.org/homepages/phaethon/q3a/formats/md3format.html
10   *)   *)
11    
12  structure LoadMD3 : sig  structure LoadMD3 : sig
# Line 207  Line 207 
207            val (shader, pos) = getS32 (data, pos)            val (shader, pos) = getS32 (data, pos)
208  (*+DEBUG  (*+DEBUG
209  val _ = print(concat["shader: name = \"", name, "\"\n"])  val _ = print(concat["shader: name = \"", name, "\"\n"])
210    -DEBUG*)
211            in            in
212              MD3.SHADER{name = name, index = shader}              MD3.SHADER{name = name, index = shader}
213            end            end
 -DEBUG*)  
214    
215    (* read the vertex indices of a triangle *)    (* read the vertex indices of a triangle *)
216      fun readTriangle inS = let      fun readTriangle inS = let
# Line 261  Line 261 
261            in            in
262              (v, n)              (v, n)
263            end            end
264      end      end (* local *)
265    
266      fun readSurface inS = let      fun readSurface inS = let
267            val start = filePos inS            val start = filePos inS
# Line 344  Line 344 
344            val {name, numFrames, numTags, numSurfaces,            val {name, numFrames, numTags, numSurfaces,
345                    framesOffset, tagsOffset, surfsOffset                    framesOffset, tagsOffset, surfsOffset
346                  } = readHdr inS                  } = readHdr inS
347  (*+DEBUG  (*+DEBUG*)
348  val () = print(concat["HDR: name = \"", name, "\", #frames = ",  val () = print(concat["HDR: name = \"", name, "\", #frames = ",
349  Int.toString numFrames, ", #tags = ", Int.toString numTags,  Int.toString numFrames, ", #tags = ", Int.toString numTags,
350  ", #surfaces = ", Int.toString numSurfaces, "\n"  ", #surfaces = ", Int.toString numSurfaces, "\n"
351  ])  ])
352  -DEBUG*)  (*-DEBUG*)
353            val () = seek (inS, framesOffset)            val () = seek (inS, framesOffset)
354            val frames = readN readFrame (inS, numFrames)            val frames = readN readFrame (inS, numFrames)
355            val () = seek (inS, tagsOffset)            val () = seek (inS, tagsOffset)
# Line 373  Line 373 
373            end            end
374    
375    end    end
   

Legend:
Removed from v.401  
changed lines
  Added in v.402

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0