Difference between revisions of "Texture (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
(Added example C struct for the struct section (The text description is easy to misunderstand))
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RW Section|Texture|0x0006}}
+
{{RW Section
 +
| NAME = Texture
 +
| VENDORNAME = Criterion Games
 +
| MODULENAME = Core
 +
| MODULEID = 000000
 +
| IDENTIFIER = 06
 +
| PARENTS = [[Material (RW Section)|Material]]
 +
| CHILDREN = [[Struct (RW Section)|Struct]], [[String (RW Section)|String]]
 +
| EXTENSIONS = [[Sky Mipmap Val (RW Section)|Sky Mipmap Val]], [[Anisotropy PLG (RW Section)|Anisotropy]]
 +
}}
  
'''Texture''' is a container section used in [[model file|DFF files]] as child of a [[Material (RW Section)|material section]] or an [[Material Effects PLG (RW Section)|Material Effects PLG]] section. The section itself does not store any data at all. All additional information get stored inside a [[Struct (RW Section)|struct section]] which directly follows this one as a child. A ''texture'' section is used to store identifying information about a texture and it's alpha layer.
+
'''Texture''' is a container section used in [[model file|DFF files]] as child of a [[Material (RW Section)|material section]] or an [[Material Effects PLG (RW Section)|Material Effects PLG]] section. The section itself does not store any data at all. All additional information get stored inside a [[Struct (RW Section)|struct section]] which directly follows this one as a child. A ''texture'' section is used to store the sampler state of a texture.
  
 
== Structure ==
 
== Structure ==
  
The structure stores filtering information for the texture.
+
The structure stores filtering and uv-addressing information for the texture.
  
  2b - WORD  - Filter flags
+
  1byte Texture filtering (Texture filtering modes)
  2b - WORD  - Unknown (Platform?)
+
4bit U-addressing
 +
4bit V-addressing
 +
  1bit Does texture use mip levels
 +
15bits padding
 +
 
 +
Example C structure (UInt32 is a 4 byte unsigned integer type)
 +
<syntaxhighlight lang="c">
 +
struct
 +
{
 +
    // Filtering mode
 +
    UInt32 filtering : 8;
 +
 
 +
    // Addressing modes for u, v
 +
    UInt32 u : 4;
 +
    UInt32 v : 4;
 +
 
 +
    UInt32 mipmaps : 1;
 +
};
 +
</syntaxhighlight>
 +
 
 +
Texture filtering modes
 +
0 - FILTERNAFILTERMODE (filtering is disabled)
 +
1 - FILTERNEAREST (Point sampled)
 +
2 - FILTERLINEAR (Bilinear)
 +
3 - FILTERMIPNEAREST (Point sampled per pixel mip map)
 +
4 - FILTERMIPLINEAR (Bilinear per pixel mipmap)
 +
5 - FILTERLINEARMIPNEAREST (MipMap interp point sampled)
 +
6 - FILTERLINEARMIPLINEAR (Trilinear)
 +
 
 +
Texture addressing modes
 +
0 - TEXTUREADDRESSNATEXTUREADDRESS (no tiling)
 +
1 - TEXTUREADDRESSWRAP (tile in U or V direction)
 +
2 - TEXTUREADDRESSMIRROR (mirror in U or V direction)
 +
3 - TEXTUREADDRESSCLAMP
 +
4 - TEXTUREADDRESSBORDER
  
 
== Child sections ==
 
== Child sections ==
Line 16: Line 59:
 
* [[String (RW Section)|String]] &ndash; Holds the texture's name
 
* [[String (RW Section)|String]] &ndash; Holds the texture's name
 
* [[String (RW Section)|String]] &ndash; Holds the texture's alpha layer name.
 
* [[String (RW Section)|String]] &ndash; Holds the texture's alpha layer name.
 
=== Extension ===
 
 
The section can also hold an extension which usualy holds an ''Sky Mipmap Val''.
 
 
* [[Sky Mipmap Val (RW Section)|Sky Mipmap Val]]
 
  
 
== See also ==
 
== See also ==
 
* [[Material (RW Section)|Material]]
 
* [[Material (RW Section)|Material]]
 
* [[Material Effects PLG (RW Section)|Material Effects PLG]]
 
* [[Material Effects PLG (RW Section)|Material Effects PLG]]
* [[RenderWare_binary_stream_file|RW file format specification]]
 
  
{{N|SA|VC}}
+
{{N|SA|VC|3}}
[[Category:GTA_3]]
 

Latest revision as of 16:06, 28 November 2020

Texture
RenderWare Stream Section
Vendor Criterion Games
Module Core
Module ID 0x000000
Identifier 0x06
Chunk ID 0x00000006
Versions All
Hierarchy
Parents:
Material
Children:
Struct, String
Extensions:
Sky Mipmap Val, Anisotropy
File Format

Texture is a container section used in DFF files as child of a material section or an Material Effects PLG section. The section itself does not store any data at all. All additional information get stored inside a struct section which directly follows this one as a child. A texture section is used to store the sampler state of a texture.

Structure

The structure stores filtering and uv-addressing information for the texture.

1byte Texture filtering (Texture filtering modes)
4bit U-addressing
4bit V-addressing
1bit Does texture use mip levels
15bits padding

Example C structure (UInt32 is a 4 byte unsigned integer type)

struct
{
    // Filtering mode
    UInt32 filtering : 8;

    // Addressing modes for u, v
    UInt32 u : 4;
    UInt32 v : 4;

    UInt32 mipmaps : 1;
};

Texture filtering modes

0 - FILTERNAFILTERMODE (filtering is disabled)
1 - FILTERNEAREST (Point sampled)
2 - FILTERLINEAR (Bilinear)
3 - FILTERMIPNEAREST (Point sampled per pixel mip map)
4 - FILTERMIPLINEAR (Bilinear per pixel mipmap)
5 - FILTERLINEARMIPNEAREST (MipMap interp point sampled)
6 - FILTERLINEARMIPLINEAR (Trilinear)

Texture addressing modes

0 - TEXTUREADDRESSNATEXTUREADDRESS (no tiling)
1 - TEXTUREADDRESSWRAP (tile in U or V direction)
2 - TEXTUREADDRESSMIRROR (mirror in U or V direction)
3 - TEXTUREADDRESSCLAMP
4 - TEXTUREADDRESSBORDER

Child sections

There are always child sections which appear in the order they are listed here.

  • String – Holds the texture's name
  • String – Holds the texture's alpha layer name.

See also