From 6b1dd34a72b6a3554509976d6f1a84377e1f915d Mon Sep 17 00:00:00 2001 From: lanariel Date: Wed, 22 Jan 2014 16:31:33 +0100 Subject: [PATCH 01/29] Working SSAO + Read Animated .dan --- Code/OysterGraphics/FileLoader/DanLoader.cpp | 482 +++++++++++------- Code/OysterGraphics/Model/ModelInfo.h | 23 +- .../Render/Rendering/BasicRender.cpp | 2 +- .../Render/Resources/Deffered.cpp | 39 +- .../Render/Resources/Deffered.h | 9 +- .../HLSL/Deffered Shaders/Defines.hlsli | 4 +- .../HLSL/Deffered Shaders/LightPass.hlsl | 6 +- .../HLSL/Deffered Shaders/PostPass.hlsl | 5 +- .../Shader/HLSL/Deffered Shaders/SSAO.hlsli | 21 +- Code/Tester/MainTest.cpp | 24 +- 10 files changed, 387 insertions(+), 228 deletions(-) diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index 73f0c8c8..a0e1e56c 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -102,206 +102,320 @@ struct MaterialHeader /// struct SkeletonHeader { - // do this... + unsigned int numBones; + + /// + SkeletonHeader(char* data) + { + memcpy(&numBones, data, sizeof(unsigned int)); + } }; /// struct AnimationHeader { - // do this... -}; + unsigned int numAnims; -struct Frame -{ - // do this... + + AnimationHeader(char* data) + { + memcpy(&numAnims, data, sizeof(unsigned int)); + } }; /// -void Oyster::Graphics::Loading::UnloadDAN(void* data) -{ - Model::ModelInfo* info = (Model::ModelInfo*) data; - SAFE_DELETE(info->Vertices); - if(info->Indexed) - { - SAFE_DELETE(info->Indecies); - } - for(int i =0;iMaterial.size();++i) - { - Oyster::Resource::OysterResource::ReleaseResource(info->Material[i]); - } - delete info; -} - +void Oyster::Graphics::Loading::UnloadDAN(void* data) +{ + Model::ModelInfo* info = (Model::ModelInfo*) data; + SAFE_DELETE(info->Vertices); + if(info->Indexed) + { + SAFE_DELETE(info->Indecies); + } + for(int i =0;iMaterial.size();++i) + { + Oyster::Resource::OysterResource::ReleaseResource(info->Material[i]); + } + delete info; +} + static wchar_t* charToWChar(const char* text) { - // Convert to a wchar_t* - size_t origsize = strlen(text) + 1; - size_t convertedChars = 0; + // Convert to a wchar_t* + size_t origsize = strlen(text) + 1; + size_t convertedChars = 0; wchar_t* wcstring = new wchar_t[origsize]; - mbstowcs_s(&convertedChars, wcstring, origsize, text, _TRUNCATE); + mbstowcs_s(&convertedChars, wcstring, origsize, text, _TRUNCATE); return wcstring; -} - -/// -void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resource::CustomData& out) -{ - // - Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo(); - modelInfo->Indexed = false; - // Open file in binary mode +} + +static void ReadData(void* Destination, std::ifstream& file, int size) +{ + char* buffer = new char[size]; + file.read(buffer,size); + memcpy(Destination,buffer,size); + delete[] buffer; +} + +/// +void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resource::CustomData& out) +{ + // + Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo(); + modelInfo->Indexed = false; + // Open file in binary mode std::ifstream danFile; - danFile.open(filename, std::ios::binary); - if (!danFile.is_open()) - return; - - // Read file header - char* buffer = new char[sizeof(FileHeader)]; - danFile.read(buffer, sizeof(FileHeader)); - FileHeader fileHeader(buffer); - delete[] buffer; // ( note: may crash here.) - - // If problem with compatability then close file and return from method - if (fileHeader.versionMajor != DANFILEVERSIONMAJOR) - { - danFile.close(); - return; - } - - // Read the .dan-file - while (!danFile.eof()) - { - // read header type - unsigned int headerType; - buffer = new char[4]; - danFile.read(buffer, 4); - memcpy(&headerType, buffer, 4); - //delete[] buffer; // ( note: may crash here.) - - // handle header type - switch ((HeaderType)headerType) - { - // vertex header - case HeaderType::VERTEXHEADER: - { - // Fetch vertex header, number of vertices - buffer = new char[4]; - danFile.read(buffer, 4); - VertexHeader vertexHeader(buffer); - delete[] buffer; // ( note: may crash here.) - - // Fetch all vertices - Vertex* vertices = new Vertex[vertexHeader.numVertices]; - unsigned int bufferSize = VERTEXSIZE * vertexHeader.numVertices; - buffer = new char[bufferSize]; - danFile.read(buffer, bufferSize); - memcpy(vertices, buffer, bufferSize); - delete[] buffer; // ( note: may crash here.) - - // Do the deed - Oyster::Graphics::Core::Buffer* vertexBuffer = new Oyster::Graphics::Core::Buffer(); - Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC bufferInitDesc; - bufferInitDesc.ElementSize = sizeof(Vertex); - bufferInitDesc.InitData = vertices; - bufferInitDesc.NumElements = vertexHeader.numVertices; - bufferInitDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::VERTEX_BUFFER; - bufferInitDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_DEFAULT; - vertexBuffer->Init(bufferInitDesc); - modelInfo->VertexCount = vertexHeader.numVertices; - modelInfo->Vertices = vertexBuffer; - - delete[] vertices; // ( note: may crash here.) - - break; - } - case HeaderType::INDEXHEADER: - { - // Fetch vertex header, number of vertices - buffer = new char[4]; - danFile.read(buffer, 4); - IndexHeader indexHeader(buffer); - delete[] buffer; // ( note: may crash here.) - - // Fetch all indices - unsigned int* indices = new unsigned int[indexHeader.numIndices]; - unsigned int bufferSize = sizeof(unsigned int) * indexHeader.numIndices; - buffer = new char[bufferSize]; - danFile.read(buffer, bufferSize); - memcpy(indices, buffer, bufferSize); - delete[] buffer; // ( note: may crash here.) - - // Do the deed - Oyster::Graphics::Core::Buffer* indexBuffer = new Oyster::Graphics::Core::Buffer(); - Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC bufferInitDesc; - bufferInitDesc.ElementSize = sizeof(unsigned int); - bufferInitDesc.InitData = indices; - bufferInitDesc.NumElements = indexHeader.numIndices; - bufferInitDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::INDEX_BUFFER; - bufferInitDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_DEFAULT; - indexBuffer->Init(bufferInitDesc); - modelInfo->IndexCount = indexHeader.numIndices; - modelInfo->Indecies = indexBuffer; - modelInfo->Indexed = true; - - delete[] indices; // ( note: may crash here.) - - break; - } - // material header - case HeaderType::MATERIALHEADER: - { - // Fetch material header, 2 texture path strings - MaterialHeader materialHeader; - buffer = new char[4]; - danFile.read(buffer, 4); - memcpy(&materialHeader.diffuseMapPathLength, buffer, 4); - delete[] buffer; // ( note: may crash here.) + danFile.open(filename, std::ios::binary); + if (!danFile.is_open()) + return; - buffer = new char[materialHeader.diffuseMapPathLength]; - danFile.read(buffer, materialHeader.diffuseMapPathLength); + // Read file header + char* buffer = new char[sizeof(FileHeader)]; + danFile.read(buffer, sizeof(FileHeader)); + FileHeader fileHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + // If problem with compatability then close file and return from method + if (fileHeader.versionMajor != DANFILEVERSIONMAJOR) + { + danFile.close(); + return; + } + + // Read the .dan-file + while (!danFile.eof()) + { + // read header type + unsigned int headerType; + ReadData(&headerType,danFile,4); + + // handle header type + switch ((HeaderType)headerType) + { + // vertex header + case HeaderType::VERTEXHEADER: + { + // Fetch vertex header, number of vertices + buffer = new char[4]; + danFile.read(buffer, 4); + VertexHeader vertexHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + // Fetch all vertices + unsigned int bufferSize = VERTEXSIZE * vertexHeader.numVertices; + buffer = new char[bufferSize]; + danFile.read(buffer, bufferSize); + + // Do the deed + Oyster::Graphics::Core::Buffer* vertexBuffer = new Oyster::Graphics::Core::Buffer(); + Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC bufferInitDesc; + bufferInitDesc.ElementSize = sizeof(Vertex); + bufferInitDesc.InitData = buffer; + bufferInitDesc.NumElements = vertexHeader.numVertices; + bufferInitDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::VERTEX_BUFFER; + bufferInitDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_DEFAULT; + vertexBuffer->Init(bufferInitDesc); + modelInfo->VertexCount = vertexHeader.numVertices; + modelInfo->Vertices = vertexBuffer; + + + delete[] buffer; // ( note: may crash here.) + + break; + } + case HeaderType::INDEXHEADER: + { + // Fetch vertex header, number of vertices + buffer = new char[4]; + danFile.read(buffer, 4); + IndexHeader indexHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + // Fetch all indices + unsigned int* indices = new unsigned int[indexHeader.numIndices]; + unsigned int bufferSize = sizeof(unsigned int) * indexHeader.numIndices; + + + ReadData(indices,danFile,bufferSize); + + // Do the deed + Oyster::Graphics::Core::Buffer* indexBuffer = new Oyster::Graphics::Core::Buffer(); + Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC bufferInitDesc; + bufferInitDesc.ElementSize = sizeof(unsigned int); + bufferInitDesc.InitData = indices; + bufferInitDesc.NumElements = indexHeader.numIndices; + bufferInitDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::INDEX_BUFFER; + bufferInitDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_DEFAULT; + indexBuffer->Init(bufferInitDesc); + modelInfo->IndexCount = indexHeader.numIndices; + modelInfo->Indecies = indexBuffer; + modelInfo->Indexed = true; + + delete[] indices; // ( note: may crash here.) + + break; + } + // material header + case HeaderType::MATERIALHEADER: + { + // Fetch material header, 2 texture path strings + MaterialHeader materialHeader; + + //read difuse map name length + ReadData(&materialHeader.diffuseMapPathLength,danFile,4); + + //read diffuse map name materialHeader.diffuseMapPath = new char[materialHeader.diffuseMapPathLength+1]; - memcpy(materialHeader.diffuseMapPath, buffer, materialHeader.diffuseMapPathLength); - materialHeader.diffuseMapPath[materialHeader.diffuseMapPathLength] = 0; - delete[] buffer; // ( note: may crash here.) - - buffer = new char[4]; - danFile.read(buffer, 4); - memcpy(&materialHeader.normalMapPathLength, buffer, 4); - delete[] buffer; // ( note: may crash here.) + ReadData(materialHeader.diffuseMapPath,danFile,materialHeader.diffuseMapPathLength); + //null terminate + materialHeader.diffuseMapPath[materialHeader.diffuseMapPathLength] = 0; + + //read normal map name length + ReadData(&materialHeader.normalMapPathLength,danFile,4); - buffer = new char[materialHeader.normalMapPathLength]; - danFile.read(buffer, materialHeader.normalMapPathLength); + //read difuse map name materialHeader.normalMapPath = new char[materialHeader.normalMapPathLength + 1]; - memcpy(materialHeader.normalMapPath, buffer, materialHeader.normalMapPathLength); - materialHeader.normalMapPath[materialHeader.normalMapPathLength] = 0; - delete[] buffer; // ( note: may crash here.) - - // - ID3D11ShaderResourceView* diffuseMap = (ID3D11ShaderResourceView*)Oyster::Resource::OysterResource::LoadResource(charToWChar(materialHeader.diffuseMapPath), Oyster::Graphics::Loading::LoadTexture); - ID3D11ShaderResourceView* normalMap = (ID3D11ShaderResourceView*)Oyster::Resource::OysterResource::LoadResource(charToWChar(materialHeader.normalMapPath), Oyster::Graphics::Loading::LoadTexture); - modelInfo->Material.push_back(diffuseMap); - modelInfo->Material.push_back(normalMap); - - break; - } - // skeleton header - case HeaderType::SKELETONHEADER: - { - // not implemented... - break; - } - // animation header - case HeaderType::ANIMATIONHEADER: - { - // not implemented... - break; - } - } - } - - // close file - danFile.close(); - - // Set modelinfo as output data - out.loadedData = modelInfo; - out.resourceUnloadFnc = Oyster::Graphics::Loading::UnloadDAN; + ReadData(materialHeader.normalMapPath,danFile,materialHeader.normalMapPathLength); + materialHeader.normalMapPath[materialHeader.normalMapPathLength] = 0; + + //load diffuse map + wchar_t* path = charToWChar(materialHeader.diffuseMapPath); + ID3D11ShaderResourceView* diffuseMap = (ID3D11ShaderResourceView*)Oyster::Resource::OysterResource::LoadResource(path, Oyster::Graphics::Loading::LoadTexture); + delete[] path; + + //load normal map + path = charToWChar(materialHeader.normalMapPath); + ID3D11ShaderResourceView* normalMap = (ID3D11ShaderResourceView*)Oyster::Resource::OysterResource::LoadResource(path, Oyster::Graphics::Loading::LoadTexture); + delete[] path; + + //add to model + modelInfo->Material.push_back(diffuseMap); + modelInfo->Material.push_back(normalMap); + + //clean up + delete[] materialHeader.diffuseMapPath; + delete[] materialHeader.normalMapPath; + + break; + } + + // skeleton header + case HeaderType::SKELETONHEADER: + { + // Fetch Skeleton header, number of Bones + buffer = new char[4]; + danFile.read(buffer, 4); + SkeletonHeader skeletonHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + //array for bone data + Oyster::Math::Matrix* bones = new Oyster::Math::Matrix[skeletonHeader.numBones*2]; + + //read bones + ReadData(bones,danFile,skeletonHeader.numBones * 2 * sizeof(Oyster::Math::Matrix)); + + //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 + + 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->bones = Bones; + + break; + } + // animation header + case HeaderType::ANIMATIONHEADER: + { + //get num anims + buffer = new char[4]; + danFile.read(buffer, 4); + AnimationHeader animationHeader(buffer); + delete[] buffer; + + Oyster::Graphics::Model::Animation* anims = new Oyster::Graphics::Model::Animation[animationHeader.numAnims]; + for(int a = 0; a < animationHeader.numAnims; ++a) + { + //read name of animation + int nameLength; + + + ReadData(&nameLength,danFile,4); + + char* name = new char[nameLength + 1]; + ReadData(name,danFile,nameLength); + name[nameLength] = 0; + + wchar_t* wName = charToWChar(name); + anims[a].name = std::wstring(wName); + delete[] wName; + + Oyster::Graphics::Model::Animation A = anims[a]; + + //read nr of bones in animation + ReadData(&A.Bones,danFile,4); + + //create Frame array and Bone part of KeyFrameArray; + A.Frames = new int[A.Bones]; + A.Keyframes = new Oyster::Graphics::Model::Frame*[A.Bones]; + + //loop per bone and gather data + for(int b = 0; b < 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 + int boneIndex; + ReadData(&boneIndex,danFile,4); + + for(int f = 0; f < A.Frames[b]; ++f) + { + //write index of bone + A.Keyframes[b][f].bone.Parent = boneIndex; + + //read bone transform + ReadData(&A.Keyframes[b][f].bone.Transform,danFile,sizeof(Oyster::Math::Matrix)); + + + ReadData(&A.Keyframes[b][f].time,danFile,sizeof(double)); + } + } + } + + break; + } + } + } + + // close file + danFile.close(); + + // Set modelinfo as output data + out.loadedData = modelInfo; + out.resourceUnloadFnc = Oyster::Graphics::Loading::UnloadDAN; } \ No newline at end of file diff --git a/Code/OysterGraphics/Model/ModelInfo.h b/Code/OysterGraphics/Model/ModelInfo.h index 9dcef562..9afa9e21 100644 --- a/Code/OysterGraphics/Model/ModelInfo.h +++ b/Code/OysterGraphics/Model/ModelInfo.h @@ -11,12 +11,31 @@ namespace Oyster { namespace Model { + struct Bone + { + Math::Float4x4 Transform; + int Parent; + }; + struct Frame + { + Bone bone; + double time; + }; + struct Animation + { + std::wstring name; + int Bones; + int* Frames; //! Bone as index + Frame** Keyframes; //! @brief [Bone][Frame] + }; struct ModelInfo { std::vector Material; - Core::Buffer *Vertices,*Indecies; + Core::Buffer *Vertices,*Indecies,*Skeleton; bool Indexed; - int VertexCount, IndexCount; + int VertexCount, IndexCount, BoneCount, AnimationCount; + Bone* bones; + Animation* Animations; }; } } diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 0a5a275c..1e76bc61 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -18,7 +18,7 @@ namespace Oyster void Basic::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) { Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,0,0,1)); - Preparations::Basic::ClearRTV(Resources::Deffered::GBufferRTV,Resources::Deffered::GBufferSize,Math::Float4(1,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); Definitions::VP vp; diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index f606d57e..f9a837a2 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -12,7 +12,7 @@ const std::wstring PathToHLSL = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\De const std::wstring PathToCSO = L"..\\Content\\Shaders\\"; const int KernelSize = 10; -const int SampleSpread = 8; +const int SampleSpread = 16; namespace Oyster { @@ -156,6 +156,7 @@ namespace Oyster Core::Init::CreateLinkedShaderResourceFromStructuredBuffer(&b,&PointLightView,NULL); srand((unsigned int)time(0)); + //SSAO Math::Vector3 kernel[KernelSize]; Math::Vector3 random[SampleSpread]; @@ -186,13 +187,12 @@ namespace Oyster { random[i] = Oyster::Math::Vector3( (float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1, - (float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1, + /*(float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1,*/ + 1.0f, 0.0f); } random[i].Normalize(); } - //kernel[0] = Math::Vector3(0,1,1); - //kernel[0].Normalize(); D3D11_TEXTURE1D_DESC T1desc; T1desc.Width = KernelSize; @@ -208,17 +208,32 @@ namespace Oyster D3D11_SUBRESOURCE_DATA rnd; rnd.pSysMem = random; + rnd.SysMemPitch = sqrt(SampleSpread) * sizeof(Oyster::Math::Vector3); - ID3D11Texture1D *pTexture1[2]; + ID3D11Texture1D *pTexture1; - Core::device->CreateTexture1D( &T1desc, &sphere, &pTexture1[0] ); - Core::device->CreateShaderResourceView( pTexture1[0], 0, &SSAOKernel ); - pTexture1[0]->Release(); + Core::device->CreateTexture1D( &T1desc, &sphere, &pTexture1 ); + Core::device->CreateShaderResourceView( pTexture1, 0, &SSAOKernel ); + pTexture1->Release(); - T1desc.Width = SampleSpread; - Core::device->CreateTexture1D( &T1desc, &rnd, &pTexture1[1] ); - Core::device->CreateShaderResourceView( (pTexture1[1]), 0, &SSAORandom ); - pTexture1[1]->Release(); + D3D11_TEXTURE2D_DESC T2desc; + T2desc.Width = KernelSize; + T2desc.MipLevels = T2desc.ArraySize = 1; + T2desc.Format = DXGI_FORMAT_R32G32B32_FLOAT; + T2desc.Usage = D3D11_USAGE_DEFAULT; + T2desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + T2desc.CPUAccessFlags = 0; + T2desc.MiscFlags = 0; + T2desc.Height = sqrt(SampleSpread); + T2desc.Width = SampleSpread/sqrt(SampleSpread); + T2desc.SampleDesc.Quality = 0; + T2desc.SampleDesc.Count = 1; + + ID3D11Texture2D *pTexture2; + + Core::device->CreateTexture2D( &T2desc, &rnd, &pTexture2 ); + Core::device->CreateShaderResourceView( (pTexture2), 0, &SSAORandom ); + pTexture2->Release(); ////Create ShaderEffects diff --git a/Code/OysterGraphics/Render/Resources/Deffered.h b/Code/OysterGraphics/Render/Resources/Deffered.h index c4559cab..9d8065e0 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.h +++ b/Code/OysterGraphics/Render/Resources/Deffered.h @@ -18,12 +18,15 @@ namespace Oyster static const int LBufferSize = 3; static const int MaxLightSize = 100; //! GBuffers - //! 0 = Diffuse + SpecKoeff - //! 1 = Normal + Glow + //! 0 = Diffuse + Glow + //! 1 = Normal + Spec static ID3D11RenderTargetView* GBufferRTV[GBufferSize]; static ID3D11ShaderResourceView* GBufferSRV[GBufferSize]; - + //! LBuffer + //! 0 = Diffuse + //! 1 = Specular + //! 2 = SSAO static ID3D11UnorderedAccessView* LBufferUAV[LBufferSize]; static ID3D11ShaderResourceView* LBufferSRV[LBufferSize]; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli index 9096045d..1f1061d1 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli @@ -32,10 +32,10 @@ Texture2D DepthTexture : register(t2); StructuredBuffer Points : register(t3); Texture1D SSAOKernel : register(t4); -Texture1D SSAORand : register(t5); +Texture2D SSAORand : register(t5); RWTexture2D Diffuse : register(u0); RWTexture2D Specular : register(u1); -RWTexture2D Ambient : register(u2); +RWTexture2D Ambient : register(u2); #endif \ 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 98b2887e..f7dbb4a1 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl @@ -31,10 +31,10 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) Specular[DTid.xy] = float4(Shaded.Specular, 1); - if((DTid.x + DTid.y) %4 == 0 ) + if(DTid.x & 1 && DTid.y & 1 ) { - float AmbValue = GetSSAO(ViewPos, UV, DTid.xy, GTid.xy); - Ambient[DTid.xy/4] = AmbValue; + float AmbValue = GetSSAO(ViewPos, UV, DTid.xy, GTid.xy/2); + Ambient[DTid.xy/2] = AmbValue; } } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl index 1c52e5bf..d029535b 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl @@ -7,6 +7,7 @@ RWTexture2D Output; [numthreads(16, 16, 1)] void main( uint3 DTid : SV_DispatchThreadID ) { - //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/4].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW - Output[DTid.xy] = Diffuse[DTid.xy]; + //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/2].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW + Output[DTid.xy] = Ambient[DTid.xy/2]; + //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli index 32f84f90..d642c0ec 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli @@ -1,27 +1,30 @@ #include "Defines.hlsli" #include "PosManipulation.hlsli" -static float Radius =5; +static float Radius = 100; float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) { float occlusion = 0.0f; //create sample coordinate system - float4 rnd = float4( SSAORand[(rndID.x + rndID.y) % SSAORand.Length.x].xyz, 0.0f ); + float4 rnd = float4( SSAORand[int2(rndID.x % (SSAORand.Length.x), rndID.y % (SSAORand.Length.y))].xyz, 0.0f ); rnd = normalize(rnd); - float3 normal = NormalSpec[uv].xyz; - float4 tangent = float4( normalize(rnd.xyz - (normal * dot(rnd.xyz, normal))), 0.0f ); - float4 biTangent = float4( cross(tangent.xyz, normal), 0.0f ); + float3 normal = NormalSpec[texCoord2].xyz; + float3 tangent = float3( normalize(rnd.xyz - (normal * dot(rnd.xyz, normal)))); + float3 biTangent = float3( cross(tangent.xyz, normal)); - float4x4 tbn = float4x4(tangent, biTangent, float4(normal,0), float4(pos*Radius,1)); + float3x3 tbn = float3x3(tangent, biTangent, normal); for( uint i = 0; i < SSAOKernel.Length.x; ++i ) { + //int i = 0; //take sample from localspace to viewspace - float4 sampled = mul(tbn, float4(SSAOKernel[i].xyz,1)); + + float3 sampled = mul(tbn, SSAOKernel[i].xyz); + sampled = sampled * Radius + pos; //project sample to get uv.xy - float4 ProjOffset = sampled; + float4 ProjOffset = float4(sampled,1); ProjOffset = mul(Proj, ProjOffset); float4 offset = ProjOffset; float2 UV = offset; @@ -39,7 +42,7 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) //compare to depth from sample float rangeCheck = (abs(pos.z - sampleDepth) < Radius) ? 1.0f : 0.0f; - occlusion += (sampleDepth >= sampled.z ? 1.0f : 0.0f) * rangeCheck; + occlusion += (sampleDepth <= sampled.z ? 1.0f : 0.0f) * rangeCheck; } occlusion /= (float)(SSAOKernel.Length.x); occlusion = 1.0f - occlusion; diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index d25a9adc..eb5b241e 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -121,7 +121,7 @@ HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow ) // Adjust and create window g_hInst = hInstance; - RECT rc = { 0, 0, 1024, 768 }; + RECT rc = { 0, 0, 1280, 720 }; AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE ); if(!(g_hWnd = CreateWindow( @@ -159,25 +159,25 @@ HRESULT InitDirect3D() return E_FAIL; } - m = Oyster::Graphics::API::CreateModel(L"cube_tri.dan"); - m2 = Oyster::Graphics::API::CreateModel(L"cube_tri.dan"); + m = Oyster::Graphics::API::CreateModel(L"untitled.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); - m3 = Oyster::Graphics::API::CreateModel(L"cube_tri.dan"); + 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,1024.0f/768.0f,.1f,100); + P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000); Oyster::Graphics::API::SetProjection(P); - V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,15.4f)); + V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,200,500.4f)); V = V.GetInverse(); Oyster::Graphics::Definitions::Pointlight pl; pl.Color = Oyster::Math::Float3(1,1,1); pl.Bright = 1; - pl.Pos = Oyster::Math::Float3(0,5,5.4f); - pl.Radius = 15; + pl.Pos = Oyster::Math::Float3(0,-20.0f,30.4f); + pl.Radius = 90; Oyster::Graphics::API::AddLight(pl); @@ -188,9 +188,13 @@ float angle = 0; HRESULT Update(float deltaTime) { - angle += Oyster::Math::pi/8 * deltaTime; - m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle); + angle += Oyster::Math::pi/16 * deltaTime; + 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); + //Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; + //ma *= 5; + //ma.m44 = 1; + //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); return S_OK; } From 15625ac5d29c0e4cc13ef10d68dd8b9931bc2108 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 27 Jan 2014 14:24:13 +0100 Subject: [PATCH 02/29] Basic Animation (NOT STABLE) --- Code/DanBias.sln | 80 ++++++++++--------- .../Definitions/GraphicalDefinition.h | 13 +-- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 3 +- Code/OysterGraphics/FileLoader/DanLoader.cpp | 65 ++++++--------- Code/OysterGraphics/Model/Model.h | 8 +- Code/OysterGraphics/Model/ModelInfo.h | 4 +- .../Render/Rendering/BasicRender.cpp | 75 +++++++++++++++-- .../Render/Resources/Deffered.cpp | 11 +-- .../Render/Resources/Deffered.h | 2 +- .../HLSL/Deffered Shaders/GBufferHeader.hlsli | 8 +- .../Deffered Shaders/VertexGatherData.hlsl | 4 + Code/Tester/MainTest.cpp | 25 +++--- Code/Tester/Tester.vcxproj | 5 +- 13 files changed, 179 insertions(+), 124 deletions(-) diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 2e047aee..7182fe89 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -41,26 +41,26 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Debug|Win32 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.Build.0 = Release|Win32 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Release|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Release|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.ActiveCfg = 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.Build.0 = Debug|Win32 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Debug|Win32 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.Build.0 = Release|Win32 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Release|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Release|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Release|Win32 {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|x64.ActiveCfg = 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.Build.0 = Debug|Win32 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Debug|Win32 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.Build.0 = Release|Win32 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.ActiveCfg = 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.Build.0 = Debug|Win32 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Debug|Win32 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Debug|x64 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Debug|x64 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.Build.0 = Release|Win32 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Release|x64 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Release|x64 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.ActiveCfg = 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.Build.0 = Debug|Win32 + {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Debug|Win32 - {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Debug|x64 - {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Debug|x64 - {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.Build.0 = Release|Win32 + {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Release|x64 + {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Release|x64 + {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.ActiveCfg = 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.Build.0 = Debug|Win32 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Debug|Win32 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Debug|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Debug|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.Build.0 = Release|Win32 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Release|x64 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Release|x64 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {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.Build.0 = Release|Win32 {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.Build.0 = 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.Build.0 = Debug|Win32 + {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.ActiveCfg = Release|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.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.Build.0 = 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|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.Build.0 = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32 diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index d6529c48..d7dbc9f0 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -14,12 +14,6 @@ namespace Oyster Oyster::Math::Float3 normal; }; - struct VP - { - Oyster::Math::Matrix V; - Oyster::Math::Matrix P; - }; - struct PerModel { Math::Matrix WV; @@ -55,6 +49,13 @@ namespace Oyster float Bright; }; + struct AnimationData + { + int Animated; + Math::Float3 Pad; + Math::Matrix animatedData[10]; + }; + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 0e38eeb2..196c7f8d 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -82,8 +82,9 @@ namespace Oyster Model::Model* m = new Model::Model(); m->WorldMatrix = Oyster::Math::Float4x4::identity; 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; if(mi->Vertices->GetBufferPointer() == NULL) diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index a0e1e56c..84676e5b 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -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(); modelInfo->Indexed = false; + modelInfo->Animated = false; // Open file in binary mode std::ifstream danFile; 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.) //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 - 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 - - 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->bones = Bones; + modelInfo->bones = bones; break; } @@ -371,41 +349,44 @@ void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resour anims[a].name = std::wstring(wName); delete[] wName; - Oyster::Graphics::Model::Animation A = anims[a]; - //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; - A.Frames = new int[A.Bones]; - A.Keyframes = new Oyster::Graphics::Model::Frame*[A.Bones]; + anims[a].Frames = new int[anims[a].Bones]; + anims[a].Keyframes = new Oyster::Graphics::Model::Frame*[anims[a].Bones]; //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 int boneIndex; 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 - A.Keyframes[b][f].bone.Parent = boneIndex; + anims[a].Keyframes[b][f].bone.Parent = boneIndex; //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; } diff --git a/Code/OysterGraphics/Model/Model.h b/Code/OysterGraphics/Model/Model.h index 0103b143..f4639c74 100644 --- a/Code/OysterGraphics/Model/Model.h +++ b/Code/OysterGraphics/Model/Model.h @@ -9,12 +9,14 @@ namespace Oyster { namespace Model { + struct ModelInfo; struct Model { - //! do not Edit, linked to render data - void* info; + ModelInfo* info; Oyster::Math::Float4x4 WorldMatrix; - bool Visible; + bool Visible, LoopAnimation; + int AnimationPlaying; + float AnimationTime; }; } diff --git a/Code/OysterGraphics/Model/ModelInfo.h b/Code/OysterGraphics/Model/ModelInfo.h index 9afa9e21..27efe0bb 100644 --- a/Code/OysterGraphics/Model/ModelInfo.h +++ b/Code/OysterGraphics/Model/ModelInfo.h @@ -31,8 +31,8 @@ namespace Oyster struct ModelInfo { std::vector Material; - Core::Buffer *Vertices,*Indecies,*Skeleton; - bool Indexed; + Core::Buffer *Vertices,*Indecies; + bool Indexed, Animated; int VertexCount, IndexCount, BoneCount, AnimationCount; Bone* bones; Animation* Animations; diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 1e76bc61..c1ab6024 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -21,13 +21,7 @@ namespace Oyster Preparations::Basic::ClearRTV(Resources::Deffered::GBufferRTV,Resources::Deffered::GBufferSize,Math::Float4(0,0,0,1)); Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Deffered::GeometryPass); - Definitions::VP vp; - vp.V = View; - vp.P = Projection; - - void* data = Resources::Deffered::VPData.Map(); - memcpy(data, &vp, sizeof(Definitions::VP)); - Resources::Deffered::VPData.Unmap(); + void* data; Definitions::LightConstants lc; lc.InvProj = Projection.GetInverse(); @@ -61,10 +55,73 @@ namespace Oyster void* data = Resources::Deffered::ModelData.Map(); memcpy(data,&(pm),sizeof(pm)); Resources::Deffered::ModelData.Unmap(); - 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()) { Core::deviceContext->PSSetShaderResources(0,(UINT)info->Material.size(),&(info->Material[0])); @@ -84,6 +141,8 @@ namespace Oyster } } } + + void Basic::EndFrame() { Core::PipelineManager::SetRenderPass(Resources::Deffered::LightPass); diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index f9a837a2..361a94dd 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -34,7 +34,7 @@ namespace Oyster Shader::RenderPass Deffered::PostPass; Buffer Deffered::ModelData = Buffer(); - Buffer Deffered::VPData = Buffer(); + Buffer Deffered::AnimationData = Buffer(); Buffer Deffered::LightConstantsData = Buffer(); Buffer Deffered::PointLightsData = Buffer(); @@ -74,8 +74,9 @@ namespace Oyster ModelData.Init(desc); - desc.NumElements = 2; - VPData.Init(desc); + desc.NumElements = 1; + desc.ElementSize = sizeof(Definitions::AnimationData); + AnimationData.Init(desc); desc.ElementSize = sizeof(Definitions::LightConstants); desc.NumElements = 1; @@ -254,7 +255,7 @@ namespace Oyster Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout); 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.RenderStates.Rasterizer = rs; GeometryPass.RenderStates.SampleCount = 1; @@ -296,7 +297,7 @@ namespace Oyster void Deffered::Clean() { Resources::Deffered::ModelData.~Buffer(); - Resources::Deffered::VPData.~Buffer(); + Resources::Deffered::AnimationData.~Buffer(); Resources::Deffered::LightConstantsData.~Buffer(); Resources::Deffered::PointLightsData.~Buffer(); SAFE_RELEASE(Resources::Deffered::PointLightView); diff --git a/Code/OysterGraphics/Render/Resources/Deffered.h b/Code/OysterGraphics/Render/Resources/Deffered.h index 9d8065e0..025da28b 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.h +++ b/Code/OysterGraphics/Render/Resources/Deffered.h @@ -36,7 +36,7 @@ namespace Oyster static Core::Buffer ModelData; - static Core::Buffer VPData; + static Core::Buffer AnimationData; static Core::Buffer LightConstantsData; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli index 18cac11d..95012a3b 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli @@ -30,11 +30,11 @@ Texture2D Normal : register(t1); SamplerState S1 : register(s0); -cbuffer PerFrame : register(b0) +cbuffer Animation : register(b0) { - matrix View; - float4x4 Projection; - matrix VP; + int Animated; + float3 Pad; + float4x4 BoneAnimation[10]; } cbuffer PerModel : register(b1) diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index 8a361ccf..09312dbc 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -3,6 +3,10 @@ VertexOut main( VertexIn input ) { 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.normal = mul(WV, float4(input.normal,0)).xyz; output.UV = input.UV; diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index eb5b241e..3b4d94fe 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -162,8 +162,10 @@ HRESULT InitDirect3D() m = Oyster::Graphics::API::CreateModel(L"untitled.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); - 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); + m2->AnimationPlaying = 0; + 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); @@ -189,13 +191,14 @@ HRESULT Update(float deltaTime) { angle += Oyster::Math::pi/16 * deltaTime; - 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); - //Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; - //ma *= 5; - //ma.m44 = 1; - //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); + //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); + 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; + ma *= 50; + ma.m44 = 1; + m2->WorldMatrix = m2->WorldMatrix * ma; + 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; } @@ -204,9 +207,9 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::SetView(V); Oyster::Graphics::API::NewFrame(); - Oyster::Graphics::API::RenderModel(*m); + //Oyster::Graphics::API::RenderModel(*m); Oyster::Graphics::API::RenderModel(*m2); - Oyster::Graphics::API::RenderModel(*m3); + //Oyster::Graphics::API::RenderModel(*m3); Oyster::Graphics::API::EndFrame(); diff --git a/Code/Tester/Tester.vcxproj b/Code/Tester/Tester.vcxproj index 2f10fdc5..a4749cab 100644 --- a/Code/Tester/Tester.vcxproj +++ b/Code/Tester/Tester.vcxproj @@ -113,7 +113,7 @@ true OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies) $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) - OysterGraphics_x86D.dll;%(DelayLoadDLLs) + OysterGraphics_$(PlatformShortName)D.dll; @@ -159,7 +159,7 @@ OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies) $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) true - OysterGraphics_x86.dll; + OysterGraphics_$(PlatformShortName).dll; @@ -182,6 +182,7 @@ OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies) $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) true + OysterGraphics_$(PlatformShortName).dll; From 99a605a25bca8b27e5632afb643253bfc0008353 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 28 Jan 2014 13:48:15 +0100 Subject: [PATCH 03/29] 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 From 34f58d41406f357019e25b5561420c378322776b Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 3 Feb 2014 12:09:11 +0100 Subject: [PATCH 04/29] Anim Testing --- .../Render/Rendering/BasicRender.cpp | 69 ++++--------------- .../HLSL/Deffered Shaders/LightPass.hlsl | 2 +- .../HLSL/Deffered Shaders/PostPass.hlsl | 2 +- Code/Tester/MainTest.cpp | 12 ++-- 4 files changed, 20 insertions(+), 65 deletions(-) diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 113d7b6f..e9f988d2 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -40,6 +40,14 @@ namespace Oyster Resources::Deffered::PointLightsData.Unmap(); } + Math::Matrix RecursiveBindPos(int index, Model::ModelInfo* mi) + { + if(mi->bones[index].Parent == index) + return mi->bones[index].Transform; + + return mi->bones[index].Transform.GetInverse() * RecursiveBindPos(mi->bones[index].Parent,mi); + } + void Basic::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection) { for(int i = 0; i < count; ++i) @@ -57,69 +65,16 @@ namespace Oyster Resources::Deffered::ModelData.Unmap(); Model::ModelInfo* info = (Model::ModelInfo*)models[i].info; - - - Definitions::AnimationData am; + + Definitions::AnimationData am; //final if(info->Animated && models[i].AnimationPlaying != -1) { - - Definitions::AnimationData am2; - //write default data - for (int b = 0; b < info->BoneCount; b++) + for(int b = 0; b BoneCount; ++b) { - am2.animatedData[b] = info->bones[b].Transform; + am.animatedData[b] = RecursiveBindPos(b,info); } - //loop bones in animation am.Animated = 1; - - - Model::Frame Prev, Next; - - models[i].AnimationTime = fmod(models[i].AnimationTime,info->Animations[models[i].AnimationPlaying].duration); - - for(int x = 0; x < info->Animations[models[i].AnimationPlaying].Bones; ++x) - { - //loop frame per bone - Prev.bone.Parent = 0; - Next = Prev; - 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; - 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]; - //sneaky write do correct data buffer - am.animatedData[x] = (am2.animatedData[Prev.bone.Parent] * info->bones[Prev.bone.Parent].Transform.GetInverse()); - } } else am.Animated = 0; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl index 483f2889..b1203085 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl @@ -34,7 +34,7 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) if(DTid.x & 1 && DTid.y & 1 ) { float AmbValue = GetSSAO(ViewPos, UV, DTid.xy, GTid.xy/2); - Ambient[DTid.xy/2] = AmbValue; + Ambient[DTid.xy/2] = float4(DiffuseGlow[DTid.xy].xyz, AmbValue); } } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl index d029535b..1b00d607 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl @@ -8,6 +8,6 @@ RWTexture2D Output; void main( uint3 DTid : SV_DispatchThreadID ) { //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/2].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW - Output[DTid.xy] = Ambient[DTid.xy/2]; + Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; } \ No newline at end of file diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index dcafe91f..d3f63c48 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -161,7 +161,7 @@ HRESULT InitDirect3D() m = Oyster::Graphics::API::CreateModel(L"untitled.dan"); m2 = Oyster::Graphics::API::CreateModel(L"still.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,0,0),Oyster::Math::Float3::null); m2->AnimationPlaying = 0; m2->AnimationTime = 0.0f; //m3 = Oyster::Graphics::API::CreateModel(L"box_2.dan"); @@ -171,7 +171,7 @@ HRESULT InitDirect3D() P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000); Oyster::Graphics::API::SetProjection(P); - V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,200,500.4f)); + V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f)); V = V.GetInverse(); @@ -192,11 +192,11 @@ HRESULT Update(float deltaTime) angle += Oyster::Math::pi/16 * deltaTime; //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); - m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-Oyster::Math::pi/2,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null); + //m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-Oyster::Math::pi/2,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null); Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; - ma *= 50; - ma.m44 = 1; - m2->WorldMatrix = m2->WorldMatrix * ma; + //ma *= 50; + //ma.m44 = 1; + //m2->WorldMatrix = m2->WorldMatrix * ma; 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; From 97a3792bffe8fe7d9fa55b1014a6c1fb4df562d8 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 4 Feb 2014 14:59:51 +0100 Subject: [PATCH 05/29] Anim Test Not working Joints --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 2 + Code/OysterGraphics/FileLoader/DanLoader.cpp | 3 +- .../FileLoader/ShaderLoader.cpp | 3 +- Code/OysterGraphics/Model/ModelInfo.h | 3 +- .../Render/Rendering/BasicRender.cpp | 83 +++++++++++++++++-- Code/OysterGraphics/Render/Rendering/Render.h | 3 + .../HLSL/Deffered Shaders/PostPass.hlsl | 2 +- .../Deffered Shaders/VertexGatherData.hlsl | 16 ++-- Code/Tester/MainTest.cpp | 3 +- 9 files changed, 97 insertions(+), 21 deletions(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 2d9c3dc6..ad010c8b 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -32,6 +32,8 @@ namespace Oyster Render::Resources::Deffered::Init(); Render::Preparations::Basic::SetViewPort(); + Render::Rendering::Basic::cube = API::CreateModel(L"box.dan"); + Render::Rendering::Basic::cube2 = API::CreateModel(L"box2.dan"); return API::Sucsess; } diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index 0eff143a..0dd76a06 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -397,8 +397,7 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[]) anims[a].Keyframes[b][f].bone.Parent = boneIndex; //read bone transform - ReadData(&anims[a].Keyframes[b][f].bone.Transform,danFile,sizeof(Oyster::Math::Matrix)); - + ReadData(&anims[a].Keyframes[b][f].bone.Relative, danFile, sizeof(Math::Matrix)); ReadData(&anims[a].Keyframes[b][f].time,danFile,sizeof(double)); } diff --git a/Code/OysterGraphics/FileLoader/ShaderLoader.cpp b/Code/OysterGraphics/FileLoader/ShaderLoader.cpp index 17e9d1fe..5edc86dd 100644 --- a/Code/OysterGraphics/FileLoader/ShaderLoader.cpp +++ b/Code/OysterGraphics/FileLoader/ShaderLoader.cpp @@ -143,8 +143,7 @@ namespace Oyster } else { - memset(&out,0,sizeof(out)); - return; + return NULL; } #endif return Core::PipelineManager::CreateShader(data, Core::PipelineManager::ShaderType(type)); diff --git a/Code/OysterGraphics/Model/ModelInfo.h b/Code/OysterGraphics/Model/ModelInfo.h index 3a184f65..dece6668 100644 --- a/Code/OysterGraphics/Model/ModelInfo.h +++ b/Code/OysterGraphics/Model/ModelInfo.h @@ -13,7 +13,8 @@ namespace Oyster { struct Bone { - Math::Float4x4 Transform; + Math::Matrix Relative; + Math::Matrix Absolute; int Parent; }; struct Frame diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index e9f988d2..d5f7a676 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -2,6 +2,7 @@ #include "../Resources/Deffered.h" #include "../../Definitions/GraphicalDefinition.h" #include "../../Model/ModelInfo.h" +#include "../../DllInterfaces/GFXAPI.h" #include #include @@ -14,6 +15,8 @@ namespace Oyster namespace Rendering { Definitions::Pointlight pl; + Model::Model* Basic::cube = NULL; + Model::Model* Basic::cube2 = NULL; void Basic::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) { @@ -40,12 +43,21 @@ namespace Oyster Resources::Deffered::PointLightsData.Unmap(); } - Math::Matrix RecursiveBindPos(int index, Model::ModelInfo* mi) + Math::Matrix RecursiveBindPosRotation(int index, Model::ModelInfo* mi) { if(mi->bones[index].Parent == index) - return mi->bones[index].Transform; + return mi->bones[index].Relative; + + return mi->bones[index].Relative*mi->bones[mi->bones->Parent].Relative; + } - return mi->bones[index].Transform.GetInverse() * RecursiveBindPos(mi->bones[index].Parent,mi); + Math::Vector4 RecursiveBindPosPosition(int index, Model::ModelInfo* mi) + { + //return Math::Vector4::standard_unit_w; + if(mi->bones[index].Parent == index) + return mi->bones[index].Relative.v[3]; + + return Math::Vector4(RecursiveBindPosPosition(mi->bones->Parent, mi).xyz + (mi->bones[index].Relative.v[3] * RecursiveBindPosRotation(mi->bones->Parent,mi)).xyz,1); } void Basic::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection) @@ -70,10 +82,71 @@ namespace Oyster Definitions::AnimationData am; //final if(info->Animated && models[i].AnimationPlaying != -1) { + //store inverse absolut transform + Math::Matrix* SkinTransform = new Math::Matrix[info->BoneCount]; + Math::Matrix* BoneAnimated = new Math::Matrix[info->BoneCount]; + Math::Matrix* BoneAbsAnimated = new Math::Matrix[info->BoneCount]; + + Math::Matrix Scale = Math::Matrix::identity; + Scale.m[1][1] = 0.1f; + Scale.m[2][2] = 0.1f; + Scale.m[3][3] = 2; + for(int b = 0; b BoneCount; ++b) { - am.animatedData[b] = RecursiveBindPos(b,info); + Model::Bone Bone = info->bones[b]; + SkinTransform[b] = Bone.Absolute.GetInverse(); + BoneAnimated[b] = Bone.Relative; + BoneAbsAnimated[b] = Bone.Absolute; } + //for each bone in animation + //HACK use first bone + int b = 0; + Model::Animation A = info->Animations[models[i].AnimationPlaying]; + //for(int b = 0; b < A.Bones;++b) + { + //for each frame on bone Write current relative data + //HACK use first frame + int f = 0; + //for(int f = 0; f < A.Frames[b]; ++b) + { + //find right frame + //HACK accept first + Model::Frame Current = A.Keyframes[b][f]; + + //calculate new matrix + Model::Bone CBone = Current.bone; + BoneAnimated[CBone.Parent] = CBone.Relative; + } + } + + //calculate Absolute Animation Transform + for(int b = 0; b < info->BoneCount; ++b) + { + BoneAbsAnimated[b] = BoneAbsAnimated[info->bones[b].Parent] * BoneAnimated[b]; + cube->WorldMatrix = BoneAbsAnimated[b] * Scale; + cube->WorldMatrix.v[3] = BoneAbsAnimated[b].v[3]; + //Basic::RenderScene(cube,1,View,Projection); + } + + //write data to am + for(int b = 0; b < info->BoneCount; ++b) + { + am.animatedData[b] = BoneAbsAnimated[b] * SkinTransform[b]; + cube2->WorldMatrix = Scale; + cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; + Basic::RenderScene(cube2,1,View,Projection); + } + + //retore to draw animated model + Definitions::PerModel pm; + pm.WV = View * models[i].WorldMatrix; + pm.WVP = Projection * pm.WV; + + void* data = Resources::Deffered::ModelData.Map(); + memcpy(data,&(pm),sizeof(pm)); + Resources::Deffered::ModelData.Unmap(); + am.Animated = 1; } else @@ -97,7 +170,7 @@ namespace Oyster } else { - Oyster::Graphics::Core::deviceContext->Draw(info->VertexCount,0); + Oyster::Graphics::Core::deviceContext->Draw(info->VertexCount,0); } } } diff --git a/Code/OysterGraphics/Render/Rendering/Render.h b/Code/OysterGraphics/Render/Rendering/Render.h index 48d153d4..f8ac7aed 100644 --- a/Code/OysterGraphics/Render/Rendering/Render.h +++ b/Code/OysterGraphics/Render/Rendering/Render.h @@ -19,6 +19,9 @@ namespace Oyster 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 EndFrame(); + + static Model::Model* cube; + static Model::Model* cube2; }; } } diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl index 1b00d607..f984ff9f 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl @@ -8,6 +8,6 @@ RWTexture2D Output; void main( uint3 DTid : SV_DispatchThreadID ) { //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/2].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW - Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w, 1); + Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index 7395e08d..cbe657f7 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -3,16 +3,14 @@ VertexOut main( VertexIn input ) { VertexOut output; - /*input.pos = ( - (mul(BoneAnimation[input.boneIndex.x], input.pos) * input.boneWeight.x) + - (mul(BoneAnimation[input.boneIndex.y], input.pos) * input.boneWeight.y) + - (mul(BoneAnimation[input.boneIndex.z], input.pos) * input.boneWeight.z) + - (mul(BoneAnimation[input.boneIndex.w], input.pos) * input.boneWeight.w) - * Animated) + input.pos * int(1-Animated);*/ + /*input.pos = + (mul(BoneAnimation[input.boneIndex.x], input.pos) * input.boneWeight.x * Animated) + + (mul(BoneAnimation[input.boneIndex.y], input.pos) * input.boneWeight.y * Animated) + + (mul(BoneAnimation[input.boneIndex.z], input.pos) * input.boneWeight.z * Animated) + + (mul(BoneAnimation[input.boneIndex.w], input.pos) * input.boneWeight.w * Animated) + + input.pos * int(1-Animated);*/ - input.pos = ( - (mul(BoneAnimation[input.boneIndex.x], input.pos)/* * input.boneWeight.x*/) - * Animated) + input.pos * int(1-Animated); + /*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)); diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index d3f63c48..13bd1b94 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -160,7 +160,7 @@ HRESULT InitDirect3D() } m = Oyster::Graphics::API::CreateModel(L"untitled.dan"); - m2 = Oyster::Graphics::API::CreateModel(L"still.dan"); + m2 = Oyster::Graphics::API::CreateModel(L"still_root_origo.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; @@ -169,6 +169,7 @@ HRESULT InitDirect3D() P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000); + //P = Oyster::Math3D::ProjectionMatrix_Orthographic(10,10,.1f,10000); Oyster::Graphics::API::SetProjection(P); V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f)); From e13410dced9401599589518104c5886c04e6bc34 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 4 Feb 2014 15:06:50 +0100 Subject: [PATCH 06/29] Fixed debug data, points in right direction Matrix::m 0 index based, not math def --- .../Render/Rendering/BasicRender.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index d5f7a676..8d37eed5 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -82,15 +82,16 @@ namespace Oyster Definitions::AnimationData am; //final if(info->Animated && models[i].AnimationPlaying != -1) { + cube->WorldMatrix == Math::Matrix::identity; //store inverse absolut transform Math::Matrix* SkinTransform = new Math::Matrix[info->BoneCount]; Math::Matrix* BoneAnimated = new Math::Matrix[info->BoneCount]; Math::Matrix* BoneAbsAnimated = new Math::Matrix[info->BoneCount]; Math::Matrix Scale = Math::Matrix::identity; + Scale.m[0][0] = 0.1f; Scale.m[1][1] = 0.1f; - Scale.m[2][2] = 0.1f; - Scale.m[3][3] = 2; + Scale.m[2][2] = 1; for(int b = 0; b BoneCount; ++b) { @@ -98,6 +99,11 @@ namespace Oyster SkinTransform[b] = Bone.Absolute.GetInverse(); BoneAnimated[b] = Bone.Relative; BoneAbsAnimated[b] = Bone.Absolute; + + + cube2->WorldMatrix = Scale * info->bones[b].Absolute; + cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; + Basic::RenderScene(cube2,1, View, Projection); } //for each bone in animation //HACK use first bone @@ -124,18 +130,15 @@ namespace Oyster for(int b = 0; b < info->BoneCount; ++b) { BoneAbsAnimated[b] = BoneAbsAnimated[info->bones[b].Parent] * BoneAnimated[b]; - cube->WorldMatrix = BoneAbsAnimated[b] * Scale; + cube->WorldMatrix = Scale * BoneAbsAnimated[b]; cube->WorldMatrix.v[3] = BoneAbsAnimated[b].v[3]; - //Basic::RenderScene(cube,1,View,Projection); + Basic::RenderScene(cube,1,View,Projection); } //write data to am for(int b = 0; b < info->BoneCount; ++b) { am.animatedData[b] = BoneAbsAnimated[b] * SkinTransform[b]; - cube2->WorldMatrix = Scale; - cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; - Basic::RenderScene(cube2,1,View,Projection); } //retore to draw animated model From 4de809a95242a1065e7f718c5be8bc52c5bb031e Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 4 Feb 2014 16:20:42 +0100 Subject: [PATCH 07/29] Added Resource support --- Code/Misc/Misc.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 6c3db1ec..5989b04a 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -152,7 +152,7 @@ - true + false true @@ -172,7 +172,7 @@ - true + false true From 98644e3fa087ef1c5d4b5620cd6a0705b7edeb7e Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Tue, 4 Feb 2014 17:59:04 +0100 Subject: [PATCH 08/29] Minimised to potential skinning problem --- .../Render/Rendering/BasicRender.cpp | 65 +++++++++++-------- .../Deffered Shaders/VertexGatherData.hlsl | 6 ++ 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 8d37eed5..8c3e1565 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -83,15 +83,17 @@ namespace Oyster if(info->Animated && models[i].AnimationPlaying != -1) { cube->WorldMatrix == Math::Matrix::identity; - //store inverse absolut transform + ////store inverse absolut transform Math::Matrix* SkinTransform = new Math::Matrix[info->BoneCount]; Math::Matrix* BoneAnimated = new Math::Matrix[info->BoneCount]; Math::Matrix* BoneAbsAnimated = new Math::Matrix[info->BoneCount]; Math::Matrix Scale = Math::Matrix::identity; - Scale.m[0][0] = 0.1f; - Scale.m[1][1] = 0.1f; - Scale.m[2][2] = 1; + Scale.m[0][0] = 1; + Scale.m[1][1] = 1; + Scale.m[2][2] = 2; + + for(int b = 0; b BoneCount; ++b) { @@ -101,36 +103,39 @@ namespace Oyster BoneAbsAnimated[b] = Bone.Absolute; - cube2->WorldMatrix = Scale * info->bones[b].Absolute; + cube2->WorldMatrix = Scale; cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; - Basic::RenderScene(cube2,1, View, Projection); + //Basic::RenderScene(cube2,1, View, Projection); } - //for each bone in animation - //HACK use first bone - int b = 0; - Model::Animation A = info->Animations[models[i].AnimationPlaying]; + BoneAnimated[8] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[8].Relative; + BoneAnimated[31] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[31].Relative; + ////for each bone in animation + ////HACK use first bone + //int b = 0; + //Model::Animation A = info->Animations[models[i].AnimationPlaying]; //for(int b = 0; b < A.Bones;++b) - { - //for each frame on bone Write current relative data - //HACK use first frame - int f = 0; - //for(int f = 0; f < A.Frames[b]; ++b) - { - //find right frame - //HACK accept first - Model::Frame Current = A.Keyframes[b][f]; + //{ + // //for each frame on bone Write current relative data + // //HACK use first frame + // int f = 0; + // //for(int f = 0; f < A.Frames[b]; ++b) + // { + // //find right frame + // //HACK accept first + // Model::Frame Current = A.Keyframes[b][f]; + // + // //calculate new matrix + // Model::Bone CBone = Current.bone; + // BoneAnimated[CBone.Parent] = CBone.Relative; + // } + //} - //calculate new matrix - Model::Bone CBone = Current.bone; - BoneAnimated[CBone.Parent] = CBone.Relative; - } - } - - //calculate Absolute Animation Transform + ////calculate Absolute Animation Transform for(int b = 0; b < info->BoneCount; ++b) { BoneAbsAnimated[b] = BoneAbsAnimated[info->bones[b].Parent] * BoneAnimated[b]; - cube->WorldMatrix = Scale * BoneAbsAnimated[b]; + //SkinTransform[b] = BoneAbsAnimated[b]; + cube->WorldMatrix = Scale; cube->WorldMatrix.v[3] = BoneAbsAnimated[b].v[3]; Basic::RenderScene(cube,1,View,Projection); } @@ -138,7 +143,7 @@ namespace Oyster //write data to am for(int b = 0; b < info->BoneCount; ++b) { - am.animatedData[b] = BoneAbsAnimated[b] * SkinTransform[b]; + am.animatedData[b] = SkinTransform[b] * BoneAbsAnimated[b]; } //retore to draw animated model @@ -150,6 +155,10 @@ namespace Oyster memcpy(data,&(pm),sizeof(pm)); Resources::Deffered::ModelData.Unmap(); + delete[]SkinTransform; + delete[]BoneAbsAnimated; + delete[]BoneAnimated; + am.Animated = 1; } else diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index cbe657f7..afb84931 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -3,6 +3,12 @@ VertexOut main( VertexIn input ) { VertexOut output; + Matrix boneTrans = BoneAnimation[input.boneIndex.x]*input.boneWeight.x + + BoneAnimation[input.boneIndex.y]*input.boneWeight.y + + BoneAnimation[input.boneIndex.z]*input.boneWeight.z + + BoneAnimation[input.boneIndex.w]*input.boneWeight.w; + + input.pos = mul(boneTrans, input.pos) + input.pos * int(1-Animated);; /*input.pos = (mul(BoneAnimation[input.boneIndex.x], input.pos) * input.boneWeight.x * Animated) + (mul(BoneAnimation[input.boneIndex.y], input.pos) * input.boneWeight.y * Animated) + From 51711b86e3038f187697c698f11e2156adca1d0c Mon Sep 17 00:00:00 2001 From: lanariel Date: Wed, 5 Feb 2014 16:00:28 +0100 Subject: [PATCH 09/29] Fixed Animate Skeleton, TODO Fix Skinning --- .../Definitions/GraphicalDefinition.h | 4 +- .../Render/Rendering/BasicRender.cpp | 68 +++-- .../HLSL/Deffered Shaders/GBufferHeader.hlsli | 6 +- .../HLSL/Deffered Shaders/PostPass.hlsl | 8 +- .../Deffered Shaders/VertexGatherData.hlsl | 18 +- .../~AutoRecover.OysterGraphics.vcxproj | 287 ++++++++++++++++++ Code/Tester/MainTest.cpp | 17 +- 7 files changed, 368 insertions(+), 40 deletions(-) create mode 100644 Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index d84f7506..93273b30 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -51,7 +51,9 @@ namespace Oyster struct AnimationData { - Math::Float4x4 animatedData[100]; + Math::Float4x4 AnimatedData[100]; + Math::Float4x4 BindPoseData[100]; + Math::Float4x4 RotationData[100]; int Animated; Math::Float3 Pad; }; diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 8c3e1565..015a1fdb 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -84,9 +84,9 @@ namespace Oyster { cube->WorldMatrix == Math::Matrix::identity; ////store inverse absolut transform - Math::Matrix* SkinTransform = new Math::Matrix[info->BoneCount]; - Math::Matrix* BoneAnimated = new Math::Matrix[info->BoneCount]; - Math::Matrix* BoneAbsAnimated = new Math::Matrix[info->BoneCount]; + Math::Matrix SkinTransform[100]; + Math::Matrix BoneAnimated[100]; + Math::Matrix BoneAbsAnimated[100]; Math::Matrix Scale = Math::Matrix::identity; Scale.m[0][0] = 1; @@ -107,28 +107,41 @@ namespace Oyster cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; //Basic::RenderScene(cube2,1, View, Projection); } - BoneAnimated[8] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[8].Relative; - BoneAnimated[31] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[31].Relative; + //BoneAnimated[8] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[8].Relative; + //BoneAnimated[31] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[31].Relative; ////for each bone in animation ////HACK use first bone - //int b = 0; - //Model::Animation A = info->Animations[models[i].AnimationPlaying]; - //for(int b = 0; b < A.Bones;++b) - //{ - // //for each frame on bone Write current relative data - // //HACK use first frame - // int f = 0; - // //for(int f = 0; f < A.Frames[b]; ++b) - // { - // //find right frame - // //HACK accept first - // Model::Frame Current = A.Keyframes[b][f]; - // - // //calculate new matrix - // Model::Bone CBone = Current.bone; - // BoneAnimated[CBone.Parent] = CBone.Relative; - // } - //} + int b = 0; + Model::Animation A = info->Animations[models[i].AnimationPlaying]; + while(models[i].AnimationTime>A.duration) + models[i].AnimationTime -= A.duration; + + float position = models[i].AnimationTime; + for(int b = 0; b < A.Bones;++b) + { + //find current frame + int nrOfFrames = A.Frames[b]; + Model::Frame PFrame = A.Keyframes[b][nrOfFrames-1]; + Model::Frame NFrame = A.Keyframes[b][nrOfFrames-1]; + bool FrameFound = false; + for (int i = 0; i < nrOfFrames; i++) + { + if(position < A.Keyframes[b][i].time) + { + PFrame = A.Keyframes[b][i-1]; + NFrame = A.Keyframes[b][i]; + break; + } + } + float denominator = (NFrame.time - PFrame.time); + if(denominator == 0) + { + BoneAnimated[PFrame.bone.Parent] = PFrame.bone.Relative; + continue; + } + float inter = (float)((position - PFrame.time) / denominator); + Math3D::InterpolateOrientation_UsingNonRigidNlerp(PFrame.bone.Relative,NFrame.bone.Relative,inter, BoneAnimated[PFrame.bone.Parent]); + } ////calculate Absolute Animation Transform for(int b = 0; b < info->BoneCount; ++b) @@ -143,7 +156,8 @@ namespace Oyster //write data to am for(int b = 0; b < info->BoneCount; ++b) { - am.animatedData[b] = SkinTransform[b] * BoneAbsAnimated[b]; + am.AnimatedData[b] = (BoneAbsAnimated[b] * SkinTransform[b]); + am.BindPoseData[b] = info->bones[b].Absolute;//Math3D::ExtractRotationMatrix(am.animatedData[b]); } //retore to draw animated model @@ -155,9 +169,9 @@ namespace Oyster memcpy(data,&(pm),sizeof(pm)); Resources::Deffered::ModelData.Unmap(); - delete[]SkinTransform; - delete[]BoneAbsAnimated; - delete[]BoneAnimated; + //delete[]SkinTransform; + //delete[]BoneAbsAnimated; + //delete[]BoneAnimated; am.Animated = 1; } diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli index f28c1b0b..bca4ca25 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli @@ -5,7 +5,7 @@ struct VertexIn float3 normal : NORMAL; float3 tangent : TANGENT; float3 biTangent : BITANGENT; - float4 boneIndex : BONEINDEX; + int4 boneIndex : BONEINDEX; float4 boneWeight : BONEWEIGHT; }; @@ -32,7 +32,9 @@ SamplerState S1 : register(s0); cbuffer Animation : register(b0) { - float4x4 BoneAnimation[100]; + float4x4 AnimatedData[100]; + float4x4 BindPoseData[100]; + float4x4 RotationData[100]; int Animated; float3 Pad; } diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl index f984ff9f..36e25514 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl @@ -4,10 +4,14 @@ Texture2D Ambient : register(t2); RWTexture2D Output; +#define AmbFactor 0.3f; + [numthreads(16, 16, 1)] void main( uint3 DTid : SV_DispatchThreadID ) { - //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/2].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW - Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); + float4 Light = Diffuse[DTid.xy] + Specular[DTid.xy]; + float4 Amb = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w,1); + //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; + Output[DTid.xy] = Light + Amb * AmbFactor; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index afb84931..ca0f31fb 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -3,12 +3,20 @@ VertexOut main( VertexIn input ) { VertexOut output; - Matrix boneTrans = BoneAnimation[input.boneIndex.x]*input.boneWeight.x + - BoneAnimation[input.boneIndex.y]*input.boneWeight.y + - BoneAnimation[input.boneIndex.z]*input.boneWeight.z + - BoneAnimation[input.boneIndex.w]*input.boneWeight.w; - input.pos = mul(boneTrans, input.pos) + input.pos * int(1-Animated);; + float3 offsetX = input.pos - BindPoseData[input.boneIndex.x][3].xyz; + float3 offsetY = input.pos - BindPoseData[input.boneIndex.y][3].xyz; + float3 offsetZ = input.pos - BindPoseData[input.boneIndex.z][3].xyz; + float3 offsetW = input.pos - BindPoseData[input.boneIndex.w][3].xyz; + + Matrix boneTrans = AnimatedData[input.boneIndex.x]*input.boneWeight.x + + AnimatedData[input.boneIndex.y]*input.boneWeight.y + + 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.normal = mul(boneTrans,input.normal) * Animated + input.normal * int(1-Animated); /*input.pos = (mul(BoneAnimation[input.boneIndex.x], input.pos) * input.boneWeight.x * Animated) + (mul(BoneAnimation[input.boneIndex.y], input.pos) * input.boneWeight.y * Animated) + diff --git a/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj b/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj new file mode 100644 index 00000000..53ffc005 --- /dev/null +++ b/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj @@ -0,0 +1,287 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0EC83E64-230E-48EF-B08C-6AC9651B4F82} + OysterGraphics + + + + DynamicLibrary + true + v110 + MultiByte + + + DynamicLibrary + true + v110 + MultiByte + + + DynamicLibrary + false + v110 + true + MultiByte + + + DynamicLibrary + false + v110 + true + MultiByte + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName)D + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName) + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName)D + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName) + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + + Level3 + Disabled + true + $(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + + + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + 5.0 + + + + + Level3 + Disabled + true + ..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + 5.0 + + + + + Level3 + Disabled + true + true + true + ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + true + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + true + 5.0 + + + + + Level3 + Disabled + true + true + true + ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + true + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + true + 5.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} + + + {f10cbc03-9809-4cba-95d8-327c287b18ee} + + + + + Compute + Compute + Compute + Compute + + + Pixel + Pixel + Pixel + Pixel + + + Compute + 5.0 + Compute + 5.0 + Compute + 5.0 + Compute + 5.0 + + + Vertex + Vertex + Vertex + Vertex + + + Vertex + Vertex + Vertex + Vertex + + + + + 5.0 + + + Pixel + Pixel + Pixel + Pixel + true + 5.0 + main + + + Vertex + Vertex + Vertex + Vertex + true + 5.0 + main + + + + + Pixel + Pixel + Pixel + Pixel + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 13bd1b94..279f89f2 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -160,7 +160,7 @@ HRESULT InitDirect3D() } m = Oyster::Graphics::API::CreateModel(L"untitled.dan"); - m2 = Oyster::Graphics::API::CreateModel(L"still_root_origo.dan"); + m2 = Oyster::Graphics::API::CreateModel(L"rigidbind_animtest_arms_bindpose (1).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; @@ -179,7 +179,7 @@ HRESULT InitDirect3D() Oyster::Graphics::Definitions::Pointlight pl; pl.Color = Oyster::Math::Float3(1,1,1); pl.Bright = 1; - pl.Pos = Oyster::Math::Float3(0,-20.0f,30.4f); + pl.Pos = Oyster::Math::Float3(0,-20.0f,0.4f); pl.Radius = 90; Oyster::Graphics::API::AddLight(pl); @@ -198,7 +198,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; } @@ -249,6 +249,17 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam Oyster::Graphics::API::ReloadShaders(); #endif break; + //Z - + case 0x5A: + m2->AnimationTime -= 0.1f; + if(m2->AnimationTime < 0) + m2->AnimationTime = 0; + break; + //X + + case 0x58: + m2->AnimationTime += 0.1f; + break; + } break; From aafbfa01f3995f321ed82cdb3b6ae46d6758682d Mon Sep 17 00:00:00 2001 From: lanariel Date: Wed, 5 Feb 2014 16:54:57 +0100 Subject: [PATCH 10/29] Calculate Graphics Memory Usage --- Code/OysterGraphics/Core/Buffer.cpp | 4 ++++ Code/OysterGraphics/Core/Core.cpp | 4 +++- Code/OysterGraphics/Core/Core.h | 2 ++ Code/OysterGraphics/Core/Init.cpp | 8 +++++++- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 9 +++++++++ Code/OysterGraphics/DllInterfaces/GFXAPI.h | 6 +++++- Code/OysterGraphics/FileLoader/ModelLoader.cpp | 4 ++++ Code/OysterGraphics/FileLoader/ShaderLoader.cpp | 1 + Code/OysterGraphics/Render/Resources/Deffered.cpp | 1 + Code/OysterGraphics/Render/Resources/Deffered.h | 1 + Code/Tester/MainTest.cpp | 2 ++ 11 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Code/OysterGraphics/Core/Buffer.cpp b/Code/OysterGraphics/Core/Buffer.cpp index d6994554..6cef2b17 100644 --- a/Code/OysterGraphics/Core/Buffer.cpp +++ b/Code/OysterGraphics/Core/Buffer.cpp @@ -155,6 +155,10 @@ HRESULT Core::Buffer::Init(const BUFFER_INIT_DESC& initDesc) { //MessageBox(NULL, L"Unable to create buffer.", L"Slenda Error", MB_ICONERROR | MB_OK); } + else + { + Core::UsedMem += bufferDesc.ByteWidth; + } return hr; } diff --git a/Code/OysterGraphics/Core/Core.cpp b/Code/OysterGraphics/Core/Core.cpp index f2392f4c..d03a64ef 100644 --- a/Code/OysterGraphics/Core/Core.cpp +++ b/Code/OysterGraphics/Core/Core.cpp @@ -33,4 +33,6 @@ Oyster::Math::Float2 Core::resolution = Oyster::Math::Float2::null; ID3D11ShaderResourceView* Core::srvNULL[16] = {0}; ID3D11RenderTargetView* Core::rtvNULL[8] = {0}; -ID3D11UnorderedAccessView* Core::uavNULL[8] = {0}; \ No newline at end of file +ID3D11UnorderedAccessView* Core::uavNULL[8] = {0}; + +int Core::UsedMem = 0; \ No newline at end of file diff --git a/Code/OysterGraphics/Core/Core.h b/Code/OysterGraphics/Core/Core.h index 050d54c5..eb420c04 100644 --- a/Code/OysterGraphics/Core/Core.h +++ b/Code/OysterGraphics/Core/Core.h @@ -46,6 +46,8 @@ namespace Oyster static ID3D11RenderTargetView* rtvNULL[8]; static ID3D11UnorderedAccessView* uavNULL[8]; + static int UsedMem; + class Buffer { public: diff --git a/Code/OysterGraphics/Core/Init.cpp b/Code/OysterGraphics/Core/Init.cpp index 05a91a59..f0b4907f 100644 --- a/Code/OysterGraphics/Core/Init.cpp +++ b/Code/OysterGraphics/Core/Init.cpp @@ -110,6 +110,7 @@ namespace Oyster if(Core::swapChain) { Core::swapChain->Release(); + Core::UsedMem -= desc.BufferDesc.Height * desc.BufferDesc.Width * 16; delete Core::swapChain; } @@ -167,7 +168,7 @@ namespace Oyster } dxgiFactory->Release(); - + Core::UsedMem += desc.BufferDesc.Height * desc.BufferDesc.Width * 16; return Init::Success; } @@ -187,6 +188,7 @@ namespace Oyster if(Core::depthStencil) { Core::depthStencil->Release(); + Core::UsedMem -= desc.Height * desc.Width * 4; delete Core::depthStencil; } @@ -214,6 +216,7 @@ namespace Oyster { return Init::Fail; } + Core::UsedMem += desc.Height * desc.Width * 4; D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc; dsvDesc.Format = DXGI_FORMAT_D32_FLOAT; dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; @@ -382,6 +385,9 @@ namespace Oyster if(FAILED(Core::device->CreateTexture2D(&texDesc,NULL,&tex))) return State::Fail; + + Core::UsedMem += texDesc.Height*texDesc.Width*16; + if(rtv) { D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index ad010c8b..66476a89 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -143,5 +143,14 @@ namespace Oyster return State::Sucsess; } #endif + + API::Option API::GetOption() + { + Option o; + o.BytesUsed = Core::UsedMem; + o.modelPath = Core::modelPath; + o.texturePath = Core::texturePath; + return o; + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 81a3bedc..555e8a0c 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -27,6 +27,7 @@ namespace Oyster struct Option { std::wstring modelPath, texturePath; + int BytesUsed; }; static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); @@ -63,8 +64,11 @@ namespace Oyster //! @brief removes all lights from the scene static void ClearLights(); - //! @brief Sets Options to the graphics, note: currently unused + //! @brief Sets Options to the graphics static State SetOptions(Option); + + //! @brief Gets Options to the graphics + static Option GetOption(); }; } } diff --git a/Code/OysterGraphics/FileLoader/ModelLoader.cpp b/Code/OysterGraphics/FileLoader/ModelLoader.cpp index b7b8b09a..fba207d1 100644 --- a/Code/OysterGraphics/FileLoader/ModelLoader.cpp +++ b/Code/OysterGraphics/FileLoader/ModelLoader.cpp @@ -690,6 +690,7 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice, SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; SRVDesc.Texture2D.MipLevels = (autogen) ? -1 : 1; + //TODO calc mipmap data hr = d3dDevice->CreateShaderResourceView( tex, &SRVDesc, textureView ); if ( FAILED(hr) ) @@ -697,6 +698,9 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice, tex->Release(); return hr; } + //todo check calc + int TexSize = twidth * theight * bpp; + Oyster::Graphics::Core::UsedMem += TexSize; if ( autogen ) { diff --git a/Code/OysterGraphics/FileLoader/ShaderLoader.cpp b/Code/OysterGraphics/FileLoader/ShaderLoader.cpp index 5edc86dd..033be403 100644 --- a/Code/OysterGraphics/FileLoader/ShaderLoader.cpp +++ b/Code/OysterGraphics/FileLoader/ShaderLoader.cpp @@ -146,6 +146,7 @@ namespace Oyster return NULL; } #endif + Core::UsedMem += data.size; return Core::PipelineManager::CreateShader(data, Core::PipelineManager::ShaderType(type)); } } diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index 361a94dd..c767da77 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -43,6 +43,7 @@ namespace Oyster ID3D11ShaderResourceView* Deffered::SSAOKernel = NULL; ID3D11ShaderResourceView* Deffered::SSAORandom = NULL; + Core::Init::State Deffered::InitShaders() { #ifdef _DEBUG diff --git a/Code/OysterGraphics/Render/Resources/Deffered.h b/Code/OysterGraphics/Render/Resources/Deffered.h index 025da28b..d422f722 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.h +++ b/Code/OysterGraphics/Render/Resources/Deffered.h @@ -17,6 +17,7 @@ namespace Oyster static const int GBufferSize = 2; static const int LBufferSize = 3; static const int MaxLightSize = 100; + //! GBuffers //! 0 = Diffuse + Glow //! 1 = Normal + Spec diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 279f89f2..31a2c8fc 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -90,6 +90,8 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL } } + Oyster::Graphics::API::Option o = Oyster::Graphics::API::GetOption(); + Oyster::Graphics::API::DeleteModel(m); Oyster::Graphics::API::DeleteModel(m2); Oyster::Graphics::API::DeleteModel(m3); From bfa54b9ccd8fe8380aaf9d44e51096eb8dd4edb0 Mon Sep 17 00:00:00 2001 From: lanariel Date: Wed, 5 Feb 2014 17:13:23 +0100 Subject: [PATCH 11/29] 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; } From a7480ebf700a2a590fa8408385e876521ee3db62 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 08:34:01 +0100 Subject: [PATCH 12/29] Proper Animation --- Code/OysterGraphics/FileLoader/DanLoader.cpp | 4 ++-- Code/OysterGraphics/FileLoader/ModelLoader.cpp | 2 +- .../Render/Rendering/BasicRender.cpp | 7 ++++--- .../Render/Resources/Deffered.cpp | 6 +++--- .../HLSL/Deffered Shaders/GBufferHeader.hlsli | 2 +- .../HLSL/Deffered Shaders/PixelGatherData.hlsl | 2 +- .../Shader/HLSL/Deffered Shaders/PostPass.hlsl | 3 ++- .../HLSL/Deffered Shaders/VertexGatherData.hlsl | 17 +++-------------- Code/Tester/MainTest.cpp | 4 ++-- 9 files changed, 19 insertions(+), 28 deletions(-) diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index 446a7ba2..ac47605c 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -146,7 +146,7 @@ void Oyster::Graphics::Loading::UnloadDAN(void* data) } delete[] info->Animations; } - for(int i =0;iMaterial.size();++i) + for(UINT i =0;iMaterial.size();++i) { Core::loader.ReleaseResource(info->Material[i]); } @@ -351,7 +351,7 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[]) Oyster::Graphics::Model::Animation* anims = new Oyster::Graphics::Model::Animation[animationHeader.numAnims]; - for(int a = 0; a < animationHeader.numAnims; ++a) + for(UINT a = 0; a < animationHeader.numAnims; ++a) { //read name of animation int nameLength; diff --git a/Code/OysterGraphics/FileLoader/ModelLoader.cpp b/Code/OysterGraphics/FileLoader/ModelLoader.cpp index fba207d1..96fa0362 100644 --- a/Code/OysterGraphics/FileLoader/ModelLoader.cpp +++ b/Code/OysterGraphics/FileLoader/ModelLoader.cpp @@ -70,7 +70,7 @@ void Oyster::Graphics::Loading::UnloadOBJ(void* data) { SAFE_DELETE(info->Indecies); } - for(int i =0;iMaterial.size();++i) + for(UINT i =0;iMaterial.size();++i) { Core::loader.ReleaseResource(info->Material[i]); } diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 015a1fdb..d44eeedc 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -82,7 +82,7 @@ namespace Oyster Definitions::AnimationData am; //final if(info->Animated && models[i].AnimationPlaying != -1) { - cube->WorldMatrix == Math::Matrix::identity; + cube->WorldMatrix = Math::Matrix::identity; ////store inverse absolut transform Math::Matrix SkinTransform[100]; Math::Matrix BoneAnimated[100]; @@ -114,7 +114,7 @@ namespace Oyster int b = 0; Model::Animation A = info->Animations[models[i].AnimationPlaying]; while(models[i].AnimationTime>A.duration) - models[i].AnimationTime -= A.duration; + models[i].AnimationTime -= (float)A.duration; float position = models[i].AnimationTime; for(int b = 0; b < A.Bones;++b) @@ -133,7 +133,7 @@ namespace Oyster break; } } - float denominator = (NFrame.time - PFrame.time); + float denominator = (float)(NFrame.time - PFrame.time); if(denominator == 0) { BoneAnimated[PFrame.bone.Parent] = PFrame.bone.Relative; @@ -150,6 +150,7 @@ namespace Oyster //SkinTransform[b] = BoneAbsAnimated[b]; cube->WorldMatrix = Scale; cube->WorldMatrix.v[3] = BoneAbsAnimated[b].v[3]; + cube->WorldMatrix = models[i].WorldMatrix * cube->WorldMatrix; Basic::RenderScene(cube,1,View,Projection); } diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index c767da77..8313bf0f 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -210,7 +210,7 @@ namespace Oyster D3D11_SUBRESOURCE_DATA rnd; rnd.pSysMem = random; - rnd.SysMemPitch = sqrt(SampleSpread) * sizeof(Oyster::Math::Vector3); + rnd.SysMemPitch = (UINT)(sqrt(SampleSpread) * sizeof(Oyster::Math::Vector3)); ID3D11Texture1D *pTexture1; @@ -226,8 +226,8 @@ namespace Oyster T2desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; T2desc.CPUAccessFlags = 0; T2desc.MiscFlags = 0; - T2desc.Height = sqrt(SampleSpread); - T2desc.Width = SampleSpread/sqrt(SampleSpread); + T2desc.Height = (UINT)sqrt(SampleSpread); + T2desc.Width = (UINT)(SampleSpread/sqrt(SampleSpread)); T2desc.SampleDesc.Quality = 0; T2desc.SampleDesc.Count = 1; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli index bca4ca25..b87b7235 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli @@ -5,7 +5,7 @@ struct VertexIn float3 normal : NORMAL; float3 tangent : TANGENT; float3 biTangent : BITANGENT; - int4 boneIndex : BONEINDEX; + float4 boneIndex : BONEINDEX; float4 boneWeight : BONEWEIGHT; }; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl index de06ce7f..cad03013 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl @@ -4,6 +4,6 @@ PixelOut main(VertexOut input) { PixelOut output; output.DiffuseGlow = Diffuse.Sample(S1, input.UV); - output.NormalSpec = float4(normalize(input.normal), 1.0f); + output.NormalSpec = float4(normalize(input.normal), Normal.Sample(S1,input.UV).w); return output; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl index 36e25514..b3abc0df 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl @@ -10,8 +10,9 @@ RWTexture2D Output; void main( uint3 DTid : SV_DispatchThreadID ) { float4 Light = Diffuse[DTid.xy] + Specular[DTid.xy]; - float4 Amb = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w,1); + float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; Output[DTid.xy] = Light + Amb * AmbFactor; + //Output[DTid.xy] = Ambient[DTid.xy/2].w; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index 19ce9377..7880d66e 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -12,23 +12,12 @@ VertexOut main( VertexIn input ) Matrix boneTrans = AnimatedData[input.boneIndex.x]*input.boneWeight.x + AnimatedData[input.boneIndex.y]*input.boneWeight.y + AnimatedData[input.boneIndex.z]*input.boneWeight.z + - AnimatedData[input.boneIndex.w]*input.boneWeight.w; + AnimatedData[input.boneIndex.w]*input.boneWeight.w; - input.pos = mul(boneTrans,float4(input.pos,1)) * Animated + input.pos * int(1-Animated); + input.pos = mul(boneTrans,float4(input.pos,1)).xyz * Animated + input.pos * int(1-Animated); - input.normal = mul(boneTrans,input.normal) * Animated + input.normal * int(1-Animated); - /*input.pos = - (mul(BoneAnimation[input.boneIndex.x], input.pos) * input.boneWeight.x * Animated) + - (mul(BoneAnimation[input.boneIndex.y], input.pos) * input.boneWeight.y * Animated) + - (mul(BoneAnimation[input.boneIndex.z], input.pos) * input.boneWeight.z * Animated) + - (mul(BoneAnimation[input.boneIndex.w], input.pos) * input.boneWeight.w * Animated) + - input.pos * int(1-Animated);*/ + input.normal = mul(boneTrans,float4(input.normal,1)).xyz * Animated + input.normal * int(1-Animated); - /*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.normal = mul(WV, float4(input.normal,0)).xyz; output.UV = input.UV; diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 988a75c9..99ba7b76 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"still.dan"); + m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.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; @@ -195,7 +195,7 @@ HRESULT Update(float deltaTime) angle += Oyster::Math::pi/16 * deltaTime; //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); - //m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-Oyster::Math::pi/2,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null); + 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::Math::Matrix ma = Oyster::Math::Matrix::identity; //ma *= 50; //ma.m44 = 1; From bab3ab0a78b189c8b5d6c4064969b2b31e7012f3 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 11:09:59 +0100 Subject: [PATCH 13/29] Shader Restructure --- .../Definitions/GraphicalDefinition.h | 7 +- Code/OysterGraphics/OldResourses/Buffers.cpp | 44 ---- Code/OysterGraphics/OldResourses/Buffers.h | 22 -- .../OldResourses/GraphicsDefinitions.h | 34 --- Code/OysterGraphics/OldResourses/Manager.cpp | 47 ---- Code/OysterGraphics/OldResourses/Manager.h | 20 -- .../OldResourses/PipelineResources.cpp | 228 ------------------ .../OldResourses/PipelineResources.h | 66 ----- .../OldResourses/ShaderEffects.cpp | 100 -------- .../OldResourses/ShaderEffects.h | 23 -- Code/OysterGraphics/OysterGraphics.vcxproj | 41 +++- .../OysterGraphics.vcxproj.filters | 27 ++- .../Render/Rendering/BasicRender.cpp | 1 - .../Render/Resources/Deffered.cpp | 56 ++++- .../Render/Resources/Deffered.h | 7 +- .../Shader/Passes/2D/2DGeometry.hlsl | 22 ++ .../Shader/Passes/2D/2DPixel.hlsl | 6 + .../Shader/Passes/2D/2DVertex.hlsl | 6 + .../Shader/Passes/2D/Header.hlsli | 18 ++ .../Gather/GatherPixel.hlsl} | 2 +- .../Gather/GatherVertex.hlsl} | 7 +- .../Gather/Header.hlsli} | 2 - .../Light}/Defines.hlsli | 9 +- .../Light}/LightCalc.hlsli | 0 .../Light}/LightPass.hlsl | 0 .../Light}/PosManipulation.hlsli | 0 .../Light}/SSAO.hlsli | 0 .../Post}/PostPass.hlsl | 0 28 files changed, 163 insertions(+), 632 deletions(-) delete mode 100644 Code/OysterGraphics/OldResourses/Buffers.cpp delete mode 100644 Code/OysterGraphics/OldResourses/Buffers.h delete mode 100644 Code/OysterGraphics/OldResourses/GraphicsDefinitions.h delete mode 100644 Code/OysterGraphics/OldResourses/Manager.cpp delete mode 100644 Code/OysterGraphics/OldResourses/Manager.h delete mode 100644 Code/OysterGraphics/OldResourses/PipelineResources.cpp delete mode 100644 Code/OysterGraphics/OldResourses/PipelineResources.h delete mode 100644 Code/OysterGraphics/OldResourses/ShaderEffects.cpp delete mode 100644 Code/OysterGraphics/OldResourses/ShaderEffects.h create mode 100644 Code/OysterGraphics/Shader/Passes/2D/2DGeometry.hlsl create mode 100644 Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl create mode 100644 Code/OysterGraphics/Shader/Passes/2D/2DVertex.hlsl create mode 100644 Code/OysterGraphics/Shader/Passes/2D/Header.hlsli rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders/PixelGatherData.hlsl => Passes/Gather/GatherPixel.hlsl} (86%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders/VertexGatherData.hlsl => Passes/Gather/GatherVertex.hlsl} (67%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders/GBufferHeader.hlsli => Passes/Gather/Header.hlsli} (92%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders => Passes/Light}/Defines.hlsli (71%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders => Passes/Light}/LightCalc.hlsli (100%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders => Passes/Light}/LightPass.hlsl (100%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders => Passes/Light}/PosManipulation.hlsli (100%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders => Passes/Light}/SSAO.hlsli (100%) rename Code/OysterGraphics/Shader/{HLSL/Deffered Shaders => Passes/Post}/PostPass.hlsl (100%) diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index 93273b30..ae7bbeb8 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -52,12 +52,15 @@ namespace Oyster struct AnimationData { Math::Float4x4 AnimatedData[100]; - Math::Float4x4 BindPoseData[100]; - Math::Float4x4 RotationData[100]; int Animated; Math::Float3 Pad; }; + struct GuiData + { + Math::Matrix Translation; + }; + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/Buffers.cpp b/Code/OysterGraphics/OldResourses/Buffers.cpp deleted file mode 100644 index e36b3790..00000000 --- a/Code/OysterGraphics/OldResourses/Buffers.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "Buffers.h" - -namespace Oyster -{ - namespace Resources - { - Buffer Buffers::V2DSprites = Buffer(); - Buffer Buffers::CbufferVS = Buffer(); - Buffer Buffers::CBufferGs = Buffer(); - Buffer Buffers::CBufferPipelineCs = Buffer(); - - void Buffers::Init() - { - Buffer::BUFFER_INIT_DESC desc; - - desc.ElementSize=sizeof(Math::Float2); - desc.NumElements=1; - desc.Type = Buffer::BUFFER_TYPE::VERTEX_BUFFER; - desc.Usage = Buffer::BUFFER_USAGE::BUFFER_DEFAULT; - desc.InitData = &Math::Float2(0,0); - - V2DSprites.Init(desc); - - desc.Type=Buffer::BUFFER_TYPE::CONSTANT_BUFFER_VS; - desc.Usage = Buffer::BUFFER_USAGE::BUFFER_CPU_WRITE_DISCARD; - desc.ElementSize=sizeof(Math::Float4x4); - desc.InitData=0; - - CbufferVS.Init(desc); - - desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; - - CBufferGs.Init(desc); - - desc.ElementSize=sizeof(Oyster::Resources::BufferDefinitions::LightStructureBuffer); - desc.NumElements=1; - desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS; - desc.Usage = Buffer::BUFFER_USAGE::BUFFER_CPU_WRITE_DISCARD; - desc.InitData = NULL; - - CBufferPipelineCs.Init(desc); - } - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/Buffers.h b/Code/OysterGraphics/OldResourses/Buffers.h deleted file mode 100644 index ec445b6c..00000000 --- a/Code/OysterGraphics/OldResourses/Buffers.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "../EngineIncludes.h" - -namespace Oyster -{ - namespace Resources - { - struct Buffers - { - static Buffer V2DSprites; - - static Buffer CbufferVS; - - static Buffer CBufferGs; - - static Buffer CBufferPipelineCs; - - static void Init(); - }; - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/GraphicsDefinitions.h b/Code/OysterGraphics/OldResourses/GraphicsDefinitions.h deleted file mode 100644 index 12a85d5f..00000000 --- a/Code/OysterGraphics/OldResourses/GraphicsDefinitions.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - - -#include "..\EngineIncludes.h" - -namespace Oyster -{ - namespace Resources - { - - namespace BufferDefinitions - { - struct LightStructureBuffer - { - ::Oyster::Math::Float4x4 viewMatrix, projectionMatrix; - ::LinearAlgebra::Vector3 numDispatches; - unsigned int reservedPadding; - }; - - struct ScreenTileFrustrum - { - ::Oyster::Math::Float rawElement[6 * 4]; - }; - - class PointLightDescription - { - public: - struct{ ::Oyster::Math::Float3 center; ::Oyster::Math::Float radius; } pos; - ::Oyster::Math::Float3 color; - ::Oyster::Math::Float intensty; - }; - }; - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/Manager.cpp b/Code/OysterGraphics/OldResourses/Manager.cpp deleted file mode 100644 index 47aa5eaf..00000000 --- a/Code/OysterGraphics/OldResourses/Manager.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "Manager.h" - -std::unordered_map< std::string, Oyster::Render::ModelInfo*> Oyster::Resources::Manager::loadedModels = std::unordered_map< std::string, Oyster::Render::ModelInfo*>(); - -Oyster::Render::Model* Oyster::Resources::Manager::LoadModel(std::string Filename, Matrix Scale) -{ - ////TODO: Add redundncy sheck, to ensure not recreating model - - ////Loop to find filename - - ////If found Return Model - - ////else Create Model - - //Oyster::FileLoaders::ObjReader *reader = Oyster::FileLoaders::ObjReader::LoadFile(Filename, Scale); - //Oyster::FileLoaders::ObjReader::Vertex** vertex = new Oyster::FileLoaders::ObjReader::Vertex*[1]; - //int vcount; - //std::map textures; - //reader->GetVertexData( vertex, vcount, textures ); - - //Oyster::Buffer::BUFFER_INIT_DESC desc; - //desc.ElementSize=sizeof(Oyster::FileLoaders::ObjReader::Vertex); - //desc.NumElements = vcount; - //desc.InitData = *vertex; - //desc.Type = Oyster::Buffer::VERTEX_BUFFER; - //desc.Usage = Oyster::Buffer::BUFFER_DEFAULT; - // - //ID3D11ShaderResourceView *srv = textures["Diffuse"]; - - //Oyster::Render::ModelInfo* m = new Oyster::Render::ModelInfo(); - // - //m->Vertices = *(Oyster::Engine::Init::Buffers::CreateBuffer(desc)); - //m->VertexCount = vcount; - //m->Material.push_back(srv); - //srv = textures["Specular"]; - //m->Material.push_back(srv); - //srv = textures["Glow"]; - //m->Material.push_back(srv); - //m->Indexed=false; - // - //Oyster::Render::Model* model = new Oyster::Render::Model(); - //model->info=m; - //model->Visible = true; - //model->World = &Oyster::Math::Float4x4(Oyster::Math::Float4x4::identity); - return NULL; -} - diff --git a/Code/OysterGraphics/OldResourses/Manager.h b/Code/OysterGraphics/OldResourses/Manager.h deleted file mode 100644 index 6de367e3..00000000 --- a/Code/OysterGraphics/OldResourses/Manager.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "../EngineIncludes.h" -#include - -namespace Oyster -{ - namespace Resources - { - struct Manager - { - //Expects to be deleted either trough manager or after a clean - static Oyster::Render::Model* LoadModel(std::string Filename, Matrix Scale); - static void Clean(); - - private: - static std::unordered_map< std::string, Oyster::Render::ModelInfo*> loadedModels; - }; - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/PipelineResources.cpp b/Code/OysterGraphics/OldResourses/PipelineResources.cpp deleted file mode 100644 index 27947c41..00000000 --- a/Code/OysterGraphics/OldResourses/PipelineResources.cpp +++ /dev/null @@ -1,228 +0,0 @@ -#include "PipelineResources.h" - -using namespace Oyster::Resources; - -ID3D11UnorderedAccessView* PipeLineResourses::TempUav = 0; -ID3D11ShaderResourceView* PipeLineResourses::TempSrv = 0; - -ID3D11ShaderResourceView* PipeLineResourses::GeometryOut[5] = {0}; -ID3D11RenderTargetView* PipeLineResourses::GeometryTarget[5] = {0}; - -ID3D11ShaderResourceView* PipeLineResourses::ComputeResources[4] = {0}; -Oyster::Buffer* PipeLineResourses::Resources[2] = {0}; - -ID3D11ShaderResourceView* PipeLineResourses::LightOut[4] = {0}; -ID3D11UnorderedAccessView* PipeLineResourses::LightTarget[4] = {0}; - -ID3D11RenderTargetView* PipeLineResourses::RtvNulls[16] = {0}; -ID3D11ShaderResourceView* PipeLineResourses::SrvNulls[16] = {0}; -ID3D11UnorderedAccessView* PipeLineResourses::uavNULL[16] = {0}; - -//Oyster::Collision3D::Frustrum* PipeLineResourses::SubFrustrums = 0; -int PipeLineResourses::FrustrumSize = 0; -LinearAlgebra::Vector3 PipeLineResourses::FrustrumDimensions = LinearAlgebra::Vector3(); - -Oyster::Resources::BufferDefinitions::LightStructureBuffer PipeLineResourses::LightData = Oyster::Resources::BufferDefinitions::LightStructureBuffer(); - -void PipeLineResourses::Init(int sizeX, int sizeY) -{ - InitGeometry(sizeX, sizeY); - - InitSSAOData(); - InitSubFrustrums(sizeX, sizeY); - InitPointLights(); - InitLightData(); - - InitLighting(sizeX, sizeY); -} - -void PipeLineResourses::InitGeometry(int sizeX, int sizeY) -{ - D3D11_TEXTURE2D_DESC Tdesc; - Tdesc.Width = sizeX; - Tdesc.Height = sizeY; - Tdesc.MipLevels = Tdesc.ArraySize = 1; - Tdesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; - Tdesc.SampleDesc.Count = 1; - Tdesc.SampleDesc.Quality=0; - Tdesc.Usage = D3D11_USAGE_DEFAULT; - Tdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; - Tdesc.CPUAccessFlags = 0; - Tdesc.MiscFlags = 0; - - ID3D11Texture2D *pTexture; - HRESULT hr; - - //Geometry stage resourses - for( int i = 0; i < 5; ++i ) - { - hr = Oyster::Core::Device->CreateTexture2D( &Tdesc, NULL, &pTexture ); - hr = Oyster::Core::Device->CreateShaderResourceView(pTexture,0,&GeometryOut[i]); - hr = Oyster::Core::Device->CreateRenderTargetView(pTexture,0,&GeometryTarget[i]); - pTexture->Release(); - } -} - -void PipeLineResourses::InitSSAOData() -{ - //create Half Spheres and Random Data - - Oyster::Buffer::BUFFER_INIT_DESC desc; - HRESULT hr; - - int NrOfSamples = Oyster::Engine::States::GetNrOfSSAOSamples(); - int SampleSpread = Oyster::Engine::States::GetSSAOSampleSpread(); - - Oyster::Math::Vector3* kernel = new Oyster::Math::Vector3[ NrOfSamples ]; - Oyster::Math::Vector3* random = new Oyster::Math::Vector3[ SampleSpread ]; - - for(int i = 0; i < NrOfSamples; ++i) - { - kernel[i] = Oyster::Math::Vector3::null; - while( kernel[i] == Oyster::Math::Vector3::null ) - { - kernel[i] = Oyster::Math::Vector3( - (float)rand() / (RAND_MAX + 1) * (1 - -1) + -1, - (float)rand() / (RAND_MAX + 1) * (1 - -1) + -1, - (float)rand() / (RAND_MAX + 1) * (1 - 0) + 0); - } - kernel[i].Normalize(); - - float scale = float(i) / float(NrOfSamples); - scale = (0.1f*(1 - scale * scale) + 1.0f *( scale * scale)); - kernel[i] *= scale; - - if( i < SampleSpread) - { - random[i] = Oyster::Math::Vector3::null; - while( random[i] == Oyster::Math::Vector3::null ) - { - random[i] = Oyster::Math::Vector3( - (float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1, - (float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1, - 0.0f); - } - random[i].Normalize(); - } - } - - - D3D11_TEXTURE1D_DESC T1desc; - T1desc.Width = NrOfSamples; - T1desc.MipLevels = T1desc.ArraySize = 1; - T1desc.Format = DXGI_FORMAT_R32G32B32_FLOAT; - T1desc.Usage = D3D11_USAGE_DEFAULT; - T1desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - T1desc.CPUAccessFlags = 0; - T1desc.MiscFlags = 0; - - D3D11_SUBRESOURCE_DATA sphere; - sphere.pSysMem = kernel; - - D3D11_SUBRESOURCE_DATA rnd; - rnd.pSysMem = random; - - - ID3D11Texture1D *pTexture1[2]; - - hr = Oyster::Core::Device->CreateTexture1D( &T1desc, &sphere, &pTexture1[0] ); - hr = Oyster::Core::Device->CreateShaderResourceView( pTexture1[0], 0, &ComputeResources[3] ); - pTexture1[0]->Release(); - delete[] kernel; - - T1desc.Width = SampleSpread; - hr = Oyster::Core::Device->CreateTexture1D( &T1desc, &rnd, &pTexture1[1] ); - hr = Oyster::Core::Device->CreateShaderResourceView( (pTexture1[1]), 0, &ComputeResources[2] ); - pTexture1[1]->Release(); - delete[] random; -} - -void PipeLineResourses::InitSubFrustrums(int sizeX, int sizeY) -{ - FrustrumDimensions.x = (sizeX + 15U) / 16U; - FrustrumDimensions.y = (sizeY + 15U) / 16U; - FrustrumDimensions.z = 1; - FrustrumSize = FrustrumDimensions.x * FrustrumDimensions.y * FrustrumDimensions.z; - //if(SubFrustrums!=0) - //delete[] SubFrustrums; - //SubFrustrums = new Collision3D::Frustrum[ FrustrumSize ]; - - Oyster::Buffer::BUFFER_INIT_DESC desc; - D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; - - //buffer description for SubFrustrums - desc.Usage = Oyster::Buffer::BUFFER_CPU_WRITE_DISCARD; - desc.Type = Oyster::Buffer::STRUCTURED_BUFFER; - desc.ElementSize = sizeof( ::Oyster::Resources::BufferDefinitions::ScreenTileFrustrum); - desc.NumElements = FrustrumSize; - desc.InitData = NULL; - - //create matching srv - srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; - srvDesc.Format = DXGI_FORMAT_UNKNOWN; - srvDesc.Buffer.FirstElement = 0; - srvDesc.Buffer.NumElements = FrustrumSize; - - PipeLineResourses::Resources[0] = Oyster::Engine::Init::Buffers::CreateBuffer(desc); - - HRESULT hr = Oyster::Core::Device->CreateShaderResourceView( *PipeLineResourses::Resources[0], &srvDesc, &Oyster::Resources::PipeLineResourses::ComputeResources[0] ); -} - -void PipeLineResourses::InitPointLights() -{ - D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; - Oyster::Buffer::BUFFER_INIT_DESC desc; - HRESULT hr; - - //buffer description for pointlight - desc.Usage = Oyster::Buffer::BUFFER_CPU_WRITE_DISCARD; - desc.Type = Oyster::Buffer::STRUCTURED_BUFFER; - desc.ElementSize = sizeof(Oyster::Resources::BufferDefinitions::PointLightDescription); - desc.NumElements = Oyster::Engine::States::GetMaxPointlights(); - desc.InitData = NULL; - - PipeLineResourses::Resources[1] = Oyster::Engine::Init::Buffers::CreateBuffer(desc); - - //create matching srv - srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; - srvDesc.Format = DXGI_FORMAT_UNKNOWN; - srvDesc.Buffer.FirstElement = 0; - srvDesc.Buffer.NumElements = Oyster::Engine::States::GetMaxPointlights(); - - hr = Oyster::Core::Device->CreateShaderResourceView( *PipeLineResourses::Resources[1], &srvDesc, &Oyster::Resources::PipeLineResourses::ComputeResources[1] ); -} - -void PipeLineResourses::InitLightData() -{ - LightData.numDispatches = FrustrumDimensions; -} - -void PipeLineResourses::InitLighting(int sizeX, int sizeY) -{ - D3D11_TEXTURE2D_DESC Tdesc; - Tdesc.Width = sizeX; - Tdesc.Height = sizeY; - Tdesc.MipLevels = Tdesc.ArraySize = 1; - Tdesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; - Tdesc.SampleDesc.Count = 1; - Tdesc.SampleDesc.Quality=0; - Tdesc.Usage = D3D11_USAGE_DEFAULT; - Tdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS; - Tdesc.CPUAccessFlags = 0; - Tdesc.MiscFlags = 0; - - ID3D11Texture2D *pTexture; - HRESULT hr; - for(int i = 0; i < 4; ++i ) - { - hr = Oyster::Core::Device->CreateTexture2D( &Tdesc, NULL, &pTexture ); - hr = Oyster::Core::Device->CreateShaderResourceView( pTexture, 0, &(LightOut[i]) ); - hr = Oyster::Core::Device->CreateUnorderedAccessView( pTexture, 0, &(LightTarget[i]) ); - pTexture->Release(); - } - - hr = Oyster::Core::Device->CreateTexture2D( &Tdesc, NULL, &pTexture ); - hr = Oyster::Core::Device->CreateShaderResourceView( pTexture, 0, &TempSrv ); - hr = Oyster::Core::Device->CreateUnorderedAccessView( pTexture, 0, &TempUav ); - pTexture->Release(); -} \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/PipelineResources.h b/Code/OysterGraphics/OldResourses/PipelineResources.h deleted file mode 100644 index 47f89c2d..00000000 --- a/Code/OysterGraphics/OldResourses/PipelineResources.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#ifndef PipeLineResources_H -#define PipeLineResources_H - -#include "..\EngineIncludes.h" - -namespace Oyster -{ - namespace Resources - { - struct PipeLineResourses - { - //0 = Diffuse - //1 = Specular - //2 = Glow - //3 = Pos - //4 = Normal - static ID3D11ShaderResourceView* GeometryOut[5]; - static ID3D11RenderTargetView* GeometryTarget[5]; - - - //0 = TileBuffer - //1 = PointList - //2 = Random - //3 = Sphere - static ID3D11ShaderResourceView* ComputeResources[4]; - static Oyster::Buffer* Resources[2]; - - - //0 = Diffuse - //1 = Specular - //2 = Glow - //3 = SSAO - static ID3D11ShaderResourceView* LightOut[4]; - static ID3D11UnorderedAccessView* LightTarget[4]; - - //0 = BlurTempStorage - static ID3D11UnorderedAccessView* TempUav; - static ID3D11ShaderResourceView* TempSrv; - - static ID3D11RenderTargetView* RtvNulls[16]; - static ID3D11ShaderResourceView* SrvNulls[16]; - static ID3D11UnorderedAccessView* uavNULL[16]; - - //static Oyster::Collision3D::Frustrum* SubFrustrums; - static int FrustrumSize; - static LinearAlgebra::Vector3 FrustrumDimensions; - - static Oyster::Resources::BufferDefinitions::LightStructureBuffer LightData; - - static void Init(int sizeX, int sizeY); - - static void InitGeometry(int sizeX, int sizeY); - - static void InitSSAOData(); - static void InitSubFrustrums(int sizeX, int sizeY); - static void InitPointLights(); - static void InitLightData(); - - static void InitLighting(int sizeX, int sizeY); - }; - } -} - -#endif \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/ShaderEffects.cpp b/Code/OysterGraphics/OldResourses/ShaderEffects.cpp deleted file mode 100644 index 33de3c05..00000000 --- a/Code/OysterGraphics/OldResourses/ShaderEffects.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "ShaderEffects.h" - -namespace Oyster -{ - namespace Resources - { - Core::ShaderManager::ShaderEffect ShaderEffects::BasicSprite = Core::ShaderManager::ShaderEffect(); - Core::ShaderManager::ShaderEffect ShaderEffects::Text2DEffect = Core::ShaderManager::ShaderEffect(); - Core::ShaderManager::ShaderEffect ShaderEffects::ModelEffect = Core::ShaderManager::ShaderEffect(); - - void ShaderEffects::Init() - { - BasicSprite.IAStage.Topology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; - BasicSprite.Shaders.Vertex = Oyster::Core::ShaderManager::Get::Vertex(L"2D"); - BasicSprite.Shaders.Geometry = Oyster::Core::ShaderManager::Get::Geometry(L"2D"); - BasicSprite.Shaders.Pixel = Oyster::Core::ShaderManager::Get::Pixel(L"Texture0"); - - D3D11_BLEND_DESC blendDesc; - blendDesc.AlphaToCoverageEnable=false; - blendDesc.IndependentBlendEnable=false; - blendDesc.RenderTarget[0].BlendEnable=true; - - blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; - blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; - blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - - blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; - blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; - blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_MAX; - - blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - - ID3D11BlendState* blender; - - Oyster::Core::Device->CreateBlendState(&blendDesc,&blender); - - BasicSprite.RenderStates.BlendState = blender; - - ID3D11InputLayout* layout; - - Oyster::Core::ShaderManager::CreateInputLayout(SpriteVertexDesc,1,Oyster::Core::ShaderManager::Get::Vertex(L"2D"),layout); - - BasicSprite.IAStage.Layout = layout; - - Text2DEffect.IAStage.Topology=D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; - Text2DEffect.Shaders.Vertex = Oyster::Core::ShaderManager::Get::Vertex(L"Text"); - Text2DEffect.Shaders.Geometry = Oyster::Core::ShaderManager::Get::Geometry(L"Text"); - Text2DEffect.Shaders.Pixel = Oyster::Core::ShaderManager::Get::Pixel(L"Texture0"); - - Oyster::Core::ShaderManager::CreateInputLayout(Text2DDesc,3,Oyster::Core::ShaderManager::Get::Vertex(L"Text"),layout); - - Text2DEffect.IAStage.Layout = layout; - - blendDesc.AlphaToCoverageEnable = true; - Oyster::Core::Device->CreateBlendState(&blendDesc,&blender); - Text2DEffect.RenderStates.BlendState = blender; - - ModelEffect.IAStage.Topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - Oyster::Core::ShaderManager::CreateInputLayout(ModelDesc,3,Oyster::Core::ShaderManager::Get::Vertex(L"OBJ"),layout); - ModelEffect.IAStage.Layout = layout; - - ModelEffect.Shaders.Vertex = Oyster::Core::ShaderManager::Get::Vertex(L"OBJ"); - ModelEffect.Shaders.Pixel = Oyster::Core::ShaderManager::Get::Pixel(L"OBJDEF"); - - Oyster::Buffer::BUFFER_INIT_DESC desc; - - desc.ElementSize=sizeof(Oyster::Math::Float4x4); - desc.NumElements = 1; - desc.Usage = Oyster::Buffer::BUFFER_CPU_WRITE_DISCARD; - desc.Type = Oyster::Buffer::CONSTANT_BUFFER_VS; - desc.InitData = NULL; - - ModelEffect.CBuffers.Vertex.push_back(Oyster::Engine::Init::Buffers::CreateBuffer(desc)); - ModelEffect.CBuffers.Vertex.push_back(Oyster::Engine::Init::Buffers::CreateBuffer(desc)); - - //use Oyster::Resources::Buffers::CbufferVS for per object data - //perObject = Oyster::Engine::Init::Buffers::CreateBuffer(desc); - - } - - D3D11_INPUT_ELEMENT_DESC ShaderEffects::SpriteVertexDesc[1] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - - D3D11_INPUT_ELEMENT_DESC ShaderEffects::Text2DDesc[3] = - { - {"Position",0, DXGI_FORMAT_R32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"Offset",0, DXGI_FORMAT_R32_SINT, 0, 4, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"CharOffset",0, DXGI_FORMAT_R32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - - D3D11_INPUT_ELEMENT_DESC ShaderEffects::ModelDesc[3] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/OldResourses/ShaderEffects.h b/Code/OysterGraphics/OldResourses/ShaderEffects.h deleted file mode 100644 index 766d63a9..00000000 --- a/Code/OysterGraphics/OldResourses/ShaderEffects.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "../Engine.h" -#include "Buffers.h" - -namespace Oyster -{ - namespace Resources - { - struct ShaderEffects - { - static Oyster::Core::ShaderManager::ShaderEffect BasicSprite; - static Oyster::Core::ShaderManager::ShaderEffect Text2DEffect; - static Oyster::Core::ShaderManager::ShaderEffect ModelEffect; - - static void Init(); - - static D3D11_INPUT_ELEMENT_DESC SpriteVertexDesc[1]; - static D3D11_INPUT_ELEMENT_DESC Text2DDesc[3]; - static D3D11_INPUT_ELEMENT_DESC ModelDesc[3]; - }; - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index e9b8ff72..f0bcb60b 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -206,19 +206,41 @@ - + + Geometry + 5.0 + Geometry + 4.0 + Geometry + 4.0 + Geometry + 4.0 + + + Pixel + Pixel + Pixel + Pixel + + + Vertex + Vertex + Vertex + Vertex + + Compute Compute Compute Compute - + Pixel Pixel Pixel Pixel - + Compute 5.0 Compute @@ -228,7 +250,7 @@ Compute 5.0 - + Vertex Vertex Vertex @@ -273,11 +295,12 @@ - - - - - + + + + + + diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.filters b/Code/OysterGraphics/OysterGraphics.vcxproj.filters index 11d05dde..d53ddc07 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.filters +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.filters @@ -45,10 +45,10 @@ Source Files - + Source Files - + Source Files @@ -86,24 +86,27 @@ Header Files - - Header Files - - - - + + + + + + + - - - - + + + + + + \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index d44eeedc..24059331 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -158,7 +158,6 @@ namespace Oyster for(int b = 0; b < info->BoneCount; ++b) { am.AnimatedData[b] = (BoneAbsAnimated[b] * SkinTransform[b]); - am.BindPoseData[b] = info->bones[b].Absolute;//Math3D::ExtractRotationMatrix(am.animatedData[b]); } //retore to draw animated model diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index 8313bf0f..c922a826 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -8,7 +8,7 @@ typedef Oyster::Graphics::Core::PipelineManager::Get GetShader; typedef Oyster::Graphics::Core::PipelineManager Shader; typedef Oyster::Graphics::Core::Buffer Buffer; -const std::wstring PathToHLSL = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\Deffered Shaders\\"; +const std::wstring PathToHLSL = L"..\\..\\Code\\OysterGraphics\\Shader\\Passes\\"; const std::wstring PathToCSO = L"..\\Content\\Shaders\\"; const int KernelSize = 10; @@ -32,10 +32,12 @@ namespace Oyster Shader::RenderPass Deffered::GeometryPass; Shader::RenderPass Deffered::LightPass; Shader::RenderPass Deffered::PostPass; + Shader::RenderPass Deffered::GuiPass; Buffer Deffered::ModelData = Buffer(); Buffer Deffered::AnimationData = Buffer(); Buffer Deffered::LightConstantsData = Buffer(); + Buffer Deffered::GuiData = Buffer(); Buffer Deffered::PointLightsData = Buffer(); ID3D11ShaderResourceView* Deffered::PointLightView = NULL; @@ -46,18 +48,31 @@ namespace Oyster Core::Init::State Deffered::InitShaders() { - #ifdef _DEBUG - std::wstring path = PathToHLSL; +#ifdef _DEBUG + std::wstring path = PathToHLSL+L"Gather\\"; std::wstring end = L".hlsl"; #else std::wstring path = PathToCSO; std::wstring end = L".cso"; #endif //Load Shaders - Core::PipelineManager::Init(path + L"PixelGatherData" + end, ShaderType::Pixel, L"Geometry"); - Core::PipelineManager::Init(path + L"VertexGatherData" + end, ShaderType::Vertex, L"Geometry"); + Core::PipelineManager::Init(path + L"GatherPixel" + end, ShaderType::Pixel, L"Gather"); + Core::PipelineManager::Init(path + L"GatherVertex" + end, ShaderType::Vertex, L"Gather"); +#ifdef _DEBUG + path = PathToHLSL+L"Light\\"; +#endif Core::PipelineManager::Init(path + L"LightPass" + end, ShaderType::Compute, L"LightPass"); - Core::PipelineManager::Init(path + L"PostPass" + end, ShaderType::Compute, L"PostPass"); +#ifdef _DEBUG + path = PathToHLSL+L"Post\\"; +#endif + Core::PipelineManager::Init(path + L"PostPass" + end, ShaderType::Compute, L"PostPass"); +#ifdef _DEBUG + path = PathToHLSL+L"2D\\"; +#endif + Core::PipelineManager::Init(path + L"2DVertex" + end,ShaderType::Vertex, L"2D"); + Core::PipelineManager::Init(path + L"2DGeometry" + end,ShaderType::Geometry, L"2D"); + Core::PipelineManager::Init(path + L"2DPixel" + end,ShaderType::Pixel, L"2D"); + return Core::Init::State::Success; } @@ -79,6 +94,10 @@ namespace Oyster desc.ElementSize = sizeof(Definitions::AnimationData); AnimationData.Init(desc); + desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; + desc.NumElements = 1; + desc.ElementSize = sizeof(Definitions::GuiData); + desc.ElementSize = sizeof(Definitions::LightConstants); desc.NumElements = 1; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS; @@ -240,8 +259,8 @@ namespace Oyster ////Create ShaderEffects ////---------------- Geometry Pass Setup ---------------------------- - GeometryPass.Shaders.Pixel = GetShader::Pixel(L"Geometry"); - GeometryPass.Shaders.Vertex = GetShader::Vertex(L"Geometry"); + GeometryPass.Shaders.Pixel = GetShader::Pixel(L"Gather"); + GeometryPass.Shaders.Vertex = GetShader::Vertex(L"Gather"); D3D11_INPUT_ELEMENT_DESC indesc[] = { @@ -254,7 +273,7 @@ namespace Oyster { "BONEWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 72, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; - Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout); + Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Gather"),GeometryPass.IAStage.Layout); GeometryPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; GeometryPass.CBuffers.Vertex.push_back(AnimationData); GeometryPass.CBuffers.Vertex.push_back(ModelData); @@ -262,7 +281,7 @@ namespace Oyster GeometryPass.RenderStates.SampleCount = 1; GeometryPass.RenderStates.SampleState = ss; GeometryPass.RenderStates.DepthStencil = dsState; - for(int i = 0; i Quads) +{ + Pixel2DIn output; + output.Pos = mul(float4(-1,-1,0,1) ,Translation); + output.Uv = float2(0,1); + Quads.Append(output); + + output.Pos = mul(float4(-1,1,0,1), Translation); + output.Uv = float2(0,0); + Quads.Append(output); + + output.Pos = mul(float4(1,-1,0,1), Translation); + output.Uv = float2(1,1); + Quads.Append(output); + + output.Pos = mul(float4(1,1,0,1), Translation); + output.Uv = float2(1,0); + Quads.Append(output); +} \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl new file mode 100644 index 00000000..a09111b9 --- /dev/null +++ b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl @@ -0,0 +1,6 @@ +#include "Header.hlsli" + +float4 main(Pixel2DIn input) : SV_Target0 +{ + return Material.Sample(LinearSampler,input.Uv); +} \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/2D/2DVertex.hlsl b/Code/OysterGraphics/Shader/Passes/2D/2DVertex.hlsl new file mode 100644 index 00000000..447d3535 --- /dev/null +++ b/Code/OysterGraphics/Shader/Passes/2D/2DVertex.hlsl @@ -0,0 +1,6 @@ +#include "Header.hlsli" + +Vertex2DIn main(Vertex2DIn input) +{ + return input; +} \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli b/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli new file mode 100644 index 00000000..5a026d34 --- /dev/null +++ b/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli @@ -0,0 +1,18 @@ +struct Vertex2DIn +{ + float2 Pos : Position; +}; + +cbuffer EveryObject2D : register(c0) +{ + float4x4 Translation; +}; + +struct Pixel2DIn +{ + float4 Pos : SV_Position; + float2 Uv : TEXCOORD; +}; + +Texture2D Material : register(t0); +SamplerState LinearSampler : register(s0); \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl b/Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl similarity index 86% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl rename to Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl index cad03013..b0a2f40f 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PixelGatherData.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl @@ -1,4 +1,4 @@ -#include "GBufferHeader.hlsli" +#include "Header.hlsli" PixelOut main(VertexOut input) { diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/Passes/Gather/GatherVertex.hlsl similarity index 67% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl rename to Code/OysterGraphics/Shader/Passes/Gather/GatherVertex.hlsl index 7880d66e..4042c224 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Gather/GatherVertex.hlsl @@ -1,14 +1,9 @@ -#include "GBufferHeader.hlsli" +#include "Header.hlsli" VertexOut main( VertexIn input ) { VertexOut output; - float3 offsetX = input.pos - BindPoseData[input.boneIndex.x][3].xyz; - float3 offsetY = input.pos - BindPoseData[input.boneIndex.y][3].xyz; - float3 offsetZ = input.pos - BindPoseData[input.boneIndex.z][3].xyz; - float3 offsetW = input.pos - BindPoseData[input.boneIndex.w][3].xyz; - Matrix boneTrans = AnimatedData[input.boneIndex.x]*input.boneWeight.x + AnimatedData[input.boneIndex.y]*input.boneWeight.y + AnimatedData[input.boneIndex.z]*input.boneWeight.z + diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli similarity index 92% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli rename to Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli index b87b7235..06583cd6 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli @@ -33,8 +33,6 @@ SamplerState S1 : register(s0); cbuffer Animation : register(b0) { float4x4 AnimatedData[100]; - float4x4 BindPoseData[100]; - float4x4 RotationData[100]; int Animated; float3 Pad; } diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli b/Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli similarity index 71% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli rename to Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli index 1f1061d1..adf01e9d 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/Defines.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Light/Defines.hlsli @@ -27,12 +27,13 @@ cbuffer LightConstants : register(b0) Texture2D DiffuseGlow : register(t0); Texture2D NormalSpec : register(t1); -Texture2D DepthTexture : register(t2); +Texture2D GUI : register(t2); +Texture2D DepthTexture : register(t3); -StructuredBuffer Points : register(t3); +StructuredBuffer Points : register(t4); -Texture1D SSAOKernel : register(t4); -Texture2D SSAORand : register(t5); +Texture1D SSAOKernel : register(t5); +Texture2D SSAORand : register(t6); RWTexture2D Diffuse : register(u0); RWTexture2D Specular : register(u1); diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli b/Code/OysterGraphics/Shader/Passes/Light/LightCalc.hlsli similarity index 100% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli rename to Code/OysterGraphics/Shader/Passes/Light/LightCalc.hlsli diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl similarity index 100% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl rename to Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PosManipulation.hlsli b/Code/OysterGraphics/Shader/Passes/Light/PosManipulation.hlsli similarity index 100% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PosManipulation.hlsli rename to Code/OysterGraphics/Shader/Passes/Light/PosManipulation.hlsli diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli b/Code/OysterGraphics/Shader/Passes/Light/SSAO.hlsli similarity index 100% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli rename to Code/OysterGraphics/Shader/Passes/Light/SSAO.hlsli diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl similarity index 100% rename from Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl rename to Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl From 5119b287d6185eccf6748b7ddd5cc3707c92142e Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 11:52:51 +0100 Subject: [PATCH 14/29] Small progress --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 11 + Code/OysterGraphics/DllInterfaces/GFXAPI.h | 10 + Code/OysterGraphics/OysterGraphics.vcxproj | 2 + .../OysterGraphics.vcxproj.filters | 6 + .../Render/Rendering/GuiRender.cpp | 44 +++ .../Render/Rendering/GuiRender.h | 22 ++ .../Render/Resources/Deffered.cpp | 3 + .../~AutoRecover.OysterGraphics.vcxproj | 287 ------------------ 8 files changed, 98 insertions(+), 287 deletions(-) create mode 100644 Code/OysterGraphics/Render/Rendering/GuiRender.cpp create mode 100644 Code/OysterGraphics/Render/Rendering/GuiRender.h delete mode 100644 Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index b6c1b521..d7d30968 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -8,6 +8,7 @@ #include "../../Misc/Resource/ResourceManager.h" #include "../FileLoader/GeneralLoader.h" #include "../Model/ModelInfo.h" +#include "../Render/Rendering/GuiRender.h" #include namespace Oyster @@ -154,5 +155,15 @@ namespace Oyster o.texturePath = Core::texturePath; return o; } + + void API::StartGuiRender() + { + Render::Rendering::Gui::BeginRender(); + } + + void API::RenderGuiElement(API::Texture tex, Math::Float2 pos, Math::Float2 size) + { + Render::Rendering::Gui::Render((ID3D11Texture2D*)tex,pos,size); + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 555e8a0c..64a774d6 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -29,6 +29,7 @@ namespace Oyster std::wstring modelPath, texturePath; int BytesUsed; }; + typedef void* Texture; static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); #ifdef _DEBUG @@ -51,6 +52,13 @@ namespace Oyster static void RenderScene(Oyster::Graphics::Model::Model models[], int count); //! @brief Renders a single model static void RenderModel(Oyster::Graphics::Model::Model& model); + + //! @brief Configures Renderer to process 2D graphics, data will be passed in to EndFrame() + static void StartGuiRender(); + + //! @brief Renders a single GUI element using the texture provided and the Pos in the upper right corner, %based system + static void RenderGuiElement(Texture, Math::Float2 Pos, Math::Float2 Size); + //! @brief Performs light calculations, post effects and presents the scene static void EndFrame(); @@ -59,6 +67,8 @@ namespace Oyster //! @brief deletes a model and relases the models resources static void DeleteModel(Oyster::Graphics::Model::Model* model); + static Texture CreateTexture(std::wstring filename); + //! @brief adds a light to the scene static void AddLight(Definitions::Pointlight light); //! @brief removes all lights from the scene diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index f0bcb60b..5d92df15 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -182,6 +182,7 @@ + @@ -193,6 +194,7 @@ + diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.filters b/Code/OysterGraphics/OysterGraphics.vcxproj.filters index d53ddc07..67e2ce46 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.filters +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.filters @@ -51,6 +51,9 @@ Source Files + + Source Files + @@ -86,6 +89,9 @@ Header Files + + Header Files + diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.cpp b/Code/OysterGraphics/Render/Rendering/GuiRender.cpp new file mode 100644 index 00000000..923f7123 --- /dev/null +++ b/Code/OysterGraphics/Render/Rendering/GuiRender.cpp @@ -0,0 +1,44 @@ +#include "GuiRender.h" + +namespace Oyster +{ + namespace Graphics + { + namespace Render + { + namespace Rendering + { + void Gui::BeginRender() + { + } + + void Gui::Render(ID3D11Texture2D* tex,Math::Float2 pos, Math::Float2 size) + { + //Oyster::Core::DeviceContext->PSSetShaderResources(0,1,&srv); + + //Pos.x -= instance.sizeX/2; + //Pos.x += size.x/2; + + //Pos.y -= instance.sizeY/2; + //Pos.y += size.y/2; + + //Matrix m; + //m = Math::Matrix::identity; + //float width = (1.0f/(instance.sizeX/2.0f)); + //float height = (1.0f/(instance.sizeY/2.0f)); + //m.m41=Pos.x * width; + //m.m42=-Pos.y * height; + //m.m43=Pos.z; + //m.m11=width*size.x/2; + //m.m22=height*size.y/2; + + //void* dest = Resources::Buffers::CBufferGs.Map(); + //memcpy(dest,&m.GetTranspose(),64); + //Resources::Buffers::CBufferGs.Unmap(); + + //Oyster::Core::DeviceContext->Draw(1,0); + } + } + } + } +} \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.h b/Code/OysterGraphics/Render/Rendering/GuiRender.h new file mode 100644 index 00000000..1d343f32 --- /dev/null +++ b/Code/OysterGraphics/Render/Rendering/GuiRender.h @@ -0,0 +1,22 @@ +#pragma once + +#include "../../Core/Core.h" + +namespace Oyster +{ + namespace Graphics + { + namespace Render + { + namespace Rendering + { + class Gui + { + public: + static void BeginRender(); + static void Render(ID3D11Texture2D* tex, Math::Float2 pos, Math::Float2 size); + }; + } + } + } +} \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index c922a826..e897e0fa 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -337,6 +337,7 @@ namespace Oyster Resources::Deffered::AnimationData.~Buffer(); Resources::Deffered::LightConstantsData.~Buffer(); Resources::Deffered::PointLightsData.~Buffer(); + GuiData.~Buffer(); SAFE_RELEASE(Resources::Deffered::PointLightView); SAFE_RELEASE(Deffered::SSAOKernel); SAFE_RELEASE(Deffered::SSAORandom); @@ -367,6 +368,8 @@ namespace Oyster } SAFE_DELETE_ARRAY(GeometryPass.RenderStates.SampleState); + + SAFE_RELEASE(GuiPass.IAStage.Layout); } } } diff --git a/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj b/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj deleted file mode 100644 index 53ffc005..00000000 --- a/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj +++ /dev/null @@ -1,287 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0EC83E64-230E-48EF-B08C-6AC9651B4F82} - OysterGraphics - - - - DynamicLibrary - true - v110 - MultiByte - - - DynamicLibrary - true - v110 - MultiByte - - - DynamicLibrary - false - v110 - true - MultiByte - - - DynamicLibrary - false - v110 - true - MultiByte - - - - - - - - - - - - - - - - - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) - - - - Level3 - Disabled - true - $(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - - - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - 5.0 - - - - - Level3 - Disabled - true - ..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - 5.0 - - - - - Level3 - Disabled - true - true - true - ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - true - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - true - 5.0 - - - - - Level3 - Disabled - true - true - true - ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - true - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - true - 5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} - - - {f10cbc03-9809-4cba-95d8-327c287b18ee} - - - - - Compute - Compute - Compute - Compute - - - Pixel - Pixel - Pixel - Pixel - - - Compute - 5.0 - Compute - 5.0 - Compute - 5.0 - Compute - 5.0 - - - Vertex - Vertex - Vertex - Vertex - - - Vertex - Vertex - Vertex - Vertex - - - - - 5.0 - - - Pixel - Pixel - Pixel - Pixel - true - 5.0 - main - - - Vertex - Vertex - Vertex - Vertex - true - 5.0 - main - - - - - Pixel - Pixel - Pixel - Pixel - - - - - - - - - - - - - - - \ No newline at end of file From 9a0f363146ca95742edcf6b143f8b85853954ef5 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 13:15:38 +0100 Subject: [PATCH 15/29] framerate double --- .../Definitions/GraphicalDefinition.h | 4 +- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 10 +++++ Code/OysterGraphics/DllInterfaces/GFXAPI.h | 1 + .../Render/Rendering/BasicRender.cpp | 38 +++++-------------- .../Shader/Passes/Gather/Header.hlsli | 4 +- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index ae7bbeb8..41420cce 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -18,6 +18,8 @@ namespace Oyster { Math::Matrix WV; Math::Matrix WVP; + int Animated; + Math::Float3 Pad; }; struct FinalVertex @@ -52,8 +54,6 @@ namespace Oyster struct AnimationData { Math::Float4x4 AnimatedData[100]; - int Animated; - Math::Float3 Pad; }; struct GuiData diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index d7d30968..ff1c632b 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -165,5 +165,15 @@ namespace Oyster { Render::Rendering::Gui::Render((ID3D11Texture2D*)tex,pos,size); } + + API::Texture API::CreateTexture(std::wstring filename) + { + return Core::loader.LoadResource((Core::texturePath + filename).c_str(),Oyster::Graphics::Loading::LoadTexture, Oyster::Graphics::Loading::UnloadTexture); + } + + void API::DeleteTexture(API::Texture tex) + { + Core::loader.ReleaseResource(tex); + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 64a774d6..a6f5ac7d 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -68,6 +68,7 @@ namespace Oyster static void DeleteModel(Oyster::Graphics::Model::Model* model); static Texture CreateTexture(std::wstring filename); + static void DeleteTexture(Texture); //! @brief adds a light to the scene static void AddLight(Definitions::Pointlight light); diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 24059331..f1abb56c 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -72,12 +72,7 @@ namespace Oyster pm.WV = View * models[i].WorldMatrix; pm.WVP = Projection * pm.WV; - void* data = Resources::Deffered::ModelData.Map(); - memcpy(data,&(pm),sizeof(pm)); - Resources::Deffered::ModelData.Unmap(); - - Model::ModelInfo* info = (Model::ModelInfo*)models[i].info; - + Model::ModelInfo* info = models[i].info; Definitions::AnimationData am; //final if(info->Animated && models[i].AnimationPlaying != -1) @@ -105,12 +100,7 @@ namespace Oyster cube2->WorldMatrix = Scale; cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; - //Basic::RenderScene(cube2,1, View, Projection); } - //BoneAnimated[8] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[8].Relative; - //BoneAnimated[31] = Math3D::RotationMatrix(3.14/4, Math::Float3(0, 0, 1)) * info->bones[31].Relative; - ////for each bone in animation - ////HACK use first bone int b = 0; Model::Animation A = info->Animations[models[i].AnimationPlaying]; while(models[i].AnimationTime>A.duration) @@ -160,27 +150,19 @@ namespace Oyster am.AnimatedData[b] = (BoneAbsAnimated[b] * SkinTransform[b]); } - //retore to draw animated model - Definitions::PerModel pm; - pm.WV = View * models[i].WorldMatrix; - pm.WVP = Projection * pm.WV; + + void *data = Resources::Deffered::AnimationData.Map(); + memcpy(data,&am,sizeof(Definitions::AnimationData)); + Resources::Deffered::AnimationData.Unmap(); - void* data = Resources::Deffered::ModelData.Map(); - memcpy(data,&(pm),sizeof(pm)); - Resources::Deffered::ModelData.Unmap(); - - //delete[]SkinTransform; - //delete[]BoneAbsAnimated; - //delete[]BoneAnimated; - - am.Animated = 1; + pm.Animated = 1; } else - am.Animated = 0; + pm.Animated = 0; - data = Resources::Deffered::AnimationData.Map(); - memcpy(data,&am,sizeof(Definitions::AnimationData)); - Resources::Deffered::AnimationData.Unmap(); + void* data = Resources::Deffered::ModelData.Map(); + memcpy(data,&(pm),sizeof(pm)); + Resources::Deffered::ModelData.Unmap(); if(info->Material.size()) { diff --git a/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli index 06583cd6..a313a649 100644 --- a/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli @@ -33,12 +33,12 @@ SamplerState S1 : register(s0); cbuffer Animation : register(b0) { float4x4 AnimatedData[100]; - int Animated; - float3 Pad; } cbuffer PerModel : register(b1) { matrix WV; matrix WVP; + int Animated; + float3 Pad; } \ No newline at end of file From 016bf374597ccdf17f24bdc5d303a5c9765b6c27 Mon Sep 17 00:00:00 2001 From: Tobias Grundel Date: Fri, 7 Feb 2014 13:46:55 +0100 Subject: [PATCH 16/29] First commit save jebuz --- Code/OysterGraphics/OysterGraphics.vcxproj | 21 +++++++++++ .../OysterGraphics.vcxproj.filters | 3 ++ .../Render/Rendering/BasicRender.cpp | 6 ++++ .../Render/Resources/Deffered.cpp | 24 +++++++++++++ .../Render/Resources/Deffered.h | 6 ++++ .../Shader/Passes/Post/BlurHor.hlsl | 33 +++++++++++++++++ .../Shader/Passes/Post/BlurSharedData.hlsli | 35 +++++++++++++++++++ .../Shader/Passes/Post/BlurVert.hlsl | 32 +++++++++++++++++ .../Shader/Passes/Post/PostPass.hlsl | 4 +-- Code/Tester/MainTest.cpp | 18 +++++----- 10 files changed, 171 insertions(+), 11 deletions(-) create mode 100644 Code/OysterGraphics/Shader/Passes/Post/BlurHor.hlsl create mode 100644 Code/OysterGraphics/Shader/Passes/Post/BlurSharedData.hlsli create mode 100644 Code/OysterGraphics/Shader/Passes/Post/BlurVert.hlsl diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index 5d92df15..4ade9218 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -242,6 +242,26 @@ Pixel Pixel + + Compute + 5.0 + Compute + 4.0 + Compute + 4.0 + Compute + 4.0 + + + Compute + 5.0 + Compute + 4.0 + Compute + 4.0 + Compute + 4.0 + Compute 5.0 @@ -304,6 +324,7 @@ + diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.filters b/Code/OysterGraphics/OysterGraphics.vcxproj.filters index 67e2ce46..643249c4 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.filters +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.filters @@ -105,6 +105,8 @@ + + @@ -114,5 +116,6 @@ + \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 24059331..3058a25d 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -209,6 +209,12 @@ namespace Oyster Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); + Core::PipelineManager::SetRenderPass(Resources::Deffered::BlurHorPass); + Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); + + Core::PipelineManager::SetRenderPass(Resources::Deffered::BlurVertPass); + Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); + Core::PipelineManager::SetRenderPass(Resources::Deffered::PostPass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index e897e0fa..adc80eca 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -28,11 +28,16 @@ namespace Oyster ID3D11UnorderedAccessView* Deffered::LBufferUAV[Deffered::LBufferSize] = {0}; ID3D11ShaderResourceView* Deffered::LBufferSRV[Deffered::LBufferSize] = {0}; + + ID3D11UnorderedAccessView* Deffered::BlurBufferUAV = {0}; + ID3D11ShaderResourceView* Deffered::BlurBufferSRV = {0}; Shader::RenderPass Deffered::GeometryPass; Shader::RenderPass Deffered::LightPass; Shader::RenderPass Deffered::PostPass; Shader::RenderPass Deffered::GuiPass; + Shader::RenderPass Deffered::BlurVertPass; //Set this pass second when doing a "fullscreen" blur + Shader::RenderPass Deffered::BlurHorPass; //Set this pass first when doing a "fullscreen" blur Buffer Deffered::ModelData = Buffer(); Buffer Deffered::AnimationData = Buffer(); @@ -66,6 +71,8 @@ namespace Oyster path = PathToHLSL+L"Post\\"; #endif Core::PipelineManager::Init(path + L"PostPass" + end, ShaderType::Compute, L"PostPass"); + Core::PipelineManager::Init(path + L"BlurHor" + end, ShaderType::Compute, L"BlurHor"); + Core::PipelineManager::Init(path + L"BlurVert" + end, ShaderType::Compute, L"BlurVert"); #ifdef _DEBUG path = PathToHLSL+L"2D\\"; #endif @@ -328,6 +335,20 @@ namespace Oyster GuiPass.RenderStates.SampleCount = 1; GuiPass.RenderStates.SampleState = ss; + ////---------------- Blur Pass Setup ---------------------------- + BlurHorPass.Shaders.Compute = GetShader::Compute(L"BlurHor"); + BlurVertPass.Shaders.Compute = GetShader::Compute(L"BlurVert"); + + //Taking the Ambient SRV from LBufferSRV and setting it as input texture + BlurHorPass.SRV.Compute.push_back(LBufferSRV[2]); + //Output texture is the Blur UAV buffer + BlurHorPass.UAV.Compute.push_back(BlurBufferUAV); + + //Taking the Blur SRV and setting it as input texture now + BlurVertPass.SRV.Compute.push_back(BlurBufferSRV); + //And the Ambient UAV is now the output texture + BlurVertPass.UAV.Compute.push_back(LBufferUAV[2]); + return Core::Init::State::Success; } @@ -342,6 +363,9 @@ namespace Oyster SAFE_RELEASE(Deffered::SSAOKernel); SAFE_RELEASE(Deffered::SSAORandom); + SAFE_RELEASE(BlurBufferSRV); + SAFE_RELEASE(BlurBufferUAV); + for(int i = 0; i< GBufferSize; ++i) { SAFE_RELEASE(GBufferRTV[i]); diff --git a/Code/OysterGraphics/Render/Resources/Deffered.h b/Code/OysterGraphics/Render/Resources/Deffered.h index a1ae6c4f..72fa039f 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.h +++ b/Code/OysterGraphics/Render/Resources/Deffered.h @@ -32,9 +32,15 @@ namespace Oyster static ID3D11UnorderedAccessView* LBufferUAV[LBufferSize]; static ID3D11ShaderResourceView* LBufferSRV[LBufferSize]; + //Blur UAV and SRV + static ID3D11UnorderedAccessView* BlurBufferUAV; + static ID3D11ShaderResourceView* BlurBufferSRV; + static Core::PipelineManager::RenderPass GeometryPass; static Core::PipelineManager::RenderPass GuiPass; static Core::PipelineManager::RenderPass LightPass; + static Core::PipelineManager::RenderPass BlurHorPass; + static Core::PipelineManager::RenderPass BlurVertPass; static Core::PipelineManager::RenderPass PostPass; diff --git a/Code/OysterGraphics/Shader/Passes/Post/BlurHor.hlsl b/Code/OysterGraphics/Shader/Passes/Post/BlurHor.hlsl new file mode 100644 index 00000000..7489cd41 --- /dev/null +++ b/Code/OysterGraphics/Shader/Passes/Post/BlurHor.hlsl @@ -0,0 +1,33 @@ +#include "BlurSharedData.hlsli" + +[numthreads(N,1,1)] +void main(int3 ThreadID : SV_DispatchThreadID, int3 gThreadID : SV_GroupThreadID) +{ + + if(gThreadID.x < blurRadius) + { + int x = max(ThreadID.x-blurRadius,0); + gCache[gThreadID.x] = inTex[int2(x,ThreadID.y)]; + } + if(gThreadID.x >= N-blurRadius) + { + int x = min(ThreadID.x+blurRadius,inTex.Length.x-1); + gCache[gThreadID.x+2*blurRadius] = inTex[int2(x,ThreadID.y)]; + } + gCache[gThreadID.x+blurRadius] = inTex[min(ThreadID.xy,inTex.Length.xy-1)]; + + GroupMemoryBarrierWithGroupSync(); + + float4 blurCol = float4(0,0,0,0); + + [unroll] + for(int i = -blurRadius; i <= blurRadius;++i) + { + int k = gThreadID.x + blurRadius + i; + blurCol +=Weights[i + blurRadius] * gCache[k]; + } + + outTex[ThreadID.xy] = blurCol; + //Output[ThreadID.xy] = Diffuse[((ThreadID.xy))]; +} + diff --git a/Code/OysterGraphics/Shader/Passes/Post/BlurSharedData.hlsli b/Code/OysterGraphics/Shader/Passes/Post/BlurSharedData.hlsli new file mode 100644 index 00000000..8a7b5fd1 --- /dev/null +++ b/Code/OysterGraphics/Shader/Passes/Post/BlurSharedData.hlsli @@ -0,0 +1,35 @@ +#ifndef BLURSHAREDDATA +#define BLURSHAREDDATA + + + +static const float Weights[9] = +{ + 0.05f, 0.05f, 0.1f, 0.15f, 0.3f, 0.15f, 0.1f, 0.05f, 0.05f +}; + +static const int blurRadius = 4; + +#define N 128 +#define gSize (N+2*blurRadius) +groupshared float4 gCache[gSize]; + +Texture2D inTex : register(t0); +RWTexture2D outTex : register(u0); + +//cbuffer BlurrData : register(c0) +//{ +// static const int blurRadius = 5; +// static const float Weights[11] = +// { +// 0.05f,0.05f,0.1f,0.1f,0.1f,0.2f,0.1f,0.1f,0.1f,0.05f,0.05f +// }; +//}; + +//[numthreads(16,16,1)] +//void TryCompute(uint3 ThreadID : SV_DispatchThreadID) +//{ +// Output[ThreadID.xy] = Diffuse[ThreadID.xy]*0.5f+Glow[ThreadID.xy]*Glow[ThreadID.xy].w; +//} + +#endif \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Post/BlurVert.hlsl b/Code/OysterGraphics/Shader/Passes/Post/BlurVert.hlsl new file mode 100644 index 00000000..aa5e4a27 --- /dev/null +++ b/Code/OysterGraphics/Shader/Passes/Post/BlurVert.hlsl @@ -0,0 +1,32 @@ +#include "BlurSharedData.hlsli" + +[numthreads(1,N,1)] +void main(int3 ThreadID : SV_DispatchThreadID, int3 gThreadID : SV_GroupThreadID) +{ + + if(gThreadID.y < blurRadius) + { + int y = max(ThreadID.y-blurRadius,0); + gCache[gThreadID.y] = inTex[int2(ThreadID.x,y)]; + } + if(gThreadID.y >= N-blurRadius) + { + int y = min(ThreadID.y+blurRadius,inTex.Length.y-1); + gCache[gThreadID.y+2*blurRadius] = inTex[int2(ThreadID.x,y)]; + } + gCache[gThreadID.y+blurRadius] = inTex[min(ThreadID.xy,inTex.Length.xy-1)]; + + GroupMemoryBarrierWithGroupSync(); + + float4 blurCol = float4(0,0,0,0); + + [unroll] + for(int i = -blurRadius; i <= blurRadius;++i) + { + int k = gThreadID.y + blurRadius + i; + blurCol +=Weights[i + blurRadius] * gCache[k]; + } + + outTex[ThreadID.xy] = blurCol; + //Output[ThreadID.xy] = inTex[((ThreadID.xy))]; +} \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index b3abc0df..3956d9b6 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -13,6 +13,6 @@ void main( uint3 DTid : SV_DispatchThreadID ) float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; - Output[DTid.xy] = Light + Amb * AmbFactor; - //Output[DTid.xy] = Ambient[DTid.xy/2].w; + //Output[DTid.xy] = Light + Amb * AmbFactor; + Output[DTid.xy] = Ambient[DTid.xy/2].w; } \ No newline at end of file diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 99ba7b76..0c4262dc 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -161,11 +161,11 @@ HRESULT InitDirect3D() return E_FAIL; } - m = Oyster::Graphics::API::CreateModel(L"untitled.dan"); - m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.dan"); + m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); + /*m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.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; + 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); @@ -194,13 +194,13 @@ HRESULT Update(float deltaTime) { angle += Oyster::Math::pi/16 * deltaTime; - //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); - 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::Math::Matrix ma = Oyster::Math::Matrix::identity; + m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); + /*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::Math::Matrix ma = Oyster::Math::Matrix::identity;*/ //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; } @@ -210,8 +210,8 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::SetView(V); Oyster::Graphics::API::NewFrame(); - //Oyster::Graphics::API::RenderModel(*m); - Oyster::Graphics::API::RenderModel(*m2); + Oyster::Graphics::API::RenderModel(*m); + //Oyster::Graphics::API::RenderModel(*m2); //Oyster::Graphics::API::RenderModel(*m3); Oyster::Graphics::API::EndFrame(); From d9133f459a57a32804fad5a7f4a9d1bbe8f1a2af Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 13:47:09 +0100 Subject: [PATCH 17/29] 2d Almost working --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 2 +- .../Render/Rendering/GuiRender.cpp | 39 +++++++++---------- .../Render/Rendering/GuiRender.h | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index ff1c632b..36b8653f 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -163,7 +163,7 @@ namespace Oyster void API::RenderGuiElement(API::Texture tex, Math::Float2 pos, Math::Float2 size) { - Render::Rendering::Gui::Render((ID3D11Texture2D*)tex,pos,size); + Render::Rendering::Gui::Render((ID3D11ShaderResourceView*)tex,pos,size); } API::Texture API::CreateTexture(std::wstring filename) diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.cpp b/Code/OysterGraphics/Render/Rendering/GuiRender.cpp index 923f7123..f347daf2 100644 --- a/Code/OysterGraphics/Render/Rendering/GuiRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/GuiRender.cpp @@ -1,4 +1,6 @@ #include "GuiRender.h" +#include "../Resources/Deffered.h" +#include "../../Definitions/GraphicalDefinition.h" namespace Oyster { @@ -12,31 +14,28 @@ namespace Oyster { } - void Gui::Render(ID3D11Texture2D* tex,Math::Float2 pos, Math::Float2 size) + void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float2 pos, Math::Float2 size) { - //Oyster::Core::DeviceContext->PSSetShaderResources(0,1,&srv); + Core::deviceContext->PSSetShaderResources(0,1,&tex); - //Pos.x -= instance.sizeX/2; - //Pos.x += size.x/2; + pos *= 2; + pos -= 1; + pos.y *= -1; - //Pos.y -= instance.sizeY/2; - //Pos.y += size.y/2; + Definitions::GuiData gd; - //Matrix m; - //m = Math::Matrix::identity; - //float width = (1.0f/(instance.sizeX/2.0f)); - //float height = (1.0f/(instance.sizeY/2.0f)); - //m.m41=Pos.x * width; - //m.m42=-Pos.y * height; - //m.m43=Pos.z; - //m.m11=width*size.x/2; - //m.m22=height*size.y/2; - - //void* dest = Resources::Buffers::CBufferGs.Map(); - //memcpy(dest,&m.GetTranspose(),64); - //Resources::Buffers::CBufferGs.Unmap(); + gd.Translation = Math::Matrix::identity; + gd.Translation.m41 = pos.x; + gd.Translation.m42 = pos.y; + gd.Translation.m11 = size.x; + gd.Translation.m22 = size.y; - //Oyster::Core::DeviceContext->Draw(1,0); + + void* data = Render::Resources::Deffered::GuiData.Map(); + memcpy(data,&gd,sizeof(gd)); + Render::Resources::Deffered::GuiData.Unmap(); + + Core::deviceContext->Draw(1,0); } } } diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.h b/Code/OysterGraphics/Render/Rendering/GuiRender.h index 1d343f32..d7e25dd7 100644 --- a/Code/OysterGraphics/Render/Rendering/GuiRender.h +++ b/Code/OysterGraphics/Render/Rendering/GuiRender.h @@ -14,7 +14,7 @@ namespace Oyster { public: static void BeginRender(); - static void Render(ID3D11Texture2D* tex, Math::Float2 pos, Math::Float2 size); + static void Render(ID3D11ShaderResourceView* tex, Math::Float2 pos, Math::Float2 size); }; } } From 1de325c5a6ccd27ee58271f157d26e3794357ea5 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 15:52:07 +0100 Subject: [PATCH 18/29] Fixed cleaning up Deffered.cpp --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 32 ++- Code/OysterGraphics/OysterGraphics.vcxproj | 18 +- .../OysterGraphics.vcxproj.filters | 30 +-- .../BasicRender.cpp => DefaultRenderer.cpp} | 53 ++-- Code/OysterGraphics/Render/DefaultRenderer.h | 25 ++ .../GuiRender.cpp => GuiRenderer.cpp} | 10 +- .../{Rendering/GuiRender.h => GuiRenderer.h} | 2 +- Code/OysterGraphics/Render/Rendering/Render.h | 29 --- .../{Resources/Deffered.cpp => Resources.cpp} | 232 ++++++++++-------- Code/OysterGraphics/Render/Resources.h | 91 +++++++ .../OysterGraphics/Render/Resources/Debug.cpp | 53 ---- Code/OysterGraphics/Render/Resources/Debug.h | 39 --- .../Render/Resources/Deffered.h | 69 ------ .../Shader/Passes/{Post => Blur}/BlurHor.hlsl | 0 .../{Post => Blur}/BlurSharedData.hlsli | 0 .../Passes/{Post => Blur}/BlurVert.hlsl | 0 .../Shader/Passes/Post/PostPass.hlsl | 4 +- Code/Tester/MainTest.cpp | 25 +- 18 files changed, 331 insertions(+), 381 deletions(-) rename Code/OysterGraphics/Render/{Rendering/BasicRender.cpp => DefaultRenderer.cpp} (78%) create mode 100644 Code/OysterGraphics/Render/DefaultRenderer.h rename Code/OysterGraphics/Render/{Rendering/GuiRender.cpp => GuiRenderer.cpp} (74%) rename Code/OysterGraphics/Render/{Rendering/GuiRender.h => GuiRenderer.h} (90%) delete mode 100644 Code/OysterGraphics/Render/Rendering/Render.h rename Code/OysterGraphics/Render/{Resources/Deffered.cpp => Resources.cpp} (61%) create mode 100644 Code/OysterGraphics/Render/Resources.h delete mode 100644 Code/OysterGraphics/Render/Resources/Debug.cpp delete mode 100644 Code/OysterGraphics/Render/Resources/Debug.h delete mode 100644 Code/OysterGraphics/Render/Resources/Deffered.h rename Code/OysterGraphics/Shader/Passes/{Post => Blur}/BlurHor.hlsl (100%) rename Code/OysterGraphics/Shader/Passes/{Post => Blur}/BlurSharedData.hlsli (100%) rename Code/OysterGraphics/Shader/Passes/{Post => Blur}/BlurVert.hlsl (100%) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 36b8653f..06579b48 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -1,14 +1,12 @@ #include "GFXAPI.h" #include "../Core/Core.h" -#include "../Render/Resources/Debug.h" -#include "../Render/Resources/Deffered.h" -#include "../Render/Rendering/Render.h" +#include "../Render/Resources.h" +#include "../Render/DefaultRenderer.h" #include "../FileLoader/ObjReader.h" -//#include "../../Misc/Resource/OysterResource.h" #include "../../Misc/Resource/ResourceManager.h" #include "../FileLoader/GeneralLoader.h" #include "../Model/ModelInfo.h" -#include "../Render/Rendering/GuiRender.h" +#include "../Render/GuiRenderer.h" #include namespace Oyster @@ -30,11 +28,11 @@ namespace Oyster { return API::Fail; } - Render::Resources::Deffered::Init(); + Render::Resources::Init(); Render::Preparations::Basic::SetViewPort(); - Render::Rendering::Basic::cube = API::CreateModel(L"box.dan"); - Render::Rendering::Basic::cube2 = API::CreateModel(L"box2.dan"); + Render::DefaultRenderer::cube = API::CreateModel(L"box.dan"); + Render::DefaultRenderer::cube2 = API::CreateModel(L"box2.dan"); return API::Sucsess; } @@ -52,27 +50,27 @@ namespace Oyster { if(Lights.size()) { - Render::Rendering::Basic::NewFrame(View, Projection, &Lights[0], (int)Lights.size()); + Render::DefaultRenderer::NewFrame(View, Projection, &Lights[0], (int)Lights.size()); } else { - Render::Rendering::Basic::NewFrame(View, Projection, NULL, 0); + Render::DefaultRenderer::NewFrame(View, Projection, NULL, 0); } } void API::RenderScene(Model::Model models[], int count) { - Render::Rendering::Basic::RenderScene(models,count, View, Projection); + Render::DefaultRenderer::RenderScene(models,count, View, Projection); } void API::RenderModel(Model::Model& m) { - Render::Rendering::Basic::RenderScene(&m,1, View, Projection); + Render::DefaultRenderer::RenderScene(&m,1, View, Projection); } void API::EndFrame() { - Render::Rendering::Basic::EndFrame(); + Render::DefaultRenderer::EndFrame(); } API::State API::SetOptions(API::Option option) @@ -112,12 +110,12 @@ namespace Oyster void API::Clean() { - DeleteModel(Render::Rendering::Basic::cube); - DeleteModel(Render::Rendering::Basic::cube2); + DeleteModel(Render::DefaultRenderer::cube); + DeleteModel(Render::DefaultRenderer::cube2); SAFE_DELETE(Core::viewPort); Core::loader.Clean(); Oyster::Graphics::Core::PipelineManager::Clean(); - Oyster::Graphics::Render::Resources::Deffered::Clean(); + Oyster::Graphics::Render::Resources::Clean(); SAFE_RELEASE(Core::depthStencil); SAFE_RELEASE(Core::depthStencilUAV); @@ -142,7 +140,7 @@ namespace Oyster #ifdef _DEBUG API::State API::ReloadShaders() { - Render::Resources::Deffered::InitShaders(); + Render::Resources::InitShaders(); return State::Sucsess; } #endif diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index 4ade9218..ca2e776b 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -181,9 +181,9 @@ - - - + + + @@ -194,10 +194,10 @@ - - + + - + @@ -242,7 +242,7 @@ Pixel Pixel - + Compute 5.0 Compute @@ -252,7 +252,7 @@ Compute 4.0 - + Compute 5.0 Compute @@ -324,7 +324,7 @@ - + diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.filters b/Code/OysterGraphics/OysterGraphics.vcxproj.filters index 643249c4..4fcaee03 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.filters +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.filters @@ -24,9 +24,6 @@ Source Files - - Source Files - Source Files @@ -42,16 +39,19 @@ Source Files - - Source Files - Source Files Source Files - + + Source Files + + + Source Files + + Source Files @@ -62,9 +62,6 @@ Header Files - - Header Files - Header Files @@ -86,10 +83,13 @@ Header Files - + Header Files - + + Header Files + + Header Files @@ -105,8 +105,8 @@ - - + + @@ -116,6 +116,6 @@ - + \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp similarity index 78% rename from Code/OysterGraphics/Render/Rendering/BasicRender.cpp rename to Code/OysterGraphics/Render/DefaultRenderer.cpp index 5e18419b..36e5475d 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -1,8 +1,8 @@ -#include "Render.h" -#include "../Resources/Deffered.h" -#include "../../Definitions/GraphicalDefinition.h" -#include "../../Model/ModelInfo.h" -#include "../../DllInterfaces/GFXAPI.h" +#include "DefaultRenderer.h" +#include "Resources.h" +#include "../Definitions/GraphicalDefinition.h" +#include "../Model/ModelInfo.h" +#include "../DllInterfaces/GFXAPI.h" #include #include @@ -12,17 +12,15 @@ namespace Oyster { namespace Render { - namespace Rendering - { Definitions::Pointlight pl; - Model::Model* Basic::cube = NULL; - Model::Model* Basic::cube2 = NULL; + Model::Model* DefaultRenderer::cube = NULL; + Model::Model* DefaultRenderer::cube2 = NULL; - void Basic::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) + void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) { Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,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); + Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,1)); + Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Gather::Pass); void* data; @@ -34,13 +32,13 @@ namespace Oyster lc.Proj = Projection; lc.SSAORadius = 3; - data = Resources::Deffered::LightConstantsData.Map(); + data = Resources::Light::LightConstantsData.Map(); memcpy(data, &lc, sizeof(Definitions::LightConstants)); - Resources::Deffered::LightConstantsData.Unmap(); + Resources::Light::LightConstantsData.Unmap(); - data = Resources::Deffered::PointLightsData.Map(); + data = Resources::Light::PointLightsData.Map(); memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); - Resources::Deffered::PointLightsData.Unmap(); + Resources::Light::PointLightsData.Unmap(); } Math::Matrix RecursiveBindPosRotation(int index, Model::ModelInfo* mi) @@ -60,7 +58,7 @@ namespace Oyster return Math::Vector4(RecursiveBindPosPosition(mi->bones->Parent, mi).xyz + (mi->bones[index].Relative.v[3] * RecursiveBindPosRotation(mi->bones->Parent,mi)).xyz,1); } - void Basic::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) { for(int i = 0; i < count; ++i) { @@ -141,7 +139,7 @@ namespace Oyster cube->WorldMatrix = Scale; cube->WorldMatrix.v[3] = BoneAbsAnimated[b].v[3]; cube->WorldMatrix = models[i].WorldMatrix * cube->WorldMatrix; - Basic::RenderScene(cube,1,View,Projection); + DefaultRenderer::RenderScene(cube,1,View,Projection); } //write data to am @@ -151,18 +149,18 @@ namespace Oyster } - void *data = Resources::Deffered::AnimationData.Map(); + void *data = Resources::Gather::AnimationData.Map(); memcpy(data,&am,sizeof(Definitions::AnimationData)); - Resources::Deffered::AnimationData.Unmap(); + Resources::Gather::AnimationData.Unmap(); pm.Animated = 1; } else pm.Animated = 0; - void* data = Resources::Deffered::ModelData.Map(); + void* data = Resources::Gather::ModelData.Map(); memcpy(data,&(pm),sizeof(pm)); - Resources::Deffered::ModelData.Unmap(); + Resources::Gather::ModelData.Unmap(); if(info->Material.size()) { @@ -185,25 +183,24 @@ namespace Oyster } - void Basic::EndFrame() + void DefaultRenderer::EndFrame() { - Core::PipelineManager::SetRenderPass(Resources::Deffered::LightPass); + Core::PipelineManager::SetRenderPass(Resources::Light::Pass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); - Core::PipelineManager::SetRenderPass(Resources::Deffered::BlurHorPass); + Core::PipelineManager::SetRenderPass(Resources::Blur::HorPass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); - Core::PipelineManager::SetRenderPass(Resources::Deffered::BlurVertPass); + Core::PipelineManager::SetRenderPass(Resources::Blur::VertPass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); - Core::PipelineManager::SetRenderPass(Resources::Deffered::PostPass); + Core::PipelineManager::SetRenderPass(Resources::PostPass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); Core::swapChain->Present(0,0); } - } } } } \ No newline at end of file diff --git a/Code/OysterGraphics/Render/DefaultRenderer.h b/Code/OysterGraphics/Render/DefaultRenderer.h new file mode 100644 index 00000000..5402f310 --- /dev/null +++ b/Code/OysterGraphics/Render/DefaultRenderer.h @@ -0,0 +1,25 @@ +#pragma once +#include "..\Definitions\GraphicalDefinition.h" +#include "..\Core\Core.h" +#include "Preparations\Preparations.h" +#include "..\Model\Model.h" + +namespace Oyster +{ + namespace Graphics + { + namespace Render + { + class DefaultRenderer + { + public: + 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 EndFrame(); + + static Model::Model* cube; + static Model::Model* cube2; + }; + } + } +} \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.cpp b/Code/OysterGraphics/Render/GuiRenderer.cpp similarity index 74% rename from Code/OysterGraphics/Render/Rendering/GuiRender.cpp rename to Code/OysterGraphics/Render/GuiRenderer.cpp index f347daf2..dabb2a7b 100644 --- a/Code/OysterGraphics/Render/Rendering/GuiRender.cpp +++ b/Code/OysterGraphics/Render/GuiRenderer.cpp @@ -1,6 +1,6 @@ -#include "GuiRender.h" -#include "../Resources/Deffered.h" -#include "../../Definitions/GraphicalDefinition.h" +#include "GuiRenderer.h" +#include "Resources.h" +#include "../Definitions/GraphicalDefinition.h" namespace Oyster { @@ -31,9 +31,9 @@ namespace Oyster gd.Translation.m22 = size.y; - void* data = Render::Resources::Deffered::GuiData.Map(); + void* data = Render::Resources::Gui::Data.Map(); memcpy(data,&gd,sizeof(gd)); - Render::Resources::Deffered::GuiData.Unmap(); + Render::Resources::Gui::Data.Unmap(); Core::deviceContext->Draw(1,0); } diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.h b/Code/OysterGraphics/Render/GuiRenderer.h similarity index 90% rename from Code/OysterGraphics/Render/Rendering/GuiRender.h rename to Code/OysterGraphics/Render/GuiRenderer.h index d7e25dd7..c722ae24 100644 --- a/Code/OysterGraphics/Render/Rendering/GuiRender.h +++ b/Code/OysterGraphics/Render/GuiRenderer.h @@ -1,6 +1,6 @@ #pragma once -#include "../../Core/Core.h" +#include "../Core/Core.h" namespace Oyster { diff --git a/Code/OysterGraphics/Render/Rendering/Render.h b/Code/OysterGraphics/Render/Rendering/Render.h deleted file mode 100644 index f8ac7aed..00000000 --- a/Code/OysterGraphics/Render/Rendering/Render.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include "..\..\Definitions\GraphicalDefinition.h" -#include "..\..\Core\Core.h" -#include "..\Preparations\Preparations.h" -#include "..\..\Model\Model.h" - -namespace Oyster -{ - namespace Graphics - { - namespace Render - { - namespace Rendering - { - class Basic - { - public: - - 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 EndFrame(); - - static Model::Model* cube; - static Model::Model* cube2; - }; - } - } - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources.cpp similarity index 61% rename from Code/OysterGraphics/Render/Resources/Deffered.cpp rename to Code/OysterGraphics/Render/Resources.cpp index adc80eca..b59b5844 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -1,7 +1,7 @@ #pragma once -#include "Deffered.h" -#include "..\..\Definitions\GraphicalDefinition.h" +#include "Resources.h" +#include "..\Definitions\GraphicalDefinition.h" typedef Oyster::Graphics::Core::PipelineManager::ShaderType ShaderType; typedef Oyster::Graphics::Core::PipelineManager::Get GetShader; @@ -20,38 +20,40 @@ namespace Oyster { namespace Render { - namespace Resources - { - ID3D11RenderTargetView* Deffered::GBufferRTV[Deffered::GBufferSize] = {0}; - ID3D11ShaderResourceView* Deffered::GBufferSRV[Deffered::GBufferSize] = {0}; + ID3D11RenderTargetView* Resources::GBufferRTV[Resources::GBufferSize] = {0}; + ID3D11ShaderResourceView* Resources::GBufferSRV[Resources::GBufferSize] = {0}; - ID3D11UnorderedAccessView* Deffered::LBufferUAV[Deffered::LBufferSize] = {0}; - ID3D11ShaderResourceView* Deffered::LBufferSRV[Deffered::LBufferSize] = {0}; + ID3D11UnorderedAccessView* Resources::LBufferUAV[Resources::LBufferSize] = {0}; + ID3D11ShaderResourceView* Resources::LBufferSRV[Resources::LBufferSize] = {0}; - ID3D11UnorderedAccessView* Deffered::BlurBufferUAV = {0}; - ID3D11ShaderResourceView* Deffered::BlurBufferSRV = {0}; + ID3D11UnorderedAccessView* Resources::Blur::BufferUAV = {0}; + ID3D11ShaderResourceView* Resources::Blur::BufferSRV = {0}; - Shader::RenderPass Deffered::GeometryPass; - Shader::RenderPass Deffered::LightPass; - Shader::RenderPass Deffered::PostPass; - Shader::RenderPass Deffered::GuiPass; - Shader::RenderPass Deffered::BlurVertPass; //Set this pass second when doing a "fullscreen" blur - Shader::RenderPass Deffered::BlurHorPass; //Set this pass first when doing a "fullscreen" blur + Shader::RenderPass Resources::Gather::Pass; + Shader::RenderPass Resources::Light::Pass; + Shader::RenderPass Resources::PostPass; + Shader::RenderPass Resources::Gui::Pass; + Shader::RenderPass Resources::Blur::VertPass; //Set this pass second when doing a "fullscreen" blur + Shader::RenderPass Resources::Blur::HorPass; //Set this pass first when doing a "fullscreen" blur - Buffer Deffered::ModelData = Buffer(); - Buffer Deffered::AnimationData = Buffer(); - Buffer Deffered::LightConstantsData = Buffer(); - Buffer Deffered::GuiData = Buffer(); + Buffer Resources::Gather::ModelData = Buffer(); + Buffer Resources::Gather::AnimationData = Buffer(); + Buffer Resources::Light::LightConstantsData = Buffer(); + Buffer Resources::Gui::Data = Buffer(); - Buffer Deffered::PointLightsData = Buffer(); - ID3D11ShaderResourceView* Deffered::PointLightView = NULL; + Buffer Resources::Light::PointLightsData = Buffer(); + ID3D11ShaderResourceView* Resources::Light::PointLightView = NULL; - ID3D11ShaderResourceView* Deffered::SSAOKernel = NULL; - ID3D11ShaderResourceView* Deffered::SSAORandom = NULL; + ID3D11ShaderResourceView* Resources::Light::SSAOKernel = NULL; + ID3D11ShaderResourceView* Resources::Light::SSAORandom = NULL; + + ID3D11RasterizerState* Resources::RenderStates::rs = NULL; + ID3D11SamplerState** Resources::RenderStates::ss = new ID3D11SamplerState*[1]; + ID3D11DepthStencilState* Resources::RenderStates::dsState = NULL; - Core::Init::State Deffered::InitShaders() + Core::Init::State Resources::InitShaders() { #ifdef _DEBUG std::wstring path = PathToHLSL+L"Gather\\"; @@ -71,6 +73,9 @@ namespace Oyster path = PathToHLSL+L"Post\\"; #endif Core::PipelineManager::Init(path + L"PostPass" + end, ShaderType::Compute, L"PostPass"); +#ifdef _DEBUG + path = PathToHLSL+L"Blur\\"; +#endif Core::PipelineManager::Init(path + L"BlurHor" + end, ShaderType::Compute, L"BlurHor"); Core::PipelineManager::Init(path + L"BlurVert" + end, ShaderType::Compute, L"BlurVert"); #ifdef _DEBUG @@ -83,10 +88,8 @@ namespace Oyster return Core::Init::State::Success; } - Core::Init::State Deffered::Init() + Core::Init::State Resources::InitBuffers() { - InitShaders(); - //Create Buffers Buffer::BUFFER_INIT_DESC desc; desc.ElementSize = sizeof(Definitions::PerModel); @@ -95,11 +98,11 @@ namespace Oyster desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_VS; desc.Usage = Buffer::BUFFER_USAGE::BUFFER_CPU_WRITE_DISCARD; - ModelData.Init(desc); + Gather::ModelData.Init(desc); desc.NumElements = 1; desc.ElementSize = sizeof(Definitions::AnimationData); - AnimationData.Init(desc); + Gather::AnimationData.Init(desc); desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; desc.NumElements = 1; @@ -109,13 +112,17 @@ namespace Oyster desc.NumElements = 1; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS; - LightConstantsData.Init(desc); + Light::LightConstantsData.Init(desc); desc.ElementSize = sizeof(Definitions::Pointlight); desc.NumElements = MaxLightSize; desc.Type = Buffer::STRUCTURED_BUFFER; - PointLightsData.Init(desc); + Light::PointLightsData.Init(desc); + return Core::Init::Success; + } + Core::Init::State Resources::InitRenderStates() + { ////Create States D3D11_RASTERIZER_DESC rdesc; rdesc.CullMode = D3D11_CULL_BACK; @@ -129,8 +136,8 @@ namespace Oyster rdesc.MultisampleEnable = false; rdesc.AntialiasedLineEnable = false; - ID3D11RasterizerState* rs = NULL; - Oyster::Graphics::Core::device->CreateRasterizerState(&rdesc,&rs); + + Oyster::Graphics::Core::device->CreateRasterizerState(&rdesc,&RenderStates::rs); D3D11_SAMPLER_DESC sdesc; sdesc.Filter = D3D11_FILTER_ANISOTROPIC; @@ -144,8 +151,8 @@ namespace Oyster sdesc.MinLOD = 0; sdesc.MaxLOD = D3D11_FLOAT32_MAX; - ID3D11SamplerState** ss = new ID3D11SamplerState*[1]; - Oyster::Graphics::Core::device->CreateSamplerState(&sdesc,ss); + + Oyster::Graphics::Core::device->CreateSamplerState(&sdesc,RenderStates::ss); D3D11_DEPTH_STENCIL_DESC ddesc; ddesc.DepthEnable = true; @@ -166,23 +173,27 @@ namespace Oyster ddesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; ddesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; - ID3D11DepthStencilState* dsState; - Core::device->CreateDepthStencilState(&ddesc,&dsState); + + Core::device->CreateDepthStencilState(&ddesc,&RenderStates::dsState); + return Core::Init::Success; + } + Core::Init::State Resources::InitViews() + { //Create Views - for(int i = 0; i< Resources::Deffered::GBufferSize; ++i) + for(int i = 0; i< GBufferSize; ++i) { Core::Init::CreateLinkedShaderResourceFromTexture(&GBufferRTV[i],&GBufferSRV[i],NULL); } - for(int i = 0; i < Resources::Deffered::LBufferSize; ++i) + for(int i = 0; i < LBufferSize; ++i) { Core::Init::CreateLinkedShaderResourceFromTexture(NULL,&LBufferSRV[i],&LBufferUAV[i]); } - Buffer* b = &PointLightsData; + Buffer* b = &Light::PointLightsData; - Core::Init::CreateLinkedShaderResourceFromStructuredBuffer(&b,&PointLightView,NULL); + Core::Init::CreateLinkedShaderResourceFromStructuredBuffer(&b,&Light::PointLightView,NULL); srand((unsigned int)time(0)); //SSAO @@ -241,7 +252,7 @@ namespace Oyster ID3D11Texture1D *pTexture1; Core::device->CreateTexture1D( &T1desc, &sphere, &pTexture1 ); - Core::device->CreateShaderResourceView( pTexture1, 0, &SSAOKernel ); + Core::device->CreateShaderResourceView( pTexture1, 0, &Light::SSAOKernel ); pTexture1->Release(); D3D11_TEXTURE2D_DESC T2desc; @@ -260,14 +271,17 @@ namespace Oyster ID3D11Texture2D *pTexture2; Core::device->CreateTexture2D( &T2desc, &rnd, &pTexture2 ); - Core::device->CreateShaderResourceView( (pTexture2), 0, &SSAORandom ); + Core::device->CreateShaderResourceView( (pTexture2), 0, &Light::SSAORandom ); pTexture2->Release(); + return Core::Init::Success; + } - ////Create ShaderEffects + Core::Init::State Resources::InitPasses() + { ////---------------- Geometry Pass Setup ---------------------------- - GeometryPass.Shaders.Pixel = GetShader::Pixel(L"Gather"); - GeometryPass.Shaders.Vertex = GetShader::Vertex(L"Gather"); + Gather::Pass.Shaders.Pixel = GetShader::Pixel(L"Gather"); + Gather::Pass.Shaders.Vertex = GetShader::Vertex(L"Gather"); D3D11_INPUT_ELEMENT_DESC indesc[] = { @@ -280,91 +294,104 @@ namespace Oyster { "BONEWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 72, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; - Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Gather"),GeometryPass.IAStage.Layout); - GeometryPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - GeometryPass.CBuffers.Vertex.push_back(AnimationData); - GeometryPass.CBuffers.Vertex.push_back(ModelData); - GeometryPass.RenderStates.Rasterizer = rs; - GeometryPass.RenderStates.SampleCount = 1; - GeometryPass.RenderStates.SampleState = ss; - GeometryPass.RenderStates.DepthStencil = dsState; + Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Gather"),Gather::Pass.IAStage.Layout); + Gather::Pass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + Gather::Pass.CBuffers.Vertex.push_back(Gather::AnimationData); + Gather::Pass.CBuffers.Vertex.push_back(Gather::ModelData); + Gather::Pass.RenderStates.Rasterizer = RenderStates::rs; + Gather::Pass.RenderStates.SampleCount = 1; + Gather::Pass.RenderStates.SampleState = RenderStates::ss; + Gather::Pass.RenderStates.DepthStencil = RenderStates::dsState; for(int i = 0; i -// /Code/OysterGraphics/Shader/HLSL -const std::wstring PathFromExeToCso = L"..\\Content\\Shaders\\"; -const std::wstring PathFromExeToHlsl = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\"; -const std::wstring VertexTransformDebug = L"TransformDebugVertex"; -const std::wstring VertexDebug = L"DebugVertex"; -const std::wstring PixelRed = L"DebugPixel"; -const std::wstring PixelTexture = L"Texture"; -const std::wstring ComputeDebug = L"Debug"; - -typedef Oyster::Graphics::Core::PipelineManager::ShaderType ShaderType; -typedef Oyster::Graphics::Core::PipelineManager::Get GetShader; -typedef Oyster::Graphics::Core::PipelineManager Shader; -typedef Oyster::Graphics::Core::Buffer Buffer; - -namespace Oyster -{ - namespace Graphics - { - namespace Render - { - //Shader::RenderPass Resources::Debug::obj; - Shader::RenderPass Resources::Debug::debugCompute;// = Shader::ShaderEffect();; - //Buffer Resources::Debug::ModelData = Buffer(); - //Buffer Resources::Debug::VPData = Buffer(); - - //ID3D11ShaderResourceView* Resources::Debug::srv = NULL; - //ID3D11RenderTargetView* Resources::Debug::rtv = NULL; - - Core::Init::State Resources::Debug::Init() - { - -#pragma region LoadShaders - /** Load Compute Shaders for d3dcompile */ - Core::PipelineManager::Init(PathFromExeToHlsl + L"ComputeDebug\\" + L"DebugCompute.hlsl", ShaderType::Compute, ComputeDebug); - -#pragma endregion - return Core::Init::Success; - } - - void Resources::Debug::Clean() - { - - } - } - } -} - -#endif \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Resources/Debug.h b/Code/OysterGraphics/Render/Resources/Debug.h deleted file mode 100644 index 3dc2fae2..00000000 --- a/Code/OysterGraphics/Render/Resources/Debug.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#ifndef Reources_h -#define Reources_h - -#ifdef _DEBUG - -#include "../OysterGraphics/Core/Core.h" - -namespace Oyster -{ - namespace Graphics - { - namespace Render - { - namespace Resources - { - class Debug - { - public: - //static Core::PipelineManager::RenderPass obj; - static Core::PipelineManager::RenderPass debugCompute; - //static Core::Buffer ModelData; - //static Core::Buffer VPData; - - //static ID3D11ShaderResourceView* srv; - //static ID3D11RenderTargetView* rtv; - - static Core::Init::State Init(); - static void Clean(); - }; - } - } - } -} - -#endif - -#endif \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Resources/Deffered.h b/Code/OysterGraphics/Render/Resources/Deffered.h deleted file mode 100644 index 72fa039f..00000000 --- a/Code/OysterGraphics/Render/Resources/Deffered.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include "../../Core/Core.h" - -namespace Oyster -{ - namespace Graphics - { - namespace Render - { - namespace Resources - { - class Deffered - { - public: - - static const int GBufferSize = 3; - static const int LBufferSize = 3; - static const int MaxLightSize = 100; - - //! GBuffers - //! 0 = Diffuse + Glow - //! 1 = Normal + Spec - //! 2 = GUI - static ID3D11RenderTargetView* GBufferRTV[GBufferSize]; - static ID3D11ShaderResourceView* GBufferSRV[GBufferSize]; - - //! LBuffer - //! 0 = Diffuse - //! 1 = Specular - //! 2 = SSAO - static ID3D11UnorderedAccessView* LBufferUAV[LBufferSize]; - static ID3D11ShaderResourceView* LBufferSRV[LBufferSize]; - - //Blur UAV and SRV - static ID3D11UnorderedAccessView* BlurBufferUAV; - static ID3D11ShaderResourceView* BlurBufferSRV; - - static Core::PipelineManager::RenderPass GeometryPass; - static Core::PipelineManager::RenderPass GuiPass; - static Core::PipelineManager::RenderPass LightPass; - static Core::PipelineManager::RenderPass BlurHorPass; - static Core::PipelineManager::RenderPass BlurVertPass; - static Core::PipelineManager::RenderPass PostPass; - - - static Core::Buffer ModelData; - static Core::Buffer AnimationData; - - static Core::Buffer LightConstantsData; - - static Core::Buffer PointLightsData; - - static Core::Buffer GuiData; - - static ID3D11ShaderResourceView* PointLightView; - - static ID3D11ShaderResourceView* SSAOKernel; - - static ID3D11ShaderResourceView* SSAORandom; - - static Core::Init::State Init(); - static Core::Init::State InitShaders(); - static void Clean(); - }; - } - } - } -} \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Post/BlurHor.hlsl b/Code/OysterGraphics/Shader/Passes/Blur/BlurHor.hlsl similarity index 100% rename from Code/OysterGraphics/Shader/Passes/Post/BlurHor.hlsl rename to Code/OysterGraphics/Shader/Passes/Blur/BlurHor.hlsl diff --git a/Code/OysterGraphics/Shader/Passes/Post/BlurSharedData.hlsli b/Code/OysterGraphics/Shader/Passes/Blur/BlurSharedData.hlsli similarity index 100% rename from Code/OysterGraphics/Shader/Passes/Post/BlurSharedData.hlsli rename to Code/OysterGraphics/Shader/Passes/Blur/BlurSharedData.hlsli diff --git a/Code/OysterGraphics/Shader/Passes/Post/BlurVert.hlsl b/Code/OysterGraphics/Shader/Passes/Blur/BlurVert.hlsl similarity index 100% rename from Code/OysterGraphics/Shader/Passes/Post/BlurVert.hlsl rename to Code/OysterGraphics/Shader/Passes/Blur/BlurVert.hlsl diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 3956d9b6..b3abc0df 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -13,6 +13,6 @@ void main( uint3 DTid : SV_DispatchThreadID ) float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; - //Output[DTid.xy] = Light + Amb * AmbFactor; - Output[DTid.xy] = Ambient[DTid.xy/2].w; + Output[DTid.xy] = Light + Amb * AmbFactor; + //Output[DTid.xy] = Ambient[DTid.xy/2].w; } \ No newline at end of file diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 0c4262dc..bdb9fe7f 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -160,18 +160,21 @@ HRESULT InitDirect3D() { return E_FAIL; } - + Oyster::Graphics::API::Option o = Oyster::Graphics::API::GetOption(); + o.modelPath = L"..\\Content\\Models\\"; + o.texturePath = L"..\\Content\\Textures\\"; + Oyster::Graphics::API::SetOptions(o); + m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); - /*m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.dan"); + m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.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;*/ + 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_Orthographic(10,10,.1f,10000); Oyster::Graphics::API::SetProjection(P); V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f)); @@ -179,7 +182,7 @@ HRESULT InitDirect3D() Oyster::Graphics::Definitions::Pointlight pl; - pl.Color = Oyster::Math::Float3(1,1,1); + pl.Color = Oyster::Math::Float3(1,0,1); pl.Bright = 1; pl.Pos = Oyster::Math::Float3(0,-20.0f,0.4f); pl.Radius = 90; @@ -192,15 +195,15 @@ HRESULT InitDirect3D() float angle = 0; HRESULT Update(float deltaTime) { - angle += Oyster::Math::pi/16 * deltaTime; - m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle) * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); - /*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::Math::Matrix ma = Oyster::Math::Matrix::identity;*/ + //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle); + //m->WorldMatrix = m->WorldMatrix * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); + 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::Math::Matrix ma = Oyster::Math::Matrix::identity; //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; } @@ -211,7 +214,7 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::NewFrame(); Oyster::Graphics::API::RenderModel(*m); - //Oyster::Graphics::API::RenderModel(*m2); + Oyster::Graphics::API::RenderModel(*m2); //Oyster::Graphics::API::RenderModel(*m3); Oyster::Graphics::API::EndFrame(); From 1121bbdebf51fe8a20c2b04b9647acd11743a76b Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 7 Feb 2014 16:51:35 +0100 Subject: [PATCH 19/29] TODO:: Fix Pixel Data to Post Pass --- Code/OysterGraphics/Render/DefaultRenderer.cpp | 2 +- Code/OysterGraphics/Render/GuiRenderer.cpp | 3 ++- Code/OysterGraphics/Render/Resources.cpp | 10 ++++++---- Code/OysterGraphics/Render/Resources.h | 8 ++++++-- Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl | 2 +- Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl | 1 + Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl | 6 ++++++ Code/Tester/MainTest.cpp | 5 ++++- 8 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 36e5475d..48cbdd74 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -195,7 +195,7 @@ namespace Oyster Core::PipelineManager::SetRenderPass(Resources::Blur::VertPass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); - Core::PipelineManager::SetRenderPass(Resources::PostPass); + Core::PipelineManager::SetRenderPass(Resources::Post::Pass); Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1); diff --git a/Code/OysterGraphics/Render/GuiRenderer.cpp b/Code/OysterGraphics/Render/GuiRenderer.cpp index dabb2a7b..62b724cd 100644 --- a/Code/OysterGraphics/Render/GuiRenderer.cpp +++ b/Code/OysterGraphics/Render/GuiRenderer.cpp @@ -12,6 +12,7 @@ namespace Oyster { void Gui::BeginRender() { + Core::PipelineManager::SetRenderPass(Render::Resources::Gui::Pass); } void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float2 pos, Math::Float2 size) @@ -32,7 +33,7 @@ namespace Oyster void* data = Render::Resources::Gui::Data.Map(); - memcpy(data,&gd,sizeof(gd)); + memcpy(data,&gd,sizeof(Definitions::GuiData)); Render::Resources::Gui::Data.Unmap(); Core::deviceContext->Draw(1,0); diff --git a/Code/OysterGraphics/Render/Resources.cpp b/Code/OysterGraphics/Render/Resources.cpp index b59b5844..90bd1d53 100644 --- a/Code/OysterGraphics/Render/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -32,7 +32,7 @@ namespace Oyster Shader::RenderPass Resources::Gather::Pass; Shader::RenderPass Resources::Light::Pass; - Shader::RenderPass Resources::PostPass; + Shader::RenderPass Resources::Post::Pass; Shader::RenderPass Resources::Gui::Pass; Shader::RenderPass Resources::Blur::VertPass; //Set this pass second when doing a "fullscreen" blur Shader::RenderPass Resources::Blur::HorPass; //Set this pass first when doing a "fullscreen" blur @@ -107,6 +107,7 @@ namespace Oyster desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; desc.NumElements = 1; desc.ElementSize = sizeof(Definitions::GuiData); + Gui::Data.Init(desc); desc.ElementSize = sizeof(Definitions::LightConstants); desc.NumElements = 1; @@ -325,18 +326,19 @@ namespace Oyster Light::Pass.SRV.Compute.push_back(Light::SSAORandom); ////---------------- Post Pass Setup ---------------------------- - PostPass.Shaders.Compute = GetShader::Compute(L"PostPass"); + Post::Pass.Shaders.Compute = GetShader::Compute(L"PostPass"); for(int i = 0; i Output; +cbuffer Size : register(b0) +{ + int2 Pixels; +} + #define AmbFactor 0.3f; [numthreads(16, 16, 1)] @@ -15,4 +20,5 @@ void main( uint3 DTid : SV_DispatchThreadID ) //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; Output[DTid.xy] = Light + Amb * AmbFactor; //Output[DTid.xy] = Ambient[DTid.xy/2].w; + Output[DTid.xy] = Ambient[DTid.xy/2 + Pixels/2]; } \ No newline at end of file diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index bdb9fe7f..a692688f 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -20,6 +20,7 @@ HWND g_hWnd = NULL; Oyster::Graphics::Model::Model* m = NULL; Oyster::Graphics::Model::Model* m2 = NULL; Oyster::Graphics::Model::Model* m3 = NULL; +Oyster::Graphics::API::Texture t = NULL; Oyster::Math::Float4x4 V; Oyster::Math::Float4x4 P; @@ -173,6 +174,7 @@ HRESULT InitDirect3D() //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"); P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000); Oyster::Graphics::API::SetProjection(P); @@ -216,7 +218,8 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::RenderModel(*m); Oyster::Graphics::API::RenderModel(*m2); //Oyster::Graphics::API::RenderModel(*m3); - + 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::EndFrame(); return S_OK; From e6e56ba21bfb69b3aaf73673f2cb69f2806740b2 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 01:03:10 +0100 Subject: [PATCH 20/29] Done with 2D --- .../OysterGraphics/Definitions/GraphicalDefinition.h | 5 +++++ Code/OysterGraphics/Render/DefaultRenderer.cpp | 10 +++++++++- Code/OysterGraphics/Render/Resources.cpp | 12 +++++++----- .../Shader/Passes/Light/LightPass.hlsl | 3 ++- Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl | 10 ++++++++-- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index 41420cce..7c0d76d7 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -61,6 +61,11 @@ namespace Oyster Math::Matrix Translation; }; + struct PostData + { + int x; + int y; + }; } } } \ No newline at end of file diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 48cbdd74..45bd0630 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -19,7 +19,7 @@ namespace Oyster void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) { Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,0,0,1)); - Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,1)); + Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,0)); Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Gather::Pass); void* data; @@ -39,6 +39,14 @@ namespace Oyster data = Resources::Light::PointLightsData.Map(); memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); Resources::Light::PointLightsData.Unmap(); + + Definitions::PostData pd; + pd.x = lc.Pixels.x; + pd.y = lc.Pixels.y; + + data = Resources::Post::Data.Map(); + memcpy(data, &pd, sizeof(Definitions::PostData)); + Resources::Post::Data.Unmap(); } Math::Matrix RecursiveBindPosRotation(int index, Model::ModelInfo* mi) diff --git a/Code/OysterGraphics/Render/Resources.cpp b/Code/OysterGraphics/Render/Resources.cpp index 90bd1d53..f7b1144d 100644 --- a/Code/OysterGraphics/Render/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -41,6 +41,7 @@ namespace Oyster Buffer Resources::Gather::AnimationData = Buffer(); Buffer Resources::Light::LightConstantsData = Buffer(); Buffer Resources::Gui::Data = Buffer(); + Buffer Resources::Post::Data = Buffer(); Buffer Resources::Light::PointLightsData = Buffer(); ID3D11ShaderResourceView* Resources::Light::PointLightView = NULL; @@ -109,10 +110,11 @@ namespace Oyster desc.ElementSize = sizeof(Definitions::GuiData); Gui::Data.Init(desc); - desc.ElementSize = sizeof(Definitions::LightConstants); - desc.NumElements = 1; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS; - + desc.ElementSize = sizeof(Definitions::PostData); + Post::Data.Init(desc); + + desc.ElementSize = sizeof(Definitions::LightConstants); Light::LightConstantsData.Init(desc); desc.ElementSize = sizeof(Definitions::Pointlight); @@ -332,6 +334,7 @@ namespace Oyster Post::Pass.SRV.Compute.push_back(LBufferSRV[i]); } Post::Pass.UAV.Compute.push_back(Core::backBufferUAV); + Post::Pass.CBuffers.Compute.push_back(Post::Data); ////---------------- GUI Pass Setup ---------------------------- Gui::Pass.Shaders.Vertex = GetShader::Vertex(L"2D"); @@ -379,8 +382,6 @@ namespace Oyster return Core::Init::State::Success; } - - void Resources::Clean() { Gather::ModelData.~Buffer(); @@ -388,6 +389,7 @@ namespace Oyster Light::LightConstantsData.~Buffer(); Light::PointLightsData.~Buffer(); Gui::Data.~Buffer(); + Post::Data.~Buffer(); SAFE_RELEASE(Light::PointLightView); SAFE_RELEASE(Light::SSAOKernel); SAFE_RELEASE(Light::SSAORandom); diff --git a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl index 75a927c3..8c988f1f 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl @@ -35,7 +35,8 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) { float AmbValue = GetSSAO(ViewPos, UV, DTid.xy, GTid.xy/2); Ambient[DTid.xy/2] = float4(DiffuseGlow[DTid.xy].xyz, AmbValue); - Ambient[DTid.xy + Pixels/2] = GUI[DTid.xy]; + Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy]; + //Ambient[DTid.xy] = GUI[DTid.xy]; } } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 3f6ff9d5..78d6ebd1 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -18,7 +18,13 @@ void main( uint3 DTid : SV_DispatchThreadID ) float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; - Output[DTid.xy] = Light + Amb * AmbFactor; + //Output[DTid.xy] = Light + Amb * AmbFactor; //Output[DTid.xy] = Ambient[DTid.xy/2].w; - Output[DTid.xy] = Ambient[DTid.xy/2 + Pixels/2]; + float4 GUI; + uint2 index = DTid.xy/2 + int2(Pixels.x/2,0); + float3 PostLight = Light.xyz + Amb.xyz * AmbFactor; + GUI = float4(Ambient[index]); + PostLight = PostLight * (1-GUI.w); + //Output[DTid.xy] = float4((GUI.xyz * GUI.w) + ((Light + Amb * AmbFactor) * (1 - GUI.w)),0); + Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1); } \ No newline at end of file From adb273bd5ba37bfd955604319e8b6ec9b5964184 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 09:35:03 +0100 Subject: [PATCH 21/29] Fixed las bug in 2d rendering --- Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl | 2 +- .../Shader/Passes/Light/LightPass.hlsl | 4 ++-- .../Shader/Passes/Post/PostPass.hlsl | 14 +++++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl index 7531f715..a09111b9 100644 --- a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl +++ b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl @@ -2,5 +2,5 @@ float4 main(Pixel2DIn input) : SV_Target0 { - return float4(Material.Sample(LinearSampler,input.Uv).xyz,0.5); + return Material.Sample(LinearSampler,input.Uv); } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl index 8c988f1f..dc54187e 100644 --- a/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Light/LightPass.hlsl @@ -27,8 +27,8 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) Shaded.Specular += light.Specular; } - Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,1); - Specular[DTid.xy] = float4(Shaded.Specular, 1); + Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,0); + Specular[DTid.xy] = float4(Shaded.Specular, 0); if(DTid.x & 1 && DTid.y & 1 ) diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 78d6ebd1..b219bd28 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -14,17 +14,13 @@ cbuffer Size : register(b0) [numthreads(16, 16, 1)] void main( uint3 DTid : SV_DispatchThreadID ) { - float4 Light = Diffuse[DTid.xy] + Specular[DTid.xy]; - float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1); - //Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1); - //Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy]; - //Output[DTid.xy] = Light + Amb * AmbFactor; - //Output[DTid.xy] = Ambient[DTid.xy/2].w; + float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]); + float4 Amb = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w, 0); float4 GUI; uint2 index = DTid.xy/2 + int2(Pixels.x/2,0); - float3 PostLight = Light.xyz + Amb.xyz * AmbFactor; + float3 PostLight = Amb.xyz * AmbFactor; + PostLight = PostLight + Light.xyz; GUI = float4(Ambient[index]); - PostLight = PostLight * (1-GUI.w); - //Output[DTid.xy] = float4((GUI.xyz * GUI.w) + ((Light + Amb * AmbFactor) * (1 - GUI.w)),0); + PostLight = PostLight * (1 - GUI.w); Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1); } \ No newline at end of file From d0f36302cf44591d647829227c0b96a7456c605a Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 11:53:44 +0100 Subject: [PATCH 22/29] Fixed 2d render comment Started on Anim API --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 17 +++++++++--- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 12 ++++++--- Code/OysterGraphics/FileLoader/DanLoader.cpp | 25 +++++++++-------- Code/OysterGraphics/Model/Model.h | 19 ++++++++++--- Code/OysterGraphics/Model/ModelInfo.h | 3 +-- .../OysterGraphics/Render/DefaultRenderer.cpp | 27 ++++--------------- Code/Tester/MainTest.cpp | 20 +++++++------- 7 files changed, 66 insertions(+), 57 deletions(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 06579b48..fe75e982 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -17,7 +17,8 @@ namespace Oyster { Math::Float4x4 View; Math::Float4x4 Projection; - std::vector Lights; + std::vector Lights; + float dt=0; } API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion) @@ -50,7 +51,7 @@ namespace Oyster { if(Lights.size()) { - Render::DefaultRenderer::NewFrame(View, Projection, &Lights[0], (int)Lights.size()); + Render::DefaultRenderer::NewFrame(View, Projection, Lights[0], (int)Lights.size()); } else { @@ -86,7 +87,7 @@ namespace Oyster Model::Model* m = new Model::Model(); m->WorldMatrix = Oyster::Math::Float4x4::identity; m->Visible = true; - m->AnimationPlaying = -1; + m->Animation.data.AnimationPlaying = NULL; 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; @@ -127,7 +128,7 @@ namespace Oyster SAFE_RELEASE(Core::device); } - void API::AddLight(Definitions::Pointlight light) + void API::AddLight(Definitions::Pointlight *light) { Lights.push_back(light); } @@ -173,5 +174,13 @@ namespace Oyster { Core::loader.ReleaseResource(tex); } + + float API::PlayAnimation(Model::Model* m, std::wstring name,bool looping) + { + m->Animation.data.AnimationPlaying = &(*m->info->Animations.find(name)).second; + m->Animation.data.AnimationTime=0; + m->Animation.data.LoopAnimation = looping; + return m->Animation.data.AnimationPlaying->duration; + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index a6f5ac7d..2a664ecf 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -56,7 +56,7 @@ namespace Oyster //! @brief Configures Renderer to process 2D graphics, data will be passed in to EndFrame() static void StartGuiRender(); - //! @brief Renders a single GUI element using the texture provided and the Pos in the upper right corner, %based system + //! @brief Renders a single GUI element using the texture provided and the Pos in the center, %based system static void RenderGuiElement(Texture, Math::Float2 Pos, Math::Float2 Size); //! @brief Performs light calculations, post effects and presents the scene @@ -71,15 +71,21 @@ namespace Oyster static void DeleteTexture(Texture); //! @brief adds a light to the scene - static void AddLight(Definitions::Pointlight light); + static void AddLight(Definitions::Pointlight* light); //! @brief removes all lights from the scene static void ClearLights(); //! @brief Sets Options to the graphics static State SetOptions(Option); - //! @brief Gets Options to the graphics + //! @brief Gets Options from the graphics static Option GetOption(); + + //! @brief Starts an animation and returns the time of the animation + static float PlayAnimation(Model::Model* model, std::wstring name, bool looping = false); + + //! @brief Moves all animating models forward the specified time; + static void Update(float deltaTime); }; } } diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index ac47605c..99302266 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -135,16 +135,16 @@ void Oyster::Graphics::Loading::UnloadDAN(void* data) if(info->Animated) { //clean animation - for(int a = 0; a < info->AnimationCount; ++a) + for(auto a = info->Animations.begin(); a != info->Animations.end(); ++a) { - for(int x = 0; x < info->Animations[a].Bones; ++x) + for(int x = 0; x < (*a).second.Bones; ++x) { - delete[] info->Animations[a].Keyframes[x]; + delete[] (*a).second.Keyframes[x]; } - delete[] info->Animations[a].Frames; - delete[] info->Animations[a].Keyframes; + delete[] (*a).second.Frames; + delete[] (*a).second.Keyframes; } - delete[] info->Animations; + info->Animations.clear(); } for(UINT i =0;iMaterial.size();++i) { @@ -364,9 +364,6 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[]) name[nameLength] = 0; wchar_t* wName = charToWChar(name); - anims[a].name = std::wstring(wName); - delete[] wName; - delete name; //read nr of bones in animation ReadData(&anims[a].Bones,danFile,4); @@ -404,11 +401,13 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[]) ReadData(&anims[a].Keyframes[b][f].time,danFile,sizeof(double)); } } - } - modelInfo->AnimationCount = animationHeader.numAnims; - modelInfo->Animations = anims; - modelInfo->Animated = true; + modelInfo->Animations.insert(std::pair(std::wstring(wName), anims[a])); + delete[] wName; + delete name; + } + modelInfo->Animated = true; + delete[] anims; break; } } diff --git a/Code/OysterGraphics/Model/Model.h b/Code/OysterGraphics/Model/Model.h index f4639c74..2f97a441 100644 --- a/Code/OysterGraphics/Model/Model.h +++ b/Code/OysterGraphics/Model/Model.h @@ -10,13 +10,26 @@ namespace Oyster namespace Model { struct ModelInfo; + + struct Animation; + + struct AnimationData + { + Animation* AnimationPlaying; + float AnimationTime; + bool LoopAnimation; + }; + struct AnimationPlayer + { + AnimationData data; + ModelInfo* info; + }; struct Model { ModelInfo* info; Oyster::Math::Float4x4 WorldMatrix; - bool Visible, LoopAnimation; - int AnimationPlaying; - float AnimationTime; + bool Visible; + AnimationPlayer Animation; }; } diff --git a/Code/OysterGraphics/Model/ModelInfo.h b/Code/OysterGraphics/Model/ModelInfo.h index dece6668..a53bcb23 100644 --- a/Code/OysterGraphics/Model/ModelInfo.h +++ b/Code/OysterGraphics/Model/ModelInfo.h @@ -24,7 +24,6 @@ namespace Oyster }; struct Animation { - std::wstring name; int Bones; int* Frames; //! Bone as index Frame** Keyframes; //! @brief [Bone][Frame] @@ -37,7 +36,7 @@ namespace Oyster bool Indexed, Animated; int VertexCount, IndexCount, BoneCount, AnimationCount; Bone* bones; - Animation* Animations; + std::map Animations; }; } } diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 45bd0630..aaec7473 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -49,23 +49,6 @@ namespace Oyster Resources::Post::Data.Unmap(); } - Math::Matrix RecursiveBindPosRotation(int index, Model::ModelInfo* mi) - { - if(mi->bones[index].Parent == index) - return mi->bones[index].Relative; - - return mi->bones[index].Relative*mi->bones[mi->bones->Parent].Relative; - } - - Math::Vector4 RecursiveBindPosPosition(int index, Model::ModelInfo* mi) - { - //return Math::Vector4::standard_unit_w; - if(mi->bones[index].Parent == index) - return mi->bones[index].Relative.v[3]; - - return Math::Vector4(RecursiveBindPosPosition(mi->bones->Parent, mi).xyz + (mi->bones[index].Relative.v[3] * RecursiveBindPosRotation(mi->bones->Parent,mi)).xyz,1); - } - void DefaultRenderer::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection) { for(int i = 0; i < count; ++i) @@ -81,7 +64,7 @@ namespace Oyster Model::ModelInfo* info = models[i].info; Definitions::AnimationData am; //final - if(info->Animated && models[i].AnimationPlaying != -1) + if(info->Animated && models[i].Animation.data.AnimationPlaying != NULL) { cube->WorldMatrix = Math::Matrix::identity; ////store inverse absolut transform @@ -108,11 +91,11 @@ namespace Oyster cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; } int b = 0; - Model::Animation A = info->Animations[models[i].AnimationPlaying]; - while(models[i].AnimationTime>A.duration) - models[i].AnimationTime -= (float)A.duration; + Model::Animation A = *models[i].Animation.data.AnimationPlaying; + while(models[i].Animation.data.AnimationTime>A.duration) + models[i].Animation.data.AnimationTime -= (float)A.duration; - float position = models[i].AnimationTime; + float position = models[i].Animation.data.AnimationTime; for(int b = 0; b < A.Bones;++b) { //find current frame diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index a692688f..4b7ca697 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -23,6 +23,7 @@ Oyster::Graphics::Model::Model* m3 = NULL; Oyster::Graphics::API::Texture t = NULL; Oyster::Math::Float4x4 V; Oyster::Math::Float4x4 P; +Oyster::Graphics::Definitions::Pointlight pl; //-------------------------------------------------------------------------------------- @@ -169,8 +170,7 @@ HRESULT InitDirect3D() m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); m2 = Oyster::Graphics::API::CreateModel(L"T_reskinned.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; + 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); @@ -183,13 +183,13 @@ HRESULT InitDirect3D() V = V.GetInverse(); - Oyster::Graphics::Definitions::Pointlight pl; + pl.Color = Oyster::Math::Float3(1,0,1); pl.Bright = 1; pl.Pos = Oyster::Math::Float3(0,-20.0f,0.4f); pl.Radius = 90; - Oyster::Graphics::API::AddLight(pl); + Oyster::Graphics::API::AddLight(&pl); return S_OK; @@ -205,7 +205,7 @@ HRESULT Update(float deltaTime) //ma *= 50; //ma.m44 = 1; //m2->WorldMatrix = m2->WorldMatrix * ma; - m2->AnimationTime += deltaTime;// * 0.5f; + 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; } @@ -218,7 +218,7 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::RenderModel(*m); 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::EndFrame(); @@ -259,13 +259,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam break; //Z - case 0x5A: - m2->AnimationTime -= 0.1f; - if(m2->AnimationTime < 0) - m2->AnimationTime = 0; + //m2->AnimationTime -= 0.1f; + //if(m2->AnimationTime < 0) + //m2->AnimationTime = 0; break; //X + case 0x58: - m2->AnimationTime += 0.1f; + //m2->AnimationTime += 0.1f; break; } From a3ba67e3c29d3db57b0f53552f691c417cf30ed0 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 13:59:45 +0100 Subject: [PATCH 23/29] Fixed release compile and basic anim --- Code/Misc/Misc.vcxproj | 8 ++++-- Code/OysterGraphics/Core/Core.h | 3 ++- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 23 +++++++++------- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 2 +- Code/OysterGraphics/Model/Model.h | 7 +---- Code/OysterGraphics/OysterGraphics.vcxproj | 13 +++++----- .../OysterGraphics/Render/DefaultRenderer.cpp | 13 +++++----- Code/OysterGraphics/Render/DefaultRenderer.h | 2 +- Code/Tester/MainTest.cpp | 26 +++++++------------ 9 files changed, 48 insertions(+), 49 deletions(-) diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 5989b04a..2d9392a3 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -153,7 +153,9 @@ false - true + false + false + false @@ -173,7 +175,9 @@ false - true + false + false + false diff --git a/Code/OysterGraphics/Core/Core.h b/Code/OysterGraphics/Core/Core.h index eb420c04..644d9f0d 100644 --- a/Code/OysterGraphics/Core/Core.h +++ b/Code/OysterGraphics/Core/Core.h @@ -7,7 +7,8 @@ #include "Dx11Includes.h" #include #include "OysterMath.h" -#include "../Misc/Resource/ResourceManager.h" +//#include "../Misc/Resource/ResourceManager.h" +#include "../../Misc/Resource/ResourceManager.h" //#include namespace Oyster diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index fe75e982..04795f31 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -18,7 +18,7 @@ namespace Oyster Math::Float4x4 View; Math::Float4x4 Projection; std::vector Lights; - float dt=0; + float deltaTime; } 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) { - 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() @@ -87,7 +87,7 @@ namespace Oyster Model::Model* m = new Model::Model(); m->WorldMatrix = Oyster::Math::Float4x4::identity; 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); Model::ModelInfo* mi = (Model::ModelInfo*)m->info; @@ -177,10 +177,15 @@ namespace Oyster float API::PlayAnimation(Model::Model* m, std::wstring name,bool looping) { - m->Animation.data.AnimationPlaying = &(*m->info->Animations.find(name)).second; - m->Animation.data.AnimationTime=0; - m->Animation.data.LoopAnimation = looping; - return m->Animation.data.AnimationPlaying->duration; + m->Animation.AnimationPlaying = &(*m->info->Animations.find(name)).second; + m->Animation.AnimationTime=0; + m->Animation.LoopAnimation = looping; + return m->Animation.AnimationPlaying->duration; + } + + void API::Update(float dt) + { + deltaTime = dt; } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 2a664ecf..1c489dc8 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -51,7 +51,7 @@ namespace Oyster //! @brief Renders a list of models static void RenderScene(Oyster::Graphics::Model::Model models[], int count); //! @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() static void StartGuiRender(); diff --git a/Code/OysterGraphics/Model/Model.h b/Code/OysterGraphics/Model/Model.h index 2f97a441..590d7d6a 100644 --- a/Code/OysterGraphics/Model/Model.h +++ b/Code/OysterGraphics/Model/Model.h @@ -19,17 +19,12 @@ namespace Oyster float AnimationTime; bool LoopAnimation; }; - struct AnimationPlayer - { - AnimationData data; - ModelInfo* info; - }; struct Model { ModelInfo* info; Oyster::Math::Float4x4 WorldMatrix; bool Visible; - AnimationPlayer Animation; + AnimationData Animation; }; } diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index ca2e776b..c19e073f 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -78,6 +78,7 @@ $(ProjectName)_$(PlatformShortName) C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + true $(SolutionDir)..\Bin\DLL\ @@ -246,21 +247,21 @@ Compute 5.0 Compute - 4.0 + 5.0 Compute - 4.0 + 5.0 Compute - 4.0 + 5.0 Compute 5.0 Compute - 4.0 + 5.0 Compute - 4.0 + 5.0 Compute - 4.0 + 5.0 Compute diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index aaec7473..754197e8 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -49,7 +49,7 @@ namespace Oyster 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) { @@ -64,8 +64,9 @@ namespace Oyster Model::ModelInfo* info = models[i].info; 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; ////store inverse absolut transform Math::Matrix SkinTransform[100]; @@ -91,11 +92,11 @@ namespace Oyster cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3]; } int b = 0; - Model::Animation A = *models[i].Animation.data.AnimationPlaying; - while(models[i].Animation.data.AnimationTime>A.duration) - models[i].Animation.data.AnimationTime -= (float)A.duration; + Model::Animation A = *models[i].Animation.AnimationPlaying; + while(models[i].Animation.AnimationTime>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) { //find current frame diff --git a/Code/OysterGraphics/Render/DefaultRenderer.h b/Code/OysterGraphics/Render/DefaultRenderer.h index 5402f310..54075a3f 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.h +++ b/Code/OysterGraphics/Render/DefaultRenderer.h @@ -14,7 +14,7 @@ namespace Oyster { public: 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 Model::Model* cube; diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 4b7ca697..1f6e33e3 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -168,13 +168,11 @@ HRESULT InitDirect3D() Oyster::Graphics::API::SetOptions(o); 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); 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); Oyster::Graphics::API::SetProjection(P); @@ -198,15 +196,10 @@ float angle = 0; HRESULT Update(float deltaTime) { angle += Oyster::Math::pi/16 * deltaTime; - //m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle); - //m->WorldMatrix = m->WorldMatrix * Oyster::Math3D::RotationMatrix_AxisX(-Oyster::Math::pi/2); - 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::Math::Matrix ma = Oyster::Math::Matrix::identity; - //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); + m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0)*-angle,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null); + //Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; + Oyster::Graphics::API::Update(deltaTime); + //m2->Animation.data.AnimationTime += deltaTime;// * 0.5f; return S_OK; } @@ -215,10 +208,9 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::SetView(V); Oyster::Graphics::API::NewFrame(); - Oyster::Graphics::API::RenderModel(*m); - Oyster::Graphics::API::RenderModel(*m2); - //Oyster::Graphics::API::RenderModel(*m3); - //Oyster::Graphics::API::StartGuiRender(); + Oyster::Graphics::API::RenderModel(m); + Oyster::Graphics::API::RenderModel(m2); + 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::EndFrame(); From 77c3ba06aa1e49aeb9d3034b43431ad6b82b8c89 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 14:39:26 +0100 Subject: [PATCH 24/29] Framerate fix in release --- Code/OysterGraphics/Core/Init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/OysterGraphics/Core/Init.cpp b/Code/OysterGraphics/Core/Init.cpp index f0b4907f..47731dbf 100644 --- a/Code/OysterGraphics/Core/Init.cpp +++ b/Code/OysterGraphics/Core/Init.cpp @@ -33,7 +33,7 @@ namespace Oyster createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif - createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; + //createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; D3D_FEATURE_LEVEL featureLevelsToTry[] = { From 8ff81fb06a83d2885976a61908d061b87f8d14bb Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 14:54:54 +0100 Subject: [PATCH 25/29] Fixed compatability with Gamelogic --- Code/DanBias.sln | 261 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 180 insertions(+), 81 deletions(-) diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 7182fe89..7602cd2c 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -5,14 +5,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OysterGraphics", "OysterGra EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OysterMath", "OysterMath\OysterMath.vcxproj", "{F10CBC03-9809-4CBA-95D8-327C287B18EE}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OysterPhysics3D", "OysterPhysics3D\OysterPhysics3D.vcxproj", "{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sound", "Sound\Sound.vcxproj", "{34D6295A-00DD-4B1A-8258-97DA2818EC26}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowManager", "WindowManager\WindowManager.vcxproj", "{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Input", "Input\Input.vcxproj", "{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Misc", "Misc\Misc.vcxproj", "{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Network", "Network", "{C27B926E-B3EF-4990-8822-47580E43A0BE}" @@ -23,13 +15,35 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OysterNetworkServer", "Netw EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetworkDependencies", "Network\NetworkDependencies\NetworkDependencies.vcxproj", "{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameLogic", "GameLogic\GameLogic.vcxproj", "{B1195BB9-B3A5-47F0-906C-8DEA384D1520}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tester", "Tester\Tester.vcxproj", "{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Game", "Game", "{B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aDanBiasGameLauncher", "Game\aDanBiasGameLauncher\aDanBiasGameLauncher.vcxproj", "{666FEA52-975F-41CD-B224-B19AF3C0ABBA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DanBiasGame", "Game\DanBiasGame\DanBiasGame.vcxproj", "{2A1BC987-AF42-4500-802D-89CD32FC1309}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DanBiasLauncher", "Game\DanBiasLauncher\DanBiasLauncher.vcxproj", "{8690FDDF-C5B7-4C42-A337-BD5243F29B85}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DanBiasServerLauncher", "Game\DanBiasServerLauncher\DanBiasServerLauncher.vcxproj", "{060B1890-CBF3-4808-BA99-A4776222093B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameLogic", "Game\GameLogic\GameLogic.vcxproj", "{B1195BB9-B3A5-47F0-906C-8DEA384D1520}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameProtocols", "Game\GameProtocols\GameProtocols.vcxproj", "{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameServer", "Game\GameServer\GameServer.vcxproj", "{143BD516-20A1-4890-A3E4-F8BFD02220E7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetworkAPI", "Network\NetworkAPI\NetworkAPI.vcxproj", "{460D625F-2AC9-4559-B809-0BA89CEAEDF4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GamePhysics", "GamePhysics\GamePhysics.vcxproj", "{104FA3E9-94D9-4E1D-A941-28A03BC8A095}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tester", "Tester\Tester.vcxproj", "{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Input", "Input\Input.vcxproj", "{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DanBiasGame", "DanBiasGame\DanBiasGame.vcxproj", "{2A1BC987-AF42-4500-802D-89CD32FC1309}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OysterPhysics3D", "OysterPhysics3D\OysterPhysics3D.vcxproj", "{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sound", "Sound\Sound.vcxproj", "{34D6295A-00DD-4B1A-8258-97DA2818EC26}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowManager", "WindowManager\WindowManager.vcxproj", "{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +59,7 @@ Global {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.Build.0 = Debug|Win32 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Deploy.0 = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -57,6 +72,7 @@ Global {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.Build.0 = Debug|Win32 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Deploy.0 = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -65,58 +81,11 @@ Global {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.Build.0 = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Debug|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Debug|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Debug|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.Build.0 = Release|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Win32.ActiveCfg = Release|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Win32.Build.0 = Release|Win32 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.ActiveCfg = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.Build.0 = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Debug|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Debug|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Debug|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.Build.0 = Release|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Win32.ActiveCfg = Release|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Win32.Build.0 = Release|Win32 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.ActiveCfg = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.Build.0 = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.Build.0 = Release|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Win32.ActiveCfg = Release|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Win32.Build.0 = Release|Win32 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.ActiveCfg = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.Build.0 = Release|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Debug|Win32 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.Build.0 = Debug|Win32 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.ActiveCfg = Debug|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.Build.0 = Debug|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Win32.ActiveCfg = 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.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {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.Build.0 = Debug|Win32 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Deploy.0 = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -161,28 +130,6 @@ Global {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.Build.0 = Release|x64 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.Build.0 = Debug|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Win32.ActiveCfg = Release|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Win32.Build.0 = Release|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|x64.ActiveCfg = Release|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.Build.0 = 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|x64.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.Build.0 = Release|Win32 {1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -195,6 +142,18 @@ Global {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.Build.0 = Release|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Win32.ActiveCfg = Debug|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|Win32.Build.0 = Debug|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|x64.ActiveCfg = Debug|x64 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Debug|x64.Build.0 = Debug|x64 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Release|Mixed Platforms.Build.0 = Release|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Release|Win32.ActiveCfg = Release|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Release|Win32.Build.0 = Release|Win32 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Release|x64.ActiveCfg = Release|x64 + {666FEA52-975F-41CD-B224-B19AF3C0ABBA}.Release|x64.Build.0 = Release|x64 {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|Win32.ActiveCfg = Debug|Win32 @@ -207,6 +166,138 @@ Global {2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Win32.Build.0 = Release|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|x64.ActiveCfg = Release|x64 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|x64.Build.0 = Release|x64 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.ActiveCfg = Debug|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.Build.0 = Debug|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.ActiveCfg = Debug|x64 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.Build.0 = Debug|x64 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Mixed Platforms.Build.0 = Release|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Win32.ActiveCfg = Release|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Win32.Build.0 = Release|Win32 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|x64.ActiveCfg = Release|x64 + {8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|x64.Build.0 = Release|x64 + {060B1890-CBF3-4808-BA99-A4776222093B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Debug|Win32.ActiveCfg = Debug|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Debug|Win32.Build.0 = Debug|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Debug|x64.ActiveCfg = Debug|x64 + {060B1890-CBF3-4808-BA99-A4776222093B}.Debug|x64.Build.0 = Debug|x64 + {060B1890-CBF3-4808-BA99-A4776222093B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Release|Mixed Platforms.Build.0 = Release|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Release|Win32.ActiveCfg = Release|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Release|Win32.Build.0 = Release|Win32 + {060B1890-CBF3-4808-BA99-A4776222093B}.Release|x64.ActiveCfg = Release|x64 + {060B1890-CBF3-4808-BA99-A4776222093B}.Release|x64.Build.0 = Release|x64 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.Build.0 = Debug|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.Build.0 = Release|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Win32.ActiveCfg = Release|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Win32.Build.0 = Release|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|x64.ActiveCfg = Release|x64 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|x64.Build.0 = Release|x64 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.ActiveCfg = Debug|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.Build.0 = Debug|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.ActiveCfg = Debug|x64 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.Build.0 = Debug|x64 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.Build.0 = Release|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Win32.ActiveCfg = Release|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Win32.Build.0 = Release|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|x64.ActiveCfg = Release|x64 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|x64.Build.0 = Release|x64 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Debug|Win32.ActiveCfg = Debug|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Debug|Win32.Build.0 = Debug|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Debug|x64.ActiveCfg = Debug|x64 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Debug|x64.Build.0 = Debug|x64 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Release|Mixed Platforms.Build.0 = Release|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Release|Win32.ActiveCfg = Release|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Release|Win32.Build.0 = Release|Win32 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Release|x64.ActiveCfg = Release|x64 + {143BD516-20A1-4890-A3E4-F8BFD02220E7}.Release|x64.Build.0 = Release|x64 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.ActiveCfg = Debug|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.Build.0 = Debug|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.ActiveCfg = Debug|x64 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.Build.0 = Debug|x64 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.Build.0 = Release|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Win32.ActiveCfg = Release|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Win32.Build.0 = Release|Win32 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|x64.ActiveCfg = Release|x64 + {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|x64.Build.0 = Release|x64 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.Build.0 = 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|x64.ActiveCfg = Release|x64 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|x64.Build.0 = Release|x64 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Debug|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.Build.0 = Debug|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.ActiveCfg = Debug|x64 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.Build.0 = Debug|x64 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.Build.0 = Release|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Win32.ActiveCfg = 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.Build.0 = Release|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Debug|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Debug|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Debug|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.Build.0 = Release|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Win32.ActiveCfg = Release|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Win32.Build.0 = Release|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.ActiveCfg = Release|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.Build.0 = Release|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Debug|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Debug|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Debug|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.Build.0 = Release|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Win32.ActiveCfg = Release|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Win32.Build.0 = Release|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.ActiveCfg = Release|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.Build.0 = Release|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.Build.0 = Release|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Win32.ActiveCfg = Release|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Win32.Build.0 = Release|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.ActiveCfg = Release|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -215,5 +306,13 @@ Global {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8} = {C27B926E-B3EF-4990-8822-47580E43A0BE} {6A066806-F43F-4B31-A4E3-57179674F460} = {C27B926E-B3EF-4990-8822-47580E43A0BE} {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50} = {C27B926E-B3EF-4990-8822-47580E43A0BE} + {460D625F-2AC9-4559-B809-0BA89CEAEDF4} = {C27B926E-B3EF-4990-8822-47580E43A0BE} + {666FEA52-975F-41CD-B224-B19AF3C0ABBA} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} + {2A1BC987-AF42-4500-802D-89CD32FC1309} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} + {8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} + {060B1890-CBF3-4808-BA99-A4776222093B} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} + {B1195BB9-B3A5-47F0-906C-8DEA384D1520} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} + {143BD516-20A1-4890-A3E4-F8BFD02220E7} = {B0AFF0DC-5C7E-43DC-9586-CD4E38EB037B} EndGlobalSection EndGlobal From b80f594440ce6846b61a8d8ce7956a774344013f Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 15:11:33 +0100 Subject: [PATCH 26/29] Changed Animated model --- Code/Tester/MainTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 1f6e33e3..8810a825 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -168,7 +168,7 @@ HRESULT InitDirect3D() Oyster::Graphics::API::SetOptions(o); m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); - m2 = Oyster::Graphics::API::CreateModel(L"char_bindpose.dan"); + m2 = Oyster::Graphics::API::CreateModel(L"char_fake_bin.dan"); 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); From e0f3031187eeca214524f12b84faf23b13d77be4 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 16:08:03 +0100 Subject: [PATCH 27/29] Pointlight no pointer Model render pointer --- .../Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp | 2 +- Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp | 2 +- Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp | 2 +- Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp | 2 +- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 6 +++--- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 2 +- Code/OysterGraphics/Render/DefaultRenderer.cpp | 4 ++-- Code/OysterGraphics/Render/DefaultRenderer.h | 2 +- Code/Tester/MainTest.cpp | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp index 3df74e40..b368b7c4 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp @@ -35,7 +35,7 @@ void C_DynamicObj::setPos(Oyster::Math::Float4x4 world) void C_DynamicObj::Render() { - Oyster::Graphics::API::RenderModel(*(privData->model)); + Oyster::Graphics::API::RenderModel(privData->model); } void C_DynamicObj::Release() { diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp index 49c450b5..1ab43024 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp @@ -39,7 +39,7 @@ void C_Player::setPos(Oyster::Math::Float4x4 world) void C_Player::Render() { - Oyster::Graphics::API::RenderModel(*(privData->model)); + Oyster::Graphics::API::RenderModel(privData->model); } void C_Player::Release() { diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp index 177b032b..5e96c239 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp @@ -38,7 +38,7 @@ void C_StaticObj::setPos(Oyster::Math::Float4x4 world) void C_StaticObj::Render() { - Oyster::Graphics::API::RenderModel(*(privData->model)); + Oyster::Graphics::API::RenderModel(privData->model); } void C_StaticObj::Release() { diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp index fa5dff04..8df19dc1 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp @@ -34,7 +34,7 @@ void C_UIobject::setPos(Oyster::Math::Float4x4 world) void C_UIobject::Render() { - Oyster::Graphics::API::RenderModel(*(privData->model)); + Oyster::Graphics::API::RenderModel(privData->model); } void C_UIobject::Release() { diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 04795f31..3722f9f8 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -17,7 +17,7 @@ namespace Oyster { Math::Float4x4 View; Math::Float4x4 Projection; - std::vector Lights; + std::vector Lights; float deltaTime; } @@ -55,7 +55,7 @@ namespace Oyster } else { - Render::DefaultRenderer::NewFrame(View, Projection, NULL, 0); + Render::DefaultRenderer::NewFrame(View, Projection, Definitions::Pointlight(), 0); } } @@ -128,7 +128,7 @@ namespace Oyster SAFE_RELEASE(Core::device); } - void API::AddLight(Definitions::Pointlight *light) + void API::AddLight(Definitions::Pointlight light) { Lights.push_back(light); } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 1c489dc8..cb9e26cc 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -71,7 +71,7 @@ namespace Oyster static void DeleteTexture(Texture); //! @brief adds a light to the scene - static void AddLight(Definitions::Pointlight* light); + static void AddLight(Definitions::Pointlight light); //! @brief removes all lights from the scene static void ClearLights(); diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 754197e8..c3b91192 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -16,7 +16,7 @@ namespace Oyster Model::Model* DefaultRenderer::cube = NULL; Model::Model* DefaultRenderer::cube2 = NULL; - void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) + void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight Lights, int numLights) { Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,0,0,1)); Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,0)); @@ -37,7 +37,7 @@ namespace Oyster Resources::Light::LightConstantsData.Unmap(); data = Resources::Light::PointLightsData.Map(); - memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); + memcpy(data, &Lights, sizeof(Definitions::Pointlight) * numLights); Resources::Light::PointLightsData.Unmap(); Definitions::PostData pd; diff --git a/Code/OysterGraphics/Render/DefaultRenderer.h b/Code/OysterGraphics/Render/DefaultRenderer.h index 54075a3f..627998fa 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.h +++ b/Code/OysterGraphics/Render/DefaultRenderer.h @@ -13,7 +13,7 @@ namespace Oyster class DefaultRenderer { 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, float DeltaTime = 0); static void EndFrame(); diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 8810a825..a577f010 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -187,7 +187,7 @@ HRESULT InitDirect3D() pl.Pos = Oyster::Math::Float3(0,-20.0f,0.4f); pl.Radius = 90; - Oyster::Graphics::API::AddLight(&pl); + Oyster::Graphics::API::AddLight(pl); return S_OK; From cc55a3471f6ce2ec1907345d12de0bfddf7d7971 Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 10 Feb 2014 16:22:23 +0100 Subject: [PATCH 28/29] Fixed Const View Proj --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 4 ++-- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 3722f9f8..5a92f0de 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -37,12 +37,12 @@ namespace Oyster return API::Sucsess; } - void API::SetProjection(Math::Float4x4& projection) + void API::SetProjection(const Math::Float4x4& projection) { Projection = projection; } - void API::SetView(Math::Float4x4& view) + void API::SetView(const Math::Float4x4& view) { View = view; } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index cb9e26cc..65f82460 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -42,9 +42,9 @@ namespace Oyster static void Clean(); //! @brief Sets the view matrix to use next frame - static void SetView(Oyster::Math::Float4x4& View); + static void SetView(const Oyster::Math::Float4x4& View); //! @brief Sets the projection matrix to use next frame - static void SetProjection(Oyster::Math::Float4x4& Projection); + static void SetProjection(const Oyster::Math::Float4x4& Projection); //! @brief will internally use last values from SetView and SetProjection static void NewFrame(); @@ -71,7 +71,7 @@ namespace Oyster static void DeleteTexture(Texture); //! @brief adds a light to the scene - static void AddLight(Definitions::Pointlight light); + static void AddLight(const Definitions::Pointlight light); //! @brief removes all lights from the scene static void ClearLights(); From 450f4249f34a80d6f5509af32c50d2f61eaadc69 Mon Sep 17 00:00:00 2001 From: Dennis Andersen Date: Mon, 10 Feb 2014 22:25:31 +0100 Subject: [PATCH 29/29] Documentation - Updated uml diagrams --- Code/Dokumentation/Danbias Structure.uxf | 455 ++++++++++-------- Code/Dokumentation/GameServer.uxf | 311 ++++++------ Code/Dokumentation/Resource.uxf | 260 ++++++++-- .../GameClientState/LobbyState.cpp | 2 +- .../GameClientState/LoginState.cpp | 1 + Code/Misc/Misc.vcxproj | 42 +- Code/Misc/Resource/ResourceManager.h | 3 +- 7 files changed, 657 insertions(+), 417 deletions(-) diff --git a/Code/Dokumentation/Danbias Structure.uxf b/Code/Dokumentation/Danbias Structure.uxf index c24380c9..d52aa795 100644 --- a/Code/Dokumentation/Danbias Structure.uxf +++ b/Code/Dokumentation/Danbias Structure.uxf @@ -1,212 +1,197 @@ - 11 + 7 com.umlet.element.Class - 847 - 363 - 132 - 33 + 728 + 413 + 91 + 21 - Graphics + Graphics <<module>> +bg=orange com.umlet.element.Class - 561 - 363 - 132 - 33 + 546 + 413 + 84 + 21 - Sound + Sound<<?>> com.umlet.element.Class - 671 - 209 - 132 - 33 + 616 + 322 + 84 + 21 - Physics + Physics <<module>> +bg=orange com.umlet.element.Class - 858 - 132 - 121 - 33 + 735 + 238 + 77 + 21 - Game client + Game client <<dll>> +bg=red com.umlet.element.Class - 484 - 209 - 154 - 33 + 616 + 287 + 98 + 21 - Gamelogic + Gamelogic <<dll>> +bg=red com.umlet.element.Class - 506 - 132 - 121 - 33 + 504 + 238 + 84 + 21 - Game server + Game server <<dll>> +bg=red com.umlet.element.Class - 671 - 132 - 132 - 33 + 616 + 238 + 84 + 21 - Network + Network <<module>> +bg=orange com.umlet.element.Class - 704 - 363 - 132 - 33 + 637 + 413 + 84 + 21 - Input + Input<<lib>> +bg=blue com.umlet.element.Class - 495 - 55 - 176 - 44 + 714 + 182 + 98 + 28 - DanBiasClientLauncher + GameLauncher <<exe>> bg=green com.umlet.element.Relation - 880 - 132 - 54 - 252 + 749 + 238 + 34 + 188 lt=<- - 33;231;33;209;33;33 + 21;175;21;161;21;21 com.umlet.element.Relation - 583 - 132 - 351 - 252 + 560 + 238 + 223 + 188 lt=<- - 33;231;33;209;330;209;330;33 + 21;175;21;161;210;161;210;21 com.umlet.element.Relation - 528 - 132 - 54 - 98 + 525 + 238 + 146 + 62 lt=<- - 33;77;33;33 + 133;49;133;35;21;35;21;21 com.umlet.element.Relation - 594 - 110 - 98 - 54 + 567 + 224 + 62 + 34 lt=<- - 77;33;33;33 + 49;21;21;21 com.umlet.element.Relation - 605 - 187 - 87 - 54 + 637 + 287 + 34 + 48 lt=<- - 66;33;33;33 + 21;35;21;21 com.umlet.element.Relation - 737 - 132 - 197 - 252 + 658 + 238 + 125 + 188 lt=<- - 33;231;33;209;176;209;176;33 + 21;175;21;161;112;161;112;21 com.umlet.element.Relation - 770 - 110 - 109 - 54 + 679 + 224 + 69 + 34 lt=<- - 33;33;88;33 - - - com.umlet.element.Relation - - 880 - 66 - 54 - 87 - - lt=>- - 33;33;33;66 - - - com.umlet.element.Relation - - 528 - 66 - 54 - 87 - - lt=>- - 33;33;33;66 + 21;21;56;21 com.umlet.element.Package - 440 - 22 - 550 - 396 + 455 + 161 + 371 + 287 GameEngine @@ -214,21 +199,21 @@ bg=green com.umlet.element.Relation - 880 - 363 - 54 - 164 + 749 + 413 + 34 + 104 lt=<<. - 33;33;33;143 + 21;21;21;91 com.umlet.element.Package - 891 - 506 - 319 - 220 + 756 + 504 + 203 + 140 Graphics @@ -236,10 +221,10 @@ bg=green com.umlet.element.Class - 902 - 539 - 297 - 176 + 763 + 525 + 189 + 112 <<interface>> OysterGfx @@ -256,10 +241,10 @@ Release(resource :Model*) :void com.umlet.element.Package - 561 - 506 - 308 - 242 + 546 + 504 + 196 + 154 Input @@ -267,21 +252,21 @@ Release(resource :Model*) :void com.umlet.element.Relation - 649 - 363 - 142 - 175 + 602 + 413 + 90 + 111 lt=<<. - 121;33;121;154;33;154 + 77;21;77;98;21;98 com.umlet.element.Class - 572 - 539 - 286 - 198 + 553 + 525 + 182 + 126 <<interface>> RawInput @@ -299,32 +284,33 @@ Enable(Enable :bool) :void com.umlet.element.Class - 451 - 363 - 99 - 33 + 462 + 413 + 77 + 21 - Window API + Window API<<lib>> +bg=blue com.umlet.element.Relation - 462 - 132 - 472 - 252 + 483 + 238 + 300 + 188 lt=<- - 33;231;33;209;451;209;451;33 + 21;175;21;161;287;161;287;21 com.umlet.element.Package - 176 - 506 - 374 - 242 + 301 + 504 + 238 + 154 Sound @@ -332,10 +318,10 @@ Enable(Enable :bool) :void com.umlet.element.Class - 187 - 539 - 352 - 121 + 308 + 525 + 224 + 77 <<interface>> SoundWrapper @@ -349,10 +335,10 @@ Release(Resource :ResourceHandle*) :void com.umlet.element.Class - 187 - 693 - 352 - 44 + 308 + 623 + 224 + 28 <<API>> -- @@ -362,79 +348,152 @@ FMOD com.umlet.element.Relation - 330 - 627 - 54 - 87 + 399 + 581 + 34 + 55 lt=<<. - 33;66;33;33 + 21;42;21;21 com.umlet.element.Relation - 286 - 363 - 362 - 175 + 371 + 413 + 230 + 111 lt=<<. - 341;33;341;88;253;88;253;154;33;154 + 217;21;217;56;161;56;161;98;21;98 com.umlet.element.Class - 781 - 55 - 198 - 44 + 476 + 329 + 84 + 28 - DanBiasServerLauncher + Math <<lib>> +-- +/Is used globaly/ +bg=blue + + + + com.umlet.element.Relation + + 539 + 238 + 237 + 125 + + lt=<- + 21;112;224;112;224;21 + + + com.umlet.element.Class + + 476 + 294 + 77 + 28 + + Misc <<lib>> +-- +/Is used globaly/ +bg=blue + + + + com.umlet.element.Relation + + 539 + 273 + 90 + 76 + + lt=<- + 21;63;56;63;56;21;77;21 + + + UMLClass + + 105 + 168 + 245 + 140 + + /*HISTORY*/ +-- +10/2-2014 +Renamed DanBiasClientLauncher -> GameLauncher +Removed DanBiasServerLauncher - connected to GameClient +Added missing cconnections +Specified what type of box and added a colour +-- +elementstyle=wordwrap +bg=gray + + + + + com.umlet.element.Relation + + 749 + 189 + 34 + 62 + + lt=<- + 21;49;21;21 + + + com.umlet.element.Class + + 504 + 189 + 91 + 28 + + ServerUI <<exe>> +-- +/template for future/ bg=green - com.umlet.element.Class + com.umlet.element.Relation - 671 - 253 - 132 - 33 + 525 + 196 + 34 + 55 - Math - + lt=<- + 21;42;21;21 com.umlet.element.Relation - 770 - 132 - 153 - 164 + 539 + 308 + 90 + 48 lt=<- - 33;143;132;143;132;33 - - - com.umlet.element.Class - - 682 - 297 - 99 - 33 - - Misc - + 21;35;63;35;63;21;77;21 com.umlet.element.Relation - 605 - 198 - 87 - 98 + 532 + 273 + 97 + 41 lt=<- - 66;77;44;77;44;33;33;33 + 21;28;56;28;56;21;84;21 diff --git a/Code/Dokumentation/GameServer.uxf b/Code/Dokumentation/GameServer.uxf index 735a2592..890e2cbb 100644 --- a/Code/Dokumentation/GameServer.uxf +++ b/Code/Dokumentation/GameServer.uxf @@ -1,13 +1,13 @@ - - 10 + + 8 UMLClass - 610 - 340 - 100 - 30 + 632 + 344 + 104 + 24 GameLobby @@ -16,137 +16,100 @@ UMLClass - 580 - 480 - 160 - 80 + 624 + 416 + 128 + 48 GameSession -- /One instance of a game/ -/including x number of/ -/players./ +/including n players./ com.umlet.element.Relation - 620 - 340 - 60 - 160 + 664 + 344 + 40 + 88 lt=->>>> - 30;140;40;30 + 24;72;24;24 com.umlet.element.Relation - 710 - 480 - 100 - 50 + 664 + 440 + 40 + 104 lt=>>>>- - 80;30;30;30 + 24;88;24;24 UMLClass - 600 - 180 - 120 - 120 + 40 + 120 + 368 + 344 - GameServer + GameServerAPI <<singleton>> +-- +{innerclass ++ServerInitDesc<<struct>> +-- +serverName :char pointer +listenPort :int +bool broadcast :bool +ServerInitDesc() :void +innerclass} +{innerclass ++GameServerInfo<<struct>> +-- +listenPort :unsigned int +serverIp :const char pointer +innerclass} + ++static DanBiasServerReturn ServerInitiate(const ServerInitDesc& desc); ++static ServerStart() :void ++static ServerStop() :void ++static ServerUpdate() :void ++static ServerGetInfo() :GameServerInfo ++static ServerIsRunning() :bool ++static GameSetMapId( val :const int& ) :void ++static GameSetMaxClients( val :const int& ) :void ++static GameSetGameMode(val :const int&) :void ++static GameSetGameTime(val :const int&) :void ++static GameGetMapId() :int ++static GameGetMaxClients() :int ++static GameGetGameMode() :int ++static GameGetGameTime() :int ++static GameGetGameName() :const char pointer ++static GameStart() :bool com.umlet.element.Relation - 630 - 270 - 50 - 90 - - lt=>>>>- - 30;70;30;30 - - - UMLClass - - 590 - 100 - 130 + 384 + 328 + 264 40 - <<wrapper>> -DanBiasServerAPI - - - - com.umlet.element.Relation - - 630 - 110 - 50 - 90 - - lt=>>>>- - - 30;70;30;30 - - - UMLClass - - 1060 - 330 - 120 - 50 - - NetworkSession - - - - com.umlet.element.Relation - - 690 - 220 - 390 - 50 - - lt=-<<<< - 30;30;370;30 - - - com.umlet.element.Relation - - 680 - 320 - 400 - 50 - - lt=->>>>> - 30;30;380;30 - - - com.umlet.element.Relation - - 690 - 340 - 390 - 160 - - lt=->>>>> - 30;140;40;40;370;30 + lt=>>>>- + 248;24;24;24 com.umlet.element.Package - 460 - 640 - 120 - 50 + 440 + 424 + 96 + 40 GameLogicAPI bg=blue @@ -155,21 +118,21 @@ bg=blue com.umlet.element.Relation - 370 - 530 - 350 - 290 + 512 + 424 + 128 + 40 lt=<<. - 90;150;30;270;330;240;240;30 + 24;24;112;24 UMLClass - 790 - 500 - 100 - 30 + 624 + 528 + 144 + 24 GameClient @@ -177,21 +140,21 @@ bg=blue com.umlet.element.Relation - 670 - 530 - 150 - 180 + 520 + 416 + 120 + 104 lt=<<. - 130;160;30;30 + 24;88;64;88;64;24;104;24 com.umlet.element.Package - 800 - 670 - 120 - 40 + 448 + 480 + 96 + 48 GameProtocols bg=#aaaaa @@ -200,10 +163,10 @@ bg=#aaaaa com.umlet.element.Package - 1040 - 200 - 160 - 190 + 720 + 160 + 152 + 24 NetworkAPI bg=#a21aff @@ -212,56 +175,84 @@ bg=#a21aff UMLClass - 1060 - 280 - 120 - 40 + 40 + 24 + 320 + 64 - NetworkClient - - - - UMLClass - - 1060 - 230 - 120 - 40 - - NetworkServer + /*HISTORY*/ +-- +10/2-2014 +Restructured old +-- +elementstyle=wordwrap +bg=gray com.umlet.element.Relation - 690 - 240 - 390 - 80 + 720 + 160 + 40 + 272 - lt=-> - 30;30;200;30;200;60;370;60 + lt=<<. + 24;24;24;256 com.umlet.element.Relation - 690 - 260 - 390 - 100 + 704 + 160 + 40 + 200 - lt=-<<<< - 30;30;180;30;180;80;370;80 + lt=<<. + 24;24;24;184 com.umlet.element.Relation - 860 - 270 - 380 - 260 + 384 + 152 + 352 + 40 - lt=>>>- - 320;30;360;30;360;230;30;240 + lt=<<. + 336;24;24;24 + + + com.umlet.element.Relation + + 736 + 160 + 40 + 384 + + lt=<<. + 24;24;24;368 + + + com.umlet.element.Relation + + 520 + 480 + 136 + 64 + + lt=<<. + 24;24;120;24;120;48 + + + com.umlet.element.Relation + + 512 + 432 + 160 + 112 + + lt=<<. + 24;24;72;24;72;72;144;72;144;96 diff --git a/Code/Dokumentation/Resource.uxf b/Code/Dokumentation/Resource.uxf index c62ae895..1258c9af 100644 --- a/Code/Dokumentation/Resource.uxf +++ b/Code/Dokumentation/Resource.uxf @@ -1,13 +1,13 @@ - - 16 + + 6 com.umlet.element.Class - 560 - 80 - 176 - 80 + 198 + 300 + 66 + 30 <<interface>> OysterResource @@ -16,23 +16,23 @@ OysterResource com.umlet.element.Relation - 528 - 112 - 206 - 160 + 186 + 312 + 76 + 60 lt=>> implements - 112;128;112;48 + 42;48;42;18 com.umlet.element.Actor - 352 - 240 - 128 - 192 + 120 + 360 + 48 + 72 Dev @@ -40,22 +40,22 @@ implements com.umlet.element.Relation - 320 - 32 - 272 - 240 + 108 + 282 + 102 + 90 lt=<. interacts> - 240;80;96;80;96;208 + 90;30;36;30;36;78 com.umlet.element.Class - 576 - 576 - 160 - 32 + 204 + 486 + 60 + 12 CustomLoader @@ -63,10 +63,10 @@ interacts> com.umlet.element.Class - 576 - 528 - 160 - 32 + 204 + 468 + 60 + 12 ByteLoader @@ -75,33 +75,33 @@ ByteLoader com.umlet.element.Relation - 464 - 384 - 144 - 192 + 162 + 414 + 54 + 72 lt=<<- - 80;48;48;48;48;160;112;160 + 30;18;18;18;18;60;42;60 com.umlet.element.Relation - 368 - 384 - 266 - 240 + 126 + 414 + 98 + 90 lt=<<- implements partly - 176;48;144;48;144;208;208;208 + 66;18;54;18;54;78;78;78 UMLClass - 544 - 240 - 208 - 128 + 192 + 360 + 78 + 48 -- <<interface>> @@ -115,10 +115,10 @@ halign=center UMLClass - 544 - 400 - 208 - 80 + 192 + 420 + 78 + 30 OResource @@ -130,13 +130,171 @@ halign=center com.umlet.element.Relation - 688 - 256 - 196 - 224 + 252 + 366 + 66 + 84 lt=>>>> manages> - 64;192;112;192;112;48;64;48 + 18;72;36;72;36;18;18;18 + + + UMLClass + + 108 + 282 + 240 + 234 + + old +bg=gray + + + + UMLClass + + 402 + 342 + 576 + 204 + + ResourceManager +-- ++ ResourceManager() :void ++ ~ResourceManager() :void ++ HBYTEARRAY LoadBytes(const wchar_t filename[], ResourceType type, int customId = -1, bool force = false) ++ HRESOURCE LoadResource(const wchar_t filename[], LoadFunction loadFnc = 0, UnloadFunction unloadFnc = 0, int customId = -1, bool force = false) ++ HRESOURCE ReloadResource(const wchar_t filename[]) ++ HRESOURCE ReloadResource(HRESOURCE& resource) ++ void Clean() ++ void ReleaseResource(const HRESOURCE& resource) ++ void ReleaseResource(const wchar_t filename[]) ++ void SetResourceId(const HRESOURCE& resource, unsigned int id) ++ void SetResourceId(const wchar_t filename[], unsigned int id) ++ ResourceType GetResourceType(const HRESOURCE& resource) ++ ResourceType GetResourceType (const wchar_t filename[]) ++ const wchar_t* GetResourceFilename(const HRESOURCE& resource); ++ HRESOURCE GetResourceHandle(const wchar_t filename[]) ++ int GetResourceId(const HRESOURCE& resource); ++ int GetResourceId(const wchar_t filename[]); +-- +- ResourceManager(const ResourceManager& obj); +- const ResourceManager& operator=(const ResourceManager&); +- std::map<std::wstring, ResourceData*> resources; + + + + UMLClass + + 390 + 198 + 600 + 360 + + Oyster <<namespace>> +-- + + + + + UMLClass + + 396 + 222 + 588 + 330 + + Resource <<namespace>> +-- + + + + + UMLClass + + 534 + 282 + 126 + 18 + + HRESOURCE: void* <<typedef>> + + + + UMLClass + + 534 + 300 + 126 + 18 + + HBYTE: char <<typedef>> + + + + UMLClass + + 534 + 318 + 126 + 18 + + HBYTEARRAY: char* <<typedef>> + + + + UMLClass + + 534 + 246 + 264 + 18 + + UnloadFunction :void(*UnloadFunction)(void* loadedData) <<typedef>> + + + + UMLClass + + 534 + 264 + 288 + 18 + + LoadFunction :void*(*LoadFunction)(const wchar_t filename[]) <<typedef>> + + + + UMLClass + + 402 + 246 + 126 + 90 + + ResourceType <<enum>> +-- +ResourceType_Byte_Raw +ResourceType_Byte_ANSI +ResourceType_Byte_UTF8 +ResourceType_Byte_UNICODE +ResourceType_Byte_UTF16LE +ResourceType_CUSTOM +ResourceType_INVALID + + + + + UMLClass + + 378 + 174 + 630 + 396 + + New +bg=green + diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp index ccfe636d..98d192dd 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp @@ -95,7 +95,7 @@ GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* Key { if(!DanBias::GameServerAPI::GameStart()) { - //this->nwClient->Send(GameLogic::Protocol_LobbyStartGame()); + } } } diff --git a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp index e2392558..4b6c8df9 100644 --- a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp @@ -119,6 +119,7 @@ GameClientState::ClientState LoginState::Update(float deltaTime, InputClass* Key { // game ip nwClient->Connect(15152, "127.0.0.1"); + //nwClient->Connect(15152, "83.254.217.248"); if (!nwClient->IsConnected()) { diff --git a/Code/Misc/Misc.vcxproj b/Code/Misc/Misc.vcxproj index 2d9392a3..512784e7 100644 --- a/Code/Misc/Misc.vcxproj +++ b/Code/Misc/Misc.vcxproj @@ -147,10 +147,30 @@ - - - - + + false + false + false + false + + + false + false + false + false + + + false + false + false + false + + + false + false + false + false + false false @@ -171,8 +191,18 @@ - - + + false + false + false + false + + + false + false + false + false + false false diff --git a/Code/Misc/Resource/ResourceManager.h b/Code/Misc/Resource/ResourceManager.h index 4c90966e..43aa0215 100644 --- a/Code/Misc/Resource/ResourceManager.h +++ b/Code/Misc/Resource/ResourceManager.h @@ -13,6 +13,7 @@ namespace Oyster typedef void* HRESOURCE; typedef char HBYTE; typedef HBYTE* HBYTEARRAY; + /** Typedef on a fuction required for custom unloading */ typedef void(*UnloadFunction)(void* loadedData); @@ -30,7 +31,7 @@ namespace Oyster ResourceType_Byte_UTF16LE, /**< Handle can be interpeted as char[] or char* */ ResourceType_CUSTOM, /**< Handle can be interpeted as whatever */ - ResourceType_INVALID, /**< Handle can be interpeted as whatever */ + ResourceType_INVALID, }; /** A resource handler interface to interact with when loading resources.