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:
shenlei
2026-09-23 20:15:54 +09:00
co-authored by Claude Opus 5.5
parent 668f48d6ec
commit 5bfa13c5cc
27 changed files with 3616 additions and 777 deletions
+46 -13
View File
@@ -2,19 +2,19 @@
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
#include "EterLib/StdAfx.h"
#include "EterLib/GrpScreen.h"
#include "EterLib/StateManager.h"
#include "../PlatformStub.h"
#include "UIRenderCommands.h"
#include <algorithm>
// 40250 GrpScreen.cpp:838
CScreen::CScreen()
{
MT_PLATFORM_STUB();
}
CScreen::~CScreen()
{
MT_PLATFORM_STUB();
}
auto CScreen::ClearDepthBuffer() -> void
@@ -27,15 +27,26 @@ auto CScreen::Clear() -> void
MT_PLATFORM_STUB();
}
auto CScreen::Begin() -> bool
// 40250 GrpScreen.cpp:691. CPythonApplication::Process brackets the frame's render with Begin/End; only
// inside the scene does CStateManager hand transforms to the recording device.
bool CScreen::Begin()
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
assert(ms_lpd3dDevice != NULL);
ResetFaceCount();
if (!STATEMANAGER.BeginScene())
{
Tracenf("BeginScene FAILED\n");
return false;
}
return true;
}
auto CScreen::End() -> void
// 40250 GrpScreen.cpp:705
void CScreen::End()
{
MT_PLATFORM_STUB();
STATEMANAGER.EndScene();
}
auto CScreen::Show(HWND) -> void
@@ -158,19 +169,41 @@ auto CScreen::RenderCylinder(const D3DXMATRIX *, float, float, float, float, flo
MT_PLATFORM_STUB();
}
auto CScreen::SetColorOperation() -> void
// 40250 GrpScreen.cpp
void CScreen::SetColorOperation()
{
MT_PLATFORM_STUB();
STATEMANAGER.SetTexture(0, NULL);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
}
auto CScreen::SetDiffuseOperation() -> void
// 40250 GrpScreen.cpp
void CScreen::SetDiffuseOperation()
{
MT_PLATFORM_STUB();
STATEMANAGER.SetTexture(0, NULL);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
}
auto CScreen::SetBlendOperation() -> void
// 40250 GrpScreen.cpp
void CScreen::SetBlendOperation()
{
MT_PLATFORM_STUB();
STATEMANAGER.SetTexture(0, NULL);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
}
auto CScreen::SetOneColorOperation(D3DXCOLOR &) -> void