Skip to content

Commit

Permalink
Refactor planet
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Aug 21, 2024
1 parent da825a6 commit 2decd2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions colobot-base/src/graphics/engine/planet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void CPlanet::LoadTexture()
{
for (const auto& planet : m_planets)
{
m_engine->LoadTexture(TempToPath(planet.name));
m_engine->LoadTexture(planet.name);
}
}

Expand All @@ -114,7 +114,7 @@ void CPlanet::Draw()
if (planet.type != m_visibleType)
continue;

auto texture = m_engine->LoadTexture(TempToPath(planet.name));
auto texture = m_engine->LoadTexture(planet.name);

renderer->SetAlbedoTexture(texture);

Expand Down Expand Up @@ -172,7 +172,7 @@ void CPlanet::Draw()
}

void CPlanet::Create(PlanetType type, const glm::vec2& start, float dim, float speed,
float dir, const std::string& name, const glm::vec2& uv1, const glm::vec2& uv2,
float dir, const std::filesystem::path& name, const glm::vec2& uv1, const glm::vec2& uv2,
bool transparent)
{
Planet planet;
Expand Down
5 changes: 3 additions & 2 deletions colobot-base/src/graphics/engine/planet.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <string>
#include <vector>
#include <filesystem>

struct Event;

Expand Down Expand Up @@ -59,7 +60,7 @@ class CPlanet
bool EventProcess(const Event &event);
//! Creates a new planet
void Create(PlanetType type, const glm::vec2& start, float dim, float speed, float dir,
const std::string& name, const glm::vec2& uv1, const glm::vec2& uv2,
const std::filesystem::path& name, const glm::vec2& uv1, const glm::vec2& uv2,
bool transparent);
//! Indicates if there is at least one planet
bool PlanetExist();
Expand Down Expand Up @@ -99,7 +100,7 @@ class CPlanet
//! Direction in the sky
float dir = 0.0f;
//! Name of the texture
std::string name;
std::filesystem::path name;
//! Texture mapping
glm::vec2 uv1, uv2;

Expand Down
4 changes: 2 additions & 2 deletions colobot-base/src/level/robotmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3153,10 +3153,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
line->GetParam("dim")->AsFloat(0.2f),
line->GetParam("speed")->AsFloat(0.0f),
line->GetParam("dir")->AsFloat(0.0f),
TempToString(line->GetParam("image")->AsPath("textures")),
line->GetParam("image")->AsPath("textures"),
{ uv1.x, uv1.z },
{ uv2.x, uv2.z },
TempToString(line->GetParam("image")->AsPath("textures")).find("planet") != std::string::npos // TODO: add transparent op or modify textures
StrUtils::ToString(line->GetParam("image")->AsPath("textures")).find("planet") != std::string::npos // TODO: add transparent op or modify textures
);
continue;
}
Expand Down

0 comments on commit 2decd2e

Please sign in to comment.