Seperate Glow and Tint

This commit is contained in:
lanariel 2014-02-20 12:07:53 +01:00
parent d537bd6791
commit a965c66e13
10 changed files with 56 additions and 4 deletions

View File

@ -100,6 +100,26 @@ void C_Object::Release()
} }
} }
Oyster::Math::Float3 C_Object::GetTint()
{
return model->Tint;
}
Oyster::Math::Float3 C_Object::GetGlowTint()
{
return model->GlowTint;
}
void C_Object::SetTint(Oyster::Math::Float3 tint)
{
model->Tint = tint;
}
void C_Object::SetGlowTint(Oyster::Math::Float3 tint)
{
model->GlowTint = tint;
}
//////////////////////////////////////////////// ////////////////////////////////////////////////

View File

@ -66,6 +66,13 @@ namespace DanBias
void addScale(Oyster::Math::Float3 deltaScale); void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const; Oyster::Math::Float3 getScale() const;
Oyster::Math::Float3 GetTint();
Oyster::Math::Float3 GetGlowTint();
void SetTint(Oyster::Math::Float3);
void SetGlowTint(Oyster::Math::Float3);
// RB DEBUG // RB DEBUG
bool InitRB(RBInitData modelInit); bool InitRB(RBInitData modelInit);
Oyster::Math::Float4x4 getRBWorld() const; Oyster::Math::Float4x4 getRBWorld() const;

View File

@ -182,7 +182,9 @@ bool GameState::Render()
for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject ) for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject )
{ {
if( dynamicObject->second ) if( dynamicObject->second )
{
dynamicObject->second->Render(); dynamicObject->second->Render();
}
} }

View File

@ -79,6 +79,14 @@ namespace Oyster
unsigned int StopY; unsigned int StopY;
Math::Float4 BlurMask; Math::Float4 BlurMask;
}; };
struct TintData
{
Math::Float3 Tint;
Math::Float PAD;
Math::Float3 GlowTint;
Math::Float PAD2;
};
} }
} }
} }

View File

@ -139,6 +139,7 @@ namespace Oyster
m->Visible = true; m->Visible = true;
m->Animation.AnimationPlaying = NULL; m->Animation.AnimationPlaying = NULL;
m->Tint = Math::Float3(1); m->Tint = Math::Float3(1);
m->GlowTint = 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;

View File

@ -24,6 +24,7 @@ namespace Oyster
ModelInfo* info; ModelInfo* info;
Oyster::Math::Float4x4 WorldMatrix; Oyster::Math::Float4x4 WorldMatrix;
Oyster::Math::Float3 Tint; Oyster::Math::Float3 Tint;
Oyster::Math::Float3 GlowTint;
bool Visible; bool Visible;
AnimationData Animation; AnimationData Animation;
}; };

View File

@ -136,8 +136,15 @@ namespace Oyster
memcpy(data,&(pm),sizeof(pm)); memcpy(data,&(pm),sizeof(pm));
Resources::Gather::ModelData.Unmap(); Resources::Gather::ModelData.Unmap();
Definitions::TintData td;
td.GlowTint = models[i].GlowTint;
td.Tint = models[i].Tint;
td.PAD = 0;
td.PAD2 = 0;
int s = sizeof(Definitions::TintData);
data = Render::Resources::Color.Map(); data = Render::Resources::Color.Map();
memcpy(data,&models[i].Tint,sizeof(Math::Float3)); memcpy(data,&td,sizeof(Definitions::TintData));
Render::Resources::Color.Unmap(); Render::Resources::Color.Unmap();
if(info->Material.size()) if(info->Material.size())

View File

@ -123,7 +123,7 @@ namespace Oyster
Gather::AnimationData.Init(desc); Gather::AnimationData.Init(desc);
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS;
desc.ElementSize = sizeof(Math::Float3); desc.ElementSize = sizeof(Definitions::TintData);
Color.Init(desc); Color.Init(desc);
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
@ -176,7 +176,7 @@ namespace Oyster
sdesc.Filter = D3D11_FILTER_ANISOTROPIC; sdesc.Filter = D3D11_FILTER_ANISOTROPIC;
sdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; sdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; sdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sdesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sdesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sdesc.MipLODBias = 0; sdesc.MipLODBias = 0;
sdesc.MaxAnisotropy =4; sdesc.MaxAnisotropy =4;
sdesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; sdesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;

View File

@ -40,7 +40,10 @@ 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) * float4(Color, 1); float4 DiffGlow = Diffuse.Sample(S1, input.UV);
float3 tint = Color*(1-DiffGlow) + GlowColor * DiffGlow;
tint = tint / 2;
output.DiffuseGlow = DiffGlow * float4(tint,1);
//NORMALIZE //NORMALIZE
float3x3 CoTangentFrame = cotangent_frame(input.normal, normalize(input.ViewPos), input.UV); float3x3 CoTangentFrame = cotangent_frame(input.normal, normalize(input.ViewPos), input.UV);

View File

@ -42,4 +42,7 @@ cbuffer PerModel : register(b1)
cbuffer Tint : register(b0) cbuffer Tint : register(b0)
{ {
float3 Color; float3 Color;
float PAD;
float3 GlowColor;
float PAD2;
} }