Shader directory refactor

This commit is contained in:
Jack Andersen 2016-07-20 19:21:45 -10:00
parent 4bcd88e69f
commit 2ff1a2ee0b
30 changed files with 368 additions and 70 deletions

View File

@ -0,0 +1,226 @@
#include "CBooRenderer.hpp"
namespace urde
{
void CBooRenderer::AddStaticGeometry(const std::vector<CMetroidModelInstance>&, const CAreaOctTree*, int)
{
}
void CBooRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance>&)
{
}
void CBooRenderer::DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)
{
}
void CBooRenderer::DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)
{
}
void CBooRenderer::DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)
{
}
void CBooRenderer::PostRenderFogs()
{
}
void CBooRenderer::AddParticleGen(const CElementGen&)
{
}
void CBooRenderer::AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int)
{
}
void CBooRenderer::AddDrawable(const void*, const zeus::CVector3f&, const zeus::CAABox&, int, EDrawableSorting)
{
}
void CBooRenderer::SetDrawableCallback(TDrawableCallback, const void*)
{
}
void CBooRenderer::SetWorldViewpoint(const zeus::CTransform&)
{
}
void CBooRenderer::SetPerspectiveFovScalar(float)
{
}
void CBooRenderer::SetPerspective(float, float, float, float, float)
{
}
void CBooRenderer::SetPerspective(float, float, float, float)
{
}
void CBooRenderer::SetViewportOrtho(bool, float, float)
{
}
void CBooRenderer::SetClippingPlanes(const zeus::CFrustum&)
{
}
void CBooRenderer::SetViewport(int, int, int, int)
{
}
void CBooRenderer::SetDepthReadWrite(bool, bool)
{
}
void CBooRenderer::SetBlendMode_AdditiveAlpha()
{
}
void CBooRenderer::SetBlendMode_AlphaBlended()
{
}
void CBooRenderer::SetBlendMode_NoColorWrite()
{
}
void CBooRenderer::SetBlendMode_ColorMultiply()
{
}
void CBooRenderer::SetBlendMode_InvertDst()
{
}
void CBooRenderer::SetBlendMode_InvertSrc()
{
}
void CBooRenderer::SetBlendMode_Replace()
{
}
void CBooRenderer::SetBlendMode_AdditiveDestColor()
{
}
void CBooRenderer::SetDebugOption(EDebugOption, int)
{
}
void CBooRenderer::BeginScene()
{
}
void CBooRenderer::EndScene()
{
}
void CBooRenderer::BeginPrimitive(EPrimitiveType, int)
{
}
void CBooRenderer::BeginLines(int)
{
}
void CBooRenderer::BeginLineStrip(int)
{
}
void CBooRenderer::BeginTriangles(int)
{
}
void CBooRenderer::BeginTriangleStrip(int)
{
}
void CBooRenderer::BeginTriangleFan(int)
{
}
void CBooRenderer::PrimVertex(const zeus::CVector3f&)
{
}
void CBooRenderer::PrimNormal(const zeus::CVector3f&)
{
}
void CBooRenderer::PrimColor(float, float, float, float)
{
}
void CBooRenderer::PrimColor(const zeus::CColor&)
{
}
void CBooRenderer::EndPrimitive()
{
}
void CBooRenderer::SetAmbientColor(const zeus::CColor&)
{
}
void CBooRenderer::SetStaticWorldAmbientColor(const zeus::CColor&)
{
}
void CBooRenderer::DrawString(const char*, int, int)
{
}
u32 CBooRenderer::GetFPS()
{
}
void CBooRenderer::CacheReflection(TReflectionCallback, void*, bool)
{
}
void CBooRenderer::DrawSpaceWarp(const zeus::CVector3f&, float)
{
}
void CBooRenderer::DrawThermalModel(const CModel&, const zeus::CColor&, const zeus::CColor&, const float*, const float*)
{
}
void CBooRenderer::DrawXRayOutline(const CModel&, const float*, const float*)
{
}
void CBooRenderer::SetWireframeFlags(int)
{
}
void CBooRenderer::SetWorldFog(ERglFogMode, float, float, const zeus::CColor&)
{
}
void CBooRenderer::RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*)
{
}
void CBooRenderer::SetThermal(bool, float, const zeus::CColor&)
{
}
void CBooRenderer::DoThermalBlendCold()
{
}
void CBooRenderer::DoThermalBlendHot()
{
}
u32 CBooRenderer::GetStaticWorldDataSize()
{
}
}

View File

@ -1,18 +1,76 @@
#ifndef __URDE_CBOORENDERER_HPP__ #ifndef __URDE_CBOORENDERER_HPP__
#define __URDE_CBOORENDERER_HPP__ #define __URDE_CBOORENDERER_HPP__
#include "IRenderer.hpp"
namespace urde namespace urde
{ {
class IObjectStore; class IObjectStore;
class CMemorySys; class CMemorySys;
class IFactory; class IFactory;
class CBooRenderer class CBooRenderer : public IRenderer
{ {
public: public:
CBooRenderer(IObjectStore&, IFactory&) CBooRenderer(IObjectStore&, IFactory&)
{ {
} }
void AddStaticGeometry(const std::vector<CMetroidModelInstance>&, const CAreaOctTree*, int);
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>&);
void DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
void DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
void DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
void PostRenderFogs();
void AddParticleGen(const CElementGen&);
void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int);
void AddDrawable(void const *, const zeus::CVector3f&, const zeus::CAABox&, int, EDrawableSorting);
void SetDrawableCallback(TDrawableCallback, const void*);
void SetWorldViewpoint(const zeus::CTransform&);
void SetPerspectiveFovScalar(float);
void SetPerspective(float, float, float, float, float);
void SetPerspective(float, float, float, float);
void SetViewportOrtho(bool, float, float);
void SetClippingPlanes(const zeus::CFrustum&);
void SetViewport(int, int, int, int);
void SetDepthReadWrite(bool, bool);
void SetBlendMode_AdditiveAlpha();
void SetBlendMode_AlphaBlended();
void SetBlendMode_NoColorWrite();
void SetBlendMode_ColorMultiply();
void SetBlendMode_InvertDst();
void SetBlendMode_InvertSrc();
void SetBlendMode_Replace();
void SetBlendMode_AdditiveDestColor();
void SetDebugOption(EDebugOption, int);
void BeginScene();
void EndScene();
void BeginPrimitive(EPrimitiveType, int);
void BeginLines(int);
void BeginLineStrip(int);
void BeginTriangles(int);
void BeginTriangleStrip(int);
void BeginTriangleFan(int);
void PrimVertex(const zeus::CVector3f&);
void PrimNormal(const zeus::CVector3f&);
void PrimColor(float, float, float, float);
void PrimColor(const zeus::CColor&);
void EndPrimitive();
void SetAmbientColor(const zeus::CColor&);
void SetStaticWorldAmbientColor(const zeus::CColor&);
void DrawString(const char*, int, int);
u32 GetFPS();
void CacheReflection(TReflectionCallback, void*, bool);
void DrawSpaceWarp(const zeus::CVector3f&, float);
void DrawThermalModel(const CModel&, const zeus::CColor&, const zeus::CColor&, const float*, const float*);
void DrawXRayOutline(const CModel&, const float*, const float*);
void SetWireframeFlags(int);
void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&);
void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*);
void SetThermal(bool, float, const zeus::CColor&);
void DoThermalBlendCold();
void DoThermalBlendHot();
u32 GetStaticWorldDataSize();
}; };
} }

View File

@ -1,5 +1,5 @@
#include "CLineRenderer.hpp" #include "CLineRenderer.hpp"
#include "CLineRendererShaders.hpp" #include "Shaders/CLineRendererShaders.hpp"
namespace urde namespace urde
{ {

View File

@ -1,7 +1,7 @@
if(WIN32) if(WIN32)
set(PLAT_SRCS CLineRendererShadersHLSL.cpp CModelShadersHLSL.cpp) set(PLAT_SRCS Shaders/CLineRendererShadersHLSL.cpp Shaders/CModelShadersHLSL.cpp)
elseif(APPLE) elseif(APPLE)
set(PLAT_SRCS CLineRendererShadersMetal.cpp CModelShadersMetal.cpp) set(PLAT_SRCS Shaders/CLineRendererShadersMetal.cpp Shaders/CModelShadersMetal.cpp)
endif() endif()
set(GRAPHICS_SOURCES set(GRAPHICS_SOURCES
@ -10,18 +10,21 @@ set(GRAPHICS_SOURCES
CDrawable.hpp CDrawable.cpp CDrawable.hpp CDrawable.cpp
CDrawablePlaneObject.hpp CDrawablePlaneObject.cpp CDrawablePlaneObject.hpp CDrawablePlaneObject.cpp
CLineRenderer.hpp CLineRenderer.cpp CLineRenderer.hpp CLineRenderer.cpp
CLineRendererShaders.hpp CLineRendererShadersGLSL.cpp
CMetroidModelInstance.hpp CMetroidModelInstance.hpp
CLight.hpp CLight.cpp CLight.hpp CLight.cpp
CTexture.hpp CTextureBoo.cpp CTexture.hpp CTextureBoo.cpp
CModel.hpp CModelBoo.cpp CModel.hpp CModelBoo.cpp
CSkinnedModel.hpp CSkinnedModel.cpp CSkinnedModel.hpp CSkinnedModel.cpp
CModelShaders.hpp CModelShadersGLSL.cpp
CVertexMorphEffect.hpp CVertexMorphEffect.cpp CVertexMorphEffect.hpp CVertexMorphEffect.cpp
CMoviePlayer.hpp CMoviePlayer.cpp CMoviePlayer.hpp CMoviePlayer.cpp
CFrustumPlanes.hpp CFrustumPlanes.cpp CFrustumPlanes.hpp CFrustumPlanes.cpp
CGraphicsPalette.hpp CGraphicsPalette.cpp CGraphicsPalette.hpp CGraphicsPalette.cpp
CGraphics.hpp CGraphics.cpp CGraphics.hpp CGraphics.cpp
Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShadersGLSL.cpp
Shaders/CModelShaders.hpp Shaders/CModelShadersGLSL.cpp
Shaders/CXrayOutlineFilter.hpp Shaders/CXrayOutlineFilterGLSL.cpp
Shaders/CThermalColdFilter.hpp Shaders/CThermalColdFilterGLSL.cpp
Shaders/CThermalHotFilter.hpp Shaders/CThermalHotFilterGLSL.cpp
${PLAT_SRCS}) ${PLAT_SRCS})
runtime_add_list(Graphics GRAPHICS_SOURCES) runtime_add_list(Graphics GRAPHICS_SOURCES)

View File

@ -8,7 +8,7 @@
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
#include "DNACommon/CMDL.hpp" #include "DNACommon/CMDL.hpp"
#include "DNAMP1/CMDLMaterials.hpp" #include "DNAMP1/CMDLMaterials.hpp"
#include "CModelShaders.hpp" #include "Shaders/CModelShaders.hpp"
#include "boo/graphicsdev/IGraphicsDataFactory.hpp" #include "boo/graphicsdev/IGraphicsDataFactory.hpp"

View File

@ -5,7 +5,7 @@
#include "hecl/HMDLMeta.hpp" #include "hecl/HMDLMeta.hpp"
#include "hecl/Runtime.hpp" #include "hecl/Runtime.hpp"
#include "boo/graphicsdev/Metal.hpp" #include "boo/graphicsdev/Metal.hpp"
#include "CModelShaders.hpp" #include "Shaders/CModelShaders.hpp"
namespace urde namespace urde
{ {

View File

@ -6,7 +6,7 @@
#include "../CToken.hpp" #include "../CToken.hpp"
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
#include "zeus/CPlane.hpp" #include "zeus/CPlane.hpp"
#include "CFrustum.hpp" #include "zeus/CFrustum.hpp"
#include "zeus/CColor.hpp" #include "zeus/CColor.hpp"
namespace urde namespace urde
@ -21,8 +21,9 @@ class CSkinnedModel;
class IRenderer class IRenderer
{ {
public: public:
typedef void(*TDrawableCallback)(const void*, const void*, int); using TDrawableCallback = std::function<void(const void*, const void*, int)>;
typedef void(*TReflectionCallback)(void*, const CVector3f&); using TReflectionCallback = std::function<void(void*, const zeus::CVector3f&)>;
enum class EDrawableSorting enum class EDrawableSorting
{ {
}; };
@ -36,61 +37,61 @@ public:
{ {
}; };
virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>&, const CAreaOctTree*, int); virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>&, const CAreaOctTree*, int)=0;
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>&); virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>&)=0;
virtual void DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int); virtual void DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)=0;
virtual void DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int); virtual void DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)=0;
virtual void DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int); virtual void DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)=0;
virtual void PostRenderFogs(); virtual void PostRenderFogs()=0;
virtual void AddParticleGen(const CElementGen&); virtual void AddParticleGen(const CElementGen&)=0;
virtual void AddPlaneObject(const void*, const CAABox&, const CPlane&, int); virtual void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int)=0;
virtual void AddDrawable(void const *, const CVector3f&, const CAABox&, int, EDrawableSorting); virtual void AddDrawable(void const *, const zeus::CVector3f&, const zeus::CAABox&, int, EDrawableSorting)=0;
virtual void SetDrawableCallback(TDrawableCallback, const void*); virtual void SetDrawableCallback(TDrawableCallback, const void*)=0;
virtual void SetWorldViewpoint(const CTransform&); virtual void SetWorldViewpoint(const zeus::CTransform&)=0;
virtual void SetPerspectiveFovScalar(float); virtual void SetPerspectiveFovScalar(float)=0;
virtual void SetPerspective(float, float, float, float, float); virtual void SetPerspective(float, float, float, float, float)=0;
virtual void SetPerspective(float, float, float, float); virtual void SetPerspective(float, float, float, float)=0;
virtual void SetViewportOrtho(bool, float, float); virtual void SetViewportOrtho(bool, float, float)=0;
virtual void SetClippingPlanes(const CFrustum&); virtual void SetClippingPlanes(const zeus::CFrustum&)=0;
virtual void SetViewport(int, int, int, int); virtual void SetViewport(int, int, int, int)=0;
virtual void SetDepthReadWrite(bool, bool); virtual void SetDepthReadWrite(bool, bool)=0;
virtual void SetBlendMode_AdditiveAlpha(); virtual void SetBlendMode_AdditiveAlpha()=0;
virtual void SetBlendMode_AlphaBlended(); virtual void SetBlendMode_AlphaBlended()=0;
virtual void SetBlendMode_NoColorWrite(); virtual void SetBlendMode_NoColorWrite()=0;
virtual void SetBlendMode_ColorMultiply(); virtual void SetBlendMode_ColorMultiply()=0;
virtual void SetBlendMode_InvertDst(); virtual void SetBlendMode_InvertDst()=0;
virtual void SetBlendMode_InvertSrc(); virtual void SetBlendMode_InvertSrc()=0;
virtual void SetBlendMode_Replace(); virtual void SetBlendMode_Replace()=0;
virtual void SetBlendMode_AdditiveDestColor(); virtual void SetBlendMode_AdditiveDestColor()=0;
virtual void SetDebugOption(EDebugOption, int); virtual void SetDebugOption(EDebugOption, int)=0;
virtual void BeginScene(); virtual void BeginScene()=0;
virtual void EndScene(); virtual void EndScene()=0;
virtual void BeginPrimitive(EPrimitiveType, int); virtual void BeginPrimitive(EPrimitiveType, int)=0;
virtual void BeginLines(int); virtual void BeginLines(int)=0;
virtual void BeginLineStrip(int); virtual void BeginLineStrip(int)=0;
virtual void BeginTriangles(int); virtual void BeginTriangles(int)=0;
virtual void BeginTriangleStrip(int); virtual void BeginTriangleStrip(int)=0;
virtual void BeginTriangleFan(int); virtual void BeginTriangleFan(int)=0;
virtual void PrimVertex(const CVector3f&); virtual void PrimVertex(const zeus::CVector3f&)=0;
virtual void PrimNormal(const CVector3f&); virtual void PrimNormal(const zeus::CVector3f&)=0;
virtual void PrimColor(float, float, float, float); virtual void PrimColor(float, float, float, float)=0;
virtual void PrimColor(const CColor&); virtual void PrimColor(const zeus::CColor&)=0;
virtual void EndPrimitive(); virtual void EndPrimitive()=0;
virtual void SetAmbientColor(const CColor&); virtual void SetAmbientColor(const zeus::CColor&)=0;
virtual void SetStaticWorldAmbientColor(const CColor&); virtual void SetStaticWorldAmbientColor(const zeus::CColor&)=0;
virtual void DrawString(const char*, int, int); virtual void DrawString(const char*, int, int)=0;
virtual u32 GetFPS(); virtual u32 GetFPS()=0;
virtual void CacheReflection(TReflectionCallback, void*, bool); virtual void CacheReflection(TReflectionCallback, void*, bool)=0;
virtual void DrawSpaceWarp(const CVector3f&, float); virtual void DrawSpaceWarp(const zeus::CVector3f&, float)=0;
virtual void DrawThermalModel(const CModel&, const CColor&, const CColor&, const float*, const float*); virtual void DrawThermalModel(const CModel&, const zeus::CColor&, const zeus::CColor&, const float*, const float*)=0;
virtual void DrawXRayOutline(const CModel&, const float*, const float*); virtual void DrawXRayOutline(const CModel&, const float*, const float*)=0;
virtual void SetWireframeFlags(int); virtual void SetWireframeFlags(int)=0;
virtual void SetWorldFog(ERglFogMode, float, float, const CColor&); virtual void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&)=0;
virtual void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*); virtual void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*)=0;
virtual void SetThermal(bool, float, const CColor&); virtual void SetThermal(bool, float, const zeus::CColor&)=0;
virtual void DoThermalBlendCold(); virtual void DoThermalBlendCold()=0;
virtual void DoThermalBlendHot(); virtual void DoThermalBlendHot()=0;
virtual u32 GetStaticWorldDataSize(); virtual u32 GetStaticWorldDataSize()=0;
}; };
} }

View File

@ -1,5 +1,5 @@
#include "CLineRendererShaders.hpp" #include "CLineRendererShaders.hpp"
#include "CLineRenderer.hpp" #include "Graphics/CLineRenderer.hpp"
namespace urde namespace urde
{ {

View File

@ -32,6 +32,7 @@ public:
{ {
Light lights[URDE_MAX_LIGHTS]; Light lights[URDE_MAX_LIGHTS];
zeus::CColor ambient; zeus::CColor ambient;
zeus::CColor colorRegs[3];
}; };
static void Initialize(const hecl::Runtime::FileStoreManager& storeMgr, static void Initialize(const hecl::Runtime::FileStoreManager& storeMgr,

View File

@ -18,6 +18,9 @@ static const char* LightingGLSL =
"{\n" "{\n"
" Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n" " Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n"
" vec4 ambient;\n" " vec4 ambient;\n"
" vec4 colorReg0;\n"
" vec4 colorReg1;\n"
" vec4 colorReg2;\n"
"};\n" "};\n"
"\n" "\n"
"vec4 LightingFunc(vec4 mvPosIn, vec4 mvNormIn)\n" "vec4 LightingFunc(vec4 mvPosIn, vec4 mvNormIn)\n"

View File

@ -17,6 +17,9 @@ static const char* LightingHLSL =
"{\n" "{\n"
" Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n" " Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n"
" float4 ambient;\n" " float4 ambient;\n"
" float4 colorReg0;\n"
" float4 colorReg1;\n"
" float4 colorReg2;\n"
"};\n" "};\n"
"\n" "\n"
"static float4 LightingFunc(float4 mvPosIn, float4 mvNormIn)\n" "static float4 LightingFunc(float4 mvPosIn, float4 mvNormIn)\n"

View File

@ -17,6 +17,9 @@ static const char* LightingMetal =
"{\n" "{\n"
" Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n" " Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n"
" float4 ambient;\n" " float4 ambient;\n"
" float4 colorReg0;\n"
" float4 colorReg1;\n"
" float4 colorReg2;\n"
"};\n" "};\n"
"\n" "\n"
"static float4 LightingFunc(constant LightingUniform& lu, float4 mvPosIn, float4 mvNormIn)\n" "static float4 LightingFunc(constant LightingUniform& lu, float4 mvPosIn, float4 mvNormIn)\n"

View File

@ -1,5 +1,5 @@
#include "MP1.hpp" #include "MP1.hpp"
#include "Graphics/CModelShaders.hpp" #include "Graphics/Shaders/CModelShaders.hpp"
namespace urde namespace urde
{ {

2
hecl

@ -1 +1 @@
Subproject commit a0ca743e7f76ecf4d2022f815a016565356f7a46 Subproject commit 778dfaad0e133fe3126910204e97f7157c7a0492

@ -1 +1 @@
Subproject commit ba713f562b5b73b442e3e5e32c367b77ce843a66 Subproject commit 096472697cbcded63e076e9a35332698f903e042