mirror of https://github.com/AxioDL/metaforce.git
Additional ThermalCold filter work; CStateManager fields
This commit is contained in:
parent
68dcc9ca57
commit
6bbed11859
|
@ -89,6 +89,27 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
|||
//lights = {CLight::BuildLocalAmbient({}, {0.0f, 0.0f, 0.0f, 1.f})};
|
||||
m_vm.m_modelTest->GetInstance().ActivateLights(lights);
|
||||
m_vm.m_modelTest->Draw(flags);
|
||||
|
||||
zeus::CColor ctrlCol{1.f, 0.f, 0.f, 1.f};
|
||||
float fac = 0.5f;
|
||||
zeus::CColor a = zeus::CColor::lerp(ctrlCol, zeus::CColor::skWhite, fac);
|
||||
m_thermColdFilter.setColorA(a);
|
||||
float bFac = 0.f;
|
||||
float bAlpha = 1.f;
|
||||
if (fac < 0.5f)
|
||||
{
|
||||
bAlpha = fac * 2.f;
|
||||
bFac = (1.f - bAlpha) / 8.f;
|
||||
}
|
||||
zeus::CColor b{bFac, bFac, bFac, bAlpha};
|
||||
m_thermColdFilter.setColorB(b);
|
||||
zeus::CColor c = zeus::CColor::lerp(zeus::CColor::skBlack, zeus::CColor::skWhite, fac * 0.75f + 0.25f);
|
||||
m_thermColdFilter.setColorC(c);
|
||||
|
||||
m_thermColdFilter.setScale(std::sin(m_theta) * 0.5f + 0.5f);
|
||||
|
||||
m_thermColdFilter.setShift(m_random.Next() % 32);
|
||||
m_thermColdFilter.draw();
|
||||
}
|
||||
if (m_vm.m_partGen)
|
||||
{
|
||||
|
|
|
@ -46,10 +46,12 @@ class ViewManager : public specter::IViewManager
|
|||
class ParticleView : public specter::View
|
||||
{
|
||||
ViewManager& m_vm;
|
||||
CThermalColdFilter m_thermColdFilter;
|
||||
CRandom16 m_random;
|
||||
float m_theta = 0.f;
|
||||
public:
|
||||
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
|
||||
: View(res, parent), m_vm(vm) {}
|
||||
: View(res, parent), m_vm(vm), m_random(20) {}
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#include "Graphics/CLight.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
#include "World/CMorphBall.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -166,6 +169,20 @@ CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>&,
|
|||
x8ec_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
||||
}
|
||||
|
||||
void CStateManager::UpdateVisors()
|
||||
{
|
||||
xf28_thermColdScale2 = 0.f;
|
||||
xf24_thermColdScale1 = 0.f;
|
||||
CPlayerState::EPlayerVisor visor = x8b8_playerState->GetActiveVisor(*this);
|
||||
if (visor == CPlayerState::EPlayerVisor::Thermal && x8cc_nextAreaId != kInvalidAreaId)
|
||||
{
|
||||
std::unique_ptr<CGameArea>& area = x850_world->GetGameAreas()[x8cc_nextAreaId];
|
||||
const zeus::CTransform& playerXf = x84c_player->GetTransform();
|
||||
float f30 = playerXf.origin.x;
|
||||
float f29 = playerXf.origin.y;
|
||||
}
|
||||
}
|
||||
|
||||
void CStateManager::RenderLast(TUniqueId)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class CLight;
|
|||
class CDamageInfo;
|
||||
class CMaterialFilter;
|
||||
class CFinalInput;
|
||||
class CPlayer;
|
||||
class CWorld;
|
||||
class CTexture;
|
||||
|
||||
|
@ -57,6 +58,7 @@ class CStateManager
|
|||
std::unique_ptr<CAiWaypointList> x83c_aiWaypointObjs;
|
||||
std::unique_ptr<CPlatformAndDoorList> x844_platformAndDoorObjs;
|
||||
|
||||
std::unique_ptr<CPlayer> x84c_player;
|
||||
std::unique_ptr<CWorld> x850_world;
|
||||
|
||||
/* Used to be a list of 32-element reserved_vectors */
|
||||
|
@ -125,6 +127,13 @@ class CStateManager
|
|||
u16 _dummy = 0;
|
||||
};
|
||||
|
||||
float xf24_thermColdScale1 = 0.f;
|
||||
float xf28_thermColdScale2 = 0.f;
|
||||
float xf2c_ = 1.f;
|
||||
float xf30_ = 1.f;
|
||||
|
||||
void UpdateVisors();
|
||||
|
||||
public:
|
||||
enum class EScriptPersistence
|
||||
{
|
||||
|
|
|
@ -216,6 +216,12 @@ void CBooRenderer::SetThermal(bool, float, const zeus::CColor&)
|
|||
{
|
||||
}
|
||||
|
||||
void CBooRenderer::SetThermalColdScale(float scale)
|
||||
{
|
||||
x2f8_thermColdScale = zeus::clamp(0.f, scale, 1.f);
|
||||
m_thermColdFilter.setScale(x2f8_thermColdScale);
|
||||
}
|
||||
|
||||
void CBooRenderer::DoThermalBlendCold()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "IRenderer.hpp"
|
||||
#include "CDrawable.hpp"
|
||||
#include "Shaders/CThermalColdFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -31,6 +32,11 @@ class CBooRenderer : public IRenderer
|
|||
u32 x18_ = 0;
|
||||
std::list<u32> x1c_;
|
||||
zeus::CFrustum x44_frustumPlanes;
|
||||
|
||||
float x2f8_thermColdScale = 0.f;
|
||||
|
||||
CThermalColdFilter m_thermColdFilter;
|
||||
|
||||
public:
|
||||
CBooRenderer(IObjectStore& store, IFactory& resFac);
|
||||
|
||||
|
@ -86,6 +92,7 @@ public:
|
|||
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 SetThermalColdScale(float scale);
|
||||
void DoThermalBlendCold();
|
||||
void DoThermalBlendHot();
|
||||
u32 GetStaticWorldDataSize();
|
||||
|
|
|
@ -21,7 +21,7 @@ set(GRAPHICS_SOURCES
|
|||
CFrustumPlanes.hpp CFrustumPlanes.cpp
|
||||
CGraphicsPalette.hpp CGraphicsPalette.cpp
|
||||
CGraphics.hpp CGraphics.cpp
|
||||
Shaders/TFilterShader.hpp Shaders/TFilterDecl.hpp
|
||||
Shaders/TShader.hpp Shaders/TShaderDecl.hpp
|
||||
Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp Shaders/CLineRendererShadersGLSL.cpp
|
||||
Shaders/CModelShaders.hpp Shaders/CModelShaders.cpp Shaders/CModelShadersGLSL.cpp
|
||||
Shaders/CXrayOutlineFilter.hpp Shaders/CXrayOutlineFilter.cpp Shaders/CXrayOutlineFilterGLSL.cpp
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
virtual void SetWorldFog(ERglFogMode, float, float, const zeus::CColor&)=0;
|
||||
virtual void RenderFogVolume(const zeus::CColor&, const zeus::CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*)=0;
|
||||
virtual void SetThermal(bool, float, const zeus::CColor&)=0;
|
||||
virtual void SetThermalColdScale(float scale)=0;
|
||||
virtual void DoThermalBlendCold()=0;
|
||||
virtual void DoThermalBlendHot()=0;
|
||||
virtual u32 GetStaticWorldDataSize()=0;
|
||||
|
|
|
@ -8,10 +8,10 @@ CThermalColdFilter::CThermalColdFilter()
|
|||
{
|
||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
m_shiftTex = ctx.newDynamicTexture(8, 8, boo::TextureFormat::RGBA8);
|
||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 1);
|
||||
m_shiftTex = ctx.newDynamicTexture(8, 4, boo::TextureFormat::RGBA8);
|
||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
m_dataBind = TFilterShader<CThermalColdFilter>::BuildShaderDataBinding(ctx, *this);
|
||||
m_dataBind = TShader<CThermalColdFilter>::BuildShaderDataBinding(ctx, *this);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -23,12 +23,13 @@ CThermalColdFilter::CThermalColdFilter()
|
|||
{
|
||||
{{-1.0, -1.0}, {0.0, 0.0}},
|
||||
{{-1.0, 1.0}, {0.0, 1.0}},
|
||||
{{ 1.0, -1.0}, {1.0, 0.0}},
|
||||
{{ 1.0, 1.0}, {1.0, 1.0}},
|
||||
{{ 1.0, -1.0}, {1.0, 0.0}}
|
||||
};
|
||||
m_vbo->load(verts, sizeof(verts));
|
||||
|
||||
setShift(0);
|
||||
setScale(0.f);
|
||||
}
|
||||
|
||||
void CThermalColdFilter::setShift(unsigned shift)
|
||||
|
@ -45,8 +46,8 @@ void CThermalColdFilter::setShift(unsigned shift)
|
|||
if (ny > 3)
|
||||
ny = 3;
|
||||
unsigned nx = spx % 8;
|
||||
m_shiftTexture[y][x][0] = nx / 7.f;
|
||||
m_shiftTexture[y][x][1] = ny / 3.f;
|
||||
m_shiftTexture[y][x][0] = nx * 255 / 7;
|
||||
m_shiftTexture[y][x][1] = ny * 255 / 3;
|
||||
}
|
||||
}
|
||||
m_shiftTex->load(m_shiftTexture[0][0], sizeof(m_shiftTexture));
|
||||
|
@ -54,13 +55,21 @@ void CThermalColdFilter::setShift(unsigned shift)
|
|||
|
||||
void CThermalColdFilter::draw()
|
||||
{
|
||||
m_uniform.m_shiftTexMtx[0][0] = 80.f * CGraphics::g_ProjAspect;
|
||||
SClipScreenRect clipRect = {};
|
||||
clipRect.xc_width = CGraphics::g_ViewportResolution.x;
|
||||
clipRect.x10_height = CGraphics::g_ViewportResolution.y;
|
||||
CGraphics::ResolveSpareTexture(clipRect);
|
||||
|
||||
m_uniform.m_shiftTexMtx[0][0] = 80.f * (CGraphics::g_ProjAspect / 1.33f);
|
||||
m_uniform.m_shiftTexMtx[1][1] = 120.f;
|
||||
m_uniform.m_shiftTexScale[0] = 1.f / m_uniform.m_shiftTexMtx[0][0];
|
||||
m_uniform.m_shiftTexScale[1] = 1.f / m_uniform.m_shiftTexMtx[1][1];
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
||||
}
|
||||
|
||||
URDE_SPECIALIZE_FILTER(CThermalColdFilter)
|
||||
URDE_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __URDE_CTHERMALCOLDFILTER_HPP__
|
||||
#define __URDE_CTHERMALCOLDFILTER_HPP__
|
||||
|
||||
#include "TFilterShader.hpp"
|
||||
#include "TShader.hpp"
|
||||
#include "zeus/CMatrix4f.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
|
||||
|
@ -17,6 +17,7 @@ class CThermalColdFilter
|
|||
{
|
||||
zeus::CMatrix4f m_shiftTexMtx;
|
||||
zeus::CMatrix4f m_indMtx;
|
||||
zeus::CVector2f m_shiftTexScale;
|
||||
zeus::CColor m_colorRegs[3];
|
||||
};
|
||||
u8 m_shiftTexture[4][8][4] = {};
|
||||
|
@ -42,7 +43,7 @@ public:
|
|||
void draw();
|
||||
|
||||
using _CLS = CThermalColdFilter;
|
||||
#include "TFilterDecl.hpp"
|
||||
#include "TShaderDecl.hpp"
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
static const char* VS_GLSL_TEX =
|
||||
static const char* VS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"layout(location=0) in vec4 posIn;\n"
|
||||
|
@ -13,6 +13,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"{\n"
|
||||
" mat4 shiftMtx;\n"
|
||||
" mat4 indMtx;\n"
|
||||
" vec4 shiftScale;\n"
|
||||
" vec4 colorReg0;\n"
|
||||
" vec4 colorReg1;\n"
|
||||
" vec4 colorReg2;\n"
|
||||
|
@ -26,6 +27,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
" vec4 colorReg2;\n"
|
||||
" vec2 sceneUv;\n"
|
||||
" vec2 shiftUv;\n"
|
||||
" vec2 shiftScale;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SBINDING(0) out VertToFrag vtf;\n"
|
||||
|
@ -36,11 +38,12 @@ BOO_GLSL_BINDING_HEAD
|
|||
" vtf.colorReg1 = colorReg1;\n"
|
||||
" vtf.colorReg2 = colorReg2;\n"
|
||||
" vtf.sceneUv = uvIn.xy;\n"
|
||||
" vtf.shiftUv = shiftMtx * uvIn;\n"
|
||||
" gl_Position = FLIPFROMGL(posIn);\n"
|
||||
" vtf.shiftUv = (mat3(shiftMtx) * uvIn.xyz).xy;\n"
|
||||
" vtf.shiftScale = shiftScale.xy;\n"
|
||||
" gl_Position = FLIPFROMGL(vec4(posIn.xyz, 1.0));\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS_GLSL_TEX =
|
||||
static const char* FS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"struct VertToFrag\n"
|
||||
|
@ -51,7 +54,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
" vec4 colorReg2;\n"
|
||||
" vec2 sceneUv;\n"
|
||||
" vec2 shiftUv;\n"
|
||||
" vec2 shiftDelta;\n"
|
||||
" vec2 shiftScale;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SBINDING(0) in VertToFrag vtf;\n"
|
||||
|
@ -61,17 +64,23 @@ BOO_GLSL_BINDING_HEAD
|
|||
"const vec4 kRGBToYPrime = vec4(0.299, 0.587, 0.114, 0.0);\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec2 shiftCoord = vtf.sceneUv + texture(shiftTex, vtf.shiftUv).xy;\n"
|
||||
" float shiftScene0 = dot(texture(sceneTex, shiftCoord - vec2(0.5)), kRGBToYPrime);\n"
|
||||
" float shiftScene1 = dot(texture(sceneTex, shiftCoord - vec2(0.5, 0.4984375)), kRGBToYPrime);\n"
|
||||
" vec2 indCoord = (indMtx * vec3(shiftScene0, shiftScene1, 1.0)).xy;\n"
|
||||
" vec2 shiftCoordTexel = texture(shiftTex, vtf.shiftUv).xy;\n"
|
||||
" vec2 shiftCoord = vtf.sceneUv + shiftCoordTexel * vtf.shiftScale;\n"
|
||||
" float shiftScene0 = dot(texture(sceneTex, shiftCoord), kRGBToYPrime);\n"
|
||||
" float shiftScene1 = dot(texture(sceneTex, shiftCoord + vec2(vtf.shiftScale.x / 8.0, 0.0)), kRGBToYPrime);\n"
|
||||
" vec2 indCoord = (vtf.indMtx * vec3(shiftScene0 - 0.5, shiftScene1 - 0.5, 1.0)).xy;\n"
|
||||
" float indScene = dot(texture(sceneTex, vtf.sceneUv + indCoord), kRGBToYPrime);\n"
|
||||
" colorOut = vtf.colorReg0 * indScene + vtf.colorReg1 * shiftScene0 + vtf.colorReg2;\n"
|
||||
" colorOut = vtf.colorReg0 * indScene * vec4(0.00001) + vtf.colorReg1 * shiftScene0 * vec4(0.00001) + vtf.colorReg2 * vec4(0.00001);\n"
|
||||
" float blue = 0.0;\n"
|
||||
" float green = 0.0;\n"
|
||||
" if (indCoord.y < 0.0) blue = -indCoord.y * 10.0;\n"
|
||||
" else green = indCoord.y * 10.0;\n"
|
||||
" colorOut += vec4(0.0, green, blue, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_FILTER(CThermalColdFilter)
|
||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||
|
||||
struct CThermalColdFilterGLDataBindingFactory : TFilterShader<CThermalColdFilter>::IDataBindingFactory
|
||||
struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
||||
{
|
||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CThermalColdFilter& filter)
|
||||
{
|
||||
|
@ -85,14 +94,14 @@ struct CThermalColdFilterGLDataBindingFactory : TFilterShader<CThermalColdFilter
|
|||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
||||
return cctx.newShaderDataBinding(TFilterShader<CThermalColdFilter>::m_pipeline,
|
||||
return cctx.newShaderDataBinding(TShader<CThermalColdFilter>::m_pipeline,
|
||||
ctx.newVertexFormat(3, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
||||
1, bufs, stages, nullptr, nullptr, 2, texs);
|
||||
}
|
||||
};
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
struct CThermalColdFilterVulkanDataBindingFactory : TFilterShader<CThermalColdFilter>::IDataBindingFactory
|
||||
struct CThermalColdFilterVulkanDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
||||
{
|
||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CThermalColdFilter& filter)
|
||||
{
|
||||
|
@ -100,28 +109,28 @@ struct CThermalColdFilterVulkanDataBindingFactory : TFilterShader<CThermalColdFi
|
|||
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
||||
return cctx.newShaderDataBinding(TFilterShader<CThermalColdFilter>::m_pipeline,
|
||||
TFilterShader<CThermalColdFilter>::m_vtxFmt,
|
||||
return cctx.newShaderDataBinding(TShader<CThermalColdFilter>::m_pipeline,
|
||||
TShader<CThermalColdFilter>::m_vtxFmt,
|
||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||
nullptr, nullptr, nullptr, 2, texs);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
TFilterShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::GLDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut)
|
||||
TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::GLDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut)
|
||||
{
|
||||
const char* texNames[] = {"sceneTex", "shiftTex"};
|
||||
const char* uniNames[] = {"ThermalColdUniform"};
|
||||
pipeOut = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 2, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
pipeOut = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||
return new CThermalColdFilterGLDataBindingFactory;
|
||||
}
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
TFilterShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::VulkanDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut)
|
||||
TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::VulkanDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut)
|
||||
{
|
||||
const boo::VertexElementDescriptor VtxVmt[] =
|
||||
{
|
||||
|
@ -129,7 +138,7 @@ TFilterShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Init
|
|||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||
};
|
||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
||||
pipeOut = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, vtxFmtOut, boo::BlendFactor::One,
|
||||
pipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||
return new CThermalColdFilterVulkanDataBindingFactory;
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
static TFilterShader<_CLS>::IDataBindingFactory* Initialize(boo::GLDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut);
|
||||
#if _WIN32
|
||||
static TFilterShader<_CLS>::IDataBindingFactory* Initialize(boo::ID3DDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut);
|
||||
#endif
|
||||
#if BOO_HAS_METAL
|
||||
static TFilterShader<_CLS>::IDataBindingFactory* Initialize(boo::MetalDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut);
|
||||
#endif
|
||||
#if BOO_HAS_VULKAN
|
||||
static TFilterShader<_CLS>::IDataBindingFactory* Initialize(boo::VulkanDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut);
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __URDE_TFILTERSHADER_HPP__
|
||||
#define __URDE_TFILTERSHADER_HPP__
|
||||
#ifndef __URDE_TSHADER_HPP__
|
||||
#define __URDE_TSHADER_HPP__
|
||||
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
#include "boo/graphicsdev/GL.hpp"
|
||||
|
@ -11,7 +11,7 @@ namespace urde
|
|||
{
|
||||
|
||||
template <class FilterImp>
|
||||
class TFilterShader
|
||||
class TShader
|
||||
{
|
||||
public:
|
||||
struct IDataBindingFactory
|
||||
|
@ -75,25 +75,30 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#define URDE_DECL_SPECIALIZE_FILTER(cls) \
|
||||
#define URDE_DECL_SPECIALIZE_SHADER(cls) \
|
||||
template <> boo::IShaderPipeline* \
|
||||
TFilterShader<cls>::m_pipeline; \
|
||||
TShader<cls>::m_pipeline; \
|
||||
template <> boo::IVertexFormat* \
|
||||
TFilterShader<cls>::m_vtxFmt;
|
||||
|
||||
#define URDE_SPECIALIZE_FILTER(cls) \
|
||||
template <> boo::IShaderPipeline* \
|
||||
TFilterShader<cls>::m_pipeline = nullptr; \
|
||||
template <> boo::IVertexFormat* \
|
||||
TFilterShader<cls>::m_vtxFmt = nullptr; \
|
||||
TShader<cls>::m_vtxFmt; \
|
||||
\
|
||||
template <> std::unique_ptr<TFilterShader<cls>::IDataBindingFactory> \
|
||||
TFilterShader<cls>::m_bindFactory; \
|
||||
template <> std::unique_ptr<TShader<cls>::IDataBindingFactory> \
|
||||
TShader<cls>::m_bindFactory; \
|
||||
template <> boo::GraphicsDataToken \
|
||||
TFilterShader<cls>::m_gfxToken; \
|
||||
TShader<cls>::m_gfxToken; \
|
||||
|
||||
#define URDE_SPECIALIZE_SHADER(cls) \
|
||||
template <> boo::IShaderPipeline* \
|
||||
TShader<cls>::m_pipeline = nullptr; \
|
||||
template <> boo::IVertexFormat* \
|
||||
TShader<cls>::m_vtxFmt = nullptr; \
|
||||
\
|
||||
template class TFilterShader<cls>;
|
||||
template <> std::unique_ptr<TShader<cls>::IDataBindingFactory> \
|
||||
TShader<cls>::m_bindFactory = {}; \
|
||||
template <> boo::GraphicsDataToken \
|
||||
TShader<cls>::m_gfxToken = {}; \
|
||||
\
|
||||
template class TShader<cls>;
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_TFILTERSHADER_HPP__
|
||||
#endif // __URDE_TSHADER_HPP__
|
|
@ -0,0 +1,17 @@
|
|||
static TShader<_CLS>::IDataBindingFactory* Initialize(boo::GLDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut);
|
||||
#if _WIN32
|
||||
static TShader<_CLS>::IDataBindingFactory* Initialize(boo::ID3DDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut);
|
||||
#endif
|
||||
#if BOO_HAS_METAL
|
||||
static TShader<_CLS>::IDataBindingFactory* Initialize(boo::MetalDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut);
|
||||
#endif
|
||||
#if BOO_HAS_VULKAN
|
||||
static TShader<_CLS>::IDataBindingFactory* Initialize(boo::VulkanDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut);
|
||||
#endif
|
|
@ -1,8 +1,10 @@
|
|||
#include "MP1.hpp"
|
||||
#include "Graphics/Shaders/CModelShaders.hpp"
|
||||
#include "Graphics/Shaders/CThermalColdFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||
|
||||
namespace MP1
|
||||
{
|
||||
|
@ -30,6 +32,7 @@ void CMain::InitializeSubsystems(boo::IGraphicsDataFactory* factory,
|
|||
{
|
||||
CGraphics::InitializeBoo(factory, cc, renderTex);
|
||||
CModelShaders::Initialize(storeMgr, factory);
|
||||
TShader<CThermalColdFilter>::Initialize();
|
||||
CMoviePlayer::Initialize();
|
||||
CLineRenderer::Initialize();
|
||||
CElementGen::Initialize();
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
const zeus::CTransform&, CModelData&&, const CMaterialList&,
|
||||
const CActorParameters&, TUniqueId);
|
||||
|
||||
const zeus::CTransform& GetTransform() const {return x34_transform;}
|
||||
|
||||
virtual void AddToRenderer(const zeus::CFrustum&, CStateManager&) {}
|
||||
virtual void Render(CStateManager&) {}
|
||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
|
|
|
@ -3,6 +3,8 @@ set(WORLD_SOURCES
|
|||
CWorldLight.hpp CWorldLight.cpp
|
||||
IGameArea.hpp IGameArea.cpp
|
||||
CGameArea.hpp CGameArea.cpp
|
||||
CPlayer.hpp CPlayer.cpp
|
||||
CMorphBall.hpp CMorphBall.cpp
|
||||
CActor.hpp CActor.cpp
|
||||
CAi.hpp CAi.cpp
|
||||
CAiFuncMap.hpp CAiFuncMap.cpp
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#include "CMorphBall.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CMorphBall::CMorphBall(CPlayer& player, float)
|
||||
: x0_player(player)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __URDE_CMORPHBALL_HPP__
|
||||
#define __URDE_CMORPHBALL_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CPlayer;
|
||||
|
||||
class CMorphBall
|
||||
{
|
||||
CPlayer& x0_player;
|
||||
public:
|
||||
CMorphBall(CPlayer& player, float);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CMORPHBALL_HPP__
|
|
@ -0,0 +1,21 @@
|
|||
#include "CPlayer.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
#include "CMorphBall.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
static CModelData MakePlayerAnimRes(ResId resId, const zeus::CVector3f& scale)
|
||||
{
|
||||
return CAnimRes(resId, 0, scale, 0, true);
|
||||
}
|
||||
|
||||
CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& aabb, unsigned int resId,
|
||||
const zeus::CVector3f& playerScale, float f1, float f2, float f3, float f4, const CMaterialList& ml)
|
||||
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList, kInvalidEditorId),
|
||||
xf, MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(f1), CActorParameters::None(), f2, f3)
|
||||
{
|
||||
x768_morphball.reset(new CMorphBall(*this, f4));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef __URDE_CPLAYER_HPP__
|
||||
#define __URDE_CPLAYER_HPP__
|
||||
|
||||
#include "CPhysicsActor.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "zeus/CTransform.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CMaterialList;
|
||||
class CMorphBall;
|
||||
|
||||
class CPlayer : public CPhysicsActor
|
||||
{
|
||||
std::unique_ptr<CMorphBall> x768_morphball;
|
||||
|
||||
public:
|
||||
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int,
|
||||
const zeus::CVector3f&, float, float, float, float, const CMaterialList&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CPLAYER_HPP__
|
Loading…
Reference in New Issue