port 2V2-d.2: Granny runtime on libgr2, main character model animates

Implement the Granny SDK 2.11 API the client uses on top of libgr2
(platform/EterGrnLib/GrannyRuntime.cpp, shim granny.h declared from the
SDK header): file sections, type-definition vertex conversion, material
textures by Usage, mesh/bone bindings, deformer, control clock/loop/ease
and weighted SRT sampling. Port EterGrnLib (LODController, Material, Mesh,
Model, ModelInstance*, Motion, Thing, ThingInstance, Util) plus EterLib
GrpObjectInstance/GrpCollisionObject/CollisionData verbatim and drop their
platform skeletons and pending stand-ins; register the gr2 resource
factory; vertex/index buffers are CPU-side until the 2V2-e render adapter.

app.UpdateGame/RenderGame now run 40250's bodies, reaching the
CPythonApplication members through their singletons (the platform has no
app object); CPythonGraphic joins GameSingletons in member order, and
GetMousePosition reads the host cursor.

port.login_flow asserts the main instance's PART_MAIN model has meshes,
its diffuse image loaded and the WAIT motion moves the bones between
frames; offline and live pass, port_gate macos PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-23 19:43:27 +09:00
co-authored by Claude Opus 5.5
parent 5266b00c6e
commit 668f48d6ec
74 changed files with 11404 additions and 2356 deletions
@@ -86,8 +86,107 @@ bool CPythonApplication::Create(PyObject*, const char*, int, int, int)
}
return true;
}
void CPythonApplication::UpdateGame() { MT_PLATFORM_STUB(); }
void CPythonApplication::RenderGame() { MT_PLATFORM_STUB(); }
// 40250 PythonApplication.cpp:105
void CPythonApplication::GetMousePosition(POINT* ppt)
{
CMSApplication::GetMousePosition(ppt);
}
// 40250 PythonApplication.cpp:168, the !PERF_CHECKER_RENDER_GAME branch (the profiling copy below it
// only adds timers). game.GameWindow.OnRender calls it every frame.
// PORT: the members are reached through their singletons (see the note at the top of the file).
void CPythonApplication::RenderGame()
{
float fAspect=UI::CWindowManager::Instance().GetAspect();
float fFarClip=CPythonBackground::Instance().GetFarClip();
CPythonGraphic::Instance().SetPerspective(30.0f, fAspect, 100.0, fFarClip);
CCullingManager::Instance().Process();
CPythonCharacterManager::Instance().Deform();
CEffectManager::Instance().Update();
CPythonBackground::Instance().RenderCharacterShadowToTexture();
CPythonGraphic::Instance().SetGameRenderState();
CPythonGraphic::Instance().PushState();
{
long lx, ly;
UI::CWindowManager::Instance().GetMousePosition(lx, ly);
CPythonGraphic::Instance().SetCursorPosition(lx, ly);
}
CPythonBackground::Instance().RenderSky();
CPythonBackground::Instance().RenderBeforeLensFlare();
CPythonBackground::Instance().RenderCloud();
CPythonBackground::Instance().BeginEnvironment();
CPythonBackground::Instance().Render();
CPythonBackground::Instance().SetCharacterDirLight();
CPythonCharacterManager::Instance().Render();
CPythonBackground::Instance().SetBackgroundDirLight();
CPythonBackground::Instance().RenderWater();
CPythonBackground::Instance().RenderSnow();
CPythonBackground::Instance().RenderEffect();
CPythonBackground::Instance().EndEnvironment();
CEffectManager::Instance().Render();
CPythonItem::Instance().Render();
CFlyingManager::Instance().Render();
CPythonBackground::Instance().BeginEnvironment();
CPythonBackground::Instance().RenderPCBlocker();
CPythonBackground::Instance().EndEnvironment();
CPythonBackground::Instance().RenderAfterLensFlare();
}
// 40250 PythonApplication.cpp:321 without the PERF_CHECKER_RENDER_GAME timers. game.GameWindow.OnUpdate
// calls it every frame. PORT: members through their singletons, as in RenderGame.
void CPythonApplication::UpdateGame()
{
POINT ptMouse;
GetMousePosition(&ptMouse);
CGraphicTextInstance::Hyperlink_UpdateMousePos(ptMouse.x, ptMouse.y);
//!@# Alt+Tab 중 SetTransfor 에서 튕김 현상 해결을 위해 - [levites]
//if (m_isActivateWnd)
{
CScreen s;
float fAspect = UI::CWindowManager::Instance().GetAspect();
float fFarClip = CPythonBackground::Instance().GetFarClip();
s.SetPerspective(30.0f,fAspect, 100.0f, fFarClip);
s.BuildViewFrustum();
}
TPixelPosition kPPosMainActor;
CPythonPlayer::Instance().NEW_GetMainActorPosition(&kPPosMainActor);
CPythonBackground::Instance().Update(kPPosMainActor.x, kPPosMainActor.y, kPPosMainActor.z);
CGameEventManager::Instance().SetCenterPosition(kPPosMainActor.x, kPPosMainActor.y, kPPosMainActor.z);
CGameEventManager::Instance().Update();
CPythonCharacterManager::Instance().Update();
CEffectManager::Instance().UpdateSound();
CFlyingManager::Instance().Update();
CPythonItem::Instance().Update(ptMouse);
CPythonPlayer::Instance().Update();
// NOTE : Update 에서 위치 값이 바뀌므로 다시 얻어 옵니다 - [levites]
// 이 부분 때문에 메인 케릭터의 Sound가 이전 위치에서 플레이 되는 현상이 있었음.
CPythonPlayer::Instance().NEW_GetMainActorPosition(&kPPosMainActor);
SetCenterPosition(kPPosMainActor.x, kPPosMainActor.y, kPPosMainActor.z);
}
// 40250 PythonApplication.cpp:399. Kept in order: timer, network (2V1), input polling (Godot pushes
// input instead), camera (2V3), resource GC, mouse/UI update, then the render block's interface pass.
@@ -166,7 +265,6 @@ void CMovieMan::PlayLogo(const char*) { MT_PLATFORM_STUB(); }
BOOL PERF_CHECKER_RENDER_GAME = FALSE;
BOOL SKILL_EFFECT_UPGRADE_ENABLE = FALSE;
D3DXCOLOR g_fSpecularColor;
double g_specularSpd = 0;
bool LoadLocaleData(const char*) { MT_PLATFORM_STUB(); return false; }