View Single Post
Old 10-13-11, 11:00 PM   #79
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Sat down and really started looking at these pointers and what they were doing. Here's what I've come up with so far (and now I see why I was having so much trouble with the template for the materials )

- The first 26 pointers are always the same except for:
pointer 10. This pointer points to start of art tool info data.
pointer to number of elements, number of elements value
4 bytes unknown
pointer to general, general value
pointer to mesh totals, mesh totals value
pointer to external dependencies, external dependencies value
pointer to scene totals, scene totals value
pointer to external dependencies, external dependencies value
pointer to objects, objects value
pointer to materials, materials value
pointer to used plug-ins, used plug-ins value
pointer to render data, render data value
- now if you take number of elements * 4 you'll end up at next chunk of data (skips all the elements pointers). Coincidentally this offset is the same offset given by first pointer after exporter info pointer
- the 4 pointers before the exporter info pointer are always the same
- first of the 4 pointers associates elements pointer to where the element pointers are located in file
- second of the 4 pointers associates document contents pointer with header pointer
- third of the 4 pointers associates extended data pointer with document contents pointer
- the last of the 4 pointers associates section start with art tool info
from art tool name pointer
art tool major revision
art tool minor revision
art tool pointer size
units per meter
origin (Vector 3)
right vector (Vector 3)
up vector (Vector 3)
back vector (Vector 3)
(if you skip 4 more bytes you're at the third of the 4 pointers)
- First pointer after the pointer that reads the Exporter info points to the location in file where the actual version info resides. You need to read 4 bytes (usually 0x0) first then you get the version info
- Next pointer after the pointer that reads the Exporter info points to the location in the file where the from art tool name is found
- if the GR2 file has textures then those pointers come next:
- next pointer points to location where pointer is stored for location of the textures in the file
this location where the textures are located:
take 4 * number of textures and those are the bytes to skip to get to first texture (those skipped bytes are pointers to those textures)
from filename
texture type
width
height
encoding
subformat
bytes per pixel
layout.shift for component (4 X 4 bytes)
layout.bits for component (4 X 4 bytes)
pointer to images
pointer to extended data
8 bytes uknown
- below repeats for number of textures:
next pointer points to the texture name in the embedded string
next pointer points to start of texture data in file
- next pointer marks the end of the textures and start of the materials
(there will be number of materials * 4 bytes before the first material - these bytes skipped are the pointers to each material)
now you can have a material with no texture, material with texture, etc. so next is:


Material with texture and no maps pointer:
next pointer points to first material
next pointer points to the texture the material uses
next pointer points to the something in the elements (mtl.dlt)
next pointer points to the bitmap string
next pointer points to the filename string
next pointer points to the typename string
next pointer points to the pointer for this materials extended data (with value of where extended data starts)
next pointer points to place in materials where pointer to this material resides (and places pointer to the material there)


- Material breakdowns:

Material with texture and no maps:
2 X 4 bytes unknown
pointer to material name in embedded strings
number of maps
pointer to texture
pointer to extended data
Clip U offset
Clip V offset
Clip U Width
Clip V Width
Jitter placement
UseJitter
Apply
CropPlace
filtering
MonoOutput
rgbOutput
AlphaSource
PreMultAlpha
pointer to bitmap string
pointer to filename string
StartTime
PlayBackRate
EndCondition
TieTimetoMatIDs
pointer to typename string
3X3 Matrix UVW transform
Vector3 UVW offset
UVW tiling
UVW Source
UVW Channel
Blur
BlurOffset
NoiseAmount
NoiseSize
NoiseLevel
NoisePhase
HideMapBack
UseRealWorldScale
TheDarkWraith is offline   Reply With Quote