Merge branch 'master' into chamfernormals

This commit is contained in:
Turanszki Janos
2021-07-05 12:17:52 +02:00
5 changed files with 58 additions and 44 deletions
+28 -28
View File
@@ -138,6 +138,34 @@ Character = {
if( input.Press(string.byte('J')) or input.Press(KEYBOARD_BUTTON_SPACE) or input.Press(GAMEPAD_BUTTON_2) ) then
self:Jump(2000)
end
-- state and animation update
if(self.state == self.states.STAND) then
scene.Component_GetAnimation(self.walk_anim).Stop()
local anim = scene.Component_GetAnimation(self.idle_anim)
anim.Play()
anim.SetAmount(math.lerp(anim.GetAmount(), 1, 0.1))
if(self.state ~= self.state_prev) then
anim.SetAmount(0)
end
elseif(self.state == self.states.WALK) then
scene.Component_GetAnimation(self.idle_anim).Stop()
local anim = scene.Component_GetAnimation(self.walk_anim)
anim.Play()
anim.SetAmount(math.lerp(anim.GetAmount(), 1, 0.1))
if(self.state ~= self.state_prev) then
anim.SetAmount(0)
end
elseif(self.state == self.states.JUMP) then
scene.Component_GetAnimation(self.walk_anim).Stop()
local anim = scene.Component_GetAnimation(self.idle_anim)
anim.Play()
anim.SetAmount(math.lerp(anim.GetAmount(), 1, 0.1))
if(self.state ~= self.state_prev) then
anim.SetAmount(0)
end
end
self.state_prev = self.state
-- Camera target control:
@@ -168,34 +196,6 @@ Character = {
local model_transform = scene.Component_GetTransform(self.model)
local target_transform = scene.Component_GetTransform(self.target)
-- state and animation update
if(self.state == self.states.STAND) then
scene.Component_GetAnimation(self.walk_anim).Stop()
local anim = scene.Component_GetAnimation(self.idle_anim)
anim.Play()
anim.SetAmount(math.lerp(anim.GetAmount(), 1, 0.1))
if(self.state ~= self.state_prev) then
anim.SetAmount(0)
end
elseif(self.state == self.states.WALK) then
scene.Component_GetAnimation(self.idle_anim).Stop()
local anim = scene.Component_GetAnimation(self.walk_anim)
anim.Play()
anim.SetAmount(math.lerp(anim.GetAmount(), 1, 0.1))
if(self.state ~= self.state_prev) then
anim.SetAmount(0)
end
elseif(self.state == self.states.JUMP) then
scene.Component_GetAnimation(self.walk_anim).Stop()
local anim = scene.Component_GetAnimation(self.idle_anim)
anim.Play()
anim.SetAmount(math.lerp(anim.GetAmount(), 1, 0.1))
if(self.state ~= self.state_prev) then
anim.SetAmount(0)
end
end
self.state_prev = self.state
-- apply force:
self.velocity = vector.Add(self.velocity, vector.Multiply(self.force, 0.016))
self.force = Vector(0,0,0,0)
+1 -1
View File
@@ -87,7 +87,7 @@ inline float4 blue_noise(uint2 pixel)
}
inline float4 blue_noise(uint2 pixel, float depth)
{
return frac(texture_bluenoise[pixel % 128].rgba + g_xFrame_BlueNoisePhase * depth);
return frac(texture_bluenoise[pixel % 128].rgba + g_xFrame_BlueNoisePhase + depth);
}
// Helpers:
+12
View File
@@ -19,12 +19,24 @@ GBuffer main(VertexToPixel input)
V /= dist;
float emissive = 0;
const uint2 pixel = input.pos.xy;
const float2 ScreenCoord = pixel * g_xFrame_InternalResolution_rcp;
Surface surface;
surface.create(g_xMaterial, color, 0);
surface.P = input.pos3D;
surface.N = input.nor;
surface.V = V;
surface.pixel = input.pos.xy;
#ifndef PREPASS
#ifndef ENVMAPRENDERING
#ifndef TRANSPARENT
surface.occlusion *= texture_ao.SampleLevel(sampler_linear_clamp, ScreenCoord, 0).r;
#endif // TRANSPARENT
#endif // ENVMAPRENDERING
#endif // PREPASS
surface.update();
Lighting lighting;
+16 -14
View File
@@ -517,20 +517,6 @@ struct VertexSurface
tangent.xyz = normalize(mul((float3x3)WORLD, tangent.xyz));
#endif // OBJECTSHADER_INPUT_TAN
#ifdef OBJECTSHADER_USE_WIND
if (material.IsUsingWind())
{
const float windweight = input.GetWindWeight();
const float waveoffset = dot(position.xyz, g_xFrame_WindDirection) * g_xFrame_WindWaveSize + (position.x + position.y + position.z) * g_xFrame_WindRandomness;
const float waveoffsetPrev = dot(positionPrev.xyz, g_xFrame_WindDirection) * g_xFrame_WindWaveSize + (positionPrev.x + positionPrev.y + positionPrev.z) * g_xFrame_WindRandomness;
const float3 wavedir = g_xFrame_WindDirection * windweight;
const float3 wind = sin(g_xFrame_Time * g_xFrame_WindSpeed + waveoffset) * wavedir;
const float3 windPrev = sin(g_xFrame_TimePrev * g_xFrame_WindSpeed + waveoffsetPrev) * wavedir;
position.xyz += wind;
positionPrev.xyz += windPrev;
}
#endif // OBJECTSHADER_USE_WIND
#ifdef OBJECTSHADER_INPUT_TEX
uvsets = float4(input.GetUV0() * material.texMulAdd.xy + material.texMulAdd.zw, input.GetUV1());
#endif // OBJECTSHADER_INPUT_TEX
@@ -547,6 +533,20 @@ struct VertexSurface
#else
positionPrev = position;
#endif // OBJECTSHADER_INPUT_PRE
#ifdef OBJECTSHADER_USE_WIND
if (material.IsUsingWind())
{
const float windweight = input.GetWindWeight();
const float waveoffset = dot(position.xyz, g_xFrame_WindDirection) * g_xFrame_WindWaveSize + (position.x + position.y + position.z) * g_xFrame_WindRandomness;
const float waveoffsetPrev = dot(positionPrev.xyz, g_xFrame_WindDirection) * g_xFrame_WindWaveSize + (positionPrev.x + positionPrev.y + positionPrev.z) * g_xFrame_WindRandomness;
const float3 wavedir = g_xFrame_WindDirection * windweight;
const float3 wind = sin(g_xFrame_Time * g_xFrame_WindSpeed + waveoffset) * wavedir;
const float3 windPrev = sin(g_xFrame_TimePrev * g_xFrame_WindSpeed + waveoffsetPrev) * wavedir;
position.xyz += wind;
positionPrev.xyz += windPrev;
}
#endif // OBJECTSHADER_USE_WIND
}
};
@@ -1371,10 +1371,12 @@ float4 main(PixelInput input, in bool is_frontface : SV_IsFrontFace) : SV_TARGET
#ifndef DISABLE_ALPHATEST
float alphatest = GetMaterial().alphaTest;
#ifndef TRANSPARENT
if (g_xFrame_Options & OPTION_BIT_TEMPORALAA_ENABLED)
{
alphatest = clamp(blue_noise(pixel, lineardepth).r, 0, 0.99);
}
#endif // TRANSPARENT
clip(color.a - alphatest);
#endif // DISABLE_ALPHATEST
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates, breaking compatibility changes
const int minor = 56;
// minor bug fixes, alterations, refactors, updates
const int revision = 58;
const int revision = 60;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);