diffuse textures, alpha-tested foliage, second UV set, skinned characters
This commit is contained in:
parent
9f66afbe2a
commit
4a2231b14d
3 changed files with 932 additions and 63 deletions
|
|
@ -173,9 +173,10 @@ bool WriteMetadata(const std::filesystem::path& path,
|
|||
return static_cast<bool>(out);
|
||||
}
|
||||
|
||||
void OnRenderMesh(uint32_t mesh_context, uint32_t vertex_program_state) {
|
||||
void OnRenderMesh(uint8_t* base, uint32_t mesh_context, uint32_t vertex_program_state) {
|
||||
const uint32_t dyn = skate3::native_scene::CaptureDynamicState(base, mesh_context);
|
||||
std::lock_guard<std::mutex> lock(g_mutex);
|
||||
g_current_frame.push_back({0, mesh_context, vertex_program_state, 0});
|
||||
g_current_frame.push_back({0, mesh_context, vertex_program_state, dyn});
|
||||
}
|
||||
|
||||
// SceneRenderView draw-list renderer sub_827FAF50(view, sort_vec, first, count):
|
||||
|
|
@ -286,7 +287,7 @@ void Install() {
|
|||
// r3 = MeshContext*, r4 = renderengine::VertexProgramState*.
|
||||
extern "C" REX_FUNC(sub_82795AD8) {
|
||||
if (skate3::native_render::Enabled()) {
|
||||
skate3::native_render::OnRenderMesh(ctx.r3.u32, ctx.r4.u32);
|
||||
skate3::native_render::OnRenderMesh(base, ctx.r3.u32, ctx.r4.u32);
|
||||
}
|
||||
__imp__sub_82795AD8(ctx, base);
|
||||
}
|
||||
|
|
@ -310,3 +311,23 @@ extern "C" REX_FUNC(sub_82B82E08) {
|
|||
}
|
||||
__imp__sub_82B82E08(ctx, base);
|
||||
}
|
||||
|
||||
// cProcessArenaAsset::RegisterTexture(cAssetList*, cAssetID,
|
||||
// renderengine::Texture*, rw::Resource&): r4 = 64-bit asset guid,
|
||||
// r5 = texture object.
|
||||
extern "C" REX_FUNC(sub_82C9A618) {
|
||||
if (skate3::native_render::Enabled()) {
|
||||
skate3::native_scene::OnRegisterTexture(ctx.r4.u64, ctx.r5.u32);
|
||||
}
|
||||
__imp__sub_82C9A618(ctx, base);
|
||||
}
|
||||
|
||||
// D3D::SetPending_AluConstants(device, u64 dirty_group_mask, bank, ptr):
|
||||
// bank 0x4000 = vertex constants. Bone palettes are staged through here
|
||||
// right before the skinned RenderMesh calls that consume them.
|
||||
extern "C" REX_FUNC(sub_82B83FE0) {
|
||||
if (skate3::native_render::Enabled()) {
|
||||
skate3::native_scene::OnVsConstantUpload(base, ctx.r4.u64, ctx.r5.u32, ctx.r6.u32);
|
||||
}
|
||||
__imp__sub_82B83FE0(ctx, base);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,9 +25,21 @@ struct DrawItem {
|
|||
uint32_t ib_addr; // guest address of raw index data (u16 big-endian)
|
||||
uint32_t vb_bytes;
|
||||
uint32_t ib_count;
|
||||
uint32_t diffuse_tex; // guest renderengine::Texture address (0 = none)
|
||||
uint32_t lightmap_tex; // guest renderengine::Texture address (0 = none)
|
||||
uint16_t pos_offset;
|
||||
uint16_t uv_offset;
|
||||
uint16_t uv2_offset;
|
||||
uint16_t bw_offset; // blend weights (u8x4), valid when skinned
|
||||
uint16_t bi_offset; // blend indices (u8x4), valid when skinned
|
||||
uint8_t stride;
|
||||
uint8_t pos_fmt; // xenos vertex format (26 s16x4, 32 half4, 57 float3)
|
||||
uint8_t uv_fmt; // xenos vertex format of the first texcoord (0 = none)
|
||||
uint8_t uv2_fmt; // xenos vertex format of the second texcoord (0 = none)
|
||||
bool skinned;
|
||||
// Bone palette snapshot (row-vector 4x4 matrices) taken on the game thread
|
||||
// - the guest bone array lives in a transient per-frame arena.
|
||||
std::vector<float> bones;
|
||||
// Content fingerprint of the guest payloads. Streaming reuses arena
|
||||
// addresses and pages fill in after the mesh is first submitted, so cached
|
||||
// GPU copies must be revalidated against this every frame.
|
||||
|
|
@ -55,6 +67,21 @@ struct SubmitRecord {
|
|||
|
||||
bool Enabled();
|
||||
|
||||
// Called from the cProcessArenaAsset::RegisterTexture hook: guid -> guest
|
||||
// renderengine::Texture object.
|
||||
void OnRegisterTexture(uint64_t guid, uint32_t texture);
|
||||
|
||||
// Called from the D3D::SetPending_AluConstants hook (guest render thread).
|
||||
// Large vertex-bank uploads are bone palettes staged for the next skinned
|
||||
// RenderMesh; the staging bank is reused, so contents are snapshotted here.
|
||||
void OnVsConstantUpload(uint8_t* base, uint64_t mask, uint32_t bank, uint32_t ptr);
|
||||
|
||||
// Called from the RenderMesh hook for dynamic entities. Snapshots the
|
||||
// context's instance matrix (ctx+0x10 points into a transient per-frame
|
||||
// arena; it must be read now, not at frame end) and the pending bone
|
||||
// palette. Returns a dynamic-state index (+1), 0 on failure.
|
||||
uint32_t CaptureDynamicState(uint8_t* base, uint32_t ctx);
|
||||
|
||||
// Called on the guest render thread at frame end with the frame's records.
|
||||
void BuildFrameScene(uint8_t* base, const SubmitRecord* records, size_t count);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue