Commit 342d4df0 authored by AL's avatar AL

Blending also works

parent ad51876a
......@@ -92,14 +92,18 @@ HudEffect<Effect3DSequence, PlaneTexNorm>::HudEffect(DXGraphics& gfx, Effect3DSe
PlaneTexNorm(spriteName, gfx),effectSequence(data), gfx(gfx)
{
auto& s = Drawable::Drawable::GetTechniquesReference()[4].GetSteps()[0];
s.DeleteBindableByUID(L"class Bind::VertexShader#PhongVSNormalMap.cso");
s.DeleteBindableByUID(L"class Bind::VertexShader#PhongVSNormalMap.cso");
s.AddBindable(Bind::VertexShader::Resolve(gfx, L"PhongVSScale.cso"));
s.DeleteBindableByUID(L"class Bind::PixelShader#PhongPSNormMask.cso");
s.AddBindable(Bind::PixelShader::Resolve(gfx, L"PhongPSOpac.cso"));
scaleCbuf = std::make_shared<Bind::VertexConstantBuffer<EffectCBuff>>(gfx, 3);
cbuf = std::make_shared<Bind::PixelConstantBuffer<EffectCBuff>>(gfx, 4);
s.AddBindable(cbuf);
s.AddBindable(scaleCbuf);
s.AddBindable(Bind::Blender::Resolve(gfx, true)); //alpha usage set to true by default
BindPositionData(&refPosData);
refPosData.emplace_back();
......@@ -293,12 +297,12 @@ void EffectHandler::AddEffect3D(Effect e)
PositionData posData = { 3.7f, 1.0f, 1.0f, 0.0f, 3 * PI / 2.0f, PI / 2.0f };
Effect3DSequence e3ds1;
e3ds1.AddStage({ posData.pos.x,posData.pos.y,posData.pos.z , 0.8f ,1.0f,posData.rot.x,posData.rot.y,posData.rot.z }, 2.65f);
e3ds1.AddStage({ posData.pos.x,posData.pos.y,posData.pos.z, 0.3f ,0.5f,posData.rot.x,posData.rot.y,posData.rot.z }, 0.0f);
e3ds1.AddStage({ posData.pos.x,posData.pos.y,posData.pos.z, 0.8f ,0.0f,posData.rot.x,posData.rot.y,posData.rot.z }, 0.0f);
EffectHandler::AddEffect3D(e3ds1, L"Media\\Models\\Enemy_hit.obj");
Effect3DSequence e3ds2;
e3ds2.AddStage({ posData.pos.x,posData.pos.y,posData.pos.z, 0.5f ,0.5f,posData.rot.x,posData.rot.y,posData.rot.z }, 5.0f);
e3ds2.AddStage({ posData.pos.x,posData.pos.y,posData.pos.z, 1.0f ,1.0f,posData.rot.x,posData.rot.y,posData.rot.z }, 0.0f);
e3ds2.AddStage({ posData.pos.x-0.01f,posData.pos.y,posData.pos.z, 0.5f ,0.5f,posData.rot.x,posData.rot.y,posData.rot.z }, 5.0f);
e3ds2.AddStage({ posData.pos.x-0.01f,posData.pos.y,posData.pos.z, 1.0f ,1.0f,posData.rot.x,posData.rot.y,posData.rot.z }, 0.0f);
EffectHandler::AddEffect3D(e3ds2, L"Media\\Models\\Enemy_hit.obj");
break;
}
......
......@@ -651,11 +651,11 @@
</FxCompile>
<FxCompile Include="PhongPSNormalMap.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">5.0</ShaderModel>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(RiftedTimes\Engine)%(Filename).cso</ObjectFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(RiftedTimes\Engine)%(Filename).cso</ObjectFileOutput>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="PhongPSNormalMapObject.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
......@@ -687,6 +687,16 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="PhongPSOpac.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(RiftedTimes\Engine)%(Filename).cso</ObjectFileOutput>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(RiftedTimes\Engine)%(Filename).cso</ObjectFileOutput>
</FxCompile>
<FxCompile Include="PhongPSSpec.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
......
......@@ -997,6 +997,9 @@
<FxCompile Include="PhongVSScale.hlsl">
<Filter>Shaders</Filter>
</FxCompile>
<FxCompile Include="PhongPSOpac.hlsl">
<Filter>Shaders</Filter>
</FxCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc">
......
......@@ -113,7 +113,7 @@ PlaneTexNorm::PlaneTexNorm(std::wstring modelName, DXGraphics& gfx, float scale,
cbuf[L"texSpecCol"] = specularColor;
cbuf[L"specularPower"] = shininess;
cbuf[L"texDifColInt"] = diffuseColor;
cbuf[L"normalMapEnabled"] = true;
cbuf[L"normalMapEnabled"] = hasNormalMap;
//these three should be bound outside steps because they stay the same no matter the Technique
const auto meshTag = std::filesystem::path(modelName).wstring() + L"%" + ToWide(mesh->mName.C_Str());
......
#include "ShaderOps.hlsl"
#include "LightVectorData.hlsl"
#include "PointLight.hlsl"
#include "Opacity.hlsl"
cbuffer ObjectCBuf
{
......@@ -53,5 +54,8 @@ float4 main(float3 viewFragPos : Position, float3 viewNormal : Normal, float3 vi
);
}
// final color
return float4(saturate((diffuse + ambient[0]) * dtex.rgb * texDifColInt + specular), dtex.a);
#ifdef OPAC_BOI
return float4(saturate((diffuse + ambient[0]) * dtex.rgb * texDifColInt + specular), dtex.a*opacity);
#endif
return float4(saturate((diffuse + ambient[0]) * dtex.rgb * texDifColInt + specular), dtex.a);
}
\ No newline at end of file
#define OPAC_BOI
#define MASK_BOI
#include "PhongPSNormalMap.hlsl"
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment