Model preview: AVA2 render-target window on a Vulkan colour target

Port of AVA2's CRenderTarget / GrpRenderTargetTexture / renderTarget module.
The host gains an RGBA8 offscreen colour pass for D3D colour render targets;
mt_preview shows wearable items on every allowed race and monsters with
motions, reached by X+click in the inventory and shop and from the wiki.
Player races are created as TYPE_PC so their parts exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-16 04:48:07 +09:00
co-authored by Claude Opus 5.5
parent 32372c2a73
commit 84404cf1f1
25 changed files with 1602 additions and 34 deletions
@@ -0,0 +1,74 @@
#include "StdAfx.h"
#include "CRenderTargetManager.h"
#include "../EterBase/Stl.h"
#include <memory>
CRenderTargetManager::CRenderTargetManager(){}
CRenderTargetManager::~CRenderTargetManager()
{
Destroy();
}
void CRenderTargetManager::Destroy()
{
m_renderTargets.clear();
}
void CRenderTargetManager::DeformModels()
{
for (const auto& elem : m_renderTargets)
elem.second->DeformModel();
}
void CRenderTargetManager::UpdateModels()
{
for (auto& elem : m_renderTargets)
elem.second->UpdateModel();
}
// PORT: the background is drawn into the target by RenderModel (CRenderTarget::RenderBackground).
void CRenderTargetManager::RenderBackgrounds()
{
}
void CRenderTargetManager::RenderModels()
{
for (const auto& elem : m_renderTargets)
elem.second->RenderModel();
}
void CRenderTargetManager::CreateRenderTargetTextures()
{
for (const auto& elem : m_renderTargets)
elem.second->CreateTextures();
}
void CRenderTargetManager::ReleaseRenderTargetTextures()
{
for (const auto& elem : m_renderTargets)
elem.second->ReleaseTextures();
}
bool CRenderTargetManager::CreateRenderTarget(const int index, const int width, const int height)
{
// PORT: the size check guards the recording device, which allocates the target's bytes up front.
if (index < 1 || GetRenderTarget(index) || width < 1 || height < 1 || width > 2048 || height > 2048)
return false;
try
{
m_renderTargets.emplace(index, std::make_shared<CRenderTarget>(width, height));
}
catch (const std::exception&)
{
return false;
}
return true;
}
void CRenderTargetManager::RemoveRenderTarget(const int index)
{
const auto it = m_renderTargets.find(index);
if (it != m_renderTargets.end())
{
it->second->ResetModel();
m_renderTargets.erase(index);
}
}
std::shared_ptr<CRenderTarget> CRenderTargetManager::GetRenderTarget(const int index)
{
const auto it = m_renderTargets.find(index);
if (it != m_renderTargets.end())
return it->second;
return nullptr;
}