TextureSprite Resource that use GL_NEAREST for sampling aswell as some StartMenu changes
This commit is contained in:
@@ -48,7 +48,7 @@ private:
|
||||
//const LightCullingPass* m_LightCullingPass
|
||||
int m_Iterations = 3;
|
||||
int m_Quality = 0;
|
||||
float m_BlurQuality = 2.f;
|
||||
float m_BlurQuality = 4.f;
|
||||
|
||||
GLuint m_GaussianTexture_horiz = 0;
|
||||
GLuint m_GaussianTexture_vert = 0;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "../GLM.h"
|
||||
#include "../Core/ComponentWrapper.h"
|
||||
#include "Texture.h"
|
||||
#include "TextureSprite.h"
|
||||
#include "Model.h"
|
||||
#include "RenderJob.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
@@ -24,9 +25,9 @@ struct SpriteJob : RenderJob
|
||||
::RawModel::MaterialProperties matProp = Model->MaterialGroups().front();
|
||||
TextureID = 0;
|
||||
|
||||
DiffuseTexture = CommonFunctions::LoadTexture(cSprite["DiffuseTexture"], true);
|
||||
DiffuseTexture = CommonFunctions::TryLoadResource<TextureSprite, true>(cSprite["DiffuseTexture"]);
|
||||
|
||||
IncandescenceTexture = CommonFunctions::LoadTexture(cSprite["GlowMap"], true);
|
||||
IncandescenceTexture = CommonFunctions::TryLoadResource<TextureSprite, true>(cSprite["GlowMap"]);
|
||||
|
||||
StartIndex = matProp.material->StartIndex;
|
||||
EndIndex = matProp.material->EndIndex;
|
||||
|
||||
@@ -9,7 +9,7 @@ class Texture : public BaseTexture
|
||||
{
|
||||
friend class ResourceManager;
|
||||
|
||||
private:
|
||||
protected:
|
||||
Texture(std::string path);
|
||||
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef TextureSprite_h__
|
||||
#define TextureSprite_h__
|
||||
|
||||
#include "../OpenGL.h"
|
||||
#include "BaseTexture.h"
|
||||
#include "Texture.h"
|
||||
#include "PNG.h"
|
||||
|
||||
class TextureSprite : public Texture
|
||||
{
|
||||
friend class ResourceManager;
|
||||
|
||||
protected:
|
||||
TextureSprite(std::string path);
|
||||
|
||||
public:
|
||||
~TextureSprite();
|
||||
|
||||
void Bind(GLenum textureUnit = GL_TEXTURE0);
|
||||
|
||||
GLuint m_Texture = 0;
|
||||
unsigned char* Data = nullptr;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,23 @@
|
||||
|
||||
namespace CommonFunctions
|
||||
{
|
||||
Texture* LoadTexture(std::string path, bool threaded);
|
||||
|
||||
//Loads Texture/SpriteTexture and return null if it fails
|
||||
template <typename T, bool threaded>
|
||||
Texture* TryLoadResource(std::string path)
|
||||
{
|
||||
Texture* img;
|
||||
try {
|
||||
img = ResourceManager::Load<T, threaded>(path);
|
||||
} catch (const Resource::StillLoadingException&) {
|
||||
img = ResourceManager::Load<T>("Textures/Core/ErrorTexture.png");
|
||||
} catch (const std::exception&) {
|
||||
img = nullptr;
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
|
||||
void GenerateMultiSampleTexture(GLuint* texture, int numSamples, glm::vec2 dimensions, GLint internalFormat);
|
||||
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps);
|
||||
|
||||
Reference in New Issue
Block a user