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.RoomNumber = mirror.RoomNumber;
|
||||
rendererMirror.MirroredRoomNumber = mirror.MirroredRoomNumber;
|
||||
rendererMirror.Plane = mirror.MirrorPlane;
|
||||
rendererMirror.Plane = Plane(
|
||||
Vector3(mirror.MirrorPlane.x,
|
||||
mirror.MirrorPlane.y,
|
||||
mirror.MirrorPlane.z),
|
||||
mirror.MirrorPlane.w);
|
||||
rendererMirror.ReflectionMatrix = Matrix::CreateReflection(rendererMirror.Plane);
|
||||
renderView.Mirrors.push_back(rendererMirror);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace TEN::Renderer::Structures
|
|||
struct RendererMirror
|
||||
{
|
||||
short RoomNumber;
|
||||
short MirroredRoomNumber;
|
||||
Plane Plane;
|
||||
Matrix ReflectionMatrix;
|
||||
};
|
||||
|
|
|
@ -980,6 +980,7 @@ void FreeLevel(bool partial)
|
|||
g_Level.VolumeEventSets.resize(0);
|
||||
g_Level.GlobalEventSets.resize(0);
|
||||
g_Level.LoopedEventSetIndices.resize(0);
|
||||
g_Level.Mirrors.resize(0);
|
||||
|
||||
g_GameScript->FreeLevelScripts();
|
||||
g_GameScriptEntities->FreeEntities();
|
||||
|
@ -1363,6 +1364,7 @@ bool LoadLevel(const std::string& path, bool partial)
|
|||
|
||||
LoadSprites();
|
||||
LoadBoxes();
|
||||
LoadMirrors();
|
||||
LoadAnimatedTextures();
|
||||
UpdateProgress(70);
|
||||
|
||||
|
@ -1408,20 +1410,6 @@ bool LoadLevel(const std::string& path, bool 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);
|
||||
|
||||
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)
|
||||
{
|
||||
const auto& level = *g_GameFlow->GetLevel(levelIndex);
|
||||
|
|
|
@ -88,8 +88,7 @@ struct MESH
|
|||
struct MirrorInfo
|
||||
{
|
||||
short RoomNumber;
|
||||
short MirroredRoomNumber;
|
||||
Plane MirrorPlane;
|
||||
Vector4 MirrorPlane;
|
||||
};
|
||||
|
||||
// LevelData
|
||||
|
@ -172,6 +171,7 @@ void LoadSoundSources();
|
|||
void LoadAnimatedTextures();
|
||||
void LoadEventSets();
|
||||
void LoadAIObjects();
|
||||
void LoadMirrors();
|
||||
|
||||
void LoadPortal(ROOM_INFO& room);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue