TXTR

From SimsWiki
Revision as of 19:10, 17 September 2012 by Kiwi tea (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article is imported from the old MTS2 wiki. You can help Sims2Wiki by cleaning it up. It's original page with comments can be found at http://old_wiki.modthesims2.com/TXTR

This file type uses the Resource Collection format RCOL.

TXTR file format: The texture files can store a variable size image, alpha channel and MIP maps in a variety of formats. The basic layout is:

TXTR Header ' MIP Image Header MIP Image Data ' MIP Image Header MIP Image Data ' . . . ' Tail data


Header is a standard RCOL header the texture block is coded as follows

1 $len(0xa)
10 "cImageData"
4 0x1c4a276c
4 modifier(7,9)
insert [[cSGResource]] here
4 texture width
4 texture height
4 format code

4 mipmapLevels
2 unknown 0
2 unknown (3f80,4040,4000)
4 outerloopCount
  4 unknown(0)
if modifier=9
  1 unknown(0)
endif
loop(outerloopCount)
  case(modifier)
	7:
	  innerloopCount=mipmapCount
	9:
	  4 innerloopCount
  endcase
  loop(innerloopCount)
	1 dataType
	case (dataType)
	  0:
	    4 imagedata size
	    n data
	  1:
	    1 $len
	    n $(name of a LIFO file)
	endcase
  endloop
  case (modifier)
	7:
	  4 unknown(00 00 00 ff)
	9:
	  4 unknown
	  4 unknown(00 00 21 41)
  endcase
endloop

MIP maps are stored smallest to largest and generally start with a 1x1 image and can be

put into a DDS container. Some TXTR files do not offer MIP maps.

Image data The size is based on the image format. If this is a MIP, read the data size from the header and figure out the correct

dimensions, they will be proportional to the width/height found in the TXTR header. See the Image format codes for the data size per pixel formula.

Image format codes 0=??? 1=Raw A8 R8 G8 B8, total data size = width*height*4 2=Raw R8 G8 B8, total data size = width*height*3 3=??? 4=DXT1 RGB (no alpha bit) total data size = width*height/2 5=DXT3 ARGB, total data size = width*height 6=Raw Grayscale, total data size = width*height 7... = ???


You can see the Java code snip used to decode DXT1 & DXT3 data blocks here: http:home.carolina.rr.com/dhmtb/snip.java Use it in any way you see fit.

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox