cdcScene: collect individual IScene* headers into cdcScene.h

This commit is contained in:
Adam Jensen 2024-05-06 00:46:37 +01:00
parent e4908096d9
commit 266de06374
21 changed files with 123 additions and 142 deletions

View File

@ -1,19 +0,0 @@
#pragma once
#include <cstdint>
namespace cdc {
class SceneCellGroup;
class SceneEntity;
struct RenderViewport;
class IScene {
public:
// 42 methods
virtual void Render(/*TODO*/) = 0; // 4
virtual void RenderWithoutCellTracing(RenderViewport& viewport /*TODO*/) = 0; // 8
virtual SceneCellGroup *GetCellGroup(uint32_t) = 0; // 24
virtual SceneEntity *CreateEntity() = 0; // 28
};
}

View File

@ -1,9 +0,0 @@
#pragma once
namespace cdc {
class ISceneCell {
// 27 methods
};
}

View File

@ -1,22 +0,0 @@
#pragma once
#include <cstdint>
namespace cdc {
class Scene;
class SceneCell;
class ISceneCellGroup {
public:
// 23 methods
virtual Scene *getScene() = 0; // 4
virtual uint32_t getCellCount() = 0; // 8
virtual SceneCell *cellByIndex(uint32_t index) = 0; // 10
virtual SceneCell *queryPoint(float *point, bool useThisContainer) = 0; // 14
virtual float *getOrigin() = 0; // 20
virtual void setUserData(void *) = 0; // 38
virtual void setName(const char *) = 0; // 48
virtual const char *getName() = 0; // 4C
};
}

View File

@ -1,39 +0,0 @@
#pragma once
#include <cstdint>
#include "cdcMath/Math.h"
namespace cdc {
class IDrawable;
class ISceneCellGroup;
class ISceneEntity {
public:
struct UpdateState {
static const uint32_t kEnabled = 1;
static const uint32_t kDrawable = 2;
static const uint32_t kCellGroup = 4;
static const uint32_t kMatrix = 8;
static const uint32_t kMoveState = 16;
static const uint32_t kUpdateVolume = 32;
static const uint32_t kUpdateFlags = 64;
static const uint32_t kUpdateAll = 127;
uint32_t updateFlags;
bool enabled;
IDrawable *drawable;
SceneCellGroup *cellGroup;
Matrix matrix;
uint32_t moveState;
};
// 25 methods
virtual void ApplyUpdateState(UpdateState*) = 0; // 0
virtual void setMatrix(Matrix&) = 0; // 4
virtual Matrix& getMatrix() = 0; // 8
virtual void setDrawable(IDrawable *) = 0; // C
virtual IDrawable *getDrawable() = 0; // 10
virtual void setCellGroup(ISceneCellGroup *) = 0; // 38
};
}

View File

@ -1,10 +0,0 @@
#pragma once
#include "ISceneEntity.h"
namespace cdc {
class ISceneLight : public ISceneEntity {
// 40 methods
};
}

View File

@ -1,9 +0,0 @@
#pragma once
namespace cdc {
class IScenePortal {
// 7 methods
};
}

View File

@ -18,11 +18,11 @@ Scene::Scene(CommonRenderDevice *renderDevice) : // line 199
sceneCellGroups.back()->allocateCells();
}
SceneCellGroup *Scene::GetCellGroup(uint32_t index) { // line 1540
ISceneCellGroup *Scene::GetCellGroup(uint32_t index) { // line 1540
return sceneCellGroups[index];
}
SceneEntity *Scene::CreateEntity() { // line 1570
ISceneEntity *Scene::CreateEntity() { // line 1570
return new SceneEntity(this/*, TODO*/);
}
@ -38,7 +38,7 @@ void Scene::TraverseForView(/*TODO*/) { // line 648
std::unordered_set<SceneEntity*> entities;
for (auto group : sceneCellGroups) {
for (uint32_t i = 0; i < group->getCellCount(); i++) {
auto *cell = group->cellByIndex(i);
auto *cell = static_cast<SceneCell*>/*TODO*/(group->cellByIndex(i));
for (uint16_t j = 0; j < cell->numSubCells; j++) {
auto *subcell = &cell->subCells[j];
for (auto ent : subcell->entities)

View File

@ -1,8 +1,8 @@
#pragma once
#include <vector>
#include "cdcScene.h"
#include "rendering/CommonScene.h"
#include "rendering/Culling/Primitives.h"
#include "IScene.h"
namespace cdc {
@ -39,8 +39,8 @@ public:
// 43 methods
void Render() override;
void RenderWithoutCellTracing(RenderViewport& viewport) override;
SceneCellGroup *GetCellGroup(uint32_t index) override;
SceneEntity *CreateEntity() override;
ISceneCellGroup *GetCellGroup(uint32_t index) override;
ISceneEntity *CreateEntity() override;
};
}

View File

@ -1,6 +1,6 @@
#pragma once
#include <cstdlib>
#include "ISceneCell.h"
#include "cdcScene.h"
#include "SceneCellContainer.h"
#include "SceneCellGroup.h"
#include "SceneSubCell.h"

View File

@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include "cdcScene.h"
namespace cdc {

View File

@ -1,3 +1,4 @@
#include "Scene.h"
#include "SceneCell.h"
#include "SceneCellGroup.h"
#include "cdcSceneCookdata.h"
@ -58,4 +59,24 @@ void SceneCellGroup::allocateCells() {
}
}
IScene *SceneCellGroup::getScene() { return scene1C; }
uint32_t SceneCellGroup::getCellCount() { return cells.size(); }
ISceneCell *SceneCellGroup::cellByIndex(uint32_t index) { return cells[index]; }
ISceneCell *SceneCellGroup::queryPoint(float *point, bool useThisContainer) {
return SceneCellContainer::queryPoint(point, useThisContainer);
}
float *SceneCellGroup::getOrigin() { return origin; }
void SceneCellGroup::setUserData(void *) {
// TODO
}
void SceneCellGroup::setName(const char *newName) { name = newName; }
const char *SceneCellGroup::getName() { return name; }
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <vector>
#include "ISceneCellGroup.h"
#include "cdcScene.h"
#include "SceneCellContainer.h"
namespace cdc {
@ -33,18 +33,14 @@ public:
void allocateCells();
// 22 methods from ISceneCellGroup
Scene *getScene() override { return scene1C; } // 4
uint32_t getCellCount() override { return cells.size(); } // 8
SceneCell *cellByIndex(uint32_t index) override { return cells[index]; } // 10
SceneCell *queryPoint(float *point, bool useThisContainer) override { // 14
return SceneCellContainer::queryPoint(point, useThisContainer);
}
float *getOrigin() override { return origin; } // 20
void setUserData(void *) override { // 38
// TODO
}
void setName(const char *newName) override { name = newName; } // 48
const char *getName() override { return name; } // 4C
IScene *getScene();
uint32_t getCellCount();
ISceneCell *cellByIndex(uint32_t index);
ISceneCell *queryPoint(float *point, bool useThisContainer);
float *getOrigin();
void setUserData(void *);
void setName(const char *newName);
const char *getName();
};
}

View File

@ -1,5 +1,5 @@
#pragma once
#include "IScenePortal.h"
#include "cdcScene.h"
namespace cdc {

View File

@ -94,7 +94,7 @@ void SceneEntity::UpdateData(bool reInitCell) { // line 464
// HACK
auto cell = sceneCellGroup->cellByIndex(0);
if (reInitCell) {
auto subCell = &cell->subCells[0];
auto subCell = &static_cast<SceneCell*>/*TODO*/(cell)->subCells[0];
bool alreadyPresent = false;
for (auto ent : subCell->entities)
if (ent == this)

View File

@ -1,5 +1,5 @@
#pragma once
#include "ISceneEntity.h"
#include "cdcScene.h"
#include "cdcMath/Math.h"
#include "rendering/Culling/BasicPrimitives.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "SceneEntity.h"
#include "ISceneLight.h"
#include "cdcScene.h"
namespace cdc {

View File

@ -1,9 +1,4 @@
#include "IScene.h"
#include "ISceneCell.h"
#include "ISceneCellGroup.h"
#include "ISceneEntity.h"
#include "ISceneLight.h"
#include "IScenePortal.h"
#include "cdcScene.h"
#include "Scene.h"
#include "SceneCell.h"
#include "SceneCellContainer.h"

76
cdcScene/cdcScene.h Normal file
View File

@ -0,0 +1,76 @@
#pragma once
#include <cstdint>
#include "cdcMath/Math.h"
namespace cdc {
class IDrawable;
class ISceneCellGroup;
class ISceneEntity;
struct RenderViewport;
class IScene { // line 206
public:
// 42 methods
virtual void Render(/*TODO*/) = 0; // 4
virtual void RenderWithoutCellTracing(RenderViewport& viewport /*TODO*/) = 0; // 8
virtual ISceneCellGroup *GetCellGroup(uint32_t) = 0; // 24
virtual ISceneEntity *CreateEntity() = 0; // 28
};
class ISceneCell { // line 498
// 27 methods
};
class ISceneCellGroup { // line 675
public:
// 23 methods
virtual IScene *getScene() = 0; // 4
virtual uint32_t getCellCount() = 0; // 8
virtual ISceneCell *cellByIndex(uint32_t index) = 0; // 10
virtual ISceneCell *queryPoint(float *point, bool useThisContainer) = 0; // 14
virtual float *getOrigin() = 0; // 20
virtual void setUserData(void *) = 0; // 38
virtual void setName(const char *) = 0; // 48
virtual const char *getName() = 0; // 4C
};
class ISceneEntity { // line 819
public:
struct UpdateState {
static const uint32_t kEnabled = 1;
static const uint32_t kDrawable = 2;
static const uint32_t kCellGroup = 4;
static const uint32_t kMatrix = 8;
static const uint32_t kMoveState = 16;
static const uint32_t kUpdateVolume = 32;
static const uint32_t kUpdateFlags = 64;
static const uint32_t kUpdateAll = 127;
uint32_t updateFlags;
bool enabled;
IDrawable *drawable;
ISceneCellGroup *cellGroup;
Matrix matrix;
uint32_t moveState;
};
// 25 methods
virtual void ApplyUpdateState(UpdateState*) = 0; // 0
virtual void setMatrix(Matrix&) = 0; // 4
virtual Matrix& getMatrix() = 0; // 8
virtual void setDrawable(IDrawable *) = 0; // C
virtual IDrawable *getDrawable() = 0; // 10
virtual void setCellGroup(ISceneCellGroup *) = 0; // 38
};
class ISceneLight : public ISceneEntity { // line 1036
// 40 methods
};
class IScenePortal { // line 1262
// 7 methods
};
}

View File

@ -1,6 +1,6 @@
#include <cstdint>
#include "SceneLayer.h"
#include "cdcScene/IScene.h"
#include "cdcScene/cdcScene.h"
#include "cdcScene/SceneEntity.h"
#include "cdcScene/SceneManager.h"
#include "Instance.h"
@ -58,7 +58,7 @@ void SceneLayer::PostStreamIn(StreamUnit *unit) { // 1443
}
void SceneLayer::AddInstance(Instance *instance) { // 1998
SceneEntity *entity = g_scene->CreateEntity();
SceneEntity *entity = static_cast<SceneEntity*>/*TODO*/(g_scene->CreateEntity());
// entity->SetEnabled(false);
// entity->SetName(instance->object->name)
// entity->SetFlags(2, 0);

View File

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include "cdc/dtp/admd.h"
#include "cdcScene/ISceneCellGroup.h"
#include "cdcScene/cdcScene.h"
#include "Terrain.h"
namespace dtp { struct UnitData; }

View File

@ -81,8 +81,8 @@
#include "cdcResource/WaveSection.h"
#include "cdcScript/Decompiler.h"
#include "cdcScript/ScriptType.h"
#include "cdcScene/cdcScene.h"
#include "cdcScene/IMFTypes.h"
#include "cdcScene/IScene.h"
#include "cdcScene/SceneCellGroup.h" // for SceneCellGroup to ISceneCellGroup cast
#include "cdcScene/SceneEntity.h"
#include "cdcSound/Microphone.h"