Refactored Math::IntPoint in core graphics classes
parent
cd6ea1a4c5
commit
48d2b4a618
|
@ -32,7 +32,7 @@
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
|
|
||||||
#include "level/level_category.h"
|
#include "level/level_category.h"
|
||||||
|
#include "math/intpoint.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "graphics/core/texture.h"
|
#include "graphics/core/texture.h"
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
#include "math/intpoint.h"
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -70,7 +70,7 @@ struct VertexTex2;
|
||||||
struct DeviceConfig
|
struct DeviceConfig
|
||||||
{
|
{
|
||||||
//! Screen size
|
//! Screen size
|
||||||
Math::IntPoint size = Math::IntPoint(800, 600);
|
glm::ivec2 size = { 800, 600 };
|
||||||
//! Bits per pixel
|
//! Bits per pixel
|
||||||
int bpp = 32;
|
int bpp = 32;
|
||||||
//! Full screen
|
//! Full screen
|
||||||
|
@ -474,7 +474,7 @@ public:
|
||||||
//! Creates a depth texture with specific dimensions and depth
|
//! Creates a depth texture with specific dimensions and depth
|
||||||
virtual Texture CreateDepthTexture(int width, int height, int depth) = 0;
|
virtual Texture CreateDepthTexture(int width, int height, int depth) = 0;
|
||||||
//! Updates a part of texture from raw image data
|
//! Updates a part of texture from raw image data
|
||||||
virtual void UpdateTexture(const Texture& texture, Math::IntPoint offset, ImageData* data, TexImgFormat format) = 0;
|
virtual void UpdateTexture(const Texture& texture, const glm::ivec2& offset, ImageData* data, TexImgFormat format) = 0;
|
||||||
//! Deletes a given texture, freeing it from video memory
|
//! Deletes a given texture, freeing it from video memory
|
||||||
virtual void DestroyTexture(const Texture &texture) = 0;
|
virtual void DestroyTexture(const Texture &texture) = 0;
|
||||||
//! Deletes all textures created so far
|
//! Deletes all textures created so far
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "graphics/core/color.h"
|
#include "graphics/core/color.h"
|
||||||
|
|
||||||
#include "math/intpoint.h"
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
|
||||||
// Graphics module namespace
|
// Graphics module namespace
|
||||||
|
@ -217,9 +217,9 @@ struct Texture
|
||||||
//! ID of the texture in graphics engine; 0 = invalid texture
|
//! ID of the texture in graphics engine; 0 = invalid texture
|
||||||
unsigned int id = 0;
|
unsigned int id = 0;
|
||||||
//! Size of texture
|
//! Size of texture
|
||||||
Math::IntPoint size;
|
glm::ivec2 size;
|
||||||
//! Original size of texture (as loaded from image)
|
//! Original size of texture (as loaded from image)
|
||||||
Math::IntPoint originalSize;
|
glm::ivec2 originalSize;
|
||||||
//! Whether the texture has alpha channel
|
//! Whether the texture has alpha channel
|
||||||
bool alpha = false;
|
bool alpha = false;
|
||||||
|
|
||||||
|
|
|
@ -680,7 +680,7 @@ Texture CGL33Device::CreateTexture(CImage *image, const TextureCreateParams &par
|
||||||
return Texture(); // invalid texture
|
return Texture(); // invalid texture
|
||||||
}
|
}
|
||||||
|
|
||||||
Math::IntPoint originalSize = image->GetSize();
|
glm::ivec2 originalSize = image->GetSize();
|
||||||
|
|
||||||
if (params.padToNearestPowerOfTwo)
|
if (params.padToNearestPowerOfTwo)
|
||||||
image->PadToNearestPowerOfTwo();
|
image->PadToNearestPowerOfTwo();
|
||||||
|
@ -810,7 +810,7 @@ Texture CGL33Device::CreateDepthTexture(int width, int height, int depth)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGL33Device::UpdateTexture(const Texture& texture, Math::IntPoint offset, ImageData* data, TexImgFormat format)
|
void CGL33Device::UpdateTexture(const Texture& texture, const glm::ivec2& offset, ImageData* data, TexImgFormat format)
|
||||||
{
|
{
|
||||||
if (texture.id == 0) return;
|
if (texture.id == 0) return;
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) override;
|
Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) override;
|
||||||
Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms) override;
|
Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms) override;
|
||||||
Texture CreateDepthTexture(int width, int height, int depth) override;
|
Texture CreateDepthTexture(int width, int height, int depth) override;
|
||||||
void UpdateTexture(const Texture& texture, Math::IntPoint offset, ImageData* data, TexImgFormat format) override;
|
void UpdateTexture(const Texture& texture, const glm::ivec2& offset, ImageData* data, TexImgFormat format) override;
|
||||||
void DestroyTexture(const Texture &texture) override;
|
void DestroyTexture(const Texture &texture) override;
|
||||||
void DestroyAllTextures() override;
|
void DestroyAllTextures() override;
|
||||||
|
|
||||||
|
|
|
@ -629,7 +629,7 @@ GLint LinkProgram(const std::vector<GLint>& shaders)
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(Math::IntPoint size)
|
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size)
|
||||||
{
|
{
|
||||||
auto pixels = MakeUnique<CGLFrameBufferPixels>(4 * size.x * size.y);
|
auto pixels = MakeUnique<CGLFrameBufferPixels>(4 * size.x * size.y);
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
|
|
||||||
#include "math/intpoint.h"
|
|
||||||
#include "math/vector.h"
|
#include "math/vector.h"
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -135,7 +135,7 @@ private:
|
||||||
std::unique_ptr<GLubyte[]> m_pixels;
|
std::unique_ptr<GLubyte[]> m_pixels;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(Math::IntPoint size);
|
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size);
|
||||||
|
|
||||||
struct LightLocations
|
struct LightLocations
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue