updated gbuffer, motionblur, image, archive, camera
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
This file contains changelog of wiArchive versions
|
||||
|
||||
2: serialized Material property planar_reflections
|
||||
1: Refactor Archive
|
||||
--VERSION_BARRIER------------------
|
||||
0: Created archive
|
||||
@@ -29,6 +29,7 @@ void DeferredRenderableComponent::Initialize()
|
||||
rtGBuffer.Add(FORMAT_R16G16_FLOAT);
|
||||
rtGBuffer.Add(FORMAT_R8G8B8A8_UNORM);
|
||||
rtGBuffer.Add(FORMAT_R8G8B8A8_UNORM);
|
||||
rtGBuffer.Add(FORMAT_R16G16_FLOAT);
|
||||
|
||||
rtDeferred.Initialize(
|
||||
wiRenderer::GetDevice()->GetScreenWidth(), wiRenderer::GetDevice()->GetScreenHeight()
|
||||
@@ -94,7 +95,7 @@ void DeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID){
|
||||
static const int tessellationQuality = 0;
|
||||
wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight());
|
||||
|
||||
rtGBuffer.Activate(threadID, 0.5f, 0.5f, 0.5f, 1); // special clearcolor! background should write 0.5 in velocity buffer!
|
||||
rtGBuffer.Activate(threadID, 0, 0, 0, 0);
|
||||
{
|
||||
|
||||
wiRenderer::SetClipPlane(XMFLOAT4(0, 0, 0, 0), threadID);
|
||||
@@ -222,7 +223,7 @@ void DeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID){
|
||||
rtDeferred.Activate(threadID, rtGBuffer.depth); {
|
||||
wiImage::DrawDeferred((getSSSEnabled() ? rtSSS[0].GetTexture(0) : rtLight.GetTexture(0)), rtLight.GetTexture(1)
|
||||
, getSSAOEnabled() ? rtSSAO.back().GetTexture() : wiTextureHelper::getInstance()->getWhite()
|
||||
, threadID, STENCILREF_DEFAULT);
|
||||
, threadID, STENCILREF_DEFAULT);
|
||||
wiRenderer::DrawSky(threadID);
|
||||
}
|
||||
|
||||
@@ -237,27 +238,23 @@ void DeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID){
|
||||
}
|
||||
}
|
||||
|
||||
if (getMotionBlurEnabled()){ //MOTIONBLUR
|
||||
rtMotionBlur.Activate(threadID);
|
||||
fx.process.setMotionBlur(true);
|
||||
//fx.setVelocityMap(rtGBuffer.shaderResource.back());
|
||||
//fx.setDepthMap(rtLinearDepth.shaderResource.back());
|
||||
fx.blendFlag = BLENDMODE_OPAQUE;
|
||||
if (getSSREnabled()){
|
||||
wiImage::Draw(rtSSR.GetTexture(), fx, threadID);
|
||||
}
|
||||
else{
|
||||
wiImage::Draw(rtDeferred.GetTexture(), fx, threadID);
|
||||
}
|
||||
fx.process.clear();
|
||||
}
|
||||
//if (getMotionBlurEnabled()){ //MOTIONBLUR
|
||||
// rtMotionBlur.Activate(threadID);
|
||||
// fx.process.setMotionBlur(true);
|
||||
// fx.blendFlag = BLENDMODE_OPAQUE;
|
||||
// if (getSSREnabled()){
|
||||
// wiImage::Draw(rtSSR.GetTexture(), fx, threadID);
|
||||
// }
|
||||
// else{
|
||||
// wiImage::Draw(rtDeferred.GetTexture(), fx, threadID);
|
||||
// }
|
||||
// fx.process.clear();
|
||||
//}
|
||||
}
|
||||
|
||||
wiRenderTarget& DeferredRenderableComponent::GetFinalRT()
|
||||
{
|
||||
if (getMotionBlurEnabled())
|
||||
return rtMotionBlur;
|
||||
else if (getSSREnabled())
|
||||
if (getSSREnabled())
|
||||
return rtSSR;
|
||||
else
|
||||
return rtDeferred;
|
||||
|
||||
@@ -72,7 +72,7 @@ void ForwardRenderableComponent::Render()
|
||||
|
||||
void ForwardRenderableComponent::RenderScene(GRAPHICSTHREAD threadID)
|
||||
{
|
||||
rtMain.Activate(threadID, 0.5f, 0.5f, 0.5f, 1);
|
||||
rtMain.Activate(threadID, 0, 0, 0, 0);
|
||||
{
|
||||
|
||||
wiRenderer::SetClipPlane(XMFLOAT4(0, 0, 0, 0), threadID);
|
||||
|
||||
@@ -394,6 +394,17 @@ void Renderable3DComponent::RenderComposition2(wiRenderTarget& mainRT, GRAPHICST
|
||||
}
|
||||
|
||||
wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight());
|
||||
|
||||
if (getMotionBlurEnabled()) {
|
||||
rtMotionBlur.Activate(threadID);
|
||||
fx.process.setMotionBlur(true);
|
||||
fx.blendFlag = BLENDMODE_OPAQUE;
|
||||
fx.presentFullScreen = false;
|
||||
wiImage::Draw(rtFinal[0].GetTexture(), fx, threadID);
|
||||
fx.process.clear();
|
||||
}
|
||||
|
||||
|
||||
fx.blendFlag = BLENDMODE_OPAQUE;
|
||||
|
||||
rtFinal[1].Activate(threadID);
|
||||
@@ -406,7 +417,14 @@ void Renderable3DComponent::RenderComposition2(wiRenderTarget& mainRT, GRAPHICST
|
||||
{
|
||||
fx.setMaskMap(wiTextureHelper::getInstance()->getColor(wiColor::Gray));
|
||||
}
|
||||
wiImage::Draw(rtFinal[0].GetTexture(), fx, threadID);
|
||||
if (getMotionBlurEnabled())
|
||||
{
|
||||
wiImage::Draw(rtMotionBlur.GetTexture(), fx, threadID);
|
||||
}
|
||||
else
|
||||
{
|
||||
wiImage::Draw(rtFinal[0].GetTexture(), fx, threadID);
|
||||
}
|
||||
fx.process.clear();
|
||||
|
||||
|
||||
@@ -435,6 +453,7 @@ void Renderable3DComponent::RenderComposition2(wiRenderTarget& mainRT, GRAPHICST
|
||||
fx.process.clear();
|
||||
}
|
||||
|
||||
|
||||
rtFinal[2].Activate(threadID, mainRT.depth);
|
||||
fx.process.setFXAA(getFXAAEnabled());
|
||||
if (getDepthOfFieldEnabled())
|
||||
|
||||
@@ -251,10 +251,22 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_normalmap_planarreflection.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_planarreflection.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_transparent.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_transparent_normalmap_planarreflection.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_transparent_planarreflection.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_simplest.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
|
||||
@@ -390,6 +390,18 @@
|
||||
<FxCompile Include="environmentalLightPS.hlsl">
|
||||
<Filter>PS</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_normalmap_planarreflection.hlsl">
|
||||
<Filter>PS</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_planarreflection.hlsl">
|
||||
<Filter>PS</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_transparent_normalmap_planarreflection.hlsl">
|
||||
<Filter>PS</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="objectPS_forward_dirlight_transparent_planarreflection.hlsl">
|
||||
<Filter>PS</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="PS">
|
||||
|
||||
@@ -692,6 +692,7 @@
|
||||
<ItemGroup>
|
||||
<Text Include="$(MSBuildThisFileDirectory)..\features.txt" />
|
||||
<Text Include="$(MSBuildThisFileDirectory)..\licenses.txt" />
|
||||
<Text Include="$(MSBuildThisFileDirectory)ArchiveVersionHistory.txt" />
|
||||
<Text Include="$(MSBuildThisFileDirectory)fonts\basic.wifont">
|
||||
<DeploymentContent>true</DeploymentContent>
|
||||
<FileType>Document</FileType>
|
||||
|
||||
@@ -1859,6 +1859,7 @@
|
||||
<Text Include="$(MSBuildThisFileDirectory)fonts\basic.wifont">
|
||||
<Filter>fonts</Filter>
|
||||
</Text>
|
||||
<Text Include="$(MSBuildThisFileDirectory)ArchiveVersionHistory.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\README.md" />
|
||||
|
||||
@@ -8,8 +8,6 @@ GBUFFEROutputType main(GS_OUT PSIn)
|
||||
clip(dither(PSIn.pos.xy) - PSIn.fade);
|
||||
#endif
|
||||
|
||||
float2 velocity = 0;
|
||||
|
||||
float4 color = float4(PSIn.col,1);
|
||||
color = DEGAMMA(color);
|
||||
float emissive = 0;
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#include "postProcessHF.hlsli"
|
||||
#include "reconstructPositionHF.hlsli"
|
||||
|
||||
float4 main(VertexToPixelPostProcess PSIn) : SV_TARGET
|
||||
{
|
||||
float3 color = float3(0,0,0);
|
||||
float numSampling = 0.0f;
|
||||
float numSampling = 0.0f;
|
||||
|
||||
float2 vel = texture_gbuffer2.SampleLevel(Sampler, PSIn.tex, 0).xy - 0.5;
|
||||
//return float4(vel,0,1);
|
||||
vel *= 0.06f;
|
||||
float depth = texture_depth.SampleLevel(sampler_point_clamp, PSIn.tex, 0);
|
||||
float3 P = getPosition(PSIn.tex, depth);
|
||||
float2 pos2D = PSIn.tex.xy*2-1;
|
||||
float4 pos2DPrev = mul(float4(P, 1), g_xCamera_PrevVP);
|
||||
pos2DPrev.xy = float2(1,-1)*pos2DPrev.xy/pos2DPrev.w;
|
||||
float2 vel = pos2D - pos2DPrev.xy;
|
||||
vel *= 0.025f;
|
||||
|
||||
numSampling++;
|
||||
|
||||
|
||||
+12
-20
@@ -15,13 +15,6 @@
|
||||
// DEFINITIONS
|
||||
//////////////////
|
||||
|
||||
//#define xTextureMap texture_0
|
||||
//#define xReflectionMap texture_1
|
||||
//#define xNormalMap texture_2
|
||||
//#define xSpecularMap texture_3
|
||||
//#define xDisplacementMap texture_4
|
||||
//#define xReflection texture_5
|
||||
|
||||
#define xBaseColorMap texture_0
|
||||
#define xNormalMap texture_1
|
||||
#define xRoughnessMap texture_2
|
||||
@@ -56,6 +49,7 @@ struct GBUFFEROutputType
|
||||
float4 g1 : SV_TARGET1; // texture_gbuffer1
|
||||
float4 g2 : SV_TARGET2; // texture_gbuffer2
|
||||
float4 g3 : SV_TARGET3; // texture_gbuffer3
|
||||
float4 g4 : SV_TARGET4; // texture_gbuffer4
|
||||
};
|
||||
|
||||
|
||||
@@ -71,12 +65,13 @@ inline void NormalMapping(in float2 UV, in float3 V, inout float3 N, inout float
|
||||
N = normalize(lerp(N, mul(bumpColor, tangentFrame), g_xMat_normalMapStrength));
|
||||
}
|
||||
|
||||
//inline void PlanarReflection(in float2 UV, in float2 reflectionUV, in float3 N, inout float4 baseColor)
|
||||
//{
|
||||
// float colorMat = xReflectionMap.SampleLevel(sampler_aniso_wrap, UV, 0).r;
|
||||
// float4 colorReflection = xReflection.SampleLevel(sampler_linear_clamp, reflectionUV + N.xz, 0);
|
||||
// baseColor.rgb = lerp(baseColor.rgb, colorReflection.rgb, colorMat);
|
||||
//}
|
||||
inline float3 PlanarReflection(in float2 UV, in float2 reflectionUV, in float3 N, in float3 V, in float roughness, in float3 f0)
|
||||
{
|
||||
float4 colorReflection = xReflection.SampleLevel(sampler_linear_clamp, reflectionUV + N.xz*0.1f, 0);
|
||||
float f90 = saturate(50.0 * dot(f0, 0.33));
|
||||
float3 F = F_Schlick(f0, f90, abs(dot(N, V)) + 1e-5f);
|
||||
return colorReflection.rgb * F;
|
||||
}
|
||||
|
||||
inline void Refraction(in float2 ScreenCoord, in float2 normal2D, in float3 bumpColor, inout float alpha, inout float3 albedo)
|
||||
{
|
||||
@@ -137,8 +132,6 @@ inline void DirectionalLight(in float3 N, in float3 V, in float3 P, in float3 f0
|
||||
float lineardepth = input.pos2D.z; \
|
||||
float2 refUV = float2(1, -1)*input.ReflectionMapSamplingPos.xy / input.ReflectionMapSamplingPos.w / 2.0f + 0.5f;\
|
||||
float2 ScreenCoord = float2(1, -1) * input.pos2D.xy / input.pos2D.w / 2.0f + 0.5f; \
|
||||
float2 ScreenCoordPrev = float2(1, -1)*input.pos2DPrev.xy / input.pos2DPrev.w / 2.0f + 0.5f; \
|
||||
float2 velocity = ScreenCoord - ScreenCoordPrev;
|
||||
|
||||
#define OBJECT_PS_LIGHT_BEGIN \
|
||||
float3 diffuse, specular; \
|
||||
@@ -156,12 +149,11 @@ inline void DirectionalLight(in float3 N, in float3 V, in float3 P, in float3 f0
|
||||
#define OBJECT_PS_NORMALMAPPING \
|
||||
NormalMapping(UV, P, N, bumpColor);
|
||||
|
||||
//#define OBJECT_PS_PLANARREFLECTIONS \
|
||||
// PlanarReflection(input.tex, refUV, N, color);
|
||||
#define OBJECT_PS_PLANARREFLECTIONS \
|
||||
specular += PlanarReflection(UV, refUV, N, V, roughness, f0);
|
||||
|
||||
#define OBJECT_PS_ENVIRONMENTREFLECTIONS \
|
||||
specular += EnvironmentReflection(N, V, P, roughness, f0);
|
||||
|
||||
|
||||
#define OBJECT_PS_REFRACTION \
|
||||
Refraction(ScreenCoord, input.nor2D, bumpColor, color.a, albedo);
|
||||
@@ -169,7 +161,7 @@ inline void DirectionalLight(in float3 N, in float3 V, in float3 P, in float3 f0
|
||||
#define OBJECT_PS_DEGAMMA \
|
||||
color = DEGAMMA(color);
|
||||
|
||||
#define OBJECT_PS_GAMMA \
|
||||
#define OBJECT_PS_GAMMA \
|
||||
color = GAMMA(color);
|
||||
|
||||
#define OBJECT_PS_EMISSIVE \
|
||||
@@ -182,7 +174,7 @@ inline void DirectionalLight(in float3 N, in float3 V, in float3 P, in float3 f0
|
||||
GBUFFEROutputType Out = (GBUFFEROutputType)0; \
|
||||
Out.g0 = float4(color.rgb, 1); /*FORMAT_R8G8B8A8_UNORM*/ \
|
||||
Out.g1 = float4(encode(N), 0, 0); /*FORMAT_R16G16_FLOAT*/ \
|
||||
Out.g2 = float4(velocity * 0.5f + 0.5f, sss, emissive); /*FORMAT_R8G8B8A8_UNORM*/ \
|
||||
Out.g2 = float4(0, 0, sss, emissive); /*FORMAT_R8G8B8A8_UNORM*/ \
|
||||
Out.g3 = float4(roughness, reflectance, metalness, ao); /*FORMAT_R8G8B8A8_UNORM*/ \
|
||||
return Out;
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "objectHF.hlsli"
|
||||
|
||||
|
||||
float4 main(PixelInputType input) : SV_TARGET
|
||||
{
|
||||
OBJECT_PS_DITHER
|
||||
|
||||
OBJECT_PS_MAKE
|
||||
|
||||
OBJECT_PS_DEGAMMA
|
||||
|
||||
OBJECT_PS_LIGHT_BEGIN
|
||||
|
||||
OBJECT_PS_NORMALMAPPING
|
||||
|
||||
OBJECT_PS_LIGHT_DIRECTIONAL
|
||||
|
||||
OBJECT_PS_PLANARREFLECTIONS
|
||||
|
||||
OBJECT_PS_LIGHT_END
|
||||
|
||||
OBJECT_PS_EMISSIVE
|
||||
|
||||
OBJECT_PS_FOG
|
||||
|
||||
OBJECT_PS_OUT_FORWARD
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "objectHF.hlsli"
|
||||
|
||||
|
||||
float4 main(PixelInputType input) : SV_TARGET
|
||||
{
|
||||
OBJECT_PS_DITHER
|
||||
|
||||
OBJECT_PS_MAKE
|
||||
|
||||
OBJECT_PS_DEGAMMA
|
||||
|
||||
OBJECT_PS_LIGHT_BEGIN
|
||||
|
||||
OBJECT_PS_LIGHT_DIRECTIONAL
|
||||
|
||||
OBJECT_PS_PLANARREFLECTIONS
|
||||
|
||||
OBJECT_PS_LIGHT_END
|
||||
|
||||
OBJECT_PS_EMISSIVE
|
||||
|
||||
OBJECT_PS_FOG
|
||||
|
||||
OBJECT_PS_OUT_FORWARD
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "objectHF.hlsli"
|
||||
|
||||
|
||||
|
||||
float4 main( PixelInputType input) : SV_TARGET
|
||||
{
|
||||
OBJECT_PS_MAKE
|
||||
|
||||
OBJECT_PS_DEGAMMA
|
||||
|
||||
OBJECT_PS_LIGHT_BEGIN
|
||||
|
||||
OBJECT_PS_NORMALMAPPING
|
||||
|
||||
OBJECT_PS_REFRACTION
|
||||
|
||||
OBJECT_PS_LIGHT_DIRECTIONAL
|
||||
|
||||
OBJECT_PS_PLANARREFLECTIONS
|
||||
|
||||
OBJECT_PS_LIGHT_END
|
||||
|
||||
OBJECT_PS_EMISSIVE
|
||||
|
||||
OBJECT_PS_FOG
|
||||
|
||||
OBJECT_PS_OUT_FORWARD
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "objectHF.hlsli"
|
||||
|
||||
|
||||
|
||||
float4 main(PixelInputType input) : SV_TARGET
|
||||
{
|
||||
OBJECT_PS_MAKE
|
||||
|
||||
OBJECT_PS_DEGAMMA
|
||||
|
||||
OBJECT_PS_LIGHT_BEGIN
|
||||
|
||||
OBJECT_PS_REFRACTION
|
||||
|
||||
OBJECT_PS_LIGHT_DIRECTIONAL
|
||||
|
||||
OBJECT_PS_PLANARREFLECTIONS
|
||||
|
||||
OBJECT_PS_LIGHT_END
|
||||
|
||||
OBJECT_PS_EMISSIVE
|
||||
|
||||
OBJECT_PS_FOG
|
||||
|
||||
OBJECT_PS_OUT_FORWARD
|
||||
}
|
||||
@@ -8,10 +8,6 @@ GBUFFEROutputType main(QGS_OUT PSIn)
|
||||
clip(dither(PSIn.pos.xy) - PSIn.fade);
|
||||
#endif
|
||||
|
||||
float2 ScreenCoord = float2(1, -1) * PSIn.pos2D.xy / PSIn.pos2D.w / 2.0f + 0.5f;
|
||||
float2 ScreenCoordPrev = float2(1, -1) * PSIn.pos2DPrev.xy / PSIn.pos2DPrev.w / 2.0f + 0.5f;
|
||||
float2 velocity = ScreenCoord - ScreenCoordPrev;
|
||||
|
||||
float4 color = texture_0.Sample(sampler_linear_clamp,PSIn.tex);
|
||||
ALPHATEST(color.a)
|
||||
color = DEGAMMA(color);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef _SKY_HF_
|
||||
#define _SKY_HF_
|
||||
#include "globals.hlsli"
|
||||
#include "objectHF.hlsli"
|
||||
|
||||
inline float3 GetSkyColor(in float3 normal)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ struct VSOut{
|
||||
float4 pos2DPrev : SCREENPOSITIONPREV;
|
||||
};
|
||||
|
||||
float4 main(VSOut PSIn) : SV_TARGET
|
||||
float4 main(VSOut PSIn) : SV_Target
|
||||
{
|
||||
return float4(GetSkyColor(PSIn.nor), 1);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "wiHelper.h"
|
||||
|
||||
// this should always be only INCREMENTED and only if a new serialization is implemeted somewhere!
|
||||
uint64_t __archiveVersion = 1;
|
||||
uint64_t __archiveVersion = 2;
|
||||
// this is the version number of which below the archive is not compatible with the current version
|
||||
uint64_t __archiveVersionBarrier = 1;
|
||||
|
||||
@@ -28,6 +28,13 @@ wiArchive::wiArchive(const string& fileName, bool readMode):readMode(readMode),p
|
||||
wiHelper::messageBox(ss.str(), "Error!");
|
||||
Close();
|
||||
}
|
||||
if (version > __archiveVersion)
|
||||
{
|
||||
stringstream ss("");
|
||||
ss << "The archive version (" << version << ") is higher than the program's ("<<__archiveVersion<<")!";
|
||||
wiHelper::messageBox(ss.str(), "Error!");
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -113,6 +113,10 @@ enum PSTYPES
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_NORMALMAP,
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT,
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_NORMALMAP,
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_PLANARREFLECTION,
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_NORMALMAP_PLANARREFLECTION,
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_PLANARREFLECTION,
|
||||
PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_NORMALMAP_PLANARREFLECTION,
|
||||
PSTYPE_SHADOW,
|
||||
PSTYPE_LINE,
|
||||
PSTYPE_TRAIL,
|
||||
|
||||
@@ -21,7 +21,8 @@ PixelShader *wiImage::pixelShader = nullptr, *wiImage::blurHPS = nullptr, *
|
||||
|
||||
|
||||
RasterizerState *wiImage::rasterizerState = nullptr;
|
||||
DepthStencilState *wiImage::depthStencilStateGreater = nullptr,*wiImage::depthStencilStateLess = nullptr,*wiImage::depthNoStencilState = nullptr;
|
||||
DepthStencilState *wiImage::depthStencilStateGreater = nullptr, *wiImage::depthStencilStateLess = nullptr, *wiImage::depthStencilStateEqual = nullptr
|
||||
,*wiImage::depthNoStencilState = nullptr;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -121,6 +122,11 @@ void wiImage::SetUpStates()
|
||||
depthStencilStateLess = new DepthStencilState;
|
||||
wiRenderer::GetDevice()->CreateDepthStencilState(&dsd, depthStencilStateLess);
|
||||
|
||||
dsd.FrontFace.StencilFunc = COMPARISON_EQUAL;
|
||||
dsd.BackFace.StencilFunc = COMPARISON_EQUAL;
|
||||
depthStencilStateEqual = new DepthStencilState;
|
||||
wiRenderer::GetDevice()->CreateDepthStencilState(&dsd, depthStencilStateEqual);
|
||||
|
||||
|
||||
dsd.DepthEnable = false;
|
||||
dsd.DepthWriteMask = DEPTH_WRITE_MASK_ZERO;
|
||||
@@ -234,14 +240,6 @@ void wiImage::Draw(Texture2D* texture, const wiImageEffects& effects,GRAPHICSTHR
|
||||
else
|
||||
device->BindBlendState(blendState, threadID);
|
||||
|
||||
if (effects.presentFullScreen)
|
||||
{
|
||||
device->BindVS(screenVS, threadID);
|
||||
device->BindPS(screenPS, threadID);
|
||||
device->Draw(3, threadID);
|
||||
device->EventEnd(threadID);
|
||||
return;
|
||||
}
|
||||
|
||||
ImageCB cb;
|
||||
PostProcessCB prcb;
|
||||
@@ -249,17 +247,31 @@ void wiImage::Draw(Texture2D* texture, const wiImageEffects& effects,GRAPHICSTHR
|
||||
switch (effects.stencilComp)
|
||||
{
|
||||
case COMPARISON_LESS:
|
||||
case COMPARISON_LESS_EQUAL:
|
||||
device->BindDepthStencilState(depthStencilStateLess, effects.stencilRef, threadID);
|
||||
break;
|
||||
case COMPARISON_GREATER:
|
||||
case COMPARISON_GREATER_EQUAL:
|
||||
device->BindDepthStencilState(depthStencilStateGreater, effects.stencilRef, threadID);
|
||||
break;
|
||||
case COMPARISON_EQUAL:
|
||||
device->BindDepthStencilState(depthStencilStateEqual, effects.stencilRef, threadID);
|
||||
break;
|
||||
default:
|
||||
device->BindDepthStencilState(depthNoStencilState, effects.stencilRef, threadID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (effects.presentFullScreen)
|
||||
{
|
||||
device->BindVS(screenVS, threadID);
|
||||
device->BindPS(screenPS, threadID);
|
||||
device->Draw(3, threadID);
|
||||
device->EventEnd(threadID);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!effects.blur)
|
||||
{
|
||||
if(!effects.process.active && !effects.bloom.separate && !effects.sunPos.x && !effects.sunPos.y){
|
||||
@@ -491,6 +503,7 @@ void wiImage::CleanUp()
|
||||
SAFE_DELETE(rasterizerState);
|
||||
SAFE_DELETE(depthStencilStateGreater);
|
||||
SAFE_DELETE(depthStencilStateLess);
|
||||
SAFE_DELETE(depthStencilStateEqual);
|
||||
SAFE_DELETE(depthNoStencilState);
|
||||
|
||||
SAFE_DELETE(vertexShader);
|
||||
|
||||
@@ -51,7 +51,7 @@ protected:
|
||||
|
||||
|
||||
static wiGraphicsTypes::RasterizerState *rasterizerState;
|
||||
static wiGraphicsTypes::DepthStencilState *depthStencilStateGreater,*depthStencilStateLess,*depthNoStencilState;
|
||||
static wiGraphicsTypes::DepthStencilState *depthStencilStateGreater, *depthStencilStateLess, *depthStencilStateEqual,*depthNoStencilState;
|
||||
|
||||
public:
|
||||
static void LoadShaders();
|
||||
|
||||
@@ -1470,6 +1470,10 @@ void Material::Serialize(wiArchive& archive)
|
||||
archive >> refractionIndex;
|
||||
archive >> subsurfaceScattering;
|
||||
archive >> normalMapStrength;
|
||||
if (archive.GetVersion() >= 2)
|
||||
{
|
||||
archive >> planar_reflections;
|
||||
}
|
||||
|
||||
if (!refMapName.empty())
|
||||
{
|
||||
@@ -1516,6 +1520,10 @@ void Material::Serialize(wiArchive& archive)
|
||||
archive << refractionIndex;
|
||||
archive << subsurfaceScattering;
|
||||
archive << normalMapStrength;
|
||||
if (archive.GetVersion() >= 2)
|
||||
{
|
||||
archive << planar_reflections;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@@ -149,6 +149,8 @@ struct Material
|
||||
float subsurfaceScattering;
|
||||
float normalMapStrength;
|
||||
|
||||
bool planar_reflections;
|
||||
|
||||
|
||||
Material()
|
||||
{
|
||||
@@ -201,10 +203,13 @@ struct Material
|
||||
subsurfaceScattering = 0.0f;
|
||||
emissive = 0.0f;
|
||||
normalMapStrength = 1.0f;
|
||||
|
||||
planar_reflections = false;
|
||||
}
|
||||
|
||||
bool IsTransparent() { return alpha < 1.0f; }
|
||||
bool IsWater() { return water; }
|
||||
bool HasPlanarReflection() { return planar_reflections; }
|
||||
RENDERTYPE GetRenderType()
|
||||
{
|
||||
if (IsWater())
|
||||
@@ -924,6 +929,11 @@ struct Camera:public Transform{
|
||||
XMStoreFloat3(&this->Up, Up);
|
||||
|
||||
frustum.ConstructFrustum(zFarP, Projection, this->View);
|
||||
|
||||
XMMATRIX VP = XMMatrixMultiply(View, GetProjection());
|
||||
XMStoreFloat4x4(&this->VP, VP);
|
||||
XMStoreFloat4x4(&InvView, XMMatrixInverse(nullptr, View));
|
||||
XMStoreFloat4x4(&InvVP, XMMatrixInverse(nullptr, VP));
|
||||
}
|
||||
void UpdateProjection()
|
||||
{
|
||||
|
||||
@@ -653,6 +653,10 @@ void wiRenderer::LoadBasicShaders()
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_NORMALMAP] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_normalmap.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_transparent.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_NORMALMAP] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_transparent_normalmap.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_PLANARREFLECTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_planarreflection.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_NORMALMAP_PLANARREFLECTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_normalmap_planarreflection.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_PLANARREFLECTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_transparent_planarreflection.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_NORMALMAP_PLANARREFLECTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_forward_dirlight_transparent_normalmap_planarreflection.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_SIMPLEST] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_BLACKOUT] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_blackout.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShaders[PSTYPE_TEXTUREONLY] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(SHADERPATH + "objectPS_textureonly.cso", wiResourceManager::PIXELSHADER));
|
||||
@@ -2002,8 +2006,8 @@ void wiRenderer::DrawLights(Camera* camera, GRAPHICSTHREAD threadID)
|
||||
GetDevice()->BindPrimitiveTopology(TRIANGLELIST,threadID);
|
||||
|
||||
|
||||
GetDevice()->BindBlendState(blendStates[BSTYPE_ADDITIVE],threadID);
|
||||
GetDevice()->BindRasterizerState(rasterizers[RSTYPE_BACK],threadID);
|
||||
GetDevice()->BindBlendState(blendStates[BSTYPE_ADDITIVE], threadID);
|
||||
|
||||
GetDevice()->BindVertexLayout(nullptr, threadID);
|
||||
GetDevice()->BindVertexBuffer(nullptr, 0, 0, threadID);
|
||||
@@ -2866,10 +2870,18 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, GRAPHICSTHRE
|
||||
if (subset.material->GetNormalMap() == nullptr)
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT;
|
||||
if (subset.material->HasPlanarReflection())
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_PLANARREFLECTION;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_NORMALMAP;
|
||||
if (subset.material->HasPlanarReflection())
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_NORMALMAP_PLANARREFLECTION;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -3030,10 +3042,18 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, Texture2D* refracRes, Text
|
||||
if (subset.material->GetNormalMap() == nullptr)
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT;
|
||||
if (subset.material->HasPlanarReflection())
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_PLANARREFLECTION;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_NORMALMAP;
|
||||
if (subset.material->HasPlanarReflection())
|
||||
{
|
||||
realPS = PSTYPE_OBJECT_FORWARD_DIRLIGHT_TRANSPARENT_NORMALMAP_PLANARREFLECTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3205,7 +3225,7 @@ void wiRenderer::UpdateCameraCB(GRAPHICSTHREAD threadID)
|
||||
cb.mPrevP = XMMatrixTranspose(prevCam->GetProjection());
|
||||
cb.mPrevVP = XMMatrixTranspose(prevCam->GetViewProjection());
|
||||
cb.mReflVP = XMMatrixTranspose(reflCam->GetViewProjection());
|
||||
cb.mInvP = XMMatrixInverse(nullptr, cb.mVP);
|
||||
cb.mInvVP = XMMatrixTranspose(camera->GetInvViewProjection());
|
||||
cb.mCamPos = camera->translation;
|
||||
cb.mAt = camera->At;
|
||||
cb.mUp = camera->Up;
|
||||
|
||||
@@ -122,7 +122,7 @@ protected:
|
||||
XMMATRIX mPrevP;
|
||||
XMMATRIX mPrevVP;
|
||||
XMMATRIX mReflVP;
|
||||
XMMATRIX mInvP;
|
||||
XMMATRIX mInvVP;
|
||||
XMFLOAT3 mCamPos; float pad0;
|
||||
XMFLOAT3 mAt; float pad1;
|
||||
XMFLOAT3 mUp; float pad2;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace wiVersion
|
||||
// minor features, major bug fixes
|
||||
const int minor = 8;
|
||||
// minor bug fixes, alterations, refactors
|
||||
const int revision = 22;
|
||||
const int revision = 24;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user