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/1C4A276C
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
|Long name:||Texture image|
7BITSTR block name ; "cImageData" DWORD block ID ; 0x1c4a276c DWORD block version ; 7,8 or 9 REF reference: load a cSGResource here DWORD texture width DWORD texture height DWORD format code ; see Table 1 below DWORD mipmapLevels FLOAT Purpose ; 1(Object),2(Outfit) OR 3(Interface) DWORD outerloopCount DWORD unknown ; always 0 IF (block version = 9) 7BITSTR filename repeat ; Repeat Filename without "_txtr" ENDIF LOOP ; repeat "outerloopCount" times ; IF (version = (7 or 8)) ; innerloopCount=mipmapCount ; innerLoopCount = mipmapcount when version is 7 or 8 ; ENDIF IF (version = 9) DWORD innerloopCount ENDIF LOOP ; repeat "innerloopCount" times BYTE dataType (0=image,1=useLIFO) IF (dataType = 0) DWORD imagedata size PRIOR data ENDIF IF (dataType = 1) 7BITSTR lifoName ; name of a LIFO file ENDIF ENDLOOP IF (version = 7) DWORD creator ID(0xFF000000) (unused) ENDIF IF (version = (8 or 9)) DWORD creatorID ; when creating a TXTR put a 0xffffffff here when uploaded ; to TheSims2 it will be changed to a unique number to ; track creator DWORD Format Flag ; 0x14210000 (As in Maxis S3D's) ENDIF 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=Unused 1=Raw A8 R8 G8 B8, total data size = width*height*4 2=Raw R8 G8 B8, total data size = width*height*3 3=8bit Alpha 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=32bitAlt 8=DXT5 9=24bitAlt