From 99a605a25bca8b27e5632afb643253bfc0008353 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 28 Jan 2014 13:48:15 +0100 Subject: [PATCH] Iterpolated Animations --- Code/OysterGraphics/FileLoader/DanLoader.cpp | 2 + .../Render/Rendering/BasicRender.cpp | 3 +- .../HLSL/Deffered Shaders/LightCalc.hlsli | 4 +- .../HLSL/Deffered Shaders/LightPass.hlsl | 6 +- .../Shader/HLSL/Deffered Shaders/SSAO.hlsli | 2 +- Code/Tester/Tester.vcxproj | 99 +++++++++++++++++++ Code/Tester/Tester.vcxproj.user | 16 +++ 7 files changed, 125 insertions(+), 7 deletions(-) diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index 84676e5b..4cff47ed 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -349,6 +349,8 @@ void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resour anims[a].name = std::wstring(wName); delete[] wName; + //read duration + //read nr of bones in animation ReadData(&anims[a].Bones,danFile,4); diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index c1ab6024..bfcf231b 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -107,7 +107,8 @@ namespace Oyster float interpoation =(models[i].AnimationTime - Prev.time) / (Next.time - Prev.time); //interpolate - Math::Matrix Interpolated = Prev.bone.Transform; + Math::Matrix Interpolated; + Math3D::InterpolateOrientation_UsingNonRigidNlerp(Prev.bone.Transform,Next.bone.Transform,interpoation, Interpolated); //write magic to animated data am2.animatedData[Prev.bone.Parent] = Interpolated * am2.animatedData[info->bones[Prev.bone.Parent].Parent]; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli index bd449209..8a1ff05a 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli @@ -21,8 +21,8 @@ DiffSpec LightCalc(PointLight pl, float3 pos, int2 texCoord) output.Specular * 0; if(d > pl.Radius) { - output.Diffuse = float4(0,0,0,1); - output.Specular = float4(0,0,0,1); + output.Diffuse = float3(0,0,0); + output.Specular = float3(0,0,0); } return output; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl index f7dbb4a1..483f2889 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl @@ -12,13 +12,13 @@ [numthreads(16, 16, 1)] void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) { - float2 UV = DTid / Pixels; + float2 UV = DTid.xy / Pixels; UV.x = UV.x * 2 - 1; UV.y = 1 - 2 * UV.y; float3 ViewPos = ToVpos(DTid.xy, UV); DiffSpec Shaded; - Shaded.Diffuse = float4(0,0,0,0); - Shaded.Specular = float4(0,0,0,0); + Shaded.Diffuse = float3(0,0,0); + Shaded.Specular = float3(0,0,0); for(int i = 0; i < Lights; ++i) { diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli index d642c0ec..bf71b92b 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli @@ -27,7 +27,7 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) float4 ProjOffset = float4(sampled,1); ProjOffset = mul(Proj, ProjOffset); float4 offset = ProjOffset; - float2 UV = offset; + float2 UV = offset.xy; offset /= offset.w; offset.xyz = offset.xyz * 0.5f + 0.5f; //extra invert y axis, DX11 diff --git a/Code/Tester/Tester.vcxproj b/Code/Tester/Tester.vcxproj index e7621160..64777849 100644 --- a/Code/Tester/Tester.vcxproj +++ b/Code/Tester/Tester.vcxproj @@ -5,10 +5,18 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3} @@ -22,6 +30,12 @@ v110 Unicode + + Application + true + v110 + Unicode + Application false @@ -29,23 +43,84 @@ true Unicode + + Application + false + v110 + true + Unicode + + + + + + + true + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)$(VCInstallDir)include;$(VCInstallDir)atlmfc\include; + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\Bin\Executable\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName)D + + + true + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)$(VCInstallDir)include;$(VCInstallDir)atlmfc\include; + $(SolutionDir)..\Bin\Executable\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName)D + C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) false + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)$(VCInstallDir)include;$(VCInstallDir)atlmfc\include; + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\Bin\Executable\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName) + + + false + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)$(VCInstallDir)include;$(VCInstallDir)atlmfc\include; + $(SolutionDir)..\Bin\Executable\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName) + C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + + + Windows + true + OysterGraphics_$(PlatformShortName)D.dll; + $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) + OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies) + + + + + + + @@ -108,6 +183,30 @@ OysterGraphics_$(PlatformShortName).dll; + + + Level3 + + + MaxSpeed + Disabled + true + false + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies) + $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) + true + OysterGraphics_$(PlatformShortName).dll; + + Level3 diff --git a/Code/Tester/Tester.vcxproj.user b/Code/Tester/Tester.vcxproj.user index 9a0b0ae0..2e28d6f7 100644 --- a/Code/Tester/Tester.vcxproj.user +++ b/Code/Tester/Tester.vcxproj.user @@ -3,4 +3,20 @@ true + + $(OutDir) + WindowsLocalDebugger + + + $(OutDir) + WindowsLocalDebugger + + + $(OutDir) + WindowsLocalDebugger + + + $(OutDir) + WindowsLocalDebugger + \ No newline at end of file