Cleanup to reduce includes of device.h header file

dev
Tomasz Kapuściński 2022-05-02 20:59:44 +02:00
parent 2a529ae07f
commit cac34e259b
29 changed files with 154 additions and 153 deletions

View File

@ -36,6 +36,7 @@
#include "common/system/system.h" #include "common/system/system.h"
#include "graphics/core/device.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/opengl33/glutil.h" #include "graphics/opengl33/glutil.h"
@ -115,7 +116,8 @@ CApplication::CApplication(CSystemUtils* systemUtils)
m_configFile(std::make_unique<CConfigFile>()), m_configFile(std::make_unique<CConfigFile>()),
m_input(std::make_unique<CInput>()), m_input(std::make_unique<CInput>()),
m_pathManager(std::make_unique<CPathManager>(systemUtils)), m_pathManager(std::make_unique<CPathManager>(systemUtils)),
m_modManager(std::make_unique<CModManager>(this, m_pathManager.get())) m_modManager(std::make_unique<CModManager>(this, m_pathManager.get())),
m_deviceConfig(std::make_unique<Gfx::DeviceConfig>())
{ {
m_exitCode = 0; m_exitCode = 0;
m_active = false; m_active = false;
@ -427,8 +429,8 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
std::getline(resolution, w, 'x'); std::getline(resolution, w, 'x');
std::getline(resolution, h, 'x'); std::getline(resolution, h, 'x');
m_deviceConfig.size.x = atoi(w.c_str()); m_deviceConfig->size.x = atoi(w.c_str());
m_deviceConfig.size.y = atoi(h.c_str()); m_deviceConfig->size.y = atoi(h.c_str());
m_resolutionOverride = true; m_resolutionOverride = true;
break; break;
} }
@ -615,7 +617,7 @@ bool CApplication::Create()
{ {
if (it->x == w && it->y == h) if (it->x == w && it->y == h)
{ {
m_deviceConfig.size = *it; m_deviceConfig->size = *it;
break; break;
} }
} }
@ -623,7 +625,7 @@ bool CApplication::Create()
if ( GetConfigFile().GetIntProperty("Setup", "Fullscreen", iValue) && !m_resolutionOverride ) if ( GetConfigFile().GetIntProperty("Setup", "Fullscreen", iValue) && !m_resolutionOverride )
{ {
m_deviceConfig.fullScreen = (iValue == 1); m_deviceConfig->fullScreen = (iValue == 1);
} }
if (! CreateVideoSurface()) if (! CreateVideoSurface())
@ -673,14 +675,14 @@ bool CApplication::Create()
graphics = value; graphics = value;
} }
m_device = Gfx::CreateDevice(m_deviceConfig, graphics.c_str()); m_device = Gfx::CreateDevice(*m_deviceConfig, graphics.c_str());
if (m_device == nullptr) if (m_device == nullptr)
{ {
GetLogger()->Error("Unknown graphics device: %s\n", graphics.c_str()); GetLogger()->Error("Unknown graphics device: %s\n", graphics.c_str());
GetLogger()->Info("Changing to default device\n"); GetLogger()->Info("Changing to default device\n");
m_systemUtils->SystemDialog(SystemDialogType::ERROR_MSG, "Graphics initialization error", "You have selected invalid graphics device with -graphics switch. Game will use default OpenGL device instead."); m_systemUtils->SystemDialog(SystemDialogType::ERROR_MSG, "Graphics initialization error", "You have selected invalid graphics device with -graphics switch. Game will use default OpenGL device instead.");
m_device = Gfx::CreateDevice(m_deviceConfig, "opengl"); m_device = Gfx::CreateDevice(*m_deviceConfig, "opengl");
} }
} }
//else //else
@ -747,23 +749,23 @@ bool CApplication::CreateVideoSurface()
{ {
Uint32 videoFlags = SDL_WINDOW_OPENGL; Uint32 videoFlags = SDL_WINDOW_OPENGL;
if (m_deviceConfig.fullScreen) if (m_deviceConfig->fullScreen)
videoFlags |= SDL_WINDOW_FULLSCREEN; videoFlags |= SDL_WINDOW_FULLSCREEN;
if (m_deviceConfig.resizeable) if (m_deviceConfig->resizeable)
videoFlags |= SDL_WINDOW_RESIZABLE; videoFlags |= SDL_WINDOW_RESIZABLE;
// Set OpenGL attributes // Set OpenGL attributes
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, m_deviceConfig.redSize); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, m_deviceConfig->redSize);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, m_deviceConfig.greenSize); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, m_deviceConfig->greenSize);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, m_deviceConfig.blueSize); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, m_deviceConfig->blueSize);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, m_deviceConfig.alphaSize); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, m_deviceConfig->alphaSize);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, m_deviceConfig.depthSize); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, m_deviceConfig->depthSize);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, m_deviceConfig.stencilSize); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, m_deviceConfig->stencilSize);
if (m_deviceConfig.doubleBuf) if (m_deviceConfig->doubleBuf)
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
std::string value; std::string value;
@ -848,12 +850,12 @@ bool CApplication::CreateVideoSurface()
/* If hardware acceleration specifically requested, this will force the hw accel /* If hardware acceleration specifically requested, this will force the hw accel
and fail with error if not available */ and fail with error if not available */
if (m_deviceConfig.hardwareAccel) if (m_deviceConfig->hardwareAccel)
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
m_private->window = SDL_CreateWindow(m_windowTitle.c_str(), m_private->window = SDL_CreateWindow(m_windowTitle.c_str(),
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
m_deviceConfig.size.x, m_deviceConfig.size.y, m_deviceConfig->size.x, m_deviceConfig->size.y,
videoFlags); videoFlags);
m_private->glcontext = SDL_GL_CreateContext(m_private->window); m_private->glcontext = SDL_GL_CreateContext(m_private->window);
@ -900,15 +902,15 @@ void CApplication::TryToSetVSync()
bool CApplication::ChangeVideoConfig(const Gfx::DeviceConfig &newConfig) bool CApplication::ChangeVideoConfig(const Gfx::DeviceConfig &newConfig)
{ {
m_deviceConfig = newConfig; *m_deviceConfig = newConfig;
// TODO: Somehow this doesn't work for maximized windows (at least on Ubuntu) // TODO: Somehow this doesn't work for maximized windows (at least on Ubuntu)
SDL_SetWindowSize(m_private->window, m_deviceConfig.size.x, m_deviceConfig.size.y); SDL_SetWindowSize(m_private->window, m_deviceConfig->size.x, m_deviceConfig->size.y);
SDL_SetWindowFullscreen(m_private->window, m_deviceConfig.fullScreen ? SDL_WINDOW_FULLSCREEN : 0); SDL_SetWindowFullscreen(m_private->window, m_deviceConfig->fullScreen ? SDL_WINDOW_FULLSCREEN : 0);
TryToSetVSync(); TryToSetVSync();
m_device->ConfigChanged(m_deviceConfig); m_device->ConfigChanged(*m_deviceConfig);
m_eventQueue->AddEvent(Event(EVENT_RESOLUTION_CHANGED)); m_eventQueue->AddEvent(Event(EVENT_RESOLUTION_CHANGED));
@ -1238,10 +1240,10 @@ Event CApplication::ProcessSystemEvent()
{ {
if (m_private->currentEvent.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) if (m_private->currentEvent.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
{ {
Gfx::DeviceConfig newConfig = m_deviceConfig; Gfx::DeviceConfig newConfig = *m_deviceConfig;
newConfig.size.x = m_private->currentEvent.window.data1; newConfig.size.x = m_private->currentEvent.window.data1;
newConfig.size.y = m_private->currentEvent.window.data2; newConfig.size.y = m_private->currentEvent.window.data2;
if (newConfig.size != m_deviceConfig.size) if (newConfig.size != m_deviceConfig->size)
ChangeVideoConfig(newConfig); ChangeVideoConfig(newConfig);
} }
@ -1496,7 +1498,7 @@ void CApplication::Render()
CProfiler::StopPerformanceCounter(PCNT_RENDER_ALL); CProfiler::StopPerformanceCounter(PCNT_RENDER_ALL);
CProfiler::StartPerformanceCounter(PCNT_SWAP_BUFFERS); CProfiler::StartPerformanceCounter(PCNT_SWAP_BUFFERS);
if (m_deviceConfig.doubleBuf) if (m_deviceConfig->doubleBuf)
SDL_GL_SwapWindow(m_private->window); SDL_GL_SwapWindow(m_private->window);
CProfiler::StopPerformanceCounter(PCNT_SWAP_BUFFERS); CProfiler::StopPerformanceCounter(PCNT_SWAP_BUFFERS);
} }
@ -1648,9 +1650,9 @@ long long CApplication::GetRealRelTime() const
return m_realRelTime; return m_realRelTime;
} }
Gfx::DeviceConfig CApplication::GetVideoConfig() const const Gfx::DeviceConfig& CApplication::GetVideoConfig() const
{ {
return m_deviceConfig; return *m_deviceConfig;
} }
std::vector<glm::ivec2> CApplication::GetVideoResolutionList(int display) const std::vector<glm::ivec2> CApplication::GetVideoResolutionList(int display) const

View File

@ -29,8 +29,6 @@
#include "common/singleton.h" #include "common/singleton.h"
#include "common/system/system.h" #include "common/system/system.h"
#include "graphics/core/device.h"
#include "level/level_category.h" #include "level/level_category.h"
#include <glm/glm.hpp> #include <glm/glm.hpp>
@ -51,6 +49,7 @@ class CSystemUtils;
namespace Gfx namespace Gfx
{ {
class CDevice;
class CEngine; class CEngine;
struct DeviceConfig; struct DeviceConfig;
} }
@ -188,7 +187,7 @@ public:
std::vector<glm::ivec2> GetVideoResolutionList(int display = 0) const; std::vector<glm::ivec2> GetVideoResolutionList(int display = 0) const;
//! Returns the current video mode //! Returns the current video mode
Gfx::DeviceConfig GetVideoConfig() const; const Gfx::DeviceConfig& GetVideoConfig() const;
//! Change the video mode to given mode //! Change the video mode to given mode
bool ChangeVideoConfig(const Gfx::DeviceConfig &newConfig); bool ChangeVideoConfig(const Gfx::DeviceConfig &newConfig);
@ -348,7 +347,7 @@ protected:
std::string m_errorMessage; std::string m_errorMessage;
//! Current configuration of OpenGL display device //! Current configuration of OpenGL display device
Gfx::DeviceConfig m_deviceConfig; std::unique_ptr<Gfx::DeviceConfig> m_deviceConfig;
//! Text set as window title //! Text set as window title
std::string m_windowTitle; std::string m_windowTitle;

View File

@ -25,6 +25,7 @@
#include "common/config_file.h" #include "common/config_file.h"
#include "common/logger.h" #include "common/logger.h"
#include "graphics/core/device.h"
#include "graphics/engine/camera.h" #include "graphics/engine/camera.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"

View File

@ -58,6 +58,7 @@ struct VertexCol;
struct Vertex3D; struct Vertex3D;
enum class CullFace : unsigned char; enum class CullFace : unsigned char;
enum class PrimitiveType : unsigned char;
enum class TransparencyMode : unsigned char; enum class TransparencyMode : unsigned char;
/** /**
@ -142,21 +143,6 @@ enum class FillMode : unsigned char
POLY POLY
}; };
/**
* \enum PrimitiveType
* \brief Type of primitive to render
*/
enum class PrimitiveType : unsigned char
{
POINTS,
LINES,
LINE_STRIP,
LINE_LOOP,
TRIANGLES,
TRIANGLE_STRIP,
TRIANGLE_FAN
};
/** /**
* \enum FrustumPlane * \enum FrustumPlane
* \brief Planes of frustum space * \brief Planes of frustum space

View File

@ -34,10 +34,24 @@ namespace Gfx
class CVertexBuffer; class CVertexBuffer;
enum class CullFace : unsigned char; enum class CullFace : unsigned char;
enum class PrimitiveType : unsigned char;
enum class TransparencyMode : unsigned char; enum class TransparencyMode : unsigned char;
struct Texture; struct Texture;
/**
* \enum PrimitiveType
* \brief Type of primitive to render
*/
enum class PrimitiveType : unsigned char
{
POINTS,
LINES,
LINE_STRIP,
LINE_LOOP,
TRIANGLES,
TRIANGLE_STRIP,
TRIANGLE_FAN,
};
struct ShadowParam struct ShadowParam
{ {
glm::mat4 matrix; glm::mat4 matrix;

View File

@ -39,18 +39,18 @@ namespace Gfx
* \enum TexImgFormat * \enum TexImgFormat
* \brief Format of image data * \brief Format of image data
*/ */
enum TexImgFormat enum class TexImgFormat : unsigned char
{ {
//! Try to determine automatically (may not work) //! Try to determine automatically (may not work)
TEX_IMG_AUTO, AUTO,
//! RGB triplet, 3 bytes //! RGB triplet, 3 bytes
TEX_IMG_RGB, RGB,
//! BGR triplet, 3 bytes //! BGR triplet, 3 bytes
TEX_IMG_BGR, BGR,
//! RGBA triplet, 4 bytes //! RGBA triplet, 4 bytes
TEX_IMG_RGBA, RGBA,
//! BGRA triplet, 4 bytes //! BGRA triplet, 4 bytes
TEX_IMG_BGRA BGRA,
}; };
/** /**
@ -157,7 +157,7 @@ struct TextureCreateParams
//! Whether to generate mipmaps //! Whether to generate mipmaps
bool mipmap = false; bool mipmap = false;
//! Format of source image data //! Format of source image data
TexImgFormat format = TEX_IMG_RGB; TexImgFormat format = TexImgFormat::RGB;
//! General texture filtering mode //! General texture filtering mode
TexFilter filter = TEX_FILTER_NEAREST; TexFilter filter = TEX_FILTER_NEAREST;
//! Pad the image to nearest power of 2 dimensions //! Pad the image to nearest power of 2 dimensions

View File

@ -20,7 +20,6 @@
#include "graphics/engine/cloud.h" #include "graphics/engine/cloud.h"
#include "graphics/core/device.h"
#include "graphics/core/material.h" #include "graphics/core/material.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -111,8 +110,7 @@ void CCloud::Draw()
float fogStart = deep*0.15f; float fogStart = deep*0.15f;
float fogEnd = deep*0.24f; float fogEnd = deep*0.24f;
CDevice* device = m_engine->GetDevice(); auto renderer = m_engine->GetObjectRenderer();
auto renderer = device->GetObjectRenderer();
renderer->Begin(); renderer->Begin();
auto fogColor = m_engine->GetFogColor(m_engine->GetRankView()); auto fogColor = m_engine->GetFogColor(m_engine->GetRankView());

View File

@ -276,10 +276,10 @@ CEngine::CEngine(CApplication *app, CSystemUtils* systemUtils)
m_shadowColor = 0.5f; m_shadowColor = 0.5f;
m_defaultTexParams.format = TEX_IMG_AUTO; m_defaultTexParams.format = TexImgFormat::AUTO;
m_defaultTexParams.filter = TEX_FILTER_BILINEAR; m_defaultTexParams.filter = TEX_FILTER_BILINEAR;
m_terrainTexParams.format = TEX_IMG_AUTO; m_terrainTexParams.format = TexImgFormat::AUTO;
m_terrainTexParams.filter = TEX_FILTER_BILINEAR; m_terrainTexParams.filter = TEX_FILTER_BILINEAR;
// Compute bias matrix for shadow mapping // Compute bias matrix for shadow mapping
@ -307,6 +307,16 @@ CDevice* CEngine::GetDevice()
return m_device; return m_device;
} }
CUIRenderer* CEngine::GetUIRenderer()
{
return m_device->GetUIRenderer();
}
CObjectRenderer* CEngine::GetObjectRenderer()
{
return m_device->GetObjectRenderer();
}
COldModelManager* CEngine::GetModelManager() COldModelManager* CEngine::GetModelManager()
{ {
return m_modelManager.get(); return m_modelManager.get();
@ -408,7 +418,7 @@ bool CEngine::Create()
Math::LoadOrthoProjectionMatrix(m_matProjInterface, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); Math::LoadOrthoProjectionMatrix(m_matProjInterface, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
TextureCreateParams params; TextureCreateParams params;
params.format = TEX_IMG_AUTO; params.format = TexImgFormat::AUTO;
params.filter = TEX_FILTER_NEAREST; params.filter = TEX_FILTER_NEAREST;
params.mipmap = false; params.mipmap = false;
m_miceTexture = LoadTexture("textures/interface/mouse.png", params); m_miceTexture = LoadTexture("textures/interface/mouse.png", params);
@ -3168,7 +3178,7 @@ void CEngine::Capture3DScene()
TextureCreateParams params; TextureCreateParams params;
params.filter = TEX_FILTER_BILINEAR; params.filter = TEX_FILTER_BILINEAR;
params.format = TEX_IMG_RGBA; params.format = TexImgFormat::RGBA;
params.mipmap = false; params.mipmap = false;
m_capturedWorldTexture = m_device->CreateTexture(&image, params); m_capturedWorldTexture = m_device->CreateTexture(&image, params);

View File

@ -56,6 +56,8 @@ namespace Gfx
{ {
class CDevice; class CDevice;
class CUIRenderer;
class CObjectRenderer;
class COldModelManager; class COldModelManager;
class CLightManager; class CLightManager;
class CText; class CText;
@ -436,6 +438,10 @@ public:
void SetDevice(CDevice* device); void SetDevice(CDevice* device);
//! Returns the current device //! Returns the current device
CDevice* GetDevice(); CDevice* GetDevice();
//! Returns the UI renderer
CUIRenderer* GetUIRenderer();
//! Returns the object renderer
CObjectRenderer* GetObjectRenderer();
//! Returns the text rendering engine //! Returns the text rendering engine
CText* GetText(); CText* GetText();

View File

@ -29,6 +29,7 @@
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -178,7 +179,7 @@ public:
{ {
if (m_quads.empty()) return; if (m_quads.empty()) return;
auto renderer = m_engine.GetDevice()->GetUIRenderer(); auto renderer = m_engine.GetUIRenderer();
renderer->SetTexture(Texture{ m_texID }); renderer->SetTexture(Texture{ m_texID });
renderer->SetTransparency(m_transparency); renderer->SetTransparency(m_transparency);
@ -1363,7 +1364,7 @@ CharTexture CText::CreateCharTexture(UTF8Char ch, CachedFont* font)
Texture tex; Texture tex;
tex.id = texture.id; tex.id = texture.id;
m_device->UpdateTexture(tex, texture.charPos, &imageData, TEX_IMG_RGBA); m_device->UpdateTexture(tex, texture.charPos, &imageData, TexImgFormat::RGBA);
imageData.surface = nullptr; imageData.surface = nullptr;
@ -1401,7 +1402,7 @@ FontTexture CText::CreateFontTexture(const glm::ivec2& tileSize)
data.surface = textureSurface; data.surface = textureSurface;
TextureCreateParams createParams; TextureCreateParams createParams;
createParams.format = TEX_IMG_RGBA; createParams.format = TexImgFormat::RGBA;
createParams.filter = TEX_FILTER_NEAREST; createParams.filter = TEX_FILTER_NEAREST;
createParams.mipmap = false; createParams.mipmap = false;

View File

@ -19,6 +19,8 @@
#include "graphics/opengl33/glutil.h" #include "graphics/opengl33/glutil.h"
#include "graphics/core/renderers.h"
#include "graphics/opengl33/gl33_device.h" #include "graphics/opengl33/gl33_device.h"
#include "common/image.h" #include "common/image.h"
@ -489,7 +491,24 @@ GLint LinkProgram(const std::vector<GLint>& shaders)
return program; return program;
} }
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size)
class CGLFrameBufferPixels : public CFrameBufferPixels
{
public:
CGLFrameBufferPixels(std::size_t size)
: m_pixels(std::make_unique<GLubyte[]>(size))
{}
void* GetPixelsData() override
{
return static_cast<void*>(m_pixels.get());
}
private:
std::unique_ptr<GLubyte[]> m_pixels;
};
std::unique_ptr<CFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size)
{ {
auto pixels = std::make_unique<CGLFrameBufferPixels>(4 * size.x * size.y); auto pixels = std::make_unique<CGLFrameBufferPixels>(4 * size.x * size.y);
@ -511,27 +530,27 @@ PreparedTextureData PrepareTextureData(ImageData* imageData, TexImgFormat format
texData.sourceFormat = 0; texData.sourceFormat = 0;
if (format == TEX_IMG_RGB) if (format == TexImgFormat::RGB)
{ {
texData.sourceFormat = GL_RGB; texData.sourceFormat = GL_RGB;
texData.alpha = false; texData.alpha = false;
} }
else if (format == TEX_IMG_BGR) else if (format == TexImgFormat::BGR)
{ {
texData.sourceFormat = GL_BGR; texData.sourceFormat = GL_BGR;
texData.alpha = false; texData.alpha = false;
} }
else if (format == TEX_IMG_RGBA) else if (format == TexImgFormat::RGBA)
{ {
texData.sourceFormat = GL_RGBA; texData.sourceFormat = GL_RGBA;
texData.alpha = true; texData.alpha = true;
} }
else if (format == TEX_IMG_BGRA) else if (format == TexImgFormat::BGRA)
{ {
texData.sourceFormat = GL_BGRA; texData.sourceFormat = GL_BGRA;
texData.alpha = true; texData.alpha = true;
} }
else if (format == TEX_IMG_AUTO) else if (format == TexImgFormat::AUTO)
{ {
if (imageData->surface->format->BytesPerPixel == 4) if (imageData->surface->format->BytesPerPixel == 4)
{ {

View File

@ -22,8 +22,6 @@
// config.h must be included first // config.h must be included first
#include "common/config.h" #include "common/config.h"
#include "graphics/core/device.h"
#include <GL/glew.h> #include <GL/glew.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
@ -33,11 +31,20 @@
struct SDL_Surface; struct SDL_Surface;
class CImage;
struct ImageData;
// Graphics module namespace // Graphics module namespace
namespace Gfx namespace Gfx
{ {
class CDevice;
class CFrameBufferPixels;
struct DeviceConfig;
enum class PrimitiveType : unsigned char;
enum class Type : unsigned char;
enum class TexImgFormat : unsigned char;
bool InitializeGLEW(); bool InitializeGLEW();
//! Creates OpenGL device //! Creates OpenGL device
@ -94,22 +101,6 @@ struct PreparedTextureData
PreparedTextureData PrepareTextureData(ImageData* imageData, TexImgFormat format); PreparedTextureData PrepareTextureData(ImageData* imageData, TexImgFormat format);
class CGLFrameBufferPixels : public CFrameBufferPixels std::unique_ptr<CFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size);
{
public:
CGLFrameBufferPixels(std::size_t size)
: m_pixels(std::make_unique<GLubyte[]>(size))
{}
void* GetPixelsData() override
{
return static_cast<void*>(m_pixels.get());
}
private:
std::unique_ptr<GLubyte[]> m_pixels;
};
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size);
} // namespace Gfx } // namespace Gfx

View File

@ -23,10 +23,9 @@
#include "common/event.h" #include "common/event.h"
#include "common/restext.h" #include "common/restext.h"
#include "graphics/engine/engine.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
#include "graphics/engine/engine.h"
namespace Ui namespace Ui
@ -144,8 +143,6 @@ void CButton::Draw()
glm::vec2 pos, dim, uv1, uv2; glm::vec2 pos, dim, uv1, uv2;
float dp; float dp;
auto device = m_engine->GetDevice();
if ( (m_state & STATE_VISIBLE) == 0 ) return; if ( (m_state & STATE_VISIBLE) == 0 ) return;
if ( m_state & STATE_WARNING ) // shading yellow-black? if ( m_state & STATE_WARNING ) // shading yellow-black?
@ -172,7 +169,7 @@ void CButton::Draw()
(m_state & STATE_CARD ) == 0 && (m_state & STATE_CARD ) == 0 &&
(m_state & STATE_SIMPLY) == 0 ) (m_state & STATE_SIMPLY) == 0 )
{ {
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button2.png"); auto texture = m_engine->LoadTexture("textures/interface/button2.png");

View File

@ -23,7 +23,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/restext.h" #include "common/restext.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -96,8 +95,7 @@ void CCheck::Draw()
float zoomExt, zoomInt; float zoomExt, zoomInt;
int icon; int icon;
auto device = m_engine->GetDevice(); auto renderer = m_engine->GetUIRenderer();
auto renderer = device->GetUIRenderer();
if ( (m_state & STATE_VISIBLE) == 0 ) return; if ( (m_state & STATE_VISIBLE) == 0 ) return;

View File

@ -23,7 +23,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/restext.h" #include "common/restext.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -136,7 +135,7 @@ void CColor::Draw()
DrawShadow(m_pos, m_dim); DrawShadow(m_pos, m_dim);
} }
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button1.png"); auto texture = m_engine->LoadTexture("textures/interface/button1.png");
renderer->SetTexture(texture); renderer->SetTexture(texture);

View File

@ -456,7 +456,7 @@ void CControl::Draw()
auto texture = m_engine->LoadTexture("textures/interface/button1.png"); auto texture = m_engine->LoadTexture("textures/interface/button1.png");
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
renderer->SetTransparency(Gfx::TransparencyMode::NONE); renderer->SetTransparency(Gfx::TransparencyMode::NONE);
renderer->SetTexture(texture); renderer->SetTexture(texture);
@ -613,7 +613,7 @@ void CControl::DrawIcon(const glm::vec2& pos, const glm::vec2& dim, const glm::v
{ {
glm::vec2 p1, p2, p3, p4; glm::vec2 p1, p2, p3, p4;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
p1.x = pos.x; p1.x = pos.x;
p1.y = pos.y; p1.y = pos.y;
@ -684,7 +684,7 @@ void CControl::DrawIcon(const glm::vec2& pos, const glm::vec2& dim, const glm::v
glm::vec2 corner = cor; glm::vec2 corner = cor;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
p1.x = pos.x; p1.x = pos.x;
p1.y = pos.y; p1.y = pos.y;
@ -756,7 +756,7 @@ void CControl::DrawWarning(const glm::vec2& position, const glm::vec2& dimension
glm::vec2 uv1, uv2; glm::vec2 uv1, uv2;
float dp; float dp;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
glm::vec2 pos = position; glm::vec2 pos = position;
glm::vec2 dim = dimension; glm::vec2 dim = dimension;
@ -807,7 +807,7 @@ void CControl::DrawShadow(const glm::vec2& position, const glm::vec2& dimension,
glm::vec2 uv1, uv2, corner; glm::vec2 uv1, uv2, corner;
float dp; float dp;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
glm::vec2 pos = position; glm::vec2 pos = position;
glm::vec2 dim = dimension; glm::vec2 dim = dimension;
@ -869,7 +869,7 @@ int CControl::SetButtonTextureForIcon(int icon)
int buttonFile = (icon/64) + 1; int buttonFile = (icon/64) + 1;
auto texture = m_engine->LoadTexture("textures/interface/button" + StrUtils::ToString<int>(buttonFile) + ".png"); auto texture = m_engine->LoadTexture("textures/interface/button" + StrUtils::ToString<int>(buttonFile) + ".png");
m_engine->GetDevice()->GetUIRenderer()->SetTexture(texture); m_engine->GetUIRenderer()->SetTexture(texture);
return iconIdx; return iconIdx;
} }

View File

@ -1182,16 +1182,16 @@ void CEdit::DrawImage(const glm::vec2& pos, std::string name, float width,
glm::vec2 uv1, uv2, dim; glm::vec2 uv1, uv2, dim;
float dp; float dp;
m_engine->GetDevice()->GetUIRenderer()->SetTransparency(Gfx::TransparencyMode::NONE); m_engine->GetUIRenderer()->SetTransparency(Gfx::TransparencyMode::NONE);
//m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); //m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
Gfx::TextureCreateParams params; Gfx::TextureCreateParams params;
params.format = Gfx::TEX_IMG_AUTO; params.format = Gfx::TexImgFormat::AUTO;
params.filter = Gfx::TEX_FILTER_BILINEAR; params.filter = Gfx::TEX_FILTER_BILINEAR;
params.padToNearestPowerOfTwo = true; params.padToNearestPowerOfTwo = true;
Gfx::Texture tex = m_engine->LoadTexture(PrepareImageFilename(name), params); Gfx::Texture tex = m_engine->LoadTexture(PrepareImageFilename(name), params);
m_engine->GetDevice()->GetUIRenderer()->SetTexture(tex); m_engine->GetUIRenderer()->SetTexture(tex);
uv1.x = 0.0f; uv1.x = 0.0f;
uv2.x = 1.0f; uv2.x = 1.0f;
@ -1225,7 +1225,7 @@ void CEdit::DrawBack(const glm::vec2& pos, const glm::vec2& dim)
auto texture = m_engine->LoadTexture("textures/interface/button2.png"); auto texture = m_engine->LoadTexture("textures/interface/button2.png");
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
renderer->SetTexture(texture); renderer->SetTexture(texture);
renderer->SetTransparency(Gfx::TransparencyMode::NONE); renderer->SetTransparency(Gfx::TransparencyMode::NONE);
@ -1271,7 +1271,7 @@ void CEdit::DrawBack(const glm::vec2& pos, const glm::vec2& dim)
void CEdit::DrawHorizontalGradient(const glm::vec2& pos, const glm::vec2& dim, Gfx::Color color1, Gfx::Color color2) void CEdit::DrawHorizontalGradient(const glm::vec2& pos, const glm::vec2& dim, Gfx::Color color1, Gfx::Color color2)
{ {
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
renderer->SetTransparency(Gfx::TransparencyMode::NONE); renderer->SetTransparency(Gfx::TransparencyMode::NONE);
glm::vec2 p1, p2; glm::vec2 p1, p2;

View File

@ -22,7 +22,6 @@
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -84,7 +83,7 @@ void CGauge::Draw()
auto texture = m_engine->LoadTexture("textures/interface/button2.png"); auto texture = m_engine->LoadTexture("textures/interface/button2.png");
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
renderer->SetTexture(texture); renderer->SetTexture(texture);
renderer->SetTransparency(Gfx::TransparencyMode::NONE); renderer->SetTransparency(Gfx::TransparencyMode::NONE);

View File

@ -23,7 +23,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/restext.h" #include "common/restext.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -85,8 +84,6 @@ void CGroup::Draw()
float dp; float dp;
int icon; int icon;
auto device = m_engine->GetDevice();
if ( (m_state & STATE_VISIBLE) == 0 ) return; if ( (m_state & STATE_VISIBLE) == 0 ) return;
if ( m_state & STATE_SHADOW ) if ( m_state & STATE_SHADOW )
@ -96,7 +93,7 @@ void CGroup::Draw()
dp = 0.5f / 256.0f; dp = 0.5f / 256.0f;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
if ( m_icon == 0 ) // hollow frame? if ( m_icon == 0 ) // hollow frame?
{ {

View File

@ -23,7 +23,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/restext.h" #include "common/restext.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -95,7 +94,7 @@ void CImage::Draw()
glm::vec2 uv1,uv2, corner, pos, dim; glm::vec2 uv1,uv2, corner, pos, dim;
float dp; float dp;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
if ( (m_state & STATE_VISIBLE) == 0 ) return; if ( (m_state & STATE_VISIBLE) == 0 ) return;
@ -127,7 +126,7 @@ void CImage::Draw()
if ( m_filename[0] != 0 ) // displays an image? if ( m_filename[0] != 0 ) // displays an image?
{ {
Gfx::TextureCreateParams params; Gfx::TextureCreateParams params;
params.format = Gfx::TEX_IMG_AUTO; params.format = Gfx::TexImgFormat::AUTO;
params.filter = Gfx::TEX_FILTER_BILINEAR; params.filter = Gfx::TEX_FILTER_BILINEAR;
params.padToNearestPowerOfTwo = true; params.padToNearestPowerOfTwo = true;
Gfx::Texture tex = m_engine->LoadTexture(m_filename, params); Gfx::Texture tex = m_engine->LoadTexture(m_filename, params);

View File

@ -23,7 +23,6 @@
#include "common/global.h" #include "common/global.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -138,7 +137,7 @@ void CKey::Draw()
if (m_state & STATE_SHADOW) if (m_state & STATE_SHADOW)
DrawShadow(m_pos, m_dim); DrawShadow(m_pos, m_dim);
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button1.png"); auto texture = m_engine->LoadTexture("textures/interface/button1.png");
renderer->SetTexture(texture); renderer->SetTexture(texture);

View File

@ -20,7 +20,6 @@
#include "ui/controls/list.h" #include "ui/controls/list.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
@ -367,7 +366,7 @@ void CList::Draw()
dp = 0.5f / 256.0f; dp = 0.5f / 256.0f;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
if (m_icon != -1) if (m_icon != -1)
{ {

View File

@ -22,7 +22,6 @@
#include "common/image.h" #include "common/image.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -337,7 +336,7 @@ void CMap::Draw()
glm::vec2 uv1, uv2; glm::vec2 uv1, uv2;
int i; int i;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
if ( (m_state & STATE_VISIBLE) == 0 ) if ( (m_state & STATE_VISIBLE) == 0 )
return; return;
@ -508,7 +507,7 @@ void CMap::DrawFocus(const glm::vec2& position, float dir, ObjectType type, MapC
uv2.x = 126.0f/256.0f; uv2.x = 126.0f/256.0f;
uv2.y = 255.0f/256.0f; uv2.y = 255.0f/256.0f;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button2.png"); auto texture = m_engine->LoadTexture("textures/interface/button2.png");
renderer->SetTransparency(Gfx::TransparencyMode::WHITE); renderer->SetTransparency(Gfx::TransparencyMode::WHITE);
@ -563,7 +562,7 @@ void CMap::DrawObject(const glm::vec2& position, float dir, ObjectType type, Map
dim.x = 2.0f/128.0f*0.75f; dim.x = 2.0f/128.0f*0.75f;
dim.y = 2.0f/128.0f; dim.y = 2.0f/128.0f;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
if ( bOut ) // outside the map? if ( bOut ) // outside the map?
{ {
@ -835,7 +834,7 @@ void CMap::DrawObjectIcon(const glm::vec2& pos, const glm::vec2& dim, MapColor c
dp = 0.5f/256.0f; dp = 0.5f/256.0f;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button3.png"); auto texture = m_engine->LoadTexture("textures/interface/button3.png");
renderer->SetTransparency(Gfx::TransparencyMode::NONE); renderer->SetTransparency(Gfx::TransparencyMode::NONE);
@ -984,7 +983,7 @@ void CMap::DrawHighlight(const glm::vec2& position)
dim.x *= 2.0f+cosf(m_time*8.0f)*0.5f; dim.x *= 2.0f+cosf(m_time*8.0f)*0.5f;
dim.y *= 2.0f+cosf(m_time*8.0f)*0.5f; dim.y *= 2.0f+cosf(m_time*8.0f)*0.5f;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button2.png"); auto texture = m_engine->LoadTexture("textures/interface/button2.png");
renderer->SetTransparency(Gfx::TransparencyMode::BLACK); renderer->SetTransparency(Gfx::TransparencyMode::BLACK);
@ -1003,7 +1002,7 @@ void CMap::DrawHighlight(const glm::vec2& position)
void CMap::DrawTriangle(const glm::vec2& p1, const glm::vec2& p2, const glm::vec2& p3, const glm::vec2& uv1, const glm::vec2& uv2) void CMap::DrawTriangle(const glm::vec2& p1, const glm::vec2& p2, const glm::vec2& p3, const glm::vec2& uv1, const glm::vec2& uv2)
{ {
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 3); auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 3);
@ -1019,7 +1018,7 @@ void CMap::DrawTriangle(const glm::vec2& p1, const glm::vec2& p2, const glm::vec
void CMap::DrawPenta(const glm::vec2& p1, const glm::vec2& p2, const glm::vec2& p3, const glm::vec2& p4, const glm::vec2& p5, const glm::vec2& uv1, const glm::vec2& uv2) void CMap::DrawPenta(const glm::vec2& p1, const glm::vec2& p2, const glm::vec2& p3, const glm::vec2& p4, const glm::vec2& p5, const glm::vec2& uv1, const glm::vec2& uv2)
{ {
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 5); auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 5);
vertices[0] = { { p1.x, p1.y }, { uv1.x, uv1.y } }; vertices[0] = { { p1.x, p1.y }, { uv1.x, uv1.y } };
@ -1056,7 +1055,7 @@ void CMap::DrawVertex(const glm::vec2& uv1, const glm::vec2& uv2, float zoom)
m_mapDim.x = p2.x-p1.x; m_mapDim.x = p2.x-p1.x;
m_mapDim.y = p2.y-p1.y; m_mapDim.y = p2.y-p1.y;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 4); auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 4);
vertices[0] = { { p1.x, p1.y }, { uv1.x, uv2.y } }; vertices[0] = { { p1.x, p1.y }, { uv1.x, uv2.y } };
@ -1125,7 +1124,7 @@ void CMap::UpdateTerrain()
} }
} }
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
m_engine->DeleteTexture("interface/map.png"); m_engine->DeleteTexture("interface/map.png");
m_engine->LoadTexture("textures/interface/map.png", &img); m_engine->LoadTexture("textures/interface/map.png", &img);

View File

@ -22,7 +22,6 @@
#include "common/event.h" #include "common/event.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -309,8 +308,6 @@ void CScroll::Draw()
float hButton; float hButton;
int icon, n, i; int icon, n, i;
auto device = m_engine->GetDevice();
hButton = m_buttonUp?m_dim.x/0.75f:0.0f; hButton = m_buttonUp?m_dim.x/0.75f:0.0f;
// Draws the bottom. // Draws the bottom.
@ -365,8 +362,7 @@ void CScroll::DrawVertex(const glm::vec2& pos, const glm::vec2& dim, int icon)
glm::vec2 uv1, uv2; glm::vec2 uv1, uv2;
float ex, dp; float ex, dp;
auto device = m_engine->GetDevice(); auto renderer = m_engine->GetUIRenderer();
auto renderer = device->GetUIRenderer();
if ( icon == 0 ) if ( icon == 0 )
{ {

View File

@ -22,7 +22,6 @@
#include "common/event.h" #include "common/event.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -119,7 +118,7 @@ void CShortcut::Draw()
zoom = 1.0f; zoom = 1.0f;
} }
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto texture = m_engine->LoadTexture("textures/interface/button3.png"); auto texture = m_engine->LoadTexture("textures/interface/button3.png");
renderer->SetTexture(texture); renderer->SetTexture(texture);
@ -260,7 +259,7 @@ void CShortcut::DrawVertex(int icon, float zoom)
u2 -= dp; u2 -= dp;
v2 -= dp; v2 -= dp;
auto renderer = m_engine->GetDevice()->GetUIRenderer(); auto renderer = m_engine->GetUIRenderer();
auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 4); auto vertices = renderer->BeginPrimitive(Gfx::PrimitiveType::TRIANGLE_STRIP, 4);
vertices[0] = { { p1.x, p1.y }, { u1, v2 } }; vertices[0] = { { p1.x, p1.y }, { u1, v2 } };

View File

@ -23,7 +23,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -375,8 +374,6 @@ void CSlider::Draw()
int icon; int icon;
float h; float h;
auto device = m_engine->GetDevice();
if ( (m_state & STATE_VISIBLE) == 0 ) return; if ( (m_state & STATE_VISIBLE) == 0 ) return;
if (m_buttonLeft != nullptr) if (m_buttonLeft != nullptr)
@ -492,8 +489,7 @@ void CSlider::DrawVertex(const glm::vec2& pos, const glm::vec2& dim, int icon)
glm::vec2 uv1, uv2, corner; glm::vec2 uv1, uv2, corner;
float ex, dp; float ex, dp;
auto device = m_engine->GetDevice(); auto renderer = m_engine->GetUIRenderer();
auto renderer = device->GetUIRenderer();
if ( icon == 0 ) if ( icon == 0 )
{ {

View File

@ -38,7 +38,6 @@
#include "ui/controls/slider.h" #include "ui/controls/slider.h"
#include "ui/controls/target.h" #include "ui/controls/target.h"
#include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -824,8 +823,6 @@ void CWindow::Draw()
{ {
if ( (m_state & STATE_VISIBLE) == 0 ) return; if ( (m_state & STATE_VISIBLE) == 0 ) return;
auto device = m_engine->GetDevice();
if ( m_state & STATE_SHADOW ) if ( m_state & STATE_SHADOW )
{ {
DrawShadow(m_pos, m_dim); DrawShadow(m_pos, m_dim);
@ -909,8 +906,7 @@ void CWindow::DrawVertex(const glm::vec2& position, const glm::vec2& dimension,
glm::vec2 pos = position; glm::vec2 pos = position;
glm::vec2 dim = dimension; glm::vec2 dim = dimension;
auto device = m_engine->GetDevice(); auto renderer = m_engine->GetUIRenderer();
auto renderer = device->GetUIRenderer();
dp = 0.5f/256.0f; dp = 0.5f/256.0f;
@ -1300,8 +1296,7 @@ void CWindow::DrawHach(const glm::vec2& pos, const glm::vec2& dim)
float dp, max, ndim; float dp, max, ndim;
bool bStop; bool bStop;
auto device = m_engine->GetDevice(); auto renderer = m_engine->GetUIRenderer();
auto renderer = device->GetUIRenderer();
dp = 0.5f/256.0f; dp = 0.5f/256.0f;
auto texture = m_engine->LoadTexture("textures/interface/button2.png"); auto texture = m_engine->LoadTexture("textures/interface/button2.png");

View File

@ -27,6 +27,7 @@
#include "common/settings.h" #include "common/settings.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "graphics/core/device.h"
#include "graphics/engine/camera.h" #include "graphics/engine/camera.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"

View File

@ -27,6 +27,7 @@
#include "common/settings.h" #include "common/settings.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "graphics/core/device.h"
#include "graphics/engine/camera.h" #include "graphics/engine/camera.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"