mirror of
https://github.com/rrika/cdcEngineDXHR.git
synced 2025-02-20 05:40:35 +00:00
rename CommonSceneSub{10,114} to {RenderViewport,RenderGlobalState}
This commit is contained in:
parent
a1f8122c82
commit
8abb4179df
@ -43,12 +43,12 @@ void CommonRenderDevice::method_44() {
|
||||
}
|
||||
|
||||
void CommonRenderDevice::createSiblingScene(
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *viewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer)
|
||||
{
|
||||
// TODO
|
||||
createSubScene(sub10, renderTarget, depthBuffer);
|
||||
createSubScene(viewport, renderTarget, depthBuffer);
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -140,11 +140,11 @@ void CommonRenderDevice::method_E4() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
CommonSceneSub114 *CommonRenderDevice::getSceneSub114() {
|
||||
RenderGlobalState *CommonRenderDevice::getGlobalState() {
|
||||
if (scene7C)
|
||||
return &scene7C->sub114;
|
||||
return &scene7C->globalState;
|
||||
else
|
||||
return &sceneSub114_8C;
|
||||
return &globalState_8C;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ protected:
|
||||
public:
|
||||
CommonLightManager *lightManager; // 84
|
||||
protected:
|
||||
CommonSceneSub114 sceneSub114_8C; // 8C
|
||||
RenderGlobalState globalState_8C; // 8C
|
||||
public:
|
||||
|
||||
IRenderSurface *temporarySurfaces[64]; // 1E4
|
||||
@ -59,11 +59,11 @@ public:
|
||||
virtual void method_40();
|
||||
virtual void method_44();
|
||||
virtual CommonScene *createSubScene(
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *renderViewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer) = 0;
|
||||
virtual void createSiblingScene(
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *renderViewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer);
|
||||
virtual void finishScene() = 0;
|
||||
@ -113,7 +113,7 @@ public:
|
||||
virtual void method_DC() = 0;
|
||||
virtual void method_E0();
|
||||
virtual void method_E4();
|
||||
virtual CommonSceneSub114 *getSceneSub114();
|
||||
virtual RenderGlobalState *getGlobalState();
|
||||
virtual void method_EC() = 0;
|
||||
virtual void method_F0();
|
||||
virtual void method_F4();
|
||||
|
@ -13,14 +13,14 @@ class CommonScene;
|
||||
class DrawableListsAndMasks;
|
||||
class RenderPasses;
|
||||
|
||||
struct CommonSceneSub10 {
|
||||
struct RenderViewport {
|
||||
float cameraDirection[4]; // 50
|
||||
float cameraPosition[4]; // 60
|
||||
uint32_t dwordC0; // C0, for PCDX11DepthPassCallbacks::pre
|
||||
uint32_t mask; // E0
|
||||
};
|
||||
|
||||
struct CommonSceneSub114 {
|
||||
struct RenderGlobalState {
|
||||
TextureMap *tex14[13] = {0}; // 14
|
||||
// 14 [0]
|
||||
// 18 [1]
|
||||
@ -42,10 +42,10 @@ class CommonScene :
|
||||
public IRenderDrawable
|
||||
{
|
||||
public:
|
||||
CommonSceneSub10 sub10;
|
||||
RenderViewport viewport;
|
||||
float fogColor[4];
|
||||
// float float110;
|
||||
CommonSceneSub114 sub114;
|
||||
RenderGlobalState globalState;
|
||||
uint8_t byte25C; // reset by PCDX11CompositePassCallbacks::post
|
||||
// uint8_t f25D[2];
|
||||
// Matrix4x4 mat260;
|
||||
@ -110,11 +110,11 @@ public:
|
||||
CommonRenderDevice *renderDevice,
|
||||
/* ... */
|
||||
CommonScene *parentScene,
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *viewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer,
|
||||
/* ... */
|
||||
CommonSceneSub114 *sub114,
|
||||
RenderGlobalState *globalState,
|
||||
/* ... */
|
||||
RenderPasses *renderPasses)
|
||||
:
|
||||
@ -125,8 +125,8 @@ public:
|
||||
depthBuffer(depthBuffer),
|
||||
numSubScenes(0)
|
||||
{
|
||||
this->sub10 = *sub10;
|
||||
this->sub114 = *sub114;
|
||||
this->viewport = *viewport;
|
||||
this->globalState = *globalState;
|
||||
|
||||
fogScaleOffset[0] = 0.0f;
|
||||
fogScaleOffset[1] = 0.0f;
|
||||
@ -137,18 +137,18 @@ public:
|
||||
float4x4& getProjectMatrix() override { return projectMatrix; }
|
||||
void sceneC() override {}
|
||||
void getCameraPosition(float *pos) override {
|
||||
pos[0] = sub10.cameraPosition[0];
|
||||
pos[1] = sub10.cameraPosition[1];
|
||||
pos[2] = sub10.cameraPosition[2];
|
||||
pos[3] = sub10.cameraPosition[3];
|
||||
pos[0] = viewport.cameraPosition[0];
|
||||
pos[1] = viewport.cameraPosition[1];
|
||||
pos[2] = viewport.cameraPosition[2];
|
||||
pos[3] = viewport.cameraPosition[3];
|
||||
}
|
||||
void getCameraDirection(float *dir) override {
|
||||
dir[0] = sub10.cameraDirection[0];
|
||||
dir[1] = sub10.cameraDirection[1];
|
||||
dir[2] = sub10.cameraDirection[2];
|
||||
dir[3] = sub10.cameraDirection[3];
|
||||
dir[0] = viewport.cameraDirection[0];
|
||||
dir[1] = viewport.cameraDirection[1];
|
||||
dir[2] = viewport.cameraDirection[2];
|
||||
dir[3] = viewport.cameraDirection[3];
|
||||
}
|
||||
CommonSceneSub10& getSceneSub10() override { return sub10; }
|
||||
RenderViewport& getViewport() override { return viewport; }
|
||||
IRenderTarget *getRenderTarget() override { return renderTarget; }
|
||||
IDepthBuffer *getDepthBuffer() override { return depthBuffer; }
|
||||
void scene24() override {}
|
||||
@ -159,13 +159,13 @@ public:
|
||||
|
||||
void setSharedTextureToRenderTarget(CommonRenderTarget *rt, uint32_t slot, uint32_t) {
|
||||
if (rt) {
|
||||
sub114.tex14[slot + 5] = rt->getRenderTexture();
|
||||
globalState.tex14[slot + 5] = rt->getRenderTexture();
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
void setSharedTextureToDepthBuffer(CommonDepthBuffer *db, uint32_t slot) {
|
||||
if (db) {
|
||||
sub114.tex14[slot + 5] = db->getRenderTexture();
|
||||
globalState.tex14[slot + 5] = db->getRenderTexture();
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ struct float4x4;
|
||||
|
||||
namespace cdc {
|
||||
|
||||
class CommonSceneSub10;
|
||||
class RenderViewport;
|
||||
class IRenderTarget;
|
||||
class IDepthBuffer;
|
||||
|
||||
@ -16,7 +16,7 @@ public:
|
||||
virtual void sceneC() = 0;
|
||||
virtual void getCameraPosition(float *pos) = 0;
|
||||
virtual void getCameraDirection(float *dir) = 0;
|
||||
virtual CommonSceneSub10& getSceneSub10() = 0;
|
||||
virtual RenderViewport& getViewport() = 0;
|
||||
virtual IRenderTarget *getRenderTarget() = 0;
|
||||
virtual IDepthBuffer *getDepthBuffer() = 0;
|
||||
virtual void scene24() = 0;
|
||||
|
@ -61,8 +61,8 @@ void buildUI(RenderPasses *renderPasses, DrawableListsAndMasks *lists) {
|
||||
|
||||
void buildUI(CommonScene *scene) {
|
||||
for (uint32_t i=0; i<13; i++) {
|
||||
TextureMap *t = scene->sub114.tex14[i];
|
||||
ImGui::Text("shared texture %d: %p", i, t);
|
||||
TextureMap *t = scene->globalState.tex14[i];
|
||||
ImGui::Text("global texture %d: %p", i, t);
|
||||
if (auto renderTexture = dynamic_cast<PCDX11RenderTexture*>(t)) {
|
||||
auto s = renderTexture->createShaderResourceView();
|
||||
if (s)
|
||||
|
@ -78,11 +78,11 @@ void PCDX11Material::setupVertexResources(
|
||||
texref[i].filter,
|
||||
texref[i].unknown4);
|
||||
|
||||
// assign refIndexEndA..refIndexBeginB from submaterial or CommonSceneSub114
|
||||
// assign refIndexEndA..refIndexBeginB from submaterial or RenderGlobalState
|
||||
CommonScene *scene = renderDevice->scene78;
|
||||
for (uint32_t i = subMat->vsRefIndexEndA; i < subMat->vsRefIndexBeginB; i++) {
|
||||
auto fi = texref[i].fallbackIndex & 0x1F;
|
||||
PCDX11Texture* tex = static_cast<PCDX11Texture*>(scene->sub114.tex14[fi]);
|
||||
PCDX11Texture* tex = static_cast<PCDX11Texture*>(scene->globalState.tex14[fi]);
|
||||
if (!tex) tex = static_cast<PCDX11Texture*>(texref[i].tex);
|
||||
renderDevice->setTexture(
|
||||
texref[i].slotIndex + 257,
|
||||
@ -138,11 +138,11 @@ void PCDX11Material::setupPixelResources(
|
||||
texref[i].unknown4);
|
||||
}
|
||||
|
||||
// assign refIndexEndA..refIndexBeginB from submaterial or CommonSceneSub114
|
||||
// assign refIndexEndA..refIndexBeginB from submaterial or RenderGlobalState
|
||||
CommonScene *scene = renderDevice->scene78;
|
||||
for (uint32_t i = subMat->psRefIndexEndA; i < subMat->psRefIndexBeginB; i++) {
|
||||
auto fi = texref[i].fallbackIndex & 0x1F;
|
||||
PCDX11Texture* tex = static_cast<PCDX11Texture*>(scene->sub114.tex14[fi]);
|
||||
PCDX11Texture* tex = static_cast<PCDX11Texture*>(scene->globalState.tex14[fi]);
|
||||
if (!tex) tex = static_cast<PCDX11Texture*>(texref[i].tex);
|
||||
renderDevice->setTexture(
|
||||
texref[i].slotIndex,
|
||||
@ -205,13 +205,13 @@ void PCDX11Material::setupStencil(
|
||||
uint32_t matDword18 = materialBlob->dword18;
|
||||
bool frontCounterClockwise = bool(flags & 2);
|
||||
bool stencilDoubleSided = bool(stencilSettings->back & 1);
|
||||
bool ext128DoubleSided = bool(matInstance->dword14 & 0x40);
|
||||
bool matInstanceDoubleSided = bool(matInstance->dword14 & 0x40);
|
||||
bool materialDoubleSided = bool(matDword18 & 0x80);
|
||||
bool materialRenderTwice = bool(matDword18 & 0x800);
|
||||
bool materialCullFront = bool(matDword18 & 0x2000);
|
||||
|
||||
if (stencilDoubleSided || (
|
||||
(materialDoubleSided || ext128DoubleSided) &&
|
||||
(materialDoubleSided || matInstanceDoubleSided) &&
|
||||
!(materialRenderTwice && honorRenderTwice)
|
||||
))
|
||||
stateManager->setCullMode(CullMode::none, frontCounterClockwise);
|
||||
@ -249,12 +249,12 @@ void PCDX11Material::setupMg4(
|
||||
// redo some of what setupStencil did earlier
|
||||
uint32_t matDword18 = materialBlob->dword18;
|
||||
bool frontCounterClockwise = bool(flags & 2);
|
||||
bool ext128DoubleSided = bool(matInstance->dword14 & 0x40);
|
||||
bool matInstanceDoubleSided = bool(matInstance->dword14 & 0x40);
|
||||
bool materialDoubleSided = bool(matDword18 & 0x80);
|
||||
bool materialRenderTwice = bool(matDword18 & 0x800);
|
||||
bool materialCullFront = bool(matDword18 & 0x2000);
|
||||
|
||||
if ((materialDoubleSided || ext128DoubleSided) && !materialRenderTwice)
|
||||
if ((materialDoubleSided || matInstanceDoubleSided) && !materialRenderTwice)
|
||||
stateManager->setCullMode(CullMode::none, frontCounterClockwise);
|
||||
else if (materialCullFront)
|
||||
stateManager->setCullMode(CullMode::front, frontCounterClockwise);
|
||||
@ -448,7 +448,7 @@ PCDX11StreamDecl *PCDX11Material::buildStreamDecl4(
|
||||
}
|
||||
|
||||
PCDX11StreamDecl *PCDX11Material::buildStreamDecl038(
|
||||
MaterialInstanceData *ext128sub10,
|
||||
MaterialInstanceData *matInstance,
|
||||
void *drawableExtDword50,
|
||||
void *lightConstantBufferData,
|
||||
uint32_t vsSelect,
|
||||
@ -462,9 +462,9 @@ PCDX11StreamDecl *PCDX11Material::buildStreamDecl038(
|
||||
const uint32_t subMaterialIndex = 3;
|
||||
MaterialBlobSub *subMaterial = materialBlob->subMat4C[subMaterialIndex];
|
||||
|
||||
setupDepthBias(ext128sub10);
|
||||
//setupStencil(ext128sub10, true, flags);
|
||||
stateManager->setDepthRange(ext128sub10->minDepth, ext128sub10->maxDepth);
|
||||
setupDepthBias(matInstance);
|
||||
//setupStencil(matInstance, true, flags);
|
||||
stateManager->setDepthRange(matInstance->minDepth, matInstance->maxDepth);
|
||||
stateManager->setBlendStateAndBlendFactors(materialBlob->blendState24, 0, 0);
|
||||
|
||||
uint32_t vertexIndex = vsSelect;
|
||||
@ -480,10 +480,10 @@ PCDX11StreamDecl *PCDX11Material::buildStreamDecl038(
|
||||
auto vertexShader = (*vertexTable)[vertexIndex];
|
||||
stateManager->setVertexShader(vertexShader);
|
||||
|
||||
setupPixelResources(subMaterialIndex, subMaterial, ext128sub10, (char*)drawableExtDword50, true);
|
||||
setupVertexResources(subMaterialIndex, subMaterial, ext128sub10, (char*)drawableExtDword50, true);
|
||||
setupPixelResources(subMaterialIndex, subMaterial, matInstance, (char*)drawableExtDword50, true);
|
||||
setupVertexResources(subMaterialIndex, subMaterial, matInstance, (char*)drawableExtDword50, true);
|
||||
|
||||
auto *streamDecl = static_cast<PCDX11StreamDecl*>(ext128sub10->streamDecls24[subMaterialIndex]);
|
||||
auto *streamDecl = static_cast<PCDX11StreamDecl*>(matInstance->streamDecls24[subMaterialIndex]);
|
||||
if (!streamDecl) {
|
||||
VertexAttributeLayoutB *layoutB = subMaterial->vsLayout[vsSelect];
|
||||
|
||||
|
@ -315,7 +315,7 @@ void PCDX11RenderDevice::method_30() {
|
||||
}
|
||||
|
||||
CommonScene *PCDX11RenderDevice::createSubScene(
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *viewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer
|
||||
) {
|
||||
@ -323,10 +323,10 @@ CommonScene *PCDX11RenderDevice::createSubScene(
|
||||
auto scene = new (linear30, 1, true) PCDX11Scene(
|
||||
this,
|
||||
scene7C, // parent scene perhaps?
|
||||
sub10,
|
||||
viewport,
|
||||
renderTarget,
|
||||
depthBuffer,
|
||||
getSceneSub114(),
|
||||
getGlobalState(),
|
||||
&renderPasses);
|
||||
scene7C = scene;
|
||||
return scene;
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
void method_2C() override;
|
||||
void method_30() override;
|
||||
CommonScene *createSubScene(
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *renderViewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer) override;
|
||||
void finishScene() override;
|
||||
|
@ -127,7 +127,7 @@ bool PCDX11DepthPassCallbacks::pre(
|
||||
|
||||
if (scene->depthBuffer) {
|
||||
// TODO: scene->depthBuffer->byte14 = 0;
|
||||
uint32_t dwordC0 = scene->sub10.dwordC0;
|
||||
uint32_t dwordC0 = scene->viewport.dwordC0;
|
||||
if (dwordC0 == 24 || dwordC0 == 26) {
|
||||
float color[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
renderDevice->clearRenderTargetNow(2, color, 1.0, 0);
|
||||
@ -161,7 +161,7 @@ void PCDX11DepthPassCallbacks::post(
|
||||
CommonScene *scene = renderDevice->scene78;
|
||||
if (scene->depthBuffer) {
|
||||
// TODO: scene->depthBuffer->byte14 = 1;
|
||||
scene->sub114.tex14[10] = scene->depthBuffer->getRenderTexture();
|
||||
scene->globalState.tex14[10] = scene->depthBuffer->getRenderTexture();
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ void PCDX11PostFSXPassCallbacks::post(
|
||||
// (*(void (**)(void))(*(_DWORD *)scene->postFsxRelated7A4 + 12))();
|
||||
// scene->postFsxRelated7A4 = 0;
|
||||
// }
|
||||
// scene->base.sub114.dword38 = 0;
|
||||
// scene->base.globalState.dword38 = 0;
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -43,14 +43,14 @@ void PCDX11Scene::updateUniforms() {
|
||||
stateManager->setProjectMatrix(projectMatrix);
|
||||
// TODO
|
||||
float row[4];
|
||||
row[0] = sub10.cameraPosition[0];
|
||||
row[1] = sub10.cameraPosition[1];
|
||||
row[2] = sub10.cameraPosition[2];
|
||||
row[0] = viewport.cameraPosition[0];
|
||||
row[1] = viewport.cameraPosition[1];
|
||||
row[2] = viewport.cameraPosition[2];
|
||||
row[3] = 0.0f;
|
||||
sceneBuffer.assignRow(10, row, 1); // SceneBuffer::CameraPosition
|
||||
row[0] = sub10.cameraDirection[0];
|
||||
row[1] = sub10.cameraDirection[1];
|
||||
row[2] = sub10.cameraDirection[2];
|
||||
row[0] = viewport.cameraDirection[0];
|
||||
row[1] = viewport.cameraDirection[1];
|
||||
row[2] = viewport.cameraDirection[2];
|
||||
row[3] = 0.0f;
|
||||
sceneBuffer.assignRow(11, row, 1); // SceneBuffer::CameraDirection
|
||||
row[0] = heightFogParams[0];
|
||||
|
@ -11,19 +11,19 @@ public:
|
||||
CommonRenderDevice *renderDevice,
|
||||
/* ... */
|
||||
CommonScene *parentScene,
|
||||
CommonSceneSub10 *sub10,
|
||||
RenderViewport *viewport,
|
||||
CommonRenderTarget *renderTarget,
|
||||
CommonDepthBuffer *depthBuffer,
|
||||
/* ... */
|
||||
CommonSceneSub114 *sub114,
|
||||
RenderGlobalState *globalState,
|
||||
/* ... */
|
||||
RenderPasses *renderPasses)
|
||||
:
|
||||
CommonScene(renderDevice, parentScene, sub10, renderTarget, depthBuffer, sub114, renderPasses),
|
||||
CommonScene(renderDevice, parentScene, viewport, renderTarget, depthBuffer, globalState, renderPasses),
|
||||
renderDevice(static_cast<PCDX11RenderDevice*>(renderDevice))
|
||||
{
|
||||
// TODO
|
||||
uint32_t mask = sub10->mask;
|
||||
uint32_t mask = viewport->mask;
|
||||
// TODO
|
||||
drawableListsAndMasks = renderPasses->createDrawableLists(kRegularPass, mask, renderDevice->getLinear());
|
||||
}
|
||||
|
@ -528,8 +528,8 @@ int spinnyCube(HWND window,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
cdc::CommonSceneSub10 commonSceneSub10;
|
||||
commonSceneSub10.mask = 0x3103; // pass 0, 12. 13, 1, and 8
|
||||
cdc::RenderViewport renderViewport;
|
||||
renderViewport.mask = 0x3103; // pass 0, 12. 13, 1, and 8
|
||||
// pass 12 normals (function set 10, draw bottle normals)
|
||||
// pass 13 deferred shading (just contains a cleardrawable)
|
||||
// pass 1 composite (draw bottle textures)
|
||||
@ -632,7 +632,7 @@ int spinnyCube(HWND window,
|
||||
renderDevice->resetRenderLists();
|
||||
renderDevice->beginRenderList(nullptr);
|
||||
auto *scene = renderDevice->createSubScene(
|
||||
&commonSceneSub10,
|
||||
&renderViewport,
|
||||
renderContext->renderTarget2C,
|
||||
renderContext->depthBuffer);
|
||||
scene->viewMatrix = translate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user