add simple render, add simple pbr shader(from hazel)
This commit is contained in:
@ -6,6 +6,9 @@
|
||||
#define DEMOLAYER_H
|
||||
|
||||
#include "Prism.h"
|
||||
#include "Prism/Renderer/Camera.h"
|
||||
#include "Prism/Renderer/FrameBuffer.h"
|
||||
#include "Prism/Renderer/Mesh.h"
|
||||
|
||||
class DemoLayer : public Prism::Layer
|
||||
{
|
||||
@ -20,12 +23,80 @@ public:
|
||||
virtual void OnEvent(Prism::Event& e) override;
|
||||
|
||||
private:
|
||||
float m_ClearColor[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
|
||||
glm::vec4 m_TriangleColor = { 0.4f, 0.5f, 0.6f, 1.0f };
|
||||
float m_ClearColor[4];
|
||||
|
||||
std::unique_ptr<Prism::Shader> m_Shader;
|
||||
std::unique_ptr<Prism::Shader> m_PBRShader;
|
||||
std::unique_ptr<Prism::Shader> m_SimplePBRShader;
|
||||
std::unique_ptr<Prism::Shader> m_QuadShader;
|
||||
std::unique_ptr<Prism::Shader> m_HDRShader;
|
||||
std::unique_ptr<Prism::Mesh> m_Mesh;
|
||||
std::unique_ptr<Prism::Mesh> m_SphereMesh;
|
||||
std::unique_ptr<Prism::Texture2D> m_BRDFLUT;
|
||||
|
||||
struct AlbedoInput
|
||||
{
|
||||
glm::vec3 Color = { 0.972f, 0.96f, 0.915f }; // Silver, from https://docs.unrealengine.com/en-us/Engine/Rendering/Materials/PhysicallyBased
|
||||
std::unique_ptr<Prism::Texture2D> TextureMap;
|
||||
bool SRGB = true;
|
||||
bool UseTexture = false;
|
||||
};
|
||||
AlbedoInput m_AlbedoInput;
|
||||
|
||||
struct NormalInput
|
||||
{
|
||||
std::unique_ptr<Prism::Texture2D> TextureMap;
|
||||
bool UseTexture = false;
|
||||
};
|
||||
NormalInput m_NormalInput;
|
||||
|
||||
struct MetalnessInput
|
||||
{
|
||||
float Value = 1.0f;
|
||||
std::unique_ptr<Prism::Texture2D> TextureMap;
|
||||
bool UseTexture = false;
|
||||
};
|
||||
MetalnessInput m_MetalnessInput;
|
||||
|
||||
struct RoughnessInput
|
||||
{
|
||||
float Value = 0.5f;
|
||||
std::unique_ptr<Prism::Texture2D> TextureMap;
|
||||
bool UseTexture = false;
|
||||
};
|
||||
RoughnessInput m_RoughnessInput;
|
||||
|
||||
std::unique_ptr<Prism::FrameBuffer> m_Framebuffer, m_FinalPresentBuffer;
|
||||
|
||||
std::unique_ptr<Prism::VertexBuffer> m_VertexBuffer;
|
||||
std::unique_ptr<Prism::IndexBuffer> m_IndexBuffer;
|
||||
std::unique_ptr<Prism::Shader> m_Shader;
|
||||
std::unique_ptr<Prism::TextureCube> m_EnvironmentCubeMap, m_EnvironmentIrradiance;
|
||||
|
||||
Prism::Camera m_Camera;
|
||||
|
||||
struct Light
|
||||
{
|
||||
glm::vec3 Direction;
|
||||
glm::vec3 Radiance;
|
||||
};
|
||||
Light m_Light;
|
||||
float m_LightMultiplier = 0.3f;
|
||||
|
||||
// PBR params
|
||||
float m_Exposure = 1.0f;
|
||||
|
||||
bool m_RadiancePrefilter = false;
|
||||
|
||||
float m_EnvMapRotation = 0.0f;
|
||||
|
||||
enum class Scene : uint32_t
|
||||
{
|
||||
Spheres = 0, Model = 1
|
||||
};
|
||||
Scene m_Scene;
|
||||
|
||||
// Editor resources
|
||||
std::unique_ptr<Prism::Texture2D> m_CheckerboardTex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user