Difference between revisions of "THQ Material (RW Section)"
Jump to navigation
Jump to search
| Line 28: | Line 28: | ||
bool AlphaEnabled | bool AlphaEnabled | ||
| − | AlphaTestFunc = (renderProps & 0x7800) >> | + | AlphaTestFunc = (renderProps & 0x7800) >> (12 - 1); |
| − | AlphaTestRef = (renderProps & 0x7F8000) >> | + | AlphaTestRef = (renderProps & 0x7F8000) >> (16 - 1); |
| − | ZTest = (renderProps & 0x800000) >> | + | ZTest = (renderProps & 0x800000) >> (18 - 1); |
| − | SrcBlend = (renderProps & 0x78) >> | + | SrcBlend = (renderProps & 0x78) >> (4 - 1); |
| − | DstBlend = (renderProps & 0x780) >> | + | DstBlend = (renderProps & 0x780) >> (8 - 1); |
FaceCullIndex = renderProps & 0x7; | FaceCullIndex = renderProps & 0x7; | ||
Revision as of 00:19, 9 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) | |
| 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 The Adventures of Jimmy Neutron Boy Genius: Attack of the Twonkies.
Structure
uint32 header
int32 sectionSize
uint32 version
int32 dataSize // Usually 4.
uint32 renderProps
void THQMaterial(void)
{
int32 AlphaTestFunc
int32 AlphaTestRef
bool ZTest
bool ZWrite
int32 SrcBlend
int32 DestBlend
int32 FaceCullMode
bool AlphaEnabled
AlphaTestFunc = (renderProps & 0x7800) >> (12 - 1);
AlphaTestRef = (renderProps & 0x7F8000) >> (16 - 1);
ZTest = (renderProps & 0x800000) >> (18 - 1);
SrcBlend = (renderProps & 0x78) >> (4 - 1);
DstBlend = (renderProps & 0x780) >> (8 - 1);
FaceCullIndex = renderProps & 0x7;
if (DstBlend == (void *)rwBLENDZERO)
ZWrite = TRUE
AlphaEnabled = FALSE
else
{
ZWrite = FALSE
AlphaEnabled = TRUE
if (renderProps & 0x4000000)
FaceCullIndex = (void *)rwCULLMODECULLNONE;
}
}