Skip to content

Commit b3853c2

Browse files
authored
[GEN] Add FXShader, BINORMAL, TANGENT chunks from BFME (#813)
1 parent dfef05f commit b3853c2

File tree

1 file changed

+39
-2
lines changed
  • Generals/Code/Libraries/Source/WWVegas/WW3D2

1 file changed

+39
-2
lines changed

Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,17 @@ June 5, 2001
309309
(gth) Adding line rendering options to particle systems today. This involves a
310310
new line-properties chunk and a RenderMode variable added to the InfoV2 struct.
311311
312+
TheSuperHackers @forwardport:
313+
April 5, 2025
314+
315+
Added W3D_CHUNK_FX_SHADERS and subchunks, which were added in BFME2. These
316+
chunks are used to define usage of a specific shader and pass params.
317+
318+
April 21, 2025
319+
320+
Added W3D_CHUNK_VERTEX_TANGENT and W3D_CHUNK_VERTEX_BINORMAL chunks. These are used to define
321+
normal mapping information for a mesh. They were added in BFME2.
322+
312323
********************************************************************************/
313324

314325

@@ -374,20 +385,28 @@ enum {
374385
W3D_CHUNK_DCG =0x0000003B, // per-vertex diffuse color values (array of W3dRGBAStruct's)
375386
W3D_CHUNK_DIG =0x0000003C, // per-vertex diffuse illumination values (array of W3dRGBStruct's)
376387
W3D_CHUNK_SCG =0x0000003E, // per-vertex specular color values (array of W3dRGBStruct's)
388+
W3D_CHUNK_FXSHADER_IDS =0x0000003F, // single or per-tri array of uint32 fx shader indices (check chunk size)
377389

378390
W3D_CHUNK_TEXTURE_STAGE =0x00000048, // wrapper around a texture stage.
379391
W3D_CHUNK_TEXTURE_IDS =0x00000049, // single or per-tri array of uint32 texture indices (check chunk size)
380392
W3D_CHUNK_STAGE_TEXCOORDS =0x0000004A, // per-vertex texture coordinates (array of W3dTexCoordStruct's)
381393
W3D_CHUNK_PER_FACE_TEXCOORD_IDS =0x0000004B, // indices to W3D_CHUNK_STAGE_TEXCOORDS, (array of Vector3i)
382394

383-
395+
W3D_CHUNK_FX_SHADERS =0x00000050, // define an array of shaders to be used in the mesh
396+
W3D_CHUNK_FX_SHADER =0x00000051, // a single shader entry
397+
W3D_CHUNK_FX_SHADER_INFO =0x00000052, // information about the shader to be used (W3dFXShaderInfoStruct)
398+
W3D_CHUNK_FX_SHADER_CONSTANT =0x00000053, // contains a constant name and value for the shader
399+
384400
W3D_CHUNK_DEFORM =0x00000058, // mesh deform or 'damage' information.
385401
W3D_CHUNK_DEFORM_SET =0x00000059, // set of deform information
386402
W3D_CHUNK_DEFORM_KEYFRAME =0x0000005A, // a keyframe of deform information in the set
387403
W3D_CHUNK_DEFORM_DATA =0x0000005B, // deform information about a single vertex
388404

389405
W3D_CHUNK_PS2_SHADERS =0x00000080, // Shader info specific to the Playstation 2.
390-
406+
407+
W3D_CHUNK_VERTEX_TANGENTS = 0x00000060, // array of tangents (array of W3dVectorStruct's)
408+
W3D_CHUNK_VERTEX_BINORMALS = 0x00000061, // array of binormals (array of W3dVectorStruct's)
409+
391410
W3D_CHUNK_AABTREE =0x00000090, // Axis-Aligned Box Tree for hierarchical polygon culling
392411
W3D_CHUNK_AABTREE_HEADER, // catalog of the contents of the AABTree
393412
W3D_CHUNK_AABTREE_POLYINDICES, // array of uint32 polygon indices with count=mesh.PolyCount
@@ -922,6 +941,24 @@ struct W3dPS2ShaderStruct
922941
uint8 pad[3];
923942
};
924943

944+
struct W3dFXShaderInfoStruct
945+
{
946+
char ShaderName[W3D_NAME_LEN * 2];
947+
uint8 Technique;
948+
uint8 Pad[3];
949+
};
950+
951+
typedef enum
952+
{
953+
CONSTANT_TYPE_TEXTURE = 1,
954+
CONSTANT_TYPE_FLOAT1 = 2,
955+
CONSTANT_TYPE_FLOAT2 = 3,
956+
CONSTANT_TYPE_FLOAT3 = 4,
957+
CONSTANT_TYPE_FLOAT4 = 5,
958+
CONSTANT_TYPE_INT = 6,
959+
CONSTANT_TYPE_BOOL = 7
960+
} W3D_FX_SHADER_CONSTANT_TYPES;
961+
925962
inline void W3d_Shader_Reset(W3dShaderStruct * s) {
926963
s->DepthCompare = W3DSHADER_DEPTHCOMPARE_PASS_LEQUAL;
927964
s->DepthMask = W3DSHADER_DEPTHMASK_WRITE_ENABLE;

0 commit comments

Comments
 (0)