Merge branch 'Graphics2D' into Graphics
This commit is contained in:
commit
898fc883e9
|
@ -18,6 +18,8 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
Math::Matrix WV;
|
Math::Matrix WV;
|
||||||
Math::Matrix WVP;
|
Math::Matrix WVP;
|
||||||
|
int Animated;
|
||||||
|
Math::Float3 Pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FinalVertex
|
struct FinalVertex
|
||||||
|
@ -52,8 +54,6 @@ namespace Oyster
|
||||||
struct AnimationData
|
struct AnimationData
|
||||||
{
|
{
|
||||||
Math::Float4x4 AnimatedData[100];
|
Math::Float4x4 AnimatedData[100];
|
||||||
int Animated;
|
|
||||||
Math::Float3 Pad;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuiData
|
struct GuiData
|
||||||
|
|
|
@ -163,7 +163,17 @@ namespace Oyster
|
||||||
|
|
||||||
void API::RenderGuiElement(API::Texture tex, Math::Float2 pos, Math::Float2 size)
|
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)
|
||||||
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,6 +68,7 @@ namespace Oyster
|
||||||
static void DeleteModel(Oyster::Graphics::Model::Model* model);
|
static void DeleteModel(Oyster::Graphics::Model::Model* model);
|
||||||
|
|
||||||
static Texture CreateTexture(std::wstring filename);
|
static Texture CreateTexture(std::wstring filename);
|
||||||
|
static void DeleteTexture(Texture);
|
||||||
|
|
||||||
//! @brief adds a light to the scene
|
//! @brief adds a light to the scene
|
||||||
static void AddLight(Definitions::Pointlight light);
|
static void AddLight(Definitions::Pointlight light);
|
||||||
|
|
|
@ -72,12 +72,7 @@ namespace Oyster
|
||||||
pm.WV = View * models[i].WorldMatrix;
|
pm.WV = View * models[i].WorldMatrix;
|
||||||
pm.WVP = Projection * pm.WV;
|
pm.WVP = Projection * pm.WV;
|
||||||
|
|
||||||
void* data = Resources::Deffered::ModelData.Map();
|
Model::ModelInfo* info = models[i].info;
|
||||||
memcpy(data,&(pm),sizeof(pm));
|
|
||||||
Resources::Deffered::ModelData.Unmap();
|
|
||||||
|
|
||||||
Model::ModelInfo* info = (Model::ModelInfo*)models[i].info;
|
|
||||||
|
|
||||||
|
|
||||||
Definitions::AnimationData am; //final
|
Definitions::AnimationData am; //final
|
||||||
if(info->Animated && models[i].AnimationPlaying != -1)
|
if(info->Animated && models[i].AnimationPlaying != -1)
|
||||||
|
@ -105,12 +100,7 @@ namespace Oyster
|
||||||
|
|
||||||
cube2->WorldMatrix = Scale;
|
cube2->WorldMatrix = Scale;
|
||||||
cube2->WorldMatrix.v[3] = info->bones[b].Absolute.v[3];
|
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;
|
int b = 0;
|
||||||
Model::Animation A = info->Animations[models[i].AnimationPlaying];
|
Model::Animation A = info->Animations[models[i].AnimationPlaying];
|
||||||
while(models[i].AnimationTime>A.duration)
|
while(models[i].AnimationTime>A.duration)
|
||||||
|
@ -160,27 +150,19 @@ namespace Oyster
|
||||||
am.AnimatedData[b] = (BoneAbsAnimated[b] * SkinTransform[b]);
|
am.AnimatedData[b] = (BoneAbsAnimated[b] * SkinTransform[b]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//retore to draw animated model
|
|
||||||
Definitions::PerModel pm;
|
void *data = Resources::Deffered::AnimationData.Map();
|
||||||
pm.WV = View * models[i].WorldMatrix;
|
memcpy(data,&am,sizeof(Definitions::AnimationData));
|
||||||
pm.WVP = Projection * pm.WV;
|
Resources::Deffered::AnimationData.Unmap();
|
||||||
|
|
||||||
void* data = Resources::Deffered::ModelData.Map();
|
pm.Animated = 1;
|
||||||
memcpy(data,&(pm),sizeof(pm));
|
|
||||||
Resources::Deffered::ModelData.Unmap();
|
|
||||||
|
|
||||||
//delete[]SkinTransform;
|
|
||||||
//delete[]BoneAbsAnimated;
|
|
||||||
//delete[]BoneAnimated;
|
|
||||||
|
|
||||||
am.Animated = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
am.Animated = 0;
|
pm.Animated = 0;
|
||||||
|
|
||||||
data = Resources::Deffered::AnimationData.Map();
|
void* data = Resources::Deffered::ModelData.Map();
|
||||||
memcpy(data,&am,sizeof(Definitions::AnimationData));
|
memcpy(data,&(pm),sizeof(pm));
|
||||||
Resources::Deffered::AnimationData.Unmap();
|
Resources::Deffered::ModelData.Unmap();
|
||||||
|
|
||||||
if(info->Material.size())
|
if(info->Material.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "GuiRender.h"
|
#include "GuiRender.h"
|
||||||
|
#include "../Resources/Deffered.h"
|
||||||
|
#include "../../Definitions/GraphicalDefinition.h"
|
||||||
|
|
||||||
namespace Oyster
|
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 *= 2;
|
||||||
//Pos.x += size.x/2;
|
pos -= 1;
|
||||||
|
pos.y *= -1;
|
||||||
|
|
||||||
//Pos.y -= instance.sizeY/2;
|
Definitions::GuiData gd;
|
||||||
//Pos.y += size.y/2;
|
|
||||||
|
|
||||||
//Matrix m;
|
gd.Translation = Math::Matrix::identity;
|
||||||
//m = Math::Matrix::identity;
|
gd.Translation.m41 = pos.x;
|
||||||
//float width = (1.0f/(instance.sizeX/2.0f));
|
gd.Translation.m42 = pos.y;
|
||||||
//float height = (1.0f/(instance.sizeY/2.0f));
|
gd.Translation.m11 = size.x;
|
||||||
//m.m41=Pos.x * width;
|
gd.Translation.m22 = size.y;
|
||||||
//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);
|
|
||||||
|
void* data = Render::Resources::Deffered::GuiData.Map();
|
||||||
|
memcpy(data,&gd,sizeof(gd));
|
||||||
|
Render::Resources::Deffered::GuiData.Unmap();
|
||||||
|
|
||||||
|
Core::deviceContext->Draw(1,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void BeginRender();
|
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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@ SamplerState S1 : register(s0);
|
||||||
cbuffer Animation : register(b0)
|
cbuffer Animation : register(b0)
|
||||||
{
|
{
|
||||||
float4x4 AnimatedData[100];
|
float4x4 AnimatedData[100];
|
||||||
int Animated;
|
|
||||||
float3 Pad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cbuffer PerModel : register(b1)
|
cbuffer PerModel : register(b1)
|
||||||
{
|
{
|
||||||
matrix WV;
|
matrix WV;
|
||||||
matrix WVP;
|
matrix WVP;
|
||||||
|
int Animated;
|
||||||
|
float3 Pad;
|
||||||
}
|
}
|
Loading…
Reference in New Issue