- Volition VPP: Unified BE/LE types using inheritance pattern - THQA PAK: Child types now inherit byte order from parent - Various XScript definition updates and fixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
68 lines
2.2 KiB
Plaintext
68 lines
2.2 KiB
Plaintext
type materialtechnique ui("Material Technique")
|
|
{
|
|
const PTR_INLINE = -1;
|
|
|
|
i32 technique_name_ptr ui("Technique Name Ptr");
|
|
u16 flags ui("Flags");
|
|
u16 pass_count ui("Pass Count");
|
|
|
|
// COD zone streaming order:
|
|
// 1. All pass HEADERS (20 bytes each)
|
|
// 2. Technique name (if inline)
|
|
// 3. Inline data for each pass (vertex_decl, vertex_shader, pixel_shader, args)
|
|
|
|
// First pass: Read all pass headers (20 bytes each) and store key values
|
|
// MaterialPass header = vertex_decl_ptr(4) + vertex_shader_ptr(4) + pixel_shader_ptr(4) +
|
|
// arg_counts(4) + args_ptr(4) = 20 bytes
|
|
_pass_headers_start = pos();
|
|
_pass_header_size = 20;
|
|
if (pass_count > 0) {
|
|
_total_header_bytes = pass_count * _pass_header_size;
|
|
pass_headers_raw = read(_total_header_bytes);
|
|
}
|
|
|
|
// Inline data
|
|
if (technique_name_ptr == PTR_INLINE) {
|
|
technique_name = cstring() ui("Technique Name");
|
|
set_name(technique_name);
|
|
}
|
|
|
|
// Second pass: Parse inline data for each pass based on stored header values
|
|
// Just parse sequentially - data is laid out in order
|
|
if (pass_count > 0) {
|
|
repeat(pass_count) {
|
|
_base = _pass_headers_start + (_i * _pass_header_size);
|
|
_vertex_decl_ptr = i32at(_base);
|
|
_vertex_shader_ptr = i32at(_base + 4);
|
|
_pixel_shader_ptr = i32at(_base + 8);
|
|
_per_prim_arg_count = u8at(_base + 12);
|
|
_per_obj_arg_count = u8at(_base + 13);
|
|
_stable_arg_count = u8at(_base + 14);
|
|
_args_ptr = i32at(_base + 16);
|
|
|
|
// Parse vertex declaration if inline
|
|
if (_vertex_decl_ptr == PTR_INLINE) {
|
|
_vd = parse_here("materialvertexdeclaration");
|
|
}
|
|
|
|
// Parse vertex shader if inline
|
|
if (_vertex_shader_ptr == PTR_INLINE) {
|
|
_vs = parse_here("materialvertexshader");
|
|
}
|
|
|
|
// Parse pixel shader if inline
|
|
if (_pixel_shader_ptr == PTR_INLINE) {
|
|
_ps = parse_here("pixelshader");
|
|
}
|
|
|
|
// Parse shader arguments if inline
|
|
_arg_count = _stable_arg_count + _per_obj_arg_count + _per_prim_arg_count;
|
|
if (_args_ptr == PTR_INLINE && _arg_count > 0) {
|
|
repeat(_arg_count) {
|
|
_arg = parse_here("materialshaderargument");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|