...
 
Commits (5)
#include "CMappableObject.hpp"
#include "GameGlobalObjects.hpp"
#include "CMapWorldInfo.hpp"
#include "CSimplePool.hpp"
#include "CToken.hpp"
#include "Graphics/CTexture.hpp"
#include "Runtime/AutoMapper/CMappableObject.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/CToken.hpp"
#include "Runtime/AutoMapper/CMapWorldInfo.hpp"
#include "Runtime/Camera/CCameraFilter.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Graphics/CTexture.hpp"
namespace urde {
zeus::CVector3f CMappableObject::skDoorVerts[8] = {};
......
......@@ -414,7 +414,7 @@ void CBooModel::ActivateLights(const std::vector<CLight>& lights) { m_lightingDa
void CBooModel::DisableAllLights() {
m_lightingData.ambient = zeus::skBlack;
for (size_t curLight = 0; curLight < URDE_MAX_LIGHTS; ++curLight) {
for (size_t curLight = 0; curLight < m_lightingData.lights.size(); ++curLight) {
CModelShaders::Light& lightOut = m_lightingData.lights[curLight];
lightOut.color = zeus::skClear;
lightOut.linAtt[0] = 1.f;
......
#include "CAABoxShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Runtime/Graphics/Shaders/CAABoxShader.hpp"
#include <array>
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Pipeline.hpp>
#include <zeus/CAABox.hpp>
namespace urde {
......@@ -21,16 +26,17 @@ CAABoxShader::CAABoxShader(bool zOnly) {
CGraphics::CommitResources([this, zOnly](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector3f), 34);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(zOnly ? s_zOnlyPipeline : s_Pipeline, m_vbo.get(), nullptr, nullptr, 1, bufs,
stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
m_dataBind =
ctx.newShaderDataBinding(zOnly ? s_zOnlyPipeline : s_Pipeline, m_vbo.get(), nullptr, nullptr, bufs.size(),
bufs.data(), stages.data(), nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return true;
} BooTrace);
}
void CAABoxShader::setAABB(const zeus::CAABox& aabb) {
zeus::CVector3f vboData[] = {
const std::array<zeus::CVector3f, 34> vboData{{
{aabb.max.x(), aabb.max.y(), aabb.min.z()}, {aabb.max.x(), aabb.min.y(), aabb.min.z()},
{aabb.max.x(), aabb.max.y(), aabb.max.z()}, {aabb.max.x(), aabb.min.y(), aabb.max.z()},
{aabb.max.x(), aabb.min.y(), aabb.max.z()},
......@@ -54,9 +60,9 @@ void CAABoxShader::setAABB(const zeus::CAABox& aabb) {
{aabb.min.x(), aabb.min.y(), aabb.min.z()}, {aabb.min.x(), aabb.min.y(), aabb.min.z()},
{aabb.max.x(), aabb.min.y(), aabb.min.z()}, {aabb.min.x(), aabb.max.y(), aabb.min.z()},
{aabb.max.x(), aabb.max.y(), aabb.min.z()},
};
}};
m_vbo->load(vboData, sizeof(zeus::CVector3f) * 34);
m_vbo->load(vboData.data(), sizeof(vboData));
}
void CAABoxShader::draw(const zeus::CColor& color) {
......
......@@ -2,10 +2,13 @@
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CAABox.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
namespace zeus {
class CAABox;
}
namespace urde {
class CAABoxShader {
......
#include "CCameraBlurFilter.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
#include <algorithm>
#include <cmath>
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Pipeline.hpp>
#include <zeus/CVector2f.hpp>
namespace urde {
namespace {
struct Vert {
zeus::CVector2f m_pos;
zeus::CVector2f m_uv;
};
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
} // Anonymous namespace
void CCameraBlurFilter::Initialize() { s_Pipeline = hecl::conv->convert(Shader_CCameraBlurFilter{}); }
......
#pragma once
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CVector3f.hpp>
#include <zeus/CVector4f.hpp>
namespace urde {
class CCameraBlurFilter {
struct Vert {
zeus::CVector2f m_pos;
zeus::CVector2f m_uv;
};
struct Uniform {
zeus::CVector4f m_uv[6];
float m_opacity = 1.f;
};
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
......
#include "CColoredQuadFilter.hpp"
#include "Graphics/CGraphics.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
#include <array>
#include "Runtime/Camera/CCameraFilter.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -37,18 +42,22 @@ CColoredQuadFilter::CColoredQuadFilter(EFilterType type) {
CGraphics::CommitResources([this, type](boo::IGraphicsDataFactory::Context& ctx) {
struct Vert {
zeus::CVector2f m_pos;
} verts[4] = {
};
const std::array<Vert, 4> verts{{
{{0.0, 0.0}},
{{0.0, 1.0}},
{{1.0, 0.0}},
{{1.0, 1.0}},
};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, 16, 4);
}};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts.data(), 16, verts.size());
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(SelectPipeline(type), m_vbo.get(), nullptr, nullptr, 1, bufs, stages, nullptr,
nullptr, 0, nullptr, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(SelectPipeline(type), m_vbo.get(), nullptr, nullptr, bufs.size(), bufs.data(),
stages.data(), nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return true;
} BooTrace);
}
......
#pragma once
#include "Runtime/CToken.hpp"
#include "Runtime/Camera/CCameraFilter.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CRectangle.hpp>
namespace urde {
class CTexture;
enum class EFilterShape;
enum class EFilterType;
class CColoredQuadFilter {
struct Uniform {
......
#include "CColoredStripShader.hpp"
#include "Graphics/CGraphics.hpp"
#include "hecl/Pipeline.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "Runtime/Graphics/Shaders/CColoredStripShader.hpp"
#include <array>
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Graphics/CBooRenderer.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -43,15 +47,18 @@ void CColoredStripShader::BuildResources(boo::IGraphicsDataFactory::Context& ctx
boo::ObjToken<boo::ITexture> tex) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vert), maxVerts);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[1];
if (tex)
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
std::array<boo::ObjToken<boo::ITexture>, 1> texs;
if (tex) {
texs[0] = tex;
else
} else {
texs[0] = g_Renderer->GetWhiteTexture();
m_dataBind = ctx.newShaderDataBinding(SelectPipeline(mode), m_vbo.get(), nullptr, nullptr, 1, bufs, stages, nullptr,
nullptr, 1, texs, nullptr, nullptr);
}
m_dataBind = ctx.newShaderDataBinding(SelectPipeline(mode), m_vbo.get(), nullptr, nullptr, bufs.size(), bufs.data(),
stages.data(), nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
}
CColoredStripShader::CColoredStripShader(size_t maxVerts, Mode mode, boo::ObjToken<boo::ITexture> tex) {
......
#include "CDecalShaders.hpp"
#include "Particle/CDecal.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CDecalShaders.hpp"
#include <array>
#include "Runtime/Particle/CDecal.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -44,26 +48,31 @@ void CDecalShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& c
regPipeline = m_noTexZTestNoZWrite;
}
const SQuadDescr* desc = decal.m_desc;
CUVElement* texr = desc->x14_TEX.get();
int texCount = 0;
boo::ObjToken<boo::ITexture> textures[1];
const SQuadDescr* const desc = decal.m_desc;
const CUVElement* const texr = desc->x14_TEX.get();
size_t texCount = 0;
std::array<boo::ObjToken<boo::ITexture>, 1> textures;
if (texr) {
if (texr != nullptr) {
textures[0] = texr->GetValueTexture(0).GetObj()->GetBooTexture();
texCount = 1;
}
if (decal.m_instBuf) {
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {decal.m_uniformBuf.get()};
if (!decal.m_instBuf) {
return;
}
std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> uniforms{decal.m_uniformBuf.get()};
if (regPipeline)
decal.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, nullptr, decal.m_instBuf.get(), nullptr, 1,
uniforms, nullptr, texCount, textures, nullptr, nullptr);
if (redToAlphaPipeline)
decal.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, nullptr, decal.m_instBuf.get(), nullptr,
1, uniforms, nullptr, texCount, textures, nullptr, nullptr);
if (regPipeline) {
decal.m_normalDataBind =
ctx.newShaderDataBinding(regPipeline, nullptr, decal.m_instBuf.get(), nullptr, uniforms.size(), uniforms.data(),
nullptr, texCount, textures.data(), nullptr, nullptr);
}
if (redToAlphaPipeline) {
decal.m_redToAlphaDataBind =
ctx.newShaderDataBinding(redToAlphaPipeline, nullptr, decal.m_instBuf.get(), nullptr, uniforms.size(),
uniforms.data(), nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
......
#pragma once
#include "Runtime/Graphics/CGraphics.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
namespace urde {
struct CQuadDecal;
......
#include "CElementGenShaders.hpp"
#include "Particle/CElementGen.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CElementGenShaders.hpp"
#include <iterator>
#include "Runtime/Particle/CElementGen.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -224,10 +228,10 @@ void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Conte
}
}
CUVElement* texr = desc->x54_x40_TEXR.get();
CUVElement* tind = desc->x58_x44_TIND.get();
const CUVElement* const texr = desc->x54_x40_TEXR.get();
const CUVElement* const tind = desc->x58_x44_TIND.get();
int texCount = 0;
boo::ObjToken<boo::ITexture> textures[3];
std::array<boo::ObjToken<boo::ITexture>, 3> textures;
if (texr) {
textures[0] = texr->GetValueTexture(0).GetObj()->GetBooTexture();
......@@ -242,43 +246,56 @@ void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Conte
}
if (gen.m_instBuf) {
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> uniforms{gen.m_uniformBuf.get()};
if (regPipeline)
for (int i = 0; i < 2; ++i)
gen.m_normalDataBind[i] = ctx.newShaderDataBinding((*regPipeline)[i], nullptr, gen.m_instBuf.get(), nullptr, 1,
uniforms, nullptr, texCount, textures, nullptr, nullptr);
if (regPipelineSub)
for (int i = 0; i < 2; ++i)
gen.m_normalSubDataBind[i] = ctx.newShaderDataBinding((*regPipelineSub)[i], nullptr, gen.m_instBuf.get(),
nullptr, 1, uniforms, nullptr, texCount, textures,
nullptr, nullptr);
if (redToAlphaPipeline)
for (int i = 0; i < 2; ++i)
gen.m_redToAlphaDataBind[i] = ctx.newShaderDataBinding((*redToAlphaPipeline)[i], nullptr, gen.m_instBuf.get(),
nullptr, 1, uniforms, nullptr, texCount, textures,
nullptr, nullptr);
if (redToAlphaPipelineSub)
for (int i = 0; i < 2; ++i)
gen.m_redToAlphaSubDataBind[i] =
ctx.newShaderDataBinding((*redToAlphaPipelineSub)[i], nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
if (regPipeline != nullptr) {
for (size_t i = 0; i < std::size(gen.m_normalDataBind); ++i) {
gen.m_normalDataBind[i] =
ctx.newShaderDataBinding((*regPipeline)[i], nullptr, gen.m_instBuf.get(), nullptr, uniforms.size(),
uniforms.data(), nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
if (regPipelineSub != nullptr) {
for (size_t i = 0; i < std::size(gen.m_normalSubDataBind); ++i) {
gen.m_normalSubDataBind[i] =
ctx.newShaderDataBinding((*regPipelineSub)[i], nullptr, gen.m_instBuf.get(), nullptr, uniforms.size(),
uniforms.data(), nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
if (redToAlphaPipeline != nullptr) {
for (size_t i = 0; i < std::size(gen.m_redToAlphaDataBind); ++i) {
gen.m_redToAlphaDataBind[i] =
ctx.newShaderDataBinding((*redToAlphaPipeline)[i], nullptr, gen.m_instBuf.get(), nullptr, uniforms.size(),
uniforms.data(), nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
if (redToAlphaPipelineSub != nullptr) {
for (size_t i = 0; i < std::size(gen.m_redToAlphaSubDataBind); ++i) {
gen.m_redToAlphaSubDataBind[i] = ctx.newShaderDataBinding(
(*redToAlphaPipelineSub)[i], nullptr, gen.m_instBuf.get(), nullptr, uniforms.size(), uniforms.data(),
nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
}
if (gen.m_instBufPmus) {
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBufPmus.get()};
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> uniforms{gen.m_uniformBufPmus.get()};
texCount = std::min(texCount, 1);
if (regPipelinePmus)
for (int i = 0; i < 2; ++i)
gen.m_normalDataBindPmus[i] = ctx.newShaderDataBinding((*regPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(),
nullptr, 1, uniforms, nullptr, texCount, textures,
nullptr, nullptr);
if (redToAlphaPipelinePmus)
for (int i = 0; i < 2; ++i)
gen.m_redToAlphaDataBindPmus[i] =
ctx.newShaderDataBinding((*redToAlphaPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
if (regPipelinePmus != nullptr) {
for (size_t i = 0; i < std::size(gen.m_normalDataBindPmus); ++i) {
gen.m_normalDataBindPmus[i] =
ctx.newShaderDataBinding((*regPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(), nullptr, uniforms.size(),
uniforms.data(), nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
if (redToAlphaPipelinePmus != nullptr) {
for (size_t i = 0; i < std::size(gen.m_redToAlphaDataBindPmus); ++i) {
gen.m_redToAlphaDataBindPmus[i] = ctx.newShaderDataBinding(
(*redToAlphaPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(), nullptr, uniforms.size(), uniforms.data(),
nullptr, texCount, textures.data(), nullptr, nullptr);
}
}
}
}
......
......@@ -2,8 +2,6 @@
#include <array>
#include "Runtime/Graphics/CGraphics.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
namespace urde {
......
#include "CEnergyBarShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Graphics/CTexture.hpp"
#include "Runtime/Graphics/Shaders/CEnergyBarShader.hpp"
#include <cstring>
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -29,15 +33,19 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
m_tex = tex;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), m_maxVerts);
boo::ObjToken<boo::IGraphicsBuffer> bufs[1];
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[] = {m_tex->GetBooTexture()};
for (int i = 0; i < 3; ++i) {
std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs;
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
const std::array<boo::ObjToken<boo::ITexture>, 1> texs{m_tex->GetBooTexture()};
for (size_t i = 0; i < m_uniBuf.size(); ++i) {
m_uniBuf[i] = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
bufs[0] = m_uniBuf[i].get();
m_dataBind[i] = ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, nullptr, 1, bufs, stages, nullptr,
nullptr, 1, texs, nullptr, nullptr);
m_dataBind[i] =
ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, nullptr, bufs.size(), bufs.data(), stages.data(),
nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
}
return true;
} BooTrace);
}
......
#pragma once
#include <array>
#include <vector>
#include "Runtime/Camera/CCameraFilter.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CRectangle.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
namespace urde {
class CTexture;
class CEnergyBarShader {
public:
......@@ -25,8 +26,8 @@ private:
zeus::CColor m_color;
};
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf[3];
boo::ObjToken<boo::IShaderDataBinding> m_dataBind[3];
std::array<boo::ObjToken<boo::IGraphicsBufferD>, 3> m_uniBuf;
std::array<boo::ObjToken<boo::IShaderDataBinding>, 3> m_dataBind;
Uniform m_uniform;
const CTexture* m_tex = nullptr;
size_t m_maxVerts = 0;
......
#include "CEnvFxShaders.hpp"
#include "hecl/Pipeline.hpp"
#include "World/CEnvFxManager.hpp"
#include "Runtime/Graphics/Shaders/CEnvFxShaders.hpp"
#include "Runtime/World/CEnvFxManager.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
boo::ObjToken<boo::IShaderPipeline> CEnvFxShaders::m_snowPipeline;
......@@ -18,21 +20,38 @@ void CEnvFxShaders::Shutdown() {
void CEnvFxShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CEnvFxManager& fxMgr,
CEnvFxManagerGrid& grid) {
auto uBufInfo = grid.m_uniformBuf.getBufferInfo();
auto iBufInfo = grid.m_instBuf.getBufferInfo();
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {uBufInfo.first.get(), fxMgr.m_fogUniformBuf.get()};
size_t ubufOffsets[] = {size_t(uBufInfo.second), 0};
size_t ubufSizes[] = {sizeof(CEnvFxShaders::Uniform), sizeof(CGraphics::g_Fog)};
boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment};
boo::ObjToken<boo::ITexture> textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
fxMgr.x40_txtrEnvGradient->GetBooTexture()};
grid.m_snowBinding =
ctx.newShaderDataBinding(m_snowPipeline, nullptr, iBufInfo.first.get(), nullptr, 2, uniforms, uniformStages,
ubufOffsets, ubufSizes, 2, textures, nullptr, nullptr, 0, iBufInfo.second);
const auto uBufInfo = grid.m_uniformBuf.getBufferInfo();
const auto iBufInfo = grid.m_instBuf.getBufferInfo();
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 2> uniforms{{
uBufInfo.first.get(),
fxMgr.m_fogUniformBuf.get(),
}};
const std::array<size_t, 2> ubufOffsets{
size_t(uBufInfo.second),
0,
};
constexpr std::array<size_t, 2> ubufSizes{
sizeof(CEnvFxShaders::Uniform),
sizeof(CGraphics::g_Fog),
};
constexpr std::array<boo::PipelineStage, 2> uniformStages{
boo::PipelineStage::Vertex,
boo::PipelineStage::Fragment,
};
std::array<boo::ObjToken<boo::ITexture>, 2> textures{
fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
fxMgr.x40_txtrEnvGradient->GetBooTexture(),
};
grid.m_snowBinding = ctx.newShaderDataBinding(
m_snowPipeline, nullptr, iBufInfo.first.get(), nullptr, uniforms.size(), uniforms.data(), uniformStages.data(),
ubufOffsets.data(), ubufSizes.data(), textures.size(), textures.data(), nullptr, nullptr, 0, iBufInfo.second);
textures[0] = fxMgr.xc48_underwaterFlake->GetBooTexture();
grid.m_underwaterBinding =
ctx.newShaderDataBinding(m_underwaterPipeline, nullptr, iBufInfo.first.get(), nullptr, 2, uniforms, uniformStages,
ubufOffsets, ubufSizes, 2, textures, nullptr, nullptr, 0, iBufInfo.second);
ctx.newShaderDataBinding(m_underwaterPipeline, nullptr, iBufInfo.first.get(), nullptr, uniforms.size(),
uniforms.data(), uniformStages.data(), ubufOffsets.data(), ubufSizes.data(),
textures.size(), textures.data(), nullptr, nullptr, 0, iBufInfo.second);
}
} // namespace urde
#pragma once
#include "Runtime/Graphics/CGraphics.hpp"
#include <array>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CVector2f.hpp>
......@@ -15,9 +16,9 @@ class CEnvFxManagerGrid;
class CEnvFxShaders {
public:
struct Instance {
zeus::CVector3f positions[4];
std::array<zeus::CVector3f, 4> positions;
zeus::CColor color;
zeus::CVector2f uvs[4];
std::array<zeus::CVector2f, 4> uvs;
};
struct Uniform {
zeus::CMatrix4f mv;
......
#include "CFluidPlaneShader.hpp"
#include "World/CRipple.hpp"
#include "World/CRippleManager.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CFluidPlaneShader.hpp"
#include "Runtime/World/CRipple.hpp"
#include "Runtime/World/CRippleManager.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -122,38 +124,64 @@ void CFluidPlaneShader::Cache::Clear() {
void CFluidPlaneShader::PrepareBinding(u32 maxVertCount) {
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), maxVertCount);
if (m_pipelines.m_tessellation)
if (m_pipelines.m_tessellation) {
m_pvbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(PatchVertex), maxVertCount);
}
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = {m_uniBuf.get(), m_uniBuf.get(), m_uniBuf.get()};
boo::PipelineStage ubufStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
boo::PipelineStage::Fragment};
size_t ubufOffs[] = {0, 0, 1280};
size_t ubufSizes[] = {1280, 1280, sizeof(CModelShaders::LightingUniform)};
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 3> ubufs{{
m_uniBuf.get(),
m_uniBuf.get(),
m_uniBuf.get(),
}};
constexpr std::array<boo::PipelineStage, 3> ubufStages{
boo::PipelineStage::Vertex,
boo::PipelineStage::Vertex,
boo::PipelineStage::Fragment,
};
constexpr std::array<size_t, 3> ubufOffs{
0,
0,
1280,
};
constexpr std::array<size_t, 3> ubufSizes{
1280,
1280,
sizeof(CModelShaders::LightingUniform),
};
size_t texCount = 0;
boo::ObjToken<boo::ITexture> texs[8];
if (m_patternTex1)
std::array<boo::ObjToken<boo::ITexture>, 8> texs;
if (m_patternTex1) {
texs[texCount++] = m_patternTex1->GetBooTexture();
if (m_patternTex2)
}
if (m_patternTex2) {
texs[texCount++] = m_patternTex2->GetBooTexture();
if (m_colorTex)
}
if (m_colorTex) {
texs[texCount++] = m_colorTex->GetBooTexture();
if (m_bumpMap)
}
if (m_bumpMap) {
texs[texCount++] = m_bumpMap->GetBooTexture();
if (m_envMap)
}
if (m_envMap) {
texs[texCount++] = m_envMap->GetBooTexture();
if (m_envBumpMap)
}
if (m_envBumpMap) {
texs[texCount++] = m_envBumpMap->GetBooTexture();
if (m_lightmap)
}
if (m_lightmap) {
texs[texCount++] = m_lightmap->GetBooTexture();
auto regular = ctx.newShaderDataBinding(m_pipelines.m_regular, m_vbo.get(), nullptr, nullptr, 3, ubufs, ubufStages,
ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}
auto regular = ctx.newShaderDataBinding(m_pipelines.m_regular, m_vbo.get(), nullptr, nullptr, ubufs.size(),
ubufs.data(), ubufStages.data(), ubufOffs.data(), ubufSizes.data(),
texCount, texs.data(), nullptr, nullptr);
boo::ObjToken<boo::IShaderDataBinding> tessellation;
if (m_pipelines.m_tessellation) {
texs[texCount++] = m_rippleMap.get();
tessellation = ctx.newShaderDataBinding(m_pipelines.m_tessellation, m_pvbo.get(), nullptr, nullptr, 3, ubufs,
ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
tessellation = ctx.newShaderDataBinding(m_pipelines.m_tessellation, m_pvbo.get(), nullptr, nullptr, ubufs.size(),
ubufs.data(), ubufStages.data(), ubufOffs.data(), ubufSizes.data(),
texCount, texs.data(), nullptr, nullptr);
}
m_dataBind = {regular, tessellation};
return true;
......@@ -199,11 +227,11 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info) {
uni.m_mv = CGraphics::g_GXModelView.toMatrix4f();
uni.m_mvNorm = info.normMtx;
uni.m_proj = CGraphics::GetPerspectiveProjectionMatrix(true);
for (int i = 0; i < 6; ++i)
uni.m_texMtxs[i] = info.texMtxs[i];
uni.m_texMtxs = info.texMtxs;
uni.m_lighting.ActivateLights(info.lights);
for (int i = 0; i < 3; ++i)
for (size_t i = 0; i < uni.m_lighting.colorRegs.size(); ++i) {
uni.m_lighting.colorRegs[i] = info.kColors[i];
}
uni.m_lighting.mulColor = info.kColors[3];
uni.m_lighting.fog = CGraphics::g_Fog;
uni.m_pad2.x() = info.indScale;
......@@ -217,11 +245,11 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info, const zeus::CVe
uni.m_mv = CGraphics::g_GXModelView.toMatrix4f();
uni.m_mvNorm = info.normMtx;
uni.m_proj = CGraphics::GetPerspectiveProjectionMatrix(true);
for (int i = 0; i < 6; ++i)
uni.m_texMtxs[i] = info.texMtxs[i];
int i = 0;
uni.m_texMtxs = info.texMtxs;
size_t i = 0;
for (const CRipple& ripple : rippleManager.GetRipples()) {
assert(i < 20 && "Too many ripples");
assert(i < uni.m_ripple.size() && "Too many ripples");
Ripple& rOut = uni.m_ripple[i++];
if (ripple.GetTime() >= ripple.GetTimeFalloff()) {
rOut.center.zeroOut();
......@@ -241,8 +269,9 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info, const zeus::CVe
uni.m_colorMul = colorMul;
uni.m_pad[0].x() = rippleNormResolution;
uni.m_lighting.ActivateLights(info.lights);
for (i = 0; i < 3; ++i)
for (i = 0; i < uni.m_lighting.colorRegs.size(); ++i) {
uni.m_lighting.colorRegs[i] = info.kColors[i];
}
uni.m_lighting.mulColor = info.kColors[3];
uni.m_lighting.fog = CGraphics::g_Fog;
uni.m_pad2.x() = info.indScale;
......
#pragma once
#include <array>
#include <vector>
#include "Runtime/CToken.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include "Runtime/Graphics/Shaders/CModelShaders.hpp"
#include "Runtime/World/CFluidPlaneManager.hpp"
......@@ -12,7 +12,6 @@
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CAABox.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CVector3f.hpp>
......@@ -41,15 +40,15 @@ public:
struct PatchVertex {
zeus::CVector4f m_pos;
float m_outerLevels[4] = {};
float m_innerLevels[4] = {};
std::array<float, 4> m_outerLevels{};
std::array<float, 4> m_innerLevels{};
};
struct RenderSetupInfo {
zeus::CMatrix4f texMtxs[6];
std::array<zeus::CMatrix4f, 6> texMtxs;
zeus::CMatrix4f normMtx;
float indScale = 1.f;
zeus::CColor kColors[4];
std::array<zeus::CColor, 4> kColors;
std::vector<CLight> lights;
};
......@@ -69,8 +68,8 @@ private:
};
class Cache {
ShaderPair m_cache[1024] = {};
ShaderPair m_doorCache[8] = {};
std::array<ShaderPair, 1024> m_cache{};
std::array<ShaderPair, 8> m_doorCache{};
ShaderPair& CacheSlot(const SFluidPlaneShaderInfo& info, int i) { return m_cache[i]; }
ShaderPair& CacheSlot(const SFluidPlaneDoorShaderInfo& info, int i) { return m_doorCache[i]; }
static u16 MakeCacheKey(const SFluidPlaneShaderInfo& info);
......@@ -92,10 +91,10 @@ private:
zeus::CMatrix4f m_mv;
zeus::CMatrix4f m_mvNorm;
zeus::CMatrix4f m_proj;
zeus::CMatrix4f m_texMtxs[6];
Ripple m_ripple[20];
std::array<zeus::CMatrix4f, 6> m_texMtxs;
std::array<Ripple, 20> m_ripple;
zeus::CVector4f m_colorMul;
zeus::CVector4f m_pad[3]; // rippleNormResolution, Pad out to 1280 bytes
std::array<zeus::CVector4f, 3> m_pad; // rippleNormResolution, Pad out to 1280 bytes
CModelShaders::LightingUniform m_lighting;
zeus::CVector3f m_pad2; // Pad out to 768 bytes, also holds ind scale
};
......
#include "CFogVolumeFilter.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "Runtime/Graphics/Shaders/CFogVolumeFilter.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Graphics/CBooRenderer.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <hecl/Pipeline.hpp>
#include <zeus/CColor.hpp>
namespace urde {
......
#pragma once
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <boo/BooObject.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CRectangle.hpp>
namespace boo {
struct IGraphicsBufferD;
struct IGraphicsBufferS;
struct IShaderDataBinding;
} // namespace boo
namespace zeus {
class CColor;
}
namespace urde {
......
#include "CFogVolumePlaneShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Runtime/Graphics/Shaders/CFogVolumePlaneShader.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
static boo::ObjToken<boo::IShaderPipeline> s_Pipelines[4];
static std::array<boo::ObjToken<boo::IShaderPipeline>, 4> s_Pipelines;
void CFogVolumePlaneShader::Initialize() {
s_Pipelines[0] = hecl::conv->convert(Shader_CFogVolumePlaneShader0{});
......@@ -24,9 +26,10 @@ void CFogVolumePlaneShader::CommitResources(size_t capacity) {
m_vertCapacity = capacity;
CGraphics::CommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector4f), capacity);
for (int i = 0; i < 4; ++i)
for (size_t i = 0; i < m_dataBinds.size(); ++i) {
m_dataBinds[i] = ctx.newShaderDataBinding(s_Pipelines[i], m_vbo.get(), nullptr, nullptr, 0, nullptr, nullptr,
nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
return true;
} BooTrace);
}
......
#pragma once
#include <array>
#include <cstddef>
#include <vector>
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CRectangle.hpp>
#include <zeus/CVector4f.hpp>
namespace zeus {
class CVector3f;
}
namespace urde {
class CFogVolumePlaneShader {
boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
boo::ObjToken<boo::IShaderDataBinding> m_dataBinds[4];
std::array<boo::ObjToken<boo::IShaderDataBinding>, 4> m_dataBinds;
std::vector<zeus::CVector4f> m_verts;
size_t m_vertCapacity = 0;
......
#include "CLineRendererShaders.hpp"
#include "Graphics/CLineRenderer.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CLineRendererShaders.hpp"
#include <utility>
#include "Runtime/Graphics/CLineRenderer.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -87,8 +91,8 @@ void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Con
}
}
int texCount = 0;
boo::ObjToken<boo::ITexture> textures[1];
size_t texCount = 0;
std::array<boo::ObjToken<boo::ITexture>, 1> textures;
std::pair<boo::ObjToken<boo::IGraphicsBufferD>, hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp>
vbufInfo;
......@@ -102,15 +106,16 @@ void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Con
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
}
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Fragment};
size_t ubufOffs[] = {size_t(ubufInfo.second)};
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> uniforms{ubufInfo.first.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Fragment};
const std::array<size_t, 1> ubufOffs{size_t(ubufInfo.second)};
const std::array<size_t, 1> ubufSizes{sizeof(CLineRenderer::SDrawUniform)};
for (int i = 0; i < 2; ++i)
renderer.m_shaderBind[i] =
ctx.newShaderDataBinding((*pipeline)[i], vbufInfo.first.get(), nullptr, nullptr, 1, uniforms, stages, ubufOffs,
ubufSizes, texCount, textures, nullptr, nullptr, vbufInfo.second);
for (size_t i = 0; i < std::size(renderer.m_shaderBind); ++i) {
renderer.m_shaderBind[i] = ctx.newShaderDataBinding(
(*pipeline)[i], vbufInfo.first.get(), nullptr, nullptr, uniforms.size(), uniforms.data(), stages.data(),
ubufOffs.data(), ubufSizes.data(), texCount, textures.data(), nullptr, nullptr, vbufInfo.second);
}
}
} // namespace urde
......@@ -2,8 +2,6 @@
#include <array>
#include "Runtime/Graphics/CGraphics.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
namespace urde {
......
#include "CMapSurfaceShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Runtime/Graphics/Shaders/CMapSurfaceShader.hpp"
#include <array>
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -15,10 +19,10 @@ CMapSurfaceShader::CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx,
const boo::ObjToken<boo::IGraphicsBufferS>& ibo)
: m_vbo(vbo), m_ibo(ibo) {
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, m_ibo.get(), 1, bufs, stages, nullptr,
nullptr, 0, nullptr, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, m_ibo.get(), bufs.size(), bufs.data(),
stages.data(), nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
void CMapSurfaceShader::draw(const zeus::CColor& color, u32 start, u32 count) {
......
#pragma once
#include "Runtime/RetroTypes.hpp"
#include "Runtime/GCNTypes.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
......
This diff is collapsed.
#pragma once
#include <array>
#include <optional>
#include <cstdint>
#include <memory>
#include "DataSpec/DNAMP1/CMDLMaterials.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include <hecl/Backend.hpp>
#include <hecl/Runtime.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CVector3f.hpp>
#include <zeus/CVector4f.hpp>
#define URDE_MAX_LIGHTS 8
namespace hecl::Backend {
class ShaderTag;
}
namespace urde {
class CLight;
enum EExtendedShader : uint8_t {
Flat,
......@@ -56,14 +59,14 @@ public:
zeus::CVector3f pos;
zeus::CVector3f dir;
zeus::CColor color = zeus::skClear;
float linAtt[4] = {1.f, 0.f, 0.f};
float angAtt[4] = {1.f, 0.f, 0.f};
std::array<float, 4> linAtt{1.f, 0.f, 0.f};
std::array<float, 4> angAtt{1.f, 0.f, 0.f};
};
struct LightingUniform {
Light lights[URDE_MAX_LIGHTS];
std::array<Light, URDE_MAX_LIGHTS> lights;
zeus::CColor ambient;
zeus::CColor colorRegs[3];
std::array<zeus::CColor, 3> colorRegs;
zeus::CColor mulColor;
zeus::CColor addColor;
CGraphics::CFogState fog;
......
#include "CParticleSwooshShaders.hpp"
#include "Particle/CParticleSwoosh.hpp"
#include "Particle/CSwooshDescription.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CParticleSwooshShaders.hpp"
#include <iterator>
#include "Runtime/Particle/CParticleSwoosh.hpp"
#include "Runtime/Particle/CSwooshDescription.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -86,13 +90,17 @@ void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::C
}
}
CUVElement* texr = desc->x3c_TEXR.get();
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
const CUVElement* const texr = desc->x3c_TEXR.get();
const std::array<boo::ObjToken<boo::ITexture>, 1> textures{
texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr,
};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
for (int i = 0; i < 2; ++i)
gen.m_dataBind[i] = ctx.newShaderDataBinding((*pipeline)[i], gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms,
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> uniforms{gen.m_uniformBuf.get()};
for (size_t i = 0; i < std::size(gen.m_dataBind); ++i) {
gen.m_dataBind[i] =
ctx.newShaderDataBinding((*pipeline)[i], gen.m_vertBuf.get(), nullptr, nullptr, uniforms.size(),
uniforms.data(), nullptr, texr ? 1 : 0, textures.data(), nullptr, nullptr);
}
}
} // namespace urde
......@@ -2,8 +2,6 @@
#include <array>
#include "Runtime/Graphics/CGraphics.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
......
#include "CPhazonSuitFilter.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Graphics/CTexture.hpp"
#include "Runtime/Graphics/Shaders/CPhazonSuitFilter.hpp"
#include <array>
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include <hecl/Pipeline.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
#include <zeus/CVector4f.hpp>
namespace urde {
......@@ -35,38 +44,46 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex) {
struct BlurVert {
zeus::CVector3f pos;
zeus::CVector2f uv;
} blurVerts[4] = {{{-1.f, 1.f, 0.f}, {0.f, 1.f}},
{{-1.f, -1.f, 0.f}, {0.f, 0.f}},
{{1.f, 1.f, 0.f}, {1.f, 1.f}},
{{1.f, -1.f, 0.f}, {1.f, 0.f}}};
m_blurVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, blurVerts, sizeof(BlurVert), 4);
};
const std::array<BlurVert, 4> blurVerts{{
{{-1.f, 1.f, 0.f}, {0.f, 1.f}},
{{-1.f, -1.f, 0.f}, {0.f, 0.f}},
{{1.f, 1.f, 0.f}, {1.f, 1.f}},
{{1.f, -1.f, 0.f}, {1.f, 0.f}},
}};
m_blurVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, blurVerts.data(), sizeof(BlurVert), blurVerts.size());
struct Vert {
zeus::CVector3f pos;
zeus::CVector2f screenUv;
zeus::CVector2f indUv;
zeus::CVector2f maskUv;
} verts[4] = {{{-1.f, 1.f, 0.f}, {0.01f, 0.99f}, {0.f, 4.f}, {0.f, 1.f}},
{{-1.f, -1.f, 0.f}, {0.01f, 0.01f}, {0.f, 0.f}, {0.f, 0.f}},
{{1.f, 1.f, 0.f}, {0.99f, 0.99f}, {g_Viewport.aspect * 4.f, 4.f}, {1.f, 1.f}},
{{1.f, -1.f, 0.f}, {0.99f, 0.01f}, {g_Viewport.aspect * 4.f, 0.f}, {1.f, 0.f}}};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, sizeof(Vert), 4);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBufBlurX.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[4];
int texBindIdxs[4];
};
const std::array<Vert, 4> verts{{
{{-1.f, 1.f, 0.f}, {0.01f, 0.99f}, {0.f, 4.f}, {0.f, 1.f}},
{{-1.f, -1.f, 0.f}, {0.01f, 0.01f}, {0.f, 0.f}, {0.f, 0.f}},
{{1.f, 1.f, 0.f}, {0.99f, 0.99f}, {g_Viewport.aspect * 4.f, 4.f}, {1.f, 1.f}},
{{1.f, -1.f, 0.f}, {0.99f, 0.01f}, {g_Viewport.aspect * 4.f, 0.f}, {1.f, 0.f}},
}};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts.data(), sizeof(Vert), verts.size());
std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBufBlurX.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
std::array<boo::ObjToken<boo::ITexture>, 4> texs;
std::array<int, 4> texBindIdxs;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 1;
m_dataBindBlurX = ctx.newShaderDataBinding(s_BlurPipeline, m_blurVbo.get(), nullptr, nullptr, 1, bufs, stages,
nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
m_dataBindBlurX =
ctx.newShaderDataBinding(s_BlurPipeline, m_blurVbo.get(), nullptr, nullptr, bufs.size(), bufs.data(),
stages.data(), nullptr, nullptr, 1, texs.data(), texBindIdxs.data(), nullptr);
bufs[0] = m_uniBufBlurY.get();
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 2;
m_dataBindBlurY = ctx.newShaderDataBinding(s_BlurPipeline, m_blurVbo.get(), nullptr, nullptr, 1, bufs, stages,
nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
m_dataBindBlurY =
ctx.newShaderDataBinding(s_BlurPipeline, m_blurVbo.get(), nullptr, nullptr, bufs.size(), bufs.data(),
stages.data(), nullptr, nullptr, 1, texs.data(), texBindIdxs.data(), nullptr);
bufs[0] = m_uniBuf.get();
size_t texCount;
......@@ -90,8 +107,9 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex) {
texCount = 3;
}
m_dataBind = ctx.newShaderDataBinding(m_indTex ? s_IndPipeline : s_Pipeline, m_vbo.get(), nullptr, nullptr, 1,
bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
m_dataBind = ctx.newShaderDataBinding(m_indTex ? s_IndPipeline : s_Pipeline, m_vbo.get(), nullptr, nullptr,
bufs.size(), bufs.data(), stages.data(), nullptr, nullptr, texCount,
texs.data(), texBindIdxs.data(), nullptr);
return true;
} BooTrace);
}
......
#pragma once
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
namespace zeus {
class CColor;
}
namespace urde {
class CTexture;
......
#include "CRadarPaintShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Graphics/CTexture.hpp"
#include "Runtime/Graphics/Shaders/CRadarPaintShader.hpp"
#include <cstring>
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -22,11 +26,14 @@ void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CText
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Instance), m_maxInsts);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[] = {m_tex->GetBooTexture()};
m_dataBind = ctx.newShaderDataBinding(s_Pipeline, nullptr, m_vbo.get(), nullptr, 1, bufs, stages, nullptr,
nullptr, 1, texs, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
const std::array<boo::ObjToken<boo::ITexture>, 1> texs{m_tex->GetBooTexture()};
m_dataBind =
ctx.newShaderDataBinding(s_Pipeline, nullptr, m_vbo.get(), nullptr, bufs.size(), bufs.data(), stages.data(),
nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
return true;
} BooTrace);
}
......
#pragma once
#include <array>
#include <vector>
#include "Runtime/Camera/CCameraFilter.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CRectangle.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
namespace urde {
class CTexture;
class CRadarPaintShader {
public:
struct Instance {
zeus::CVector3f pos[4];
zeus::CVector2f uv[4];
std::array<zeus::CVector3f, 4> pos;
std::array<zeus::CVector2f, 4> uv;
zeus::CColor color;
};
......
#include "CRandomStaticFilter.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "hecl/Pipeline.hpp"
#include "Runtime/Graphics/Shaders/CRandomStaticFilter.hpp"
#include <array>
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Camera/CCameraFilter.hpp"
#include "Runtime/Graphics/CBooRenderer.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
......@@ -43,20 +47,22 @@ CRandomStaticFilter::CRandomStaticFilter(EFilterType type, bool cookieCutter) :
struct Vert {
zeus::CVector2f m_pos;
zeus::CVector2f m_uv;
} verts[4] = {
};
const std::array<Vert, 4> verts{{
{{-1.f, -1.f}, {0.f, 0.f}},
{{-1.f, 1.f}, {0.f, 448.f}},
{{1.f, -1.f}, {640.f, 0.f}},
{{1.f, 1.f}, {640.f, 448.f}},
};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, sizeof(Vert), 4);
}};
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts.data(), sizeof(Vert), verts.size());
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
m_dataBind =
ctx.newShaderDataBinding(m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type), m_vbo.get(), nullptr,
nullptr, 1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
const std::array<boo::ObjToken<boo::ITexture>, 1> texs{g_Renderer->GetRandomStaticEntropyTex()};
m_dataBind = ctx.newShaderDataBinding(m_cookieCutter ? s_CookieCutterPipeline : SelectPipe