Fixed release compile and basic anim

This commit is contained in:
lanariel 2014-02-10 13:59:45 +01:00
parent d0f36302cf
commit a3ba67e3c2
9 changed files with 48 additions and 49 deletions

View File

@ -153,7 +153,9 @@
<ClCompile Include="Resource\OResource.cpp" /> <ClCompile Include="Resource\OResource.cpp" />
<ClCompile Include="Resource\ResourceManager.cpp"> <ClCompile Include="Resource\ResourceManager.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="Thread\OysterMutex.cpp" /> <ClCompile Include="Thread\OysterMutex.cpp" />
<ClCompile Include="Thread\OysterThread_Impl.cpp" /> <ClCompile Include="Thread\OysterThread_Impl.cpp" />
@ -173,7 +175,9 @@
<ClInclude Include="Resource\OResource.h" /> <ClInclude Include="Resource\OResource.h" />
<ClInclude Include="Resource\ResourceManager.h"> <ClInclude Include="Resource\ResourceManager.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClInclude> </ClInclude>
<ClInclude Include="ThreadSafeQueue.h" /> <ClInclude Include="ThreadSafeQueue.h" />
<ClInclude Include="Thread\IThreadObject.h" /> <ClInclude Include="Thread\IThreadObject.h" />

View File

@ -7,7 +7,8 @@
#include "Dx11Includes.h" #include "Dx11Includes.h"
#include <sstream> #include <sstream>
#include "OysterMath.h" #include "OysterMath.h"
#include "../Misc/Resource/ResourceManager.h" //#include "../Misc/Resource/ResourceManager.h"
#include "../../Misc/Resource/ResourceManager.h"
//#include <vld.h> //#include <vld.h>
namespace Oyster namespace Oyster

View File

@ -18,7 +18,7 @@ namespace Oyster
Math::Float4x4 View; Math::Float4x4 View;
Math::Float4x4 Projection; Math::Float4x4 Projection;
std::vector<Definitions::Pointlight*> Lights; std::vector<Definitions::Pointlight*> Lights;
float dt=0; float deltaTime;
} }
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion) API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion)
@ -61,12 +61,12 @@ namespace Oyster
void API::RenderScene(Model::Model models[], int count) void API::RenderScene(Model::Model models[], int count)
{ {
Render::DefaultRenderer::RenderScene(models,count, View, Projection); Render::DefaultRenderer::RenderScene(models,count, View, Projection, deltaTime);
} }
void API::RenderModel(Model::Model& m) void API::RenderModel(Model::Model* m)
{ {
Render::DefaultRenderer::RenderScene(&m,1, View, Projection); Render::DefaultRenderer::RenderScene(m,1, View, Projection, deltaTime);
} }
void API::EndFrame() void API::EndFrame()
@ -87,7 +87,7 @@ namespace Oyster
Model::Model* m = new Model::Model(); Model::Model* m = new Model::Model();
m->WorldMatrix = Oyster::Math::Float4x4::identity; m->WorldMatrix = Oyster::Math::Float4x4::identity;
m->Visible = true; m->Visible = true;
m->Animation.data.AnimationPlaying = NULL; m->Animation.AnimationPlaying = NULL;
m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN); m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN);
Model::ModelInfo* mi = (Model::ModelInfo*)m->info; Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
@ -177,10 +177,15 @@ namespace Oyster
float API::PlayAnimation(Model::Model* m, std::wstring name,bool looping) float API::PlayAnimation(Model::Model* m, std::wstring name,bool looping)
{ {
m->Animation.data.AnimationPlaying = &(*m->info->Animations.find(name)).second; m->Animation.AnimationPlaying = &(*m->info->Animations.find(name)).second;
m->Animation.data.AnimationTime=0; m->Animation.AnimationTime=0;
m->Animation.data.LoopAnimation = looping; m->Animation.LoopAnimation = looping;
return m->Animation.data.AnimationPlaying->duration; return m->Animation.AnimationPlaying->duration;
}
void API::Update(float dt)
{
deltaTime = dt;
} }
} }
} }

View File

@ -51,7 +51,7 @@ namespace Oyster
//! @brief Renders a list of models //! @brief Renders a list of models
static void RenderScene(Oyster::Graphics::Model::Model models[], int count); static void RenderScene(Oyster::Graphics::Model::Model models[], int count);
//! @brief Renders a single model //! @brief Renders a single model
static void RenderModel(Oyster::Graphics::Model::Model& model); static void RenderModel(Oyster::Graphics::Model::Model* model);
//! @brief Configures Renderer to process 2D graphics, data will be passed in to EndFrame() //! @brief Configures Renderer to process 2D graphics, data will be passed in to EndFrame()
static void StartGuiRender(); static void StartGuiRender();

View File

@ -19,17 +19,12 @@ namespace Oyster
float AnimationTime; float AnimationTime;
bool LoopAnimation; bool LoopAnimation;
}; };
struct AnimationPlayer
{
AnimationData data;
ModelInfo* info;
};
struct Model struct Model
{ {
ModelInfo* info; ModelInfo* info;
Oyster::Math::Float4x4 WorldMatrix; Oyster::Math::Float4x4 WorldMatrix;
bool Visible; bool Visible;
AnimationPlayer Animation; AnimationData Animation;
}; };
} }

View File

@ -78,6 +78,7 @@
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
@ -246,21 +247,21 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">5.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
</FxCompile> </FxCompile>
<FxCompile Include="Shader\Passes\Blur\BlurVert.hlsl"> <FxCompile Include="Shader\Passes\Blur\BlurVert.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">5.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel> <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
</FxCompile> </FxCompile>
<FxCompile Include="Shader\Passes\Post\PostPass.hlsl"> <FxCompile Include="Shader\Passes\Post\PostPass.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType>

View File

@ -49,7 +49,7 @@ namespace Oyster
Resources::Post::Data.Unmap(); Resources::Post::Data.Unmap();
} }
void DefaultRenderer::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection) void DefaultRenderer::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float deltaTime)
{ {
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
{ {
@ -64,8 +64,9 @@ namespace Oyster
Model::ModelInfo* info = models[i].info; Model::ModelInfo* info = models[i].info;
Definitions::AnimationData am; //final Definitions::AnimationData am; //final
if(info->Animated && models[i].Animation.data.AnimationPlaying != NULL) if(info->Animated && models[i].Animation.AnimationPlaying != NULL)
{ {
models[i].Animation.AnimationTime += deltaTime;
cube->WorldMatrix = Math::Matrix::identity; cube->WorldMatrix = Math::Matrix::identity;
////store inverse absolut transform ////store inverse absolut transform
Math::Matrix SkinTransform[100]; Math::Matrix SkinTransform[100];
@ -91,11 +92,11 @@ namespace Oyster
cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3];
} }
int b = 0; int b = 0;
Model::Animation A = *models[i].Animation.data.AnimationPlaying; Model::Animation A = *models[i].Animation.AnimationPlaying;
while(models[i].Animation.data.AnimationTime>A.duration) while(models[i].Animation.AnimationTime>A.duration)
models[i].Animation.data.AnimationTime -= (float)A.duration; models[i].Animation.AnimationTime -= (float)A.duration;
float position = models[i].Animation.data.AnimationTime; float position = models[i].Animation.AnimationTime;
for(int b = 0; b < A.Bones;++b) for(int b = 0; b < A.Bones;++b)
{ {
//find current frame //find current frame

View File

@ -14,7 +14,7 @@ namespace Oyster
{ {
public: public:
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights); static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights);
static void RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection); static void RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float DeltaTime = 0);
static void EndFrame(); static void EndFrame();
static Model::Model* cube; static Model::Model* cube;

View File

@ -168,13 +168,11 @@ HRESULT InitDirect3D()
Oyster::Graphics::API::SetOptions(o); Oyster::Graphics::API::SetOptions(o);
m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan");
m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.dan"); m2 = Oyster::Graphics::API::CreateModel(L"char_bindpose.dan");
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null);
Oyster::Graphics::API::PlayAnimation(m2, L"Bend",true); Oyster::Graphics::API::PlayAnimation(m2, L"Bend",true);
//m3 = Oyster::Graphics::API::CreateModel(L"box_2.dan");
//m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null);
t = Oyster::Graphics::API::CreateTexture(L"white.png"); t = Oyster::Graphics::API::CreateTexture(L"structure_corp_mdg.png");
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000); P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000);
Oyster::Graphics::API::SetProjection(P); Oyster::Graphics::API::SetProjection(P);
@ -198,15 +196,10 @@ float angle = 0;
HRESULT Update(float deltaTime) HRESULT Update(float deltaTime)
{ {
angle += Oyster::Math::pi/16 * deltaTime; angle += Oyster::Math::pi/16 * deltaTime;
//m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-angle,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null);
//m->WorldMatrix = m->WorldMatrix * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); //Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity;
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-Oyster::Math::pi/2,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null); Oyster::Graphics::API::Update(deltaTime);
Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; //m2->Animation.data.AnimationTime += deltaTime;// * 0.5f;
//ma *= 50;
//ma.m44 = 1;
//m2->WorldMatrix = m2->WorldMatrix * ma;
m2->Animation.data.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; return S_OK;
} }
@ -215,10 +208,9 @@ HRESULT Render(float deltaTime)
Oyster::Graphics::API::SetView(V); Oyster::Graphics::API::SetView(V);
Oyster::Graphics::API::NewFrame(); Oyster::Graphics::API::NewFrame();
Oyster::Graphics::API::RenderModel(*m); Oyster::Graphics::API::RenderModel(m);
Oyster::Graphics::API::RenderModel(*m2); Oyster::Graphics::API::RenderModel(m2);
//Oyster::Graphics::API::RenderModel(*m3); Oyster::Graphics::API::StartGuiRender();
//Oyster::Graphics::API::StartGuiRender();
Oyster::Graphics::API::RenderGuiElement(t,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(0.2f,0.2f)); Oyster::Graphics::API::RenderGuiElement(t,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(0.2f,0.2f));
Oyster::Graphics::API::EndFrame(); Oyster::Graphics::API::EndFrame();