1 Commits

Author SHA256 Message Date
51a6ea1328 added core changes to dicon viewer branch 2026-03-26 18:51:29 +01:00
7 changed files with 407 additions and 439 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

@@ -186,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()

View File

@@ -1,7 +1,6 @@
#include "OrdererSpriteSet.hpp"
#include <algorithm>
#include <tuple>
#include "Debug.hpp"
TSE::OrdererSpriteSetChunk::OrdererSpriteSetChunk(int _chunksize, const Vector2 &_pos, SortingOrder _order)
{
@@ -145,8 +144,6 @@ void TSE::OrdererSpriteSet::SetSprite(Vector2 p, Vector2 Spriteindex, float heig
{
Vector2 chunkInnerPos = LocalToChunkPos(p);
Vector2 chunkIndex = p - chunkInnerPos;
// Vector2 p2 = Vector2((int)p.x % chunkSize, (int)p.y % chunkSize);
// Vector2 chunkIndex = p - p2;
if(!chunks.contains(chunkIndex))
{
dirty = true;
@@ -178,9 +175,7 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
case TopLeft:
std::sort(orderedChunks.begin(), orderedChunks.end(), [](const Vector2& a, const Vector2& b)
{
if (a.y != b.y)
return a.y > b.y;
return a.x < b.x;
return std::tie(a.y, a.x) > std::tie(b.y, b.x);
});
break;
case TopRight:
@@ -194,9 +189,7 @@ const std::vector<TSE::Vector2> *TSE::OrdererSpriteSet::GetChunkPositionsInOrder
case BottomLeft:
std::sort(orderedChunks.begin(), orderedChunks.end(), [](const Vector2& a, const Vector2& b)
{
if (a.y != b.y)
return a.y < b.y;
return a.x < b.x;
return std::tie(a.y, a.x) < std::tie(b.y, b.x);
});
break;
case BottomRight:
@@ -210,14 +203,6 @@ 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;
}

View File

@@ -3,9 +3,6 @@
#include "BehaviourScriptRegistry.hpp"
#include "BehaviourScripts/AudioListener.hpp"
#include "BehaviourScripts/AudioSource.hpp"
#include "BehaviourScripts/TileMap.hpp"
#include "BehaviourScripts/OrdererSpriteSet.hpp"
#include "BehaviourScripts/PhysicsObject.hpp"
#include "BehaviourScripts/basicEditorCamera.hpp"
TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
@@ -29,9 +26,6 @@ TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
BehaviourScriptRegistry::RegisterBehaviourScript("Camera", []() -> BehaviourScript* {return new Camera();});
BehaviourScriptRegistry::RegisterBehaviourScript("Audio Listener", []() -> BehaviourScript* {return new AudioListener();});
BehaviourScriptRegistry::RegisterBehaviourScript("Audio Source", []() -> BehaviourScript* {return new AudioSource();});
BehaviourScriptRegistry::RegisterBehaviourScript("Tile Map", []() -> BehaviourScript* {return new TileMap();});
BehaviourScriptRegistry::RegisterBehaviourScript("Orderer Sprite Set", []() -> BehaviourScript* {return new OrdererSpriteSet();});
BehaviourScriptRegistry::RegisterBehaviourScript("Physics Object", []() -> BehaviourScript* { return new PhysicsObject(BodyType::Dynamic, ColliderShape::Box, 1.0f, 0.3f, Vector3(1, 1, 0)); });
#pragma region camerastuff

View File

@@ -208,10 +208,6 @@ namespace TSE::EDITOR
{
Draw((TileMap*)element, debug);
}
else if (name == "Orderer Sprite Set")
{
Draw((OrdererSpriteSet*)element, debug);
}
else
{
element->CustomDraw(debug);
@@ -919,30 +915,6 @@ namespace TSE::EDITOR
ImGui::TextDisabled(("Chunk Count: " + std::to_string(element->GetChunkCount())).c_str());
}
}
void ElementDrawer::Draw(OrdererSpriteSet *element, const bool &debug)
{
int orderIndex = static_cast<int>(element->order);
const char* orderItems[] = { "TopRight", "TopLeft", "BottomRight", "BottomLeft" };
if (ImGui::Combo("Order", &orderIndex, orderItems, IM_ARRAYSIZE(orderItems)))
{
element->order = static_cast<SortingOrder>(orderIndex);
for (auto& [_, chunk] : element->chunks)
{
chunk.SetOrdering(element->order);
}
element->DirtyAll();
}
ImGui::BeginDisabled();
ImGui::DragInt("Chunk Size", &element->chunkSize, 1.0f);
ImGui::EndDisabled();
if (debug)
{
ImGui::Separator();
ImGui::TextDisabled(("Chunk Count: " + std::to_string(element->GetChunkCount())).c_str());
}
}
void ElementDrawer::DrawAudioClipCompact(AudioClip *element, const bool &debug, const std::string &label)
{
float item_spacing = ImGui::GetStyle().ItemSpacing.x;

View File

@@ -14,7 +14,6 @@
#include "BehaviourScripts/AudioListener.hpp"
#include "BehaviourScripts/AudioSource.hpp"
#include "BehaviourScripts/TileMap.hpp"
#include "BehaviourScripts/OrdererSpriteSet.hpp"
namespace TSE::EDITOR
{
@@ -82,7 +81,6 @@ namespace TSE::EDITOR
static void Draw(Camera* element, const bool& debug);
static void Draw(ParticleSystem* element, const bool& debug);
static void Draw(TileMap* element, const bool& debug);
static void Draw(OrdererSpriteSet* element, const bool& debug);
static void DrawAudioClipCompact(AudioClip* element, const bool& debug, const std::string& label);
static void DrawAudioClipNormal(AudioClip* element, const bool& debug, const std::string& label);

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);
}