2 Commits

8 changed files with 419 additions and 398 deletions

View File

@@ -1,5 +1,2 @@
# TSE
packages needed for building under linux:
build-essential llvm cmake ninja-build clang mesa-common-dev gdb

View File

@@ -1,7 +1,6 @@
#include "Camera.hpp"
#include "elements/Transformable.hpp"
#include "interfaces/IRenderer.hpp"
#include "interfaces/IWindow.hpp"
#include "uuid.h"
TSE::Camera* TSE::Camera::mainCamera = nullptr;
@@ -187,14 +186,36 @@ TSE::Matrix4x4 BuildView_Zplus_RH(const TSE::Matrix4x4& world)
void TSE::Camera::PreDraw(IShader *shader)
{
rt->Bind();
shader->SetUniform("prMatrix", projectionMatrix);
// shader->SetUniform("prMatrix", projectionMatrix);
auto worlmatrix = baseObject->GetGlobalMatrix();
// auto worlmatrix = baseObject->GetGlobalMatrix();
viewMatrix = BuildView_Zplus_RH(worlmatrix);
// viewMatrix = BuildView_Zplus_RH(worlmatrix);
shader->SetUniform("camMatrix", &viewMatrix);
helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
// shader->SetUniform("camMatrix", &viewMatrix);
// helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
Vector3 pos = baseObject->GetGlobalPosition();
Vector3 right = baseObject->LocalToGlobalPosition(Vector3::right) - pos;
Vector3 up = baseObject->LocalToGlobalPosition(Vector3::up) - pos;
Vector3 forward = baseObject->LocalToGlobalPosition(Vector3::forward) - pos;
forward.Normalize();
shader->SetUniform("CamPos", &pos);
shader->SetUniform("CamRight", &right);
shader->SetUniform("CamUp", &up);
shader->SetUniform("CamForward", &forward);
float x = lastRtSize.x / RenderScale;
float y = lastRtSize.y / RenderScale;
float mx = -x;
float my = -y;
shader->SetUniform("OrthoLeft", mx);
shader->SetUniform("OrthoRight", x);
shader->SetUniform("OrthoBottom", my);
shader->SetUniform("OrthoTop", y);
shader->SetUniform("NearPlane", nearClippingPlane);
shader->SetUniform("FarPlane", farClippingPlane);
}
void TSE::Camera::PostDraw()
@@ -214,8 +235,5 @@ void TSE::Camera::Unbind()
void TSE::Camera::UpdateRenderTarget()
{
if (dynamic_cast<IWindow*>(rt) == nullptr)
{
rt->Update();
}
rt->Update();
}

View File

@@ -1,7 +1,6 @@
#include "OrdererSpriteSet.hpp"
#include <algorithm>
#include <tuple>
#include <cmath>
#include "Debug.hpp"
TSE::OrdererSpriteSetChunk::OrdererSpriteSetChunk(int _chunksize, const Vector2 &_pos, SortingOrder _order)
@@ -211,6 +210,14 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
}
dirty = false;
string poses = "[";
for(auto pos : orderedChunks)
{
poses += pos.ToString() + ",";
}
poses.erase(poses.end() - 1);
poses += "]";
TSE_LOG("orderedPositions: " + poses);
}
return &orderedChunks;
}
@@ -238,7 +245,7 @@ void TSE::OrdererSpriteSet::DirtyAll()
TSE::Vector2 TSE::OrdererSpriteSet::LocalToChunkPos(const Vector2 &v)
{
Vector2 p = Vector2(std::fmod(v.x, chunkSize), std::fmod(v.y, chunkSize));
Vector2 p = Vector2((int)v.x % chunkSize, (int)v.y % chunkSize);
if(p.x < 0) p.x += chunkSize;
if(p.y < 0) p.y += chunkSize;
return p;

View File

@@ -50,7 +50,7 @@ namespace TSE
Rect bounds = Rect(0,0,0,0);
public:
float chunkSize = 16;
int chunkSize = 16;
SortingOrder order = TopRight;
TileSet* set;
std::unordered_map<Vector2, OrdererSpriteSetChunk> chunks;

View File

@@ -8,14 +8,13 @@
#include "BehaviourScripts/PhysicsObject.hpp"
#include "BehaviourScripts/basicEditorCamera.hpp"
TSE::EDITOR::EditorSubsystem::EditorSubsystem(ConsolView* cvp) : sv(nullptr), editorLayer("")
TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
{
rt = IRenderTexture::factory->CreateTextureHeap({100,100}, 5);
sv = SceneView(rt);
cv = cvp;
controller.AddGuiElement("Scene", &sv);
controller.AddGuiElement("Consol", cv);
controller.AddGuiElement("Consol", &cv);
controller.AddGuiElement("Hirearchie", &hv);
controller.AddGuiElement("Properties", &pv);
controller.AddGuiElement("Debug", &dv);

View File

@@ -15,7 +15,7 @@ namespace TSE::EDITOR
{
public:
ViewportController controller;
ConsolView* cv = nullptr;
ConsolView cv;
DebugView dv;
HirearchieView hv = HirearchieView(nullptr);
PropertiesView pv;
@@ -24,6 +24,6 @@ namespace TSE::EDITOR
SceneView sv;
Layer editorLayer;
EditorSubsystem(ConsolView* cvp);
EditorSubsystem();
};
} // namespace TSE::EDITOR

View File

@@ -934,7 +934,7 @@ namespace TSE::EDITOR
}
ImGui::BeginDisabled();
ImGui::DragFloat("Chunk Size", &element->chunkSize, 1.0f);
ImGui::DragInt("Chunk Size", &element->chunkSize, 1.0f);
ImGui::EndDisabled();
if (debug)

View File

@@ -105,7 +105,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
{
if(tex->bpp() == 32)
{
internal = GL_RGBA;
internal = GL_R16;
input = GL_BGRA;
size = GL_UNSIGNED_BYTE;
}
@@ -136,7 +136,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
);
}
glGenerateMipmap(GL_TEXTURE_3D);
//glGenerateMipmap(GL_TEXTURE_3D);
glBindTexture(GL_TEXTURE_3D, 0);
}