From bfa54b9ccd8fe8380aaf9d44e51096eb8dd4edb0 Mon Sep 17 00:00:00 2001 From: lanariel Date: Wed, 5 Feb 2014 17:13:23 +0100 Subject: [PATCH] Fixed Anim --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 2 ++ Code/OysterGraphics/FileLoader/DanLoader.cpp | 4 +++- .../Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl | 2 +- Code/Tester/MainTest.cpp | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 66476a89..b6c1b521 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -111,6 +111,8 @@ namespace Oyster void API::Clean() { + DeleteModel(Render::Rendering::Basic::cube); + DeleteModel(Render::Rendering::Basic::cube2); SAFE_DELETE(Core::viewPort); Core::loader.Clean(); Oyster::Graphics::Core::PipelineManager::Clean(); diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index 0dd76a06..446a7ba2 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -135,7 +135,6 @@ void Oyster::Graphics::Loading::UnloadDAN(void* data) if(info->Animated) { //clean animation - delete[] info->bones; for(int a = 0; a < info->AnimationCount; ++a) { for(int x = 0; x < info->Animations[a].Bones; ++x) @@ -151,6 +150,8 @@ void Oyster::Graphics::Loading::UnloadDAN(void* data) { Core::loader.ReleaseResource(info->Material[i]); } + if(info->BoneCount>0) + delete[] info->bones; delete info; } @@ -179,6 +180,7 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[]) Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo(); modelInfo->Indexed = false; modelInfo->Animated = false; + modelInfo->BoneCount = 0; // Open file in binary mode std::ifstream danFile; danFile.open(filename, std::ios::binary); diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index ca0f31fb..19ce9377 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -14,7 +14,7 @@ VertexOut main( VertexIn input ) AnimatedData[input.boneIndex.z]*input.boneWeight.z + AnimatedData[input.boneIndex.w]*input.boneWeight.w; - input.pos = mul(boneTrans,input.pos) * Animated + input.pos * int(1-Animated); + input.pos = mul(boneTrans,float4(input.pos,1)) * Animated + input.pos * int(1-Animated); input.normal = mul(boneTrans,input.normal) * Animated + input.normal * int(1-Animated); /*input.pos = diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 31a2c8fc..988a75c9 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -162,7 +162,7 @@ HRESULT InitDirect3D() } m = Oyster::Graphics::API::CreateModel(L"untitled.dan"); - m2 = Oyster::Graphics::API::CreateModel(L"rigidbind_animtest_arms_bindpose (1).dan"); + m2 = Oyster::Graphics::API::CreateModel(L"still.dan"); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null); m2->AnimationPlaying = 0; m2->AnimationTime = 0.0f; @@ -200,7 +200,7 @@ HRESULT Update(float deltaTime) //ma *= 50; //ma.m44 = 1; //m2->WorldMatrix = m2->WorldMatrix * ma; - //m2->AnimationTime += deltaTime * 0.5f; + m2->AnimationTime += deltaTime;// * 0.5f; //m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-0,Oyster::Math::Float3(3,4,-1*angle),Oyster::Math::Float3::null); return S_OK; }