Windows fixes

This commit is contained in:
Jack Andersen 2017-11-24 16:50:24 -10:00
parent 00b02bb0f3
commit 80f98e1218
9 changed files with 54 additions and 22 deletions

View File

@ -74,7 +74,7 @@ void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::C
if (mode == ERglFogMode::None)
{
g_Fog.m_start = 4096.f;
g_Fog.m_rangeScale = 1.f;
g_Fog.m_rangeScale = 0.f;
}
else
{

View File

@ -223,7 +223,7 @@ public:
struct CFogState
{
zeus::CColor m_color;
float m_rangeScale = 1.f;
float m_rangeScale = 0.f;
float m_start = 4096.f;
};
@ -313,6 +313,13 @@ public:
g_SpareTexture = spareTex;
}
static void ShutdownBoo()
{
g_BooFactory = nullptr;
g_BooMainCommandQueue = nullptr;
g_SpareTexture.reset();
}
static const boo::SystemChar* PlatformName()
{
return g_BooPlatformName;

View File

@ -18,7 +18,7 @@ class CLight;
class CAreaOctTree;
class CParticleGen;
class CModel;
class SShader;
struct SShader;
class CSkinnedModel;
class CPVSVisSet;
struct CAreaRenderOctTree;

View File

@ -669,7 +669,7 @@ CFluidPlaneShader::BuildBinding(boo::GLDataFactory::Context& ctx,
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
if (m_lightmap)
texs[texCount++] = (*m_lightmap)->GetBooTexture();
return ctx.newShaderDataBinding(pipeline, vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
return ctx.newShaderDataBinding(pipeline, vtxFmt, m_vbo.get(), nullptr, nullptr, 3,
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}
@ -699,7 +699,7 @@ CFluidPlaneShader::BuildBinding(boo::VulkanDataFactory::Context& ctx,
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
if (m_lightmap)
texs[texCount++] = (*m_lightmap)->GetBooTexture();
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, 3,
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}
#endif

View File

@ -66,7 +66,7 @@ static const char* FS =
" float start;\n"
"};\n"
"\n"
"struct LightingUniform\n"
"cbuffer LightingUniform : register(b2)\n"
"{\n"
" Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n"
" float4 ambient;\n"
@ -111,7 +111,7 @@ static const char* FS =
"\n"
"SamplerState samp : register(s0);\n"
"%s" // Textures here
"float4 main(in VertToFrag vtf)\n"
"float4 main(in VertToFrag vtf) : SV_Target0\n"
"{\n"
" float4 lighting = LightingFunc(vtf.mvPos, normalize(vtf.mvNorm));\n"
" float4 colorOut;\n"
@ -120,6 +120,31 @@ static const char* FS =
"}\n";
static const char* FSDoor =
"struct Light\n"
"{\n"
" float4 pos;\n"
" float4 dir;\n"
" float4 color;\n"
" float4 linAtt;\n"
" float4 angAtt;\n"
"};\n"
"struct Fog\n" // Reappropriated for indirect texture scaling
"{\n"
" float4 color;\n"
" float indScale;\n"
" float start;\n"
"};\n"
"\n"
"cbuffer LightingUniform : register(b2)\n"
"{\n"
" Light lights[" _XSTR(URDE_MAX_LIGHTS) "];\n"
" float4 ambient;\n"
" float4 kColor0;\n"
" float4 kColor1;\n"
" float4 kColor2;\n"
" float4 kColor3;\n"
" Fog fog;\n"
"};\n"
"struct VertToFrag\n"
"{\n"
" float4 pos : SV_Position;\n"
@ -133,7 +158,7 @@ static const char* FSDoor =
"\n"
"SamplerState samp : register(s0);\n"
"%s" // Textures here
"float4 main(in VertToFrag vtf)\n"
"float4 main(in VertToFrag vtf) : SV_Target0\n"
"{\n"
" float4 colorOut;\n"
"%s" // Combiner expression here
@ -165,19 +190,19 @@ CFluidPlaneShader::BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidP
int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv;
if (info.m_hasPatternTex1)
textures += hecl::Format("Texture2D patternTex1 : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D patternTex1 : register(t%d);\n", nextTex++);
if (info.m_hasPatternTex2)
textures += hecl::Format("Texture2D patternTex2 : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D patternTex2 : register(t%d);\n", nextTex++);
if (info.m_hasColorTex)
textures += hecl::Format("Texture2D colorTex : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D colorTex : register(t%d);\n", nextTex++);
if (info.m_hasBumpMap)
textures += hecl::Format("Texture2D bumpMap : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D bumpMap : register(t%d);\n", nextTex++);
if (info.m_hasEnvMap)
textures += hecl::Format("Texture2D envMap : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D envMap : register(t%d);\n", nextTex++);
if (info.m_hasEnvBumpMap)
textures += hecl::Format("Texture2D envBumpMap : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D envBumpMap : register(t%d);\n", nextTex++);
if (info.m_hasLightmap)
textures += hecl::Format("Texture2D lightMap : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D lightMap : register(t%d);\n", nextTex++);
if (info.m_hasBumpMap)
{
@ -494,11 +519,11 @@ CFluidPlaneShader::BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidP
int nextTex = 0;
if (info.m_hasPatternTex1)
textures += hecl::Format("Texture2D patternTex1 : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D patternTex1 : register(t%d);\n", nextTex++);
if (info.m_hasPatternTex2)
textures += hecl::Format("Texture2D patternTex2 : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D patternTex2 : register(t%d);\n", nextTex++);
if (info.m_hasColorTex)
textures += hecl::Format("Texture2D colorTex : register(t%d)\n", nextTex++);
textures += hecl::Format("Texture2D colorTex : register(t%d);\n", nextTex++);
// Tex0 * kColor0 * Tex1 + Tex2
if (info.m_hasPatternTex1 && info.m_hasPatternTex2)
@ -558,7 +583,7 @@ CFluidPlaneShader::BuildBinding(boo::ID3DDataFactory::Context& ctx,
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
if (m_lightmap)
texs[texCount++] = (*m_lightmap)->GetBooTexture();
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, 3,
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}

View File

@ -612,7 +612,7 @@ boo::ObjToken<boo::IShaderDataBinding> CFluidPlaneShader::BuildBinding(boo::Meta
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
if (m_lightmap)
texs[texCount++] = (*m_lightmap)->GetBooTexture();
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, 3,
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}

View File

@ -64,7 +64,6 @@ static const char* VSNoFlip =
" VertToFrag vtf;\n"
" vtf.color = color;\n"
" vtf.uv = v.uvIn.xy;\n"
" vtf.uv.y = 1.f - vtf.uv.y;\n"
" vtf.lod = lod;\n"
" vtf.position = mul(mat, float4(v.posIn.xyz, 1.0));\n"
" return vtf;\n"

View File

@ -575,6 +575,7 @@ void CMain::Shutdown()
TMultiBlendShader<CScanLinesFilter>::Shutdown();
TMultiBlendShader<CRandomStaticFilter>::Shutdown();
CFluidPlaneShader::Shutdown();
CGraphics::ShutdownBoo();
}
boo::IWindow* CMain::GetMainWindow() const

2
hecl

@ -1 +1 @@
Subproject commit 191ac39ac3d7246f3ad020d75017a663f94397fa
Subproject commit 6c480c70f1f46f35658576d91241b529d19c7a61