Model Tint added
This commit is contained in:
parent
11b6f6eddc
commit
5fbb901c69
|
@ -87,6 +87,7 @@ namespace Oyster
|
||||||
m->WorldMatrix = Oyster::Math::Float4x4::identity;
|
m->WorldMatrix = Oyster::Math::Float4x4::identity;
|
||||||
m->Visible = true;
|
m->Visible = true;
|
||||||
m->Animation.AnimationPlaying = NULL;
|
m->Animation.AnimationPlaying = NULL;
|
||||||
|
m->Tint = Math::Float3(1);
|
||||||
m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN);
|
m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN);
|
||||||
|
|
||||||
Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
|
Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
ModelInfo* info;
|
ModelInfo* info;
|
||||||
Oyster::Math::Float4x4 WorldMatrix;
|
Oyster::Math::Float4x4 WorldMatrix;
|
||||||
|
Oyster::Math::Float3 Tint;
|
||||||
bool Visible;
|
bool Visible;
|
||||||
AnimationData Animation;
|
AnimationData Animation;
|
||||||
};
|
};
|
||||||
|
|
|
@ -138,6 +138,10 @@ namespace Oyster
|
||||||
memcpy(data,&(pm),sizeof(pm));
|
memcpy(data,&(pm),sizeof(pm));
|
||||||
Resources::Gather::ModelData.Unmap();
|
Resources::Gather::ModelData.Unmap();
|
||||||
|
|
||||||
|
data = Render::Resources::Color.Map();
|
||||||
|
memcpy(data,&models[i].Tint,sizeof(Math::Float3));
|
||||||
|
Render::Resources::Color.Unmap();
|
||||||
|
|
||||||
if(info->Material.size())
|
if(info->Material.size())
|
||||||
{
|
{
|
||||||
Core::deviceContext->PSSetShaderResources(0,(UINT)info->Material.size(),&(info->Material[0]));
|
Core::deviceContext->PSSetShaderResources(0,(UINT)info->Material.size(),&(info->Material[0]));
|
||||||
|
|
|
@ -35,9 +35,9 @@ namespace Oyster
|
||||||
memcpy(data,&gd,sizeof(Definitions::GuiData));
|
memcpy(data,&gd,sizeof(Definitions::GuiData));
|
||||||
Render::Resources::Gui::Data.Unmap();
|
Render::Resources::Gui::Data.Unmap();
|
||||||
|
|
||||||
data = Render::Resources::Gui::Color.Map();
|
data = Render::Resources::Color.Map();
|
||||||
memcpy(data,&color,sizeof(Math::Float3));
|
memcpy(data,&color,sizeof(Math::Float3));
|
||||||
Render::Resources::Gui::Color.Unmap();
|
Render::Resources::Color.Unmap();
|
||||||
|
|
||||||
|
|
||||||
Core::deviceContext->Draw(1,0);
|
Core::deviceContext->Draw(1,0);
|
||||||
|
@ -76,9 +76,9 @@ namespace Oyster
|
||||||
Render::Resources::Gui::Data.Unmap();
|
Render::Resources::Gui::Data.Unmap();
|
||||||
Definitions::Text2D tmpInst;
|
Definitions::Text2D tmpInst;
|
||||||
|
|
||||||
data = Render::Resources::Gui::Color.Map();
|
data = Render::Resources::Color.Map();
|
||||||
memcpy(data,&color,sizeof(Math::Float3));
|
memcpy(data,&color,sizeof(Math::Float3));
|
||||||
Render::Resources::Gui::Color.Unmap();
|
Render::Resources::Color.Unmap();
|
||||||
|
|
||||||
void* dest = Resources::Gui::Text::Vertex.Map();
|
void* dest = Resources::Gui::Text::Vertex.Map();
|
||||||
Definitions::Text2D* dataView = reinterpret_cast<Definitions::Text2D*>(dest);
|
Definitions::Text2D* dataView = reinterpret_cast<Definitions::Text2D*>(dest);
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Oyster
|
||||||
Buffer Resources::Gather::AnimationData = Buffer();
|
Buffer Resources::Gather::AnimationData = Buffer();
|
||||||
Buffer Resources::Light::LightConstantsData = Buffer();
|
Buffer Resources::Light::LightConstantsData = Buffer();
|
||||||
Buffer Resources::Gui::Data = Buffer();
|
Buffer Resources::Gui::Data = Buffer();
|
||||||
Buffer Resources::Gui::Color = Buffer();
|
Buffer Resources::Color = Buffer();
|
||||||
Buffer Resources::Gui::Text::Vertex = Buffer();
|
Buffer Resources::Gui::Text::Vertex = Buffer();
|
||||||
Buffer Resources::Post::Data = Buffer();
|
Buffer Resources::Post::Data = Buffer();
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ namespace Oyster
|
||||||
|
|
||||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS;
|
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS;
|
||||||
desc.ElementSize = sizeof(Math::Float3);
|
desc.ElementSize = sizeof(Math::Float3);
|
||||||
Gui::Color.Init(desc);
|
Color.Init(desc);
|
||||||
|
|
||||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
|
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
|
||||||
desc.NumElements = 1;
|
desc.NumElements = 1;
|
||||||
|
@ -342,6 +342,7 @@ namespace Oyster
|
||||||
Gather::Pass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
Gather::Pass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||||
Gather::Pass.CBuffers.Vertex.push_back(Gather::AnimationData);
|
Gather::Pass.CBuffers.Vertex.push_back(Gather::AnimationData);
|
||||||
Gather::Pass.CBuffers.Vertex.push_back(Gather::ModelData);
|
Gather::Pass.CBuffers.Vertex.push_back(Gather::ModelData);
|
||||||
|
Gather::Pass.CBuffers.Pixel.push_back(Color);
|
||||||
Gather::Pass.RenderStates.Rasterizer = RenderStates::rs;
|
Gather::Pass.RenderStates.Rasterizer = RenderStates::rs;
|
||||||
Gather::Pass.RenderStates.SampleCount = 1;
|
Gather::Pass.RenderStates.SampleCount = 1;
|
||||||
Gather::Pass.RenderStates.SampleState = RenderStates::ss;
|
Gather::Pass.RenderStates.SampleState = RenderStates::ss;
|
||||||
|
@ -383,7 +384,7 @@ namespace Oyster
|
||||||
Gui::Pass.Shaders.Geometry = GetShader::Geometry(L"2D");
|
Gui::Pass.Shaders.Geometry = GetShader::Geometry(L"2D");
|
||||||
Gui::Pass.RTV.push_back(GBufferRTV[2]);
|
Gui::Pass.RTV.push_back(GBufferRTV[2]);
|
||||||
Gui::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
Gui::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
||||||
Gui::Pass.CBuffers.Pixel.push_back(Gui::Color);
|
Gui::Pass.CBuffers.Pixel.push_back(Color);
|
||||||
|
|
||||||
D3D11_INPUT_ELEMENT_DESC indesc2D[] =
|
D3D11_INPUT_ELEMENT_DESC indesc2D[] =
|
||||||
{
|
{
|
||||||
|
@ -427,7 +428,7 @@ namespace Oyster
|
||||||
|
|
||||||
Shader::CreateInputLayout(Text2Ddesc,3, GetShader::Vertex(L"2DText") ,Gui::Text::Pass.IAStage.Layout);
|
Shader::CreateInputLayout(Text2Ddesc,3, GetShader::Vertex(L"2DText") ,Gui::Text::Pass.IAStage.Layout);
|
||||||
Gui::Text::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
Gui::Text::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
||||||
Gui::Text::Pass.CBuffers.Pixel.push_back(Gui::Color);
|
Gui::Text::Pass.CBuffers.Pixel.push_back(Color);
|
||||||
Gui::Text::Pass.SRV.Pixel.push_back(Gui::Text::Font);
|
Gui::Text::Pass.SRV.Pixel.push_back(Gui::Text::Font);
|
||||||
Gui::Text::Pass.RTV.push_back(GBufferRTV[2]);
|
Gui::Text::Pass.RTV.push_back(GBufferRTV[2]);
|
||||||
Gui::Text::Pass.RenderStates.SampleCount = 1;
|
Gui::Text::Pass.RenderStates.SampleCount = 1;
|
||||||
|
@ -455,7 +456,7 @@ namespace Oyster
|
||||||
Light::LightConstantsData.~Buffer();
|
Light::LightConstantsData.~Buffer();
|
||||||
Light::PointLightsData.~Buffer();
|
Light::PointLightsData.~Buffer();
|
||||||
Gui::Data.~Buffer();
|
Gui::Data.~Buffer();
|
||||||
Gui::Color.~Buffer();
|
Color.~Buffer();
|
||||||
Gui::Text::Vertex.~Buffer();
|
Gui::Text::Vertex.~Buffer();
|
||||||
Post::Data.~Buffer();
|
Post::Data.~Buffer();
|
||||||
SAFE_RELEASE(Light::PointLightView);
|
SAFE_RELEASE(Light::PointLightView);
|
||||||
|
|
|
@ -30,6 +30,9 @@ namespace Oyster
|
||||||
static ID3D11UnorderedAccessView* LBufferUAV[LBufferSize];
|
static ID3D11UnorderedAccessView* LBufferUAV[LBufferSize];
|
||||||
static ID3D11ShaderResourceView* LBufferSRV[LBufferSize];
|
static ID3D11ShaderResourceView* LBufferSRV[LBufferSize];
|
||||||
|
|
||||||
|
|
||||||
|
static Core::Buffer Color;
|
||||||
|
|
||||||
|
|
||||||
struct RenderStates
|
struct RenderStates
|
||||||
{
|
{
|
||||||
|
@ -61,7 +64,6 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
static Core::PipelineManager::RenderPass Pass;
|
static Core::PipelineManager::RenderPass Pass;
|
||||||
static Core::Buffer Data;
|
static Core::Buffer Data;
|
||||||
static Core::Buffer Color;
|
|
||||||
struct Text
|
struct Text
|
||||||
{
|
{
|
||||||
static Core::PipelineManager::RenderPass Pass;
|
static Core::PipelineManager::RenderPass Pass;
|
||||||
|
|
|
@ -40,7 +40,7 @@ float3 perturb_normal( float3 N, float3 V, float2 texcoord )
|
||||||
PixelOut main(VertexOut input)
|
PixelOut main(VertexOut input)
|
||||||
{
|
{
|
||||||
PixelOut output;
|
PixelOut output;
|
||||||
output.DiffuseGlow = Diffuse.Sample(S1, input.UV);
|
output.DiffuseGlow = Diffuse.Sample(S1, input.UV) * float4(Color, 1);
|
||||||
float3 normal = normalize(input.normal);
|
float3 normal = normalize(input.normal);
|
||||||
|
|
||||||
normal = perturb_normal( normal, normalize(-input.ViewPos), input.UV );
|
normal = perturb_normal( normal, normalize(-input.ViewPos), input.UV );
|
||||||
|
|
|
@ -41,4 +41,9 @@ cbuffer PerModel : register(b1)
|
||||||
matrix WVP;
|
matrix WVP;
|
||||||
int Animated;
|
int Animated;
|
||||||
float3 Pad;
|
float3 Pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbuffer Tint : register(b0)
|
||||||
|
{
|
||||||
|
float3 Color;
|
||||||
}
|
}
|
|
@ -175,9 +175,12 @@ HRESULT InitDirect3D()
|
||||||
m->WorldMatrix.m[1][1] = 50;
|
m->WorldMatrix.m[1][1] = 50;
|
||||||
m->WorldMatrix.m[2][2] = 0.00000005f;
|
m->WorldMatrix.m[2][2] = 0.00000005f;
|
||||||
m2 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan");
|
m2 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan");
|
||||||
|
m2->Tint = Oyster::Math::Float3(0.8f,0.8f,1);
|
||||||
|
m3 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan");
|
||||||
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
|
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
|
||||||
Oyster::Graphics::API::PlayAnimation(m2, L"movement");
|
Oyster::Graphics::API::PlayAnimation(m2, L"movement", true);
|
||||||
|
Oyster::Graphics::API::PlayAnimation(m3, L"movement", true);
|
||||||
|
|
||||||
t = Oyster::Graphics::API::CreateTexture(L"structure_corp_mdg.png");
|
t = Oyster::Graphics::API::CreateTexture(L"structure_corp_mdg.png");
|
||||||
t2 = Oyster::Graphics::API::CreateTexture(L"whiteGui.png");
|
t2 = Oyster::Graphics::API::CreateTexture(L"whiteGui.png");
|
||||||
|
|
||||||
|
@ -189,21 +192,21 @@ HRESULT InitDirect3D()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pl.Color = Oyster::Math::Float3(1,0,0);
|
pl.Color = Oyster::Math::Float3(1,1,1);
|
||||||
pl.Bright = 1;
|
pl.Bright = 1;
|
||||||
pl.Pos = Oyster::Math::Float3(-20,0,0);
|
pl.Pos = Oyster::Math::Float3(-20,0,0);
|
||||||
pl.Radius = 90;
|
pl.Radius = 90;
|
||||||
|
|
||||||
Oyster::Graphics::API::AddLight(pl);
|
Oyster::Graphics::API::AddLight(pl);
|
||||||
|
|
||||||
pl.Color = Oyster::Math::Float3(0,1,0);
|
pl.Color = Oyster::Math::Float3(1,1,1);
|
||||||
pl.Bright = 1;
|
pl.Bright = 1;
|
||||||
pl.Pos = Oyster::Math::Float3(0,20,0);
|
pl.Pos = Oyster::Math::Float3(0,20,0);
|
||||||
pl.Radius = 90;
|
pl.Radius = 90;
|
||||||
|
|
||||||
Oyster::Graphics::API::AddLight(pl);
|
Oyster::Graphics::API::AddLight(pl);
|
||||||
|
|
||||||
pl.Color = Oyster::Math::Float3(0,0,1);
|
pl.Color = Oyster::Math::Float3(1,1,1);
|
||||||
pl.Bright = 1;
|
pl.Bright = 1;
|
||||||
pl.Pos = Oyster::Math::Float3(0,0,20);
|
pl.Pos = Oyster::Math::Float3(0,0,20);
|
||||||
pl.Radius = 90;
|
pl.Radius = 90;
|
||||||
|
@ -218,6 +221,7 @@ HRESULT Update(float deltaTime)
|
||||||
{
|
{
|
||||||
//angle += Oyster::Math::pi/16 * deltaTime;
|
//angle += Oyster::Math::pi/16 * deltaTime;
|
||||||
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0) * angle,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
|
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0) * angle,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
|
||||||
|
m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0) * -angle,Oyster::Math::Float3(-4,0,0),Oyster::Math::Float3::null);
|
||||||
//Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity;
|
//Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity;
|
||||||
Oyster::Graphics::API::Update(deltaTime);
|
Oyster::Graphics::API::Update(deltaTime);
|
||||||
//m2->Animation.data.AnimationTime += deltaTime;// * 0.5f;
|
//m2->Animation.data.AnimationTime += deltaTime;// * 0.5f;
|
||||||
|
@ -231,8 +235,9 @@ HRESULT Render(float deltaTime)
|
||||||
|
|
||||||
//Oyster::Graphics::API::RenderModel(m);
|
//Oyster::Graphics::API::RenderModel(m);
|
||||||
Oyster::Graphics::API::RenderModel(m2);
|
Oyster::Graphics::API::RenderModel(m2);
|
||||||
Oyster::Graphics::API::StartGuiRender();
|
Oyster::Graphics::API::RenderModel(m3);
|
||||||
//Oyster::Graphics::API::RenderGuiElement(t,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1));
|
//Oyster::Graphics::API::StartGuiRender();
|
||||||
|
//Oyster::Graphics::API::RenderGuiElement(t,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1), Oyster::Math::Float3(0,0,1));
|
||||||
//Oyster::Graphics::API::RenderGuiElement(t2,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1),Oyster::Math::Float3(1,0,0));
|
//Oyster::Graphics::API::RenderGuiElement(t2,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1),Oyster::Math::Float3(1,0,0));
|
||||||
Oyster::Graphics::API::StartTextRender();
|
Oyster::Graphics::API::StartTextRender();
|
||||||
std::wstring fps;
|
std::wstring fps;
|
||||||
|
|
Loading…
Reference in New Issue