PNG is now a resource.
You can now load textures threaded. PNG will now throw exceptions when errors happend SpriteComponent is now working without billboarding.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Frame.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
#include "../Rendering/Util/CommonFunctions.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
@@ -55,10 +56,10 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
m_Texture = ResourceManager::Load<Texture>(resourceName);
|
||||
m_Texture = CommonFunctions::LoadTexture(resourceName, false);
|
||||
m_TextureName = resourceName;
|
||||
if (m_Texture == nullptr) {
|
||||
m_Texture = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
||||
m_Texture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
|
||||
}
|
||||
|
||||
SizeToTexture();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "FrameBuffer.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "Util/UnorderedMapVec2.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
#include "Texture.h"
|
||||
|
||||
class DrawFinalPass
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
Texture* m_BlackTexture;
|
||||
Texture* m_NeutralNormalTexture;
|
||||
Texture* m_GreyTexture;
|
||||
Texture* m_ErrorTexture;
|
||||
|
||||
FrameBuffer m_FinalPassFrameBuffer;
|
||||
GLuint m_BloomTexture;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define Model_h__
|
||||
|
||||
#include "Rendering/RawModelCustom.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
//#include "Rendering/RawModelAssimp.h"
|
||||
#include "../OpenGL.h"
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
#include <png.h>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "Image.h"
|
||||
|
||||
class PNG : public Image
|
||||
class PNG : public Image, public Resource
|
||||
{
|
||||
public:
|
||||
PNG(std::string path);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../Core/Transform.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "TextPass.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
|
||||
class Renderer : public IRenderer
|
||||
{
|
||||
|
||||
@@ -24,23 +24,17 @@ struct SpriteJob : RenderJob
|
||||
::RawModel::MaterialGroup matGroup = Model->MaterialGroups().front();
|
||||
TextureID = (matGroup.Texture) ? matGroup.Texture->ResourceID : 0;
|
||||
|
||||
if (cSprite["DiffuseTexture"]) {
|
||||
DiffuseTexture = ResourceManager::Load<Texture>(cSprite["DiffuseTexture"]);
|
||||
} else {
|
||||
DiffuseTexture = nullptr;
|
||||
}
|
||||
if (cSprite["GlowMap"]) {
|
||||
IncandescenceTexture = ResourceManager::Load<Texture>(cSprite["GlowMap"]);
|
||||
} else {
|
||||
IncandescenceTexture = nullptr;
|
||||
}
|
||||
DiffuseTexture = CommonFunctions::LoadTexture(cSprite["DiffuseTexture"], true);
|
||||
|
||||
IncandescenceTexture = CommonFunctions::LoadTexture(cSprite["GlowMap"], true);
|
||||
|
||||
StartIndex = matGroup.StartIndex;
|
||||
EndIndex = matGroup.EndIndex;
|
||||
Matrix = matrix;
|
||||
Color = cSprite["Color"];
|
||||
Entity = cSprite.EntityID;
|
||||
glm::vec3 abspos = Transform::AbsolutePosition(world, cSprite.EntityID);
|
||||
glm::vec3 viewpos = glm::vec3(camera->ViewMatrix() * glm::vec4(abspos, 1));
|
||||
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
|
||||
glm::vec3 viewpos = glm::vec3(camera->ViewMatrix() * glm::vec4(Position, 1));
|
||||
Depth = viewpos.z;
|
||||
World = world;
|
||||
|
||||
@@ -58,6 +52,7 @@ struct SpriteJob : RenderJob
|
||||
const Texture* IncandescenceTexture;
|
||||
float Shininess = 0.f;
|
||||
glm::vec4 Color;
|
||||
glm::vec3 Position;
|
||||
const ::Model* Model = nullptr;
|
||||
unsigned int StartIndex = 0;
|
||||
unsigned int EndIndex = 0;
|
||||
|
||||
@@ -4,14 +4,11 @@
|
||||
#include "../../Common.h"
|
||||
#include "../../OpenGL.h"
|
||||
#include "../../GLM.h"
|
||||
#include "../Texture.h"
|
||||
|
||||
class CommonFuntions
|
||||
{
|
||||
public:
|
||||
CommonFuntions() = delete;
|
||||
|
||||
private:
|
||||
|
||||
namespace CommonFunctions
|
||||
{
|
||||
Texture* LoadTexture(std::string path, bool threaded);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user