mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Implemented mirrors in file format
This commit is contained in:
parent
3e89391776
commit
374abb27d3
4 changed files with 26 additions and 19 deletions
|
@ -154,8 +154,11 @@ namespace TEN::Renderer
|
||||||
{
|
{
|
||||||
RendererMirror rendererMirror;
|
RendererMirror rendererMirror;
|
||||||
rendererMirror.RoomNumber = mirror.RoomNumber;
|
rendererMirror.RoomNumber = mirror.RoomNumber;
|
||||||
rendererMirror.MirroredRoomNumber = mirror.MirroredRoomNumber;
|
rendererMirror.Plane = Plane(
|
||||||
rendererMirror.Plane = mirror.MirrorPlane;
|
Vector3(mirror.MirrorPlane.x,
|
||||||
|
mirror.MirrorPlane.y,
|
||||||
|
mirror.MirrorPlane.z),
|
||||||
|
mirror.MirrorPlane.w);
|
||||||
rendererMirror.ReflectionMatrix = Matrix::CreateReflection(rendererMirror.Plane);
|
rendererMirror.ReflectionMatrix = Matrix::CreateReflection(rendererMirror.Plane);
|
||||||
renderView.Mirrors.push_back(rendererMirror);
|
renderView.Mirrors.push_back(rendererMirror);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ namespace TEN::Renderer::Structures
|
||||||
struct RendererMirror
|
struct RendererMirror
|
||||||
{
|
{
|
||||||
short RoomNumber;
|
short RoomNumber;
|
||||||
short MirroredRoomNumber;
|
|
||||||
Plane Plane;
|
Plane Plane;
|
||||||
Matrix ReflectionMatrix;
|
Matrix ReflectionMatrix;
|
||||||
};
|
};
|
||||||
|
|
|
@ -980,6 +980,7 @@ void FreeLevel(bool partial)
|
||||||
g_Level.VolumeEventSets.resize(0);
|
g_Level.VolumeEventSets.resize(0);
|
||||||
g_Level.GlobalEventSets.resize(0);
|
g_Level.GlobalEventSets.resize(0);
|
||||||
g_Level.LoopedEventSetIndices.resize(0);
|
g_Level.LoopedEventSetIndices.resize(0);
|
||||||
|
g_Level.Mirrors.resize(0);
|
||||||
|
|
||||||
g_GameScript->FreeLevelScripts();
|
g_GameScript->FreeLevelScripts();
|
||||||
g_GameScriptEntities->FreeEntities();
|
g_GameScriptEntities->FreeEntities();
|
||||||
|
@ -1363,6 +1364,7 @@ bool LoadLevel(const std::string& path, bool partial)
|
||||||
|
|
||||||
LoadSprites();
|
LoadSprites();
|
||||||
LoadBoxes();
|
LoadBoxes();
|
||||||
|
LoadMirrors();
|
||||||
LoadAnimatedTextures();
|
LoadAnimatedTextures();
|
||||||
UpdateProgress(70);
|
UpdateProgress(70);
|
||||||
|
|
||||||
|
@ -1408,20 +1410,6 @@ bool LoadLevel(const std::string& path, bool partial)
|
||||||
|
|
||||||
UpdateProgress(100, partial);
|
UpdateProgress(100, partial);
|
||||||
|
|
||||||
// MIRROR: remove after TE changes
|
|
||||||
g_Level.Mirrors.clear();
|
|
||||||
|
|
||||||
MirrorInfo mirror;
|
|
||||||
mirror.RoomNumber = 17;
|
|
||||||
mirror.MirrorPlane = Plane(Vector3(BLOCK(10), 0, 0), Vector3(-1, 0, 0));
|
|
||||||
g_Level.Mirrors.push_back(mirror);
|
|
||||||
|
|
||||||
//mirror.MirrorPlane = Plane(Vector3(0, 0, 30000), Vector3(0, 0, -1));
|
|
||||||
//g_Level.Mirrors.push_back(mirror);
|
|
||||||
|
|
||||||
//mirror.MirrorPlane = Plane(Vector3(0, -2048, 0), Vector3(0,-1, 0));
|
|
||||||
//g_Level.Mirrors.push_back(mirror);
|
|
||||||
|
|
||||||
TENLog("Level loading complete.", LogLevel::Info);
|
TENLog("Level loading complete.", LogLevel::Info);
|
||||||
|
|
||||||
loadedSuccessfully = true;
|
loadedSuccessfully = true;
|
||||||
|
@ -1531,6 +1519,23 @@ void LoadBoxes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadMirrors()
|
||||||
|
{
|
||||||
|
int mirrorCount = ReadCount(CUBE(1024));
|
||||||
|
TENLog("Mirror count: " + std::to_string(mirrorCount), LogLevel::Info);
|
||||||
|
g_Level.Mirrors.reserve(mirrorCount);
|
||||||
|
for (int i = 0; i < mirrorCount; i++)
|
||||||
|
{
|
||||||
|
auto& mirror = g_Level.Mirrors.emplace_back();
|
||||||
|
|
||||||
|
mirror.RoomNumber = ReadInt16();
|
||||||
|
mirror.MirrorPlane.x = ReadFloat();
|
||||||
|
mirror.MirrorPlane.y = ReadFloat();
|
||||||
|
mirror.MirrorPlane.z = ReadFloat();
|
||||||
|
mirror.MirrorPlane.w = ReadFloat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool LoadLevelFile(int levelIndex)
|
bool LoadLevelFile(int levelIndex)
|
||||||
{
|
{
|
||||||
const auto& level = *g_GameFlow->GetLevel(levelIndex);
|
const auto& level = *g_GameFlow->GetLevel(levelIndex);
|
||||||
|
|
|
@ -88,8 +88,7 @@ struct MESH
|
||||||
struct MirrorInfo
|
struct MirrorInfo
|
||||||
{
|
{
|
||||||
short RoomNumber;
|
short RoomNumber;
|
||||||
short MirroredRoomNumber;
|
Vector4 MirrorPlane;
|
||||||
Plane MirrorPlane;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// LevelData
|
// LevelData
|
||||||
|
@ -172,6 +171,7 @@ void LoadSoundSources();
|
||||||
void LoadAnimatedTextures();
|
void LoadAnimatedTextures();
|
||||||
void LoadEventSets();
|
void LoadEventSets();
|
||||||
void LoadAIObjects();
|
void LoadAIObjects();
|
||||||
|
void LoadMirrors();
|
||||||
|
|
||||||
void LoadPortal(ROOM_INFO& room);
|
void LoadPortal(ROOM_INFO& room);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue