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
@@ -8,6 +8,7 @@
// RenderCoolTimeBox:CSlotWindow::OnRender 画技能冷却扇形用的,没有渲染设备时什么都不做。
#include "EterPythonLib/StdAfx.h"
#include "EterPythonLib/PythonGraphic.h"
#include "EterLib/StateManager.h"
#include "../PlatformStub.h"
#include "../EterLib/UIRenderCommands.h"
@@ -37,13 +38,81 @@ void CPythonGraphic::RenderDownButton(float, float, float, float) { MT_PLATFORM_
bool CPythonGraphic::SaveScreenShot(const char*) { MT_PLATFORM_STUB(); return false; }
void CPythonGraphic::SetCursorPosition(int, int) { MT_PLATFORM_STUB(); }
DWORD CPythonGraphic::GetAvailableMemory() { MT_PLATFORM_STUB(); return 0; }
void CPythonGraphic::SetGameRenderState() { MT_PLATFORM_STUB(); }
void CPythonGraphic::SetInterfaceRenderState() { MT_PLATFORM_STUB(); }
void CPythonGraphic::PushState() { MT_PLATFORM_STUB(); }
void CPythonGraphic::PopState() { MT_PLATFORM_STUB(); }
void CPythonGraphic::SetGamma(float) { MT_PLATFORM_STUB(); }
void CPythonGraphic::RenderCoolTimeBox(float fxCenter, float fyCenter, float fRadius, float fTime)
{
MT_PLATFORM_STUB();
}
// 40250 PythonGraphic.cpp:17
float CPythonGraphic::GetOrthoDepth()
{
return m_fOrthoDepth;
}
// 40250 PythonGraphic.cpp:22
void CPythonGraphic::SetInterfaceRenderState()
{
STATEMANAGER.SetTransform(D3DTS_PROJECTION, &ms_matIdentity);
STATEMANAGER.SetTransform(D3DTS_VIEW, &ms_matIdentity);
STATEMANAGER.SetTransform(D3DTS_WORLD, &ms_matIdentity);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_NONE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_NONE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_NONE);
STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
STATEMANAGER.SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
STATEMANAGER.SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
CPythonGraphic::Instance().SetBlendOperation();
CPythonGraphic::Instance().SetOrtho2D(ms_iWidth, ms_iHeight, GetOrthoDepth());
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, FALSE);
}
// 40250 PythonGraphic.cpp:42
void CPythonGraphic::SetGameRenderState()
{
STATEMANAGER.SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, TRUE);
}
// 40250 PythonGraphic.cpp:387
void CPythonGraphic::PushState()
{
TState curState;
curState.matProj = ms_matProj;
curState.matView = ms_matView;
//STATEMANAGER.SaveTransform(D3DTS_WORLD, &m_SaveWorldMatrix);
m_stateStack.push(curState);
//CCamera::Instance().PushParams();
}
// 40250 PythonGraphic.cpp:399
void CPythonGraphic::PopState()
{
if (m_stateStack.empty())
{
assert(!"PythonGraphic::PopState StateStack is EMPTY");
return;
}
TState & rState = m_stateStack.top();
//STATEMANAGER.RestoreTransform(D3DTS_WORLD);
ms_matProj = rState.matProj;
ms_matView = rState.matView;
UpdatePipeLineMatrix();
m_stateStack.pop();
//CCamera::Instance().PopParams();
}