2V2-e.1: 3D draw-command channel — recording D3D8 device, StateManager, GrpBase, camera
EterLib/StateManager.cpp and GrpBase.cpp ported verbatim. CGraphicDevice::Create builds a platform IDirect3DDevice8 that keeps the device state and records every Draw* call as a Render3DDraw (vertices decoded by FVF, strips/fans expanded, textures, world/view/proj, blend/depth/light state). The 40250 camera (__UpdateCamera, SetCenterPosition, ...) and the Process order (__UpdateCamera -> OnCameraUpdate -> OnUIUpdate -> Begin/SetInterfaceRenderState/OnUIRender/End) are in place; CScreen Begin/End, CPythonGraphic render states and CCullingManager::Process matrix updates are verbatim. port.login_flow asserts a textured, lit character draw under the RH perspective with every vertex on screen; offline and live pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
668f48d6ec
commit
5bfa13c5cc
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// The 3D draw calls the ported game render (CPythonApplication::RenderGame) issues through
|
||||
// CStateManager, recorded by the platform's IDirect3DDevice8 (RecordingDevice.cpp) and consumed by
|
||||
// Godot. Like UIRenderCommands.h this header stays free of D3D and godot-cpp types.
|
||||
//
|
||||
// Matrices are D3D8's row-vector layout (translation in elements 12..14), exactly as 40250 set them.
|
||||
struct Render3DDraw {
|
||||
float world[16];
|
||||
float view[16];
|
||||
float proj[16];
|
||||
|
||||
// Stage 0/1 textures, named like UIRenderTextureName: the pack path of a file texture or
|
||||
// "mem:<id>@<revision>"; empty when the stage has no texture.
|
||||
std::string texture0;
|
||||
std::string texture1;
|
||||
|
||||
// The referenced vertices, rebased so indices start at 0. normals/uv0/uv1/diffuse are empty when
|
||||
// the vertex format has no such element. pretransformed: D3DFVF_XYZRHW (screen-space x, y, z, rhw
|
||||
// in positions + rhw).
|
||||
bool pretransformed = false;
|
||||
std::vector<float> positions; // x, y, z
|
||||
std::vector<float> rhw;
|
||||
std::vector<float> normals; // x, y, z
|
||||
std::vector<float> uv0; // u, v
|
||||
std::vector<float> uv1; // u, v
|
||||
std::vector<std::uint32_t> diffuse; // 0xAARRGGBB
|
||||
std::vector<std::uint32_t> indices; // triangle list (strips and fans are expanded), or line list
|
||||
bool lines = false;
|
||||
|
||||
// D3DRS_* / D3DTSS_* values in effect for the draw.
|
||||
std::uint32_t alpha_blend = 0, src_blend = 0, dest_blend = 0;
|
||||
std::uint32_t alpha_test = 0, alpha_ref = 0, alpha_func = 0;
|
||||
std::uint32_t cull_mode = 0, z_enable = 0, z_write = 0, z_func = 0;
|
||||
std::uint32_t lighting = 0, texture_factor = 0, fog_enable = 0;
|
||||
std::uint32_t color_op[2] = {}, color_arg1[2] = {}, color_arg2[2] = {};
|
||||
std::uint32_t alpha_op[2] = {}, alpha_arg1[2] = {}, alpha_arg2[2] = {};
|
||||
// D3DMATERIAL8 diffuse/ambient/emissive (r, g, b, a) and light 0 when enabled.
|
||||
float material_diffuse[4] = {1, 1, 1, 1};
|
||||
float material_ambient[4] = {};
|
||||
float material_emissive[4] = {};
|
||||
bool light0 = false;
|
||||
float light0_direction[3] = {};
|
||||
float light0_diffuse[4] = {};
|
||||
float light0_ambient[4] = {};
|
||||
std::uint32_t ambient = 0; // D3DRS_AMBIENT
|
||||
};
|
||||
|
||||
void Render3DBeginFrame();
|
||||
void Render3DAdd(Render3DDraw draw);
|
||||
const std::vector<Render3DDraw>& Render3DDraws();
|
||||
Reference in New Issue
Block a user