Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Directly access color settings through ApplicationSettings instead of…
Browse files Browse the repository at this point in the history
… through current asset
SamVanheer committed Apr 8, 2024
1 parent 4f1e13b commit 276e68c
Showing 4 changed files with 6 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/hlam/entity/CrosshairEntity.cpp
Original file line number Diff line number Diff line change
@@ -9,11 +9,10 @@
#include "graphics/GraphicsUtils.hpp"
#include "graphics/SceneContext.hpp"

#include "settings/ApplicationSettings.hpp"
#include "settings/ColorSettings.hpp"

#include "plugins/halflife/studiomodel/StudioModelAsset.hpp"
#include "plugins/halflife/studiomodel/StudioModelColors.hpp"
#include "application/AssetManager.hpp"

void CrosshairEntity::Draw(graphics::SceneContext& sc, RenderPasses renderPass)
{
@@ -28,7 +27,7 @@ void CrosshairEntity::Draw(graphics::SceneContext& sc, RenderPasses renderPass)

sc.OpenGLFunctions->glDisable(GL_TEXTURE_2D);

auto colors = GetContext()->Asset->GetApplication()->GetColorSettings();
auto colors = GetContext()->AppSettings->GetColorSettings();

sc.OpenGLFunctions->glColor4fv(glm::value_ptr(colors->GetColor(studiomodel::CrosshairColor)));

4 changes: 2 additions & 2 deletions src/hlam/entity/GroundEntity.cpp
Original file line number Diff line number Diff line change
@@ -8,12 +8,12 @@
#include "graphics/GraphicsUtils.hpp"
#include "graphics/SceneContext.hpp"

#include "settings/ApplicationSettings.hpp"
#include "settings/ColorSettings.hpp"

#include "plugins/halflife/studiomodel/StudioModelAsset.hpp"
#include "plugins/halflife/studiomodel/StudioModelColors.hpp"
#include "plugins/halflife/studiomodel/settings/StudioModelSettings.hpp"
#include "application/AssetManager.hpp"

void GroundEntity::Draw(graphics::SceneContext& sc, RenderPasses renderPass)
{
@@ -103,7 +103,7 @@ void GroundEntity::Draw(graphics::SceneContext& sc, RenderPasses renderPass)
_groundTextureOffset.x = std::fmod(_groundTextureOffset.x, groundTextureLength);
_groundTextureOffset.y = std::fmod(_groundTextureOffset.y, groundTextureLength);

auto colors = GetContext()->Asset->GetApplication()->GetColorSettings();
auto colors = GetContext()->AppSettings->GetColorSettings();

std::optional<GLuint> texture;

4 changes: 1 addition & 3 deletions src/hlam/entity/GuidelinesEntity.cpp
Original file line number Diff line number Diff line change
@@ -17,9 +17,7 @@
#include "settings/ApplicationSettings.hpp"
#include "settings/ColorSettings.hpp"

#include "plugins/halflife/studiomodel/StudioModelAsset.hpp"
#include "plugins/halflife/studiomodel/StudioModelColors.hpp"
#include "application/AssetManager.hpp"

void GuidelinesEntity::Draw(graphics::SceneContext& sc, RenderPasses renderPass)
{
@@ -38,7 +36,7 @@ void GuidelinesEntity::Draw(graphics::SceneContext& sc, RenderPasses renderPass)

sc.OpenGLFunctions->glDisable(GL_TEXTURE_2D);

auto colors = GetContext()->Asset->GetApplication()->GetColorSettings();
auto colors = GetContext()->AppSettings->GetColorSettings();

sc.OpenGLFunctions->glColor4fv(glm::value_ptr(colors->GetColor(studiomodel::CrosshairColor)));

4 changes: 1 addition & 3 deletions src/hlam/graphics/Scene.cpp
Original file line number Diff line number Diff line change
@@ -18,9 +18,7 @@
#include "settings/ApplicationSettings.hpp"
#include "settings/ColorSettings.hpp"

#include "plugins/halflife/studiomodel/StudioModelAsset.hpp"
#include "plugins/halflife/studiomodel/StudioModelColors.hpp"
#include "application/AssetManager.hpp"

namespace graphics
{
@@ -54,7 +52,7 @@ Scene::Scene(std::string&& name, EntityContext* entityContext)
{
SetCurrentCamera(nullptr);

SkyLight.Color = _entityContext->Asset->GetApplication()->GetColorSettings()->GetColor(studiomodel::SkyLightColor);
SkyLight.Color = _entityContext->AppSettings->GetColorSettings()->GetColor(studiomodel::SkyLightColor);
}

Scene::~Scene() = default;

0 comments on commit 276e68c

Please sign in to comment.