Difference between revisions of "THQ Material (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
(Structure)
Line 17: Line 17:
 
    
 
    
 
   int32 AlphaTestRef
 
   int32 AlphaTestRef
   uint32 ZWriteFlags
+
   bool ZTest
 +
  bool ZWrite
 
   int32 SrcBlend
 
   int32 SrcBlend
 
   int32 DestBlend
 
   int32 DestBlend
Line 25: Line 26:
 
   RwCullMode FaceCullMode
 
   RwCullMode FaceCullMode
 
    
 
    
   AlphaTestRef = ((renderProps << 1) & 0xFF000000) >> 24);
+
   AlphaTestRef = ((renderProps << 1) & 0xFF000000)) >> 24;
   SrcBlend = ((renderProps << 1) & 0xF0) >> 4;
+
   ZTest = renderProps & 0x800000;
   DstBlend = ((renderProps << 1) & 0xF00) >> 8;
+
  ZWrite = ((renderProps << 9) & 0x00800000)) >> 17;
   FaceCullIndex = (renderProps << 1) & 0xF;
+
  SrcBlend = renderProps & 0x78;
 
+
   DstBlend = renderProps & 0x780;
 +
   FaceCullIndex = renderProps & 0x7;
 +
 
 
   if (DstBlend == rwBLENDZERO)
 
   if (DstBlend == rwBLENDZERO)
 
     AlphaEnabled = FALSE
 
     AlphaEnabled = FALSE

Revision as of 02:23, 7 December 2023

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
 bool ZTest
 bool ZWrite
 int32 SrcBlend
 int32 DestBlend
 int32 FaceCullIndex
 
 RwBool AlphaEnabled
 RwCullMode FaceCullMode
 
 AlphaTestRef = ((renderProps << 1) & 0xFF000000)) >> 24;
 ZTest = renderProps & 0x800000;
 ZWrite = ((renderProps << 9) & 0x00800000)) >> 17;
 SrcBlend = renderProps & 0x78;
 DstBlend = renderProps & 0x780;
 FaceCullIndex = renderProps & 0x7;
 
 if (DstBlend == rwBLENDZERO)
   AlphaEnabled = FALSE
 else
   AlphaEnabled = TRUE
 
 switch( FaceCullIndex )
   {
       case 0:
       {
           FaceCullMode = rwCULLMODECULLNONE;
           break;
       }
 
       case 1:
       {
           FaceCullMode = rwCULLMODECULLBACK;
           break;
       }
 
       case 2:
       {
           FaceCullMode = rwCULLMODECULLFRONT;
           break;
       }
   }
}