Fixed some transparency bugs and started on component based camera

This commit is contained in:
viktorljung
2015-12-14 19:10:00 +01:00
parent 6723e71fee
commit 05b78265be
17 changed files with 160 additions and 72 deletions
+6
View File
@@ -25,12 +25,18 @@ public:
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
static bool DepthSort(const std::shared_ptr<RenderJob> &i, const std::shared_ptr<RenderJob> &j)
{
return (i->Depth < j->Depth);
};
Texture* m_WhiteTexture;
const IRenderer* m_Renderer;
ShaderProgram* m_BasicForwardProgram;
};
#endif
+23
View File
@@ -0,0 +1,23 @@
#ifndef Events_SetCamera_h__
#define Events_SetCamera_h__
#include "../Core/EventBroker.h"
#include "../Core/Entity.h"
namespace Events
{
/** Thrown Every frame, use functions to pick*/
struct SetCamera : Event
{
public:
SetCamera() { };
EntityID Entity;
private:
};
}
#endif
+1
View File
@@ -46,6 +46,7 @@ public:
struct MaterialGroup
{
float Shininess;
float Transparency;
std::shared_ptr<::Texture> Texture;
std::shared_ptr<::Texture> NormalMap;
std::shared_ptr<::Texture> SpecularMap;
+31
View File
@@ -63,6 +63,37 @@ struct ModelJob : RenderJob
}
};
struct TransparentModelJob : RenderJob
{
unsigned int ShaderID = 0;
unsigned int TextureID = 0;
//TODO: RENDERER: Not sure if the best solution for pickingColor to entity link is this
EntityID Entity;
glm::mat4 ModelMatrix;
const Texture* DiffuseTexture;
const Texture* NormalTexture;
const Texture* SpecularTexture;
float Shininess = 0.f;
glm::vec4 Color;
const Model* Model = nullptr;
unsigned int StartIndex = 0;
unsigned int EndIndex = 0;
// Animation
Skeleton* Skeleton = nullptr;
bool NoRootMotion = true;
std::string AnimationName;
double AnimationTime = 0;
void CalculateHash() override
{
Hash = TextureID;
}
};
struct SpriteJob : RenderJob
{
unsigned int ShaderID = 0;
@@ -6,16 +6,19 @@
#include "../Core/ResourceManager.h"
#include "Model.h"
#include "../GLM.h"
#include "../Core/EventBroker.h"
#include "ESetCamera.h"
class RenderQueueFactory
{
public:
RenderQueueFactory();
RenderQueueFactory(EventBroker* eventBroker);
void Update(World* world);
RenderQueueCollection RenderQueues() const { return m_RenderQueues; }
private:
EventBroker* m_EventBroker;
RenderQueueCollection m_RenderQueues;
void FillModels(World* world, RenderQueue* renderQueue);
@@ -26,6 +29,9 @@ private:
glm::vec3 AbsolutePosition(World* world, EntityID entity);
glm::quat AbsoluteOrientation(World* world, EntityID entity);
glm::vec3 AbsoluteScale(World* world, EntityID entity);
EntityID m_CurrentCamera;
};
#endif
+3 -1
View File
@@ -32,8 +32,9 @@ enum lightType
class Renderer : public IRenderer
{
public:
Renderer(EventBroker* eventBroker)
Renderer(EventBroker* eventBroker, World* world)
: m_EventBroker(eventBroker)
, m_World(world)
{ }
virtual void Initialize() override;
@@ -43,6 +44,7 @@ public:
private:
//----------------------Variables----------------------//
EventBroker* m_EventBroker;
World* m_World;
Texture* m_ErrorTexture;
Texture* m_WhiteTexture;