Basic Animation (NOT STABLE)

This commit is contained in:
lanariel 2014-01-27 14:24:13 +01:00
parent 6b1dd34a72
commit 15625ac5d2
13 changed files with 179 additions and 124 deletions

View File

@ -41,26 +41,26 @@ Global
Release|x64 = Release|x64 Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.Build.0 = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Win32.ActiveCfg = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Win32.ActiveCfg = Release|Win32
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Win32.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Win32.Build.0 = Release|Win32
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.ActiveCfg = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.ActiveCfg = Release|x64
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.Build.0 = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.Build.0 = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.Build.0 = Release|x64
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Win32.ActiveCfg = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Win32.ActiveCfg = Release|Win32
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Win32.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Win32.Build.0 = Release|Win32
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|x64.ActiveCfg = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|x64.ActiveCfg = Release|x64
@ -113,50 +113,50 @@ Global
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Win32.Build.0 = Release|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Win32.Build.0 = Release|Win32
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.ActiveCfg = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.ActiveCfg = Release|x64
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.Build.0 = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.Build.0 = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.Build.0 = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Win32.ActiveCfg = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Win32.ActiveCfg = Release|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Win32.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Win32.Build.0 = Release|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.ActiveCfg = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.Build.0 = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.Build.0 = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.ActiveCfg = Debug|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.ActiveCfg = Debug|Win32
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.Build.0 = Debug|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.Build.0 = Debug|Win32
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Debug|x64 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Debug|x64 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.Build.0 = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.Build.0 = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Win32.ActiveCfg = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Win32.ActiveCfg = Release|Win32
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Win32.Build.0 = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Win32.Build.0 = Release|Win32
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.ActiveCfg = Release|x64 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.ActiveCfg = Release|x64
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.Build.0 = Release|x64 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.Build.0 = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.Build.0 = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.ActiveCfg = Debug|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.ActiveCfg = Debug|Win32
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.Build.0 = Debug|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.Build.0 = Debug|Win32
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Debug|x64 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Debug|x64 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.Build.0 = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.Build.0 = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|Win32.ActiveCfg = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Win32.ActiveCfg = Release|Win32
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|Win32.Build.0 = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Win32.Build.0 = Release|Win32
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.ActiveCfg = Release|x64 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.ActiveCfg = Release|x64
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.Build.0 = Release|x64 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.Build.0 = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.ActiveCfg = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.ActiveCfg = Debug|Win32
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.Build.0 = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.Build.0 = Debug|Win32
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Debug|x64 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Debug|x64 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.Build.0 = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.Build.0 = Release|x64
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Win32.ActiveCfg = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Win32.ActiveCfg = Release|Win32
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Win32.Build.0 = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Win32.Build.0 = Release|Win32
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|x64.ActiveCfg = Release|x64 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|x64.ActiveCfg = Release|x64
@ -183,16 +183,18 @@ Global
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.ActiveCfg = Release|Win32 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.ActiveCfg = Release|Win32
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.Build.0 = Release|Win32 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.Build.0 = Release|Win32
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|x64.ActiveCfg = Release|Win32 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|x64.ActiveCfg = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.Build.0 = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.ActiveCfg = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.ActiveCfg = Debug|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.Build.0 = Debug|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.Build.0 = Debug|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.ActiveCfg = Debug|x64 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.ActiveCfg = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.Build.0 = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.Build.0 = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.Build.0 = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.Build.0 = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.Build.0 = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|Win32
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.Build.0 = Release|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32

View File

@ -14,12 +14,6 @@ namespace Oyster
Oyster::Math::Float3 normal; Oyster::Math::Float3 normal;
}; };
struct VP
{
Oyster::Math::Matrix V;
Oyster::Math::Matrix P;
};
struct PerModel struct PerModel
{ {
Math::Matrix WV; Math::Matrix WV;
@ -55,6 +49,13 @@ namespace Oyster
float Bright; float Bright;
}; };
struct AnimationData
{
int Animated;
Math::Float3 Pad;
Math::Matrix animatedData[10];
};
} }
} }
} }

View File

@ -82,8 +82,9 @@ 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->AnimationPlaying = -1;
m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadDAN); m->info = (Model::ModelInfo*)Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadDAN);
Model::ModelInfo* mi = (Model::ModelInfo*)m->info; Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
if(mi->Vertices->GetBufferPointer() == NULL) if(mi->Vertices->GetBufferPointer() == NULL)

View File

@ -163,6 +163,7 @@ void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resour
// //
Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo(); Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo();
modelInfo->Indexed = false; modelInfo->Indexed = false;
modelInfo->Animated = false;
// Open file in binary mode // Open file in binary mode
std::ifstream danFile; std::ifstream danFile;
danFile.open(filename, std::ios::binary); danFile.open(filename, std::ios::binary);
@ -309,39 +310,16 @@ void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resour
delete[] buffer; // ( note: may crash here.) delete[] buffer; // ( note: may crash here.)
//array for bone data //array for bone data
Oyster::Math::Matrix* bones = new Oyster::Math::Matrix[skeletonHeader.numBones*2]; Oyster::Graphics::Model::Bone* bones = new Oyster::Graphics::Model::Bone[skeletonHeader.numBones];
//read bones //read bones
ReadData(bones,danFile,skeletonHeader.numBones * 2 * sizeof(Oyster::Math::Matrix)); ReadData(bones,danFile,skeletonHeader.numBones * sizeof(Oyster::Graphics::Model::Bone));
//init Graphics data
Oyster::Graphics::Core::Buffer* skeleton = new Oyster::Graphics::Core::Buffer();
Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC initDesc;
initDesc.ElementSize = sizeof(Oyster::Math::Matrix);
initDesc.InitData = bones;
initDesc.NumElements = skeletonHeader.numBones * 2;
initDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::CONSTANT_BUFFER_VS;
initDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_USAGE_IMMUTABLE;
skeleton->Init(initDesc);
modelInfo->Skeleton = skeleton;
//read skeleton Hiarchy //read skeleton Hiarchy
int* parents = new int[skeletonHeader.numBones];
ReadData(parents,danFile,skeletonHeader.numBones * sizeof(int));
//store hiarchy
Oyster::Graphics::Model::Bone* Bones = new Oyster::Graphics::Model::Bone[skeletonHeader.numBones];
for(int i = 0; i < skeletonHeader.numBones; ++i)
{
Bones[i].Parent = parents[i];
Bones[i].Transform = bones[i];
}
modelInfo->BoneCount = skeletonHeader.numBones; modelInfo->BoneCount = skeletonHeader.numBones;
modelInfo->bones = Bones; modelInfo->bones = bones;
break; break;
} }
@ -371,41 +349,44 @@ void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resour
anims[a].name = std::wstring(wName); anims[a].name = std::wstring(wName);
delete[] wName; delete[] wName;
Oyster::Graphics::Model::Animation A = anims[a];
//read nr of bones in animation //read nr of bones in animation
ReadData(&A.Bones,danFile,4); ReadData(&anims[a].Bones,danFile,4);
//create Frame array and Bone part of KeyFrameArray; //create Frame array and Bone part of KeyFrameArray;
A.Frames = new int[A.Bones]; anims[a].Frames = new int[anims[a].Bones];
A.Keyframes = new Oyster::Graphics::Model::Frame*[A.Bones]; anims[a].Keyframes = new Oyster::Graphics::Model::Frame*[anims[a].Bones];
//loop per bone and gather data //loop per bone and gather data
for(int b = 0; b < A.Bones; ++b) for(int b = 0; b < anims[a].Bones; ++b)
{ {
//read nr of frames per bone
ReadData(&A.Frames[b],danFile,4);
//create frame matrix
A.Keyframes[b] = new Oyster::Graphics::Model::Frame[A.Frames[b]];
//read bone index //read bone index
int boneIndex; int boneIndex;
ReadData(&boneIndex,danFile,4); ReadData(&boneIndex,danFile,4);
for(int f = 0; f < A.Frames[b]; ++f) //read nr of frames per bone
ReadData(&anims[a].Frames[b],danFile,4);
//create frame matrix
anims[a].Keyframes[b] = new Oyster::Graphics::Model::Frame[anims[a].Frames[b]];
for(int f = 0; f < anims[a].Frames[b]; ++f)
{ {
//write index of bone //write index of bone
A.Keyframes[b][f].bone.Parent = boneIndex; anims[a].Keyframes[b][f].bone.Parent = boneIndex;
//read bone transform //read bone transform
ReadData(&A.Keyframes[b][f].bone.Transform,danFile,sizeof(Oyster::Math::Matrix)); ReadData(&anims[a].Keyframes[b][f].bone.Transform,danFile,sizeof(Oyster::Math::Matrix));
ReadData(&A.Keyframes[b][f].time,danFile,sizeof(double)); ReadData(&anims[a].Keyframes[b][f].time,danFile,sizeof(double));
} }
} }
} }
modelInfo->AnimationCount = animationHeader.numAnims;
modelInfo->Animations = anims;
modelInfo->Animated = true;
break; break;
} }

View File

@ -9,12 +9,14 @@ namespace Oyster
{ {
namespace Model namespace Model
{ {
struct ModelInfo;
struct Model struct Model
{ {
//! do not Edit, linked to render data ModelInfo* info;
void* info;
Oyster::Math::Float4x4 WorldMatrix; Oyster::Math::Float4x4 WorldMatrix;
bool Visible; bool Visible, LoopAnimation;
int AnimationPlaying;
float AnimationTime;
}; };
} }

View File

@ -31,8 +31,8 @@ namespace Oyster
struct ModelInfo struct ModelInfo
{ {
std::vector<ID3D11ShaderResourceView*> Material; std::vector<ID3D11ShaderResourceView*> Material;
Core::Buffer *Vertices,*Indecies,*Skeleton; Core::Buffer *Vertices,*Indecies;
bool Indexed; bool Indexed, Animated;
int VertexCount, IndexCount, BoneCount, AnimationCount; int VertexCount, IndexCount, BoneCount, AnimationCount;
Bone* bones; Bone* bones;
Animation* Animations; Animation* Animations;

View File

@ -21,13 +21,7 @@ namespace Oyster
Preparations::Basic::ClearRTV(Resources::Deffered::GBufferRTV,Resources::Deffered::GBufferSize,Math::Float4(0,0,0,1)); Preparations::Basic::ClearRTV(Resources::Deffered::GBufferRTV,Resources::Deffered::GBufferSize,Math::Float4(0,0,0,1));
Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Deffered::GeometryPass); Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Deffered::GeometryPass);
Definitions::VP vp; void* data;
vp.V = View;
vp.P = Projection;
void* data = Resources::Deffered::VPData.Map();
memcpy(data, &vp, sizeof(Definitions::VP));
Resources::Deffered::VPData.Unmap();
Definitions::LightConstants lc; Definitions::LightConstants lc;
lc.InvProj = Projection.GetInverse(); lc.InvProj = Projection.GetInverse();
@ -61,10 +55,73 @@ namespace Oyster
void* data = Resources::Deffered::ModelData.Map(); void* data = Resources::Deffered::ModelData.Map();
memcpy(data,&(pm),sizeof(pm)); memcpy(data,&(pm),sizeof(pm));
Resources::Deffered::ModelData.Unmap(); Resources::Deffered::ModelData.Unmap();
Model::ModelInfo* info = (Model::ModelInfo*)models[i].info; Model::ModelInfo* info = (Model::ModelInfo*)models[i].info;
Definitions::AnimationData am;
if(info->Animated && models[i].AnimationPlaying != -1)
{
Definitions::AnimationData am2;
//write default data
for (int b = 0; b < info->BoneCount; b++)
{
am2.animatedData[b] = info->bones[b].Transform;
}
//loop bones in animation
am.Animated = 1;
for(int x = 0; x < info->Animations[models[i].AnimationPlaying].Bones; ++x)
{
Model::Frame Prev, Next;
//loop frame per bone
for(int y = 0; y < info->Animations[models[i].AnimationPlaying].Frames[x]; ++y)
{
///TODO replace with binary search?
Model::Frame f = info->Animations[models[i].AnimationPlaying].Keyframes[x][y];
//if we hit frame
if(models[i].AnimationTime == f.time)
{
Prev = f;
Next = f;
break;
}
//if time is larger than frame time, store frames
if(models[i].AnimationTime < f.time)
{
Next = f;
Prev = info->Animations[models[i].AnimationPlaying].Keyframes[x][y-1];
break;
}
}
//calculate interpolated bone position
//rebase model time to between prev and next
float interpoation =(models[i].AnimationTime - Prev.time) / (Next.time - Prev.time);
//interpolate
Math::Matrix Interpolated = Prev.bone.Transform;
//write magic to animated data
am2.animatedData[Prev.bone.Parent] = Interpolated * am2.animatedData[info->bones[Prev.bone.Parent].Parent];
//sneaky write do correct data buffer
am.animatedData[x] = am2.animatedData[Prev.bone.Parent].GetInverse() * info->bones[Prev.bone.Parent].Transform;
}
}
else
am.Animated = 0;
data = Resources::Deffered::AnimationData.Map();
memcpy(data,&am,sizeof(Definitions::AnimationData));
Resources::Deffered::AnimationData.Unmap();
if(info->Material.size()) if(info->Material.size())
{ {
Core::deviceContext->PSSetShaderResources(0,(UINT)info->Material.size(),&(info->Material[0])); Core::deviceContext->PSSetShaderResources(0,(UINT)info->Material.size(),&(info->Material[0]));
@ -84,6 +141,8 @@ namespace Oyster
} }
} }
} }
void Basic::EndFrame() void Basic::EndFrame()
{ {
Core::PipelineManager::SetRenderPass(Resources::Deffered::LightPass); Core::PipelineManager::SetRenderPass(Resources::Deffered::LightPass);

View File

@ -34,7 +34,7 @@ namespace Oyster
Shader::RenderPass Deffered::PostPass; Shader::RenderPass Deffered::PostPass;
Buffer Deffered::ModelData = Buffer(); Buffer Deffered::ModelData = Buffer();
Buffer Deffered::VPData = Buffer(); Buffer Deffered::AnimationData = Buffer();
Buffer Deffered::LightConstantsData = Buffer(); Buffer Deffered::LightConstantsData = Buffer();
Buffer Deffered::PointLightsData = Buffer(); Buffer Deffered::PointLightsData = Buffer();
@ -74,8 +74,9 @@ namespace Oyster
ModelData.Init(desc); ModelData.Init(desc);
desc.NumElements = 2; desc.NumElements = 1;
VPData.Init(desc); desc.ElementSize = sizeof(Definitions::AnimationData);
AnimationData.Init(desc);
desc.ElementSize = sizeof(Definitions::LightConstants); desc.ElementSize = sizeof(Definitions::LightConstants);
desc.NumElements = 1; desc.NumElements = 1;
@ -254,7 +255,7 @@ namespace Oyster
Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout); Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout);
GeometryPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; GeometryPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
GeometryPass.CBuffers.Vertex.push_back(VPData); GeometryPass.CBuffers.Vertex.push_back(AnimationData);
GeometryPass.CBuffers.Vertex.push_back(ModelData); GeometryPass.CBuffers.Vertex.push_back(ModelData);
GeometryPass.RenderStates.Rasterizer = rs; GeometryPass.RenderStates.Rasterizer = rs;
GeometryPass.RenderStates.SampleCount = 1; GeometryPass.RenderStates.SampleCount = 1;
@ -296,7 +297,7 @@ namespace Oyster
void Deffered::Clean() void Deffered::Clean()
{ {
Resources::Deffered::ModelData.~Buffer(); Resources::Deffered::ModelData.~Buffer();
Resources::Deffered::VPData.~Buffer(); Resources::Deffered::AnimationData.~Buffer();
Resources::Deffered::LightConstantsData.~Buffer(); Resources::Deffered::LightConstantsData.~Buffer();
Resources::Deffered::PointLightsData.~Buffer(); Resources::Deffered::PointLightsData.~Buffer();
SAFE_RELEASE(Resources::Deffered::PointLightView); SAFE_RELEASE(Resources::Deffered::PointLightView);

View File

@ -36,7 +36,7 @@ namespace Oyster
static Core::Buffer ModelData; static Core::Buffer ModelData;
static Core::Buffer VPData; static Core::Buffer AnimationData;
static Core::Buffer LightConstantsData; static Core::Buffer LightConstantsData;

View File

@ -30,11 +30,11 @@ Texture2D Normal : register(t1);
SamplerState S1 : register(s0); SamplerState S1 : register(s0);
cbuffer PerFrame : register(b0) cbuffer Animation : register(b0)
{ {
matrix View; int Animated;
float4x4 Projection; float3 Pad;
matrix VP; float4x4 BoneAnimation[10];
} }
cbuffer PerModel : register(b1) cbuffer PerModel : register(b1)

View File

@ -3,6 +3,10 @@
VertexOut main( VertexIn input ) VertexOut main( VertexIn input )
{ {
VertexOut output; VertexOut output;
input.pos = mul(BoneAnimation[input.boneIndex.x], input.pos) * Animated + input.pos * int(1-Animated);
//float4x4 m = matrix(float4(1,0,0,0),float4(0,1,0,0), float4(0,0,1,0), float4(0,0,0,1));
//input.pos = mul(BoneAnimation[0], float4(input.pos,1));
//input.pos = mul(m, float4(input.pos,1));
output.pos = mul(WVP, float4(input.pos,1)); output.pos = mul(WVP, float4(input.pos,1));
output.normal = mul(WV, float4(input.normal,0)).xyz; output.normal = mul(WV, float4(input.normal,0)).xyz;
output.UV = input.UV; output.UV = input.UV;

View File

@ -162,8 +162,10 @@ HRESULT InitDirect3D()
m = Oyster::Graphics::API::CreateModel(L"untitled.dan"); m = Oyster::Graphics::API::CreateModel(L"untitled.dan");
m2 = Oyster::Graphics::API::CreateModel(L"knee_noAnimation.dan"); m2 = Oyster::Graphics::API::CreateModel(L"knee_noAnimation.dan");
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null);
m3 = Oyster::Graphics::API::CreateModel(L"box_2.dan"); m2->AnimationPlaying = 0;
m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); m2->AnimationTime = 0.0f;
//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);
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);
@ -189,13 +191,14 @@ HRESULT Update(float deltaTime)
{ {
angle += Oyster::Math::pi/16 * deltaTime; angle += Oyster::Math::pi/16 * deltaTime;
m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2);
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-angle,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-Oyster::Math::pi/4,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null);
//Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity;
//ma *= 5; ma *= 50;
//ma.m44 = 1; ma.m44 = 1;
//m2->WorldMatrix = m2->WorldMatrix *ma; m2->WorldMatrix = m2->WorldMatrix * ma;
m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-0,Oyster::Math::Float3(3,4,-1*angle),Oyster::Math::Float3::null); 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; return S_OK;
} }
@ -204,9 +207,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::RenderModel(*m3);
Oyster::Graphics::API::EndFrame(); Oyster::Graphics::API::EndFrame();

View File

@ -113,7 +113,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>OysterGraphics_x86D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;</DelayLoadDLLs>
</Link> </Link>
<ProjectReference> <ProjectReference>
<LinkLibraryDependencies> <LinkLibraryDependencies>
@ -159,7 +159,7 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding> <PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_x86.dll;</DelayLoadDLLs> <DelayLoadDLLs>OysterGraphics_$(PlatformShortName).dll;</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -182,6 +182,7 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding> <PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName).dll;</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>