updated TSE, and fixed some small bugs

This commit is contained in:
2026-01-25 10:55:32 +01:00
parent 8ece8ca96f
commit edf079caf8
11 changed files with 25 additions and 24 deletions

View File

@@ -36,7 +36,6 @@ GravityHolder::GravityHolder(float gravityWell)
GravityHolder::~GravityHolder()
{
Transformable::HardDelete(planetMapRing, false);
delete mat;
delete mesh;
}

View File

@@ -14,7 +14,8 @@ PlanetRotater::PlanetRotater(float distance)
PlanetRotater::~PlanetRotater()
{
Transformable::HardDelete(planetMapRing, false);
planetMapRing->SetParent(nullptr);
Transformable::HardDelete(planetMapRing, true);
delete mat;
delete mesh;
}

View File

@@ -2,6 +2,7 @@
#include "Rendering/PlanetShader.hpp"
#include "utils/Time.hpp"
#include "BehaviourScripts/Camera.hpp"
#include "Debug.hpp"
SpaceController::SpaceController()
{

View File

@@ -2,7 +2,7 @@
Transformable *Asteroid::LoadSpace()
{
root = new Transformable(name);
root = new Transformable(name, id);
Transformable* planet = create();

View File

@@ -7,7 +7,7 @@
Transformable *Galaxy::LoadSpace()
{
root = new Transformable(name);
root = new Transformable(name, id);
for (auto &&system : systems)
{
@@ -22,8 +22,6 @@ Transformable *Galaxy::LoadSpace()
// position;
}
root->id = id;
float grvityWell = GetMaxDistObj();
GravityHolder* holder = new GravityHolder(grvityWell + 4.0f);

View File

@@ -4,7 +4,7 @@
Transformable *Moon::LoadSpace()
{
root = new Transformable(name);
root = new Transformable(name, id);
Transformable* planet = create();
@@ -148,7 +148,7 @@ void Moon::DeleteResources()
delete planetMesh;
delete landMat;
delete planetMat;
Transformable::HardDelete(planetLand, true);
// Transformable::HardDelete(planetLand, true);
planetBase->SetParent(nullptr);
Transformable::HardDelete(planetBase, false);

View File

@@ -4,10 +4,11 @@
#include "Utilities/Random.hpp"
#include "BehaviourScripts/GravityHolder.hpp"
#include "BehaviourScripts/SpaceController.hpp"
#include "Debug.hpp"
Transformable *Planet::LoadSpace()
{
root = new Transformable(name);
root = new Transformable(name, id);
Transformable* planet = create();
@@ -23,17 +24,17 @@ Transformable *Planet::LoadSpace()
Vector2 pos = rotateKeepDistance(Vector2::zero, {0, moon->distanceToPlanet}, GetRandomFloat(0, 360), moon->distanceToPlanet);
moonObj->position = {pos.x, pos.y, -1};
}
root->id = id;
return root;
}
void Planet::UnloadSpace()
{
TSE_LOG("Obj count pre unload: " + std::to_string(Transformable::GetTansformableCount()));
DeleteResources();
root->SetParent(nullptr);
Transformable::HardDelete(root, true);
Transformable::HardDelete(root, false);
TSE_LOG("Obj count post unload: " + std::to_string(Transformable::GetTansformableCount()));
}
Transformable *Planet::create()
@@ -213,8 +214,8 @@ void Planet::DeleteResources()
delete cloudMat;
delete landMat;
delete planetMat;
Transformable::HardDelete(planetClouds, true);
Transformable::HardDelete(planetLand, true);
// Transformable::HardDelete(planetClouds, true);
// Transformable::HardDelete(planetLand, true);
planetBase->SetParent(nullptr);
Transformable::HardDelete(planetBase, false);

View File

@@ -4,6 +4,7 @@
#include "Utilities/Random.hpp"
#include "BehaviourScripts/GravityHolder.hpp"
#include "BehaviourScripts/SpaceController.hpp"
#include "Debug.hpp"
void PlanetarySystem::DeleteResources()
{
@@ -19,7 +20,8 @@ void PlanetarySystem::DeleteResources()
Transformable *PlanetarySystem::LoadSpace()
{
root = new Transformable(name);
if(name == "") name = "root";
root = new Transformable(name, id);
if(stars.size() == 1)
{
@@ -38,8 +40,6 @@ Transformable *PlanetarySystem::LoadSpace()
planetObj->position = {pos.x, pos.y, -1};
}
root->id = id;
float grvityWell = GetMaxPlanetDistance();
GravityHolder* holder = new GravityHolder(grvityWell + 4.0f);
@@ -56,7 +56,8 @@ void PlanetarySystem::UnloadSpace()
{
DeleteResources();
root->SetParent(nullptr);
Transformable::HardDelete(root, true);
Transformable::HardDelete(root, false);
}
PlanetarySystem *PlanetarySystem::Load(nlohmann::json json)

View File

@@ -151,8 +151,8 @@ void Star::DeleteResources()
delete cloudMat;
delete landMat;
delete planetMat;
Transformable::HardDelete(planetClouds, true);
Transformable::HardDelete(planetLand, true);
// Transformable::HardDelete(planetClouds, true);
// Transformable::HardDelete(planetLand, true);
planetBase->SetParent(nullptr);
Transformable::HardDelete(planetBase, false);

View File

@@ -56,7 +56,7 @@ void SetupWindow()
TextureHandler::LoadTextures();
currentScene = new Scene();
Transformable* trans = new Transformable();
Transformable* trans = new Transformable("Space Controller");
planeteryLayer = new Layer("PlanetsAndStuff");
currentScene->AddLayer(planeteryLayer);
planeteryLayer->AddTransformable(trans);
@@ -66,7 +66,7 @@ void SetupWindow()
SpaceController* controller = (SpaceController*)trans->AddBehaviourScript(new SpaceController(cc));
lc = GalaxyGenerator::GenerateCluster(69);
controller->LoadSpace(lc->galaxies[0]->systems[96]);
controller->LoadSpace(lc->galaxies[0]->systems[96]->planets[0]);
#ifdef USE_EDITOR
currentScene->AddLayer(&editor->editorLayer);

2
TSE

Submodule TSE updated: 11e8d343af...bf4189bba0