THQ Material (RW Section)

From GTAMods Wiki
Revision as of 01:26, 7 December 2023 by Muzzarino (talk | contribs)
Jump to navigation Jump to search
THQ Material (Custom)
RenderWare Stream Section
Vendor THQ
Module Plug-In
Module ID 0x00CAFE
Identifier 0x45
Chunk ID 0x00CAFE45
Versions All
Hierarchy
Parents:
Material (Extension), Atomic (Extension, see below)
Children:
None
Extensions:
None
File Format

The custom material extension was developed by THQ to attach geometric rendering properties to a material, using alpha referencing, z-test flags, blend functions, and culling, used for the known game Jimmy Neutron: Attack of the Twonkies.

Structure

{
 uint32 header
 int32 sectionSize
 uint32 renderProps
 
 int32 AlphaTestRef
 uint32 ZWriteFlags
 int32 SrcBlend
 int32 DestBlend
 int32 FaceCullIndex
 
 RwCullMode FaceCullMode
 
 uint32 renderProps_ = renderProps << 1;
 
 SrcBlend = (renderProps_ & 0xF0) >> 4);
 DstBlend = (renderProps_ & 0xF00) >> 8);
 
 switch( FaceCullIndex )
   {
       case 0:
       {
           FaceCullMode = rwCULLMODECULLNONE;
           break;
       }
 
       case 1:
       {
           FaceCullMode = rwCULLMODECULLBACK;
           break;
       }
 
       case 2:
       {
           FaceCullMode = rwCULLMODECULLFRONT;
           break;
       }
   }
}