updated componenttemplates

This commit is contained in:
turanszkij
2015-07-07 01:02:53 +02:00
parent 5066c4c874
commit ec61ebcb10
11 changed files with 46 additions and 24 deletions
+4 -6
View File
@@ -1,13 +1,16 @@
#include "DeferredRenderableComponent.h"
#include "WickedEngine.h"
DeferredRenderableComponent::DeferredRenderableComponent(bool ssao, bool ssr) :ssao(ssao), ssr(ssr){
DeferredRenderableComponent::DeferredRenderableComponent() :ssao(false), ssr(false){
static const float lightShaftQuality = .4f;
static const float bloomDownSample = 4.f;
static const float particleDownSample = 1.0f;
static const float reflectionDownSample = 0.5f;
static const float ssaoQuality = 0.3f;
wiRenderer::SetEnviromentMap(nullptr);
wiRenderer::SetColorGrading(nullptr);
rtSun.resize(2);
rtSun[0].Initialize(
screenW
@@ -126,11 +129,6 @@ void DeferredRenderableComponent::Compose(){
RenderColorGradedComposition();
wiImage::BatchBegin();
ImageEffects fx = ImageEffects(0, 0, 200, 200);
fx.blendFlag = BLENDMODE_OPAQUE;
fx.mipLevel = 4.5f;
wiImage::Draw(rtBloom.back().shaderResource[0], fx);
}
void DeferredRenderableComponent::RenderReflections(){
+4 -7
View File
@@ -1,7 +1,5 @@
#pragma once
#include "RenderableComponent.h"
#include "RenderTarget.h"
#include "DepthTarget.h"
class DeferredRenderableComponent :
@@ -36,13 +34,12 @@ private:
void RenderComposition2();
void RenderColorGradedComposition();
protected:
bool ssr, ssao;
public:
DeferredRenderableComponent(bool ssao, bool ssr);
~DeferredRenderableComponent();
virtual void Load() = 0;
virtual void Start() = 0;
DeferredRenderableComponent();
~DeferredRenderableComponent();
void Update();
void Render();
void Compose();
+20 -6
View File
@@ -1,17 +1,31 @@
#pragma once
#include "CommonInclude.h"
#include "RenderTarget.h"
#include "DepthTarget.h"
class RenderableComponent
{
public:
static int screenW, screenH;
virtual void Load() = 0;
virtual void Start() = 0;
virtual void Update() = 0;
//Render the composition by layers
virtual void Render() = 0;
RenderableComponent(){}
~RenderableComponent(){}
//initialize component
virtual void Initialize(){};
//load (graphics) resources
virtual void Load(){};
//delete resources
virtual void Unload(){};
//start component, load temporary resources
virtual void Start(){};
//unload temporary resources
virtual void Stop(){};
//update logic
virtual void Update(){};
//Render to layers, rendertargets, etc
virtual void Render(){};
//Compose the rendered layers (for example blend the layers together as Images)
virtual void Compose() = 0;
virtual void Compose(){};
};
+3
View File
@@ -3920,6 +3920,9 @@ void wiRenderer::DrawWorldTransparent(const XMMATRIX& newView, ID3D11ShaderResou
void wiRenderer::DrawSky(const XMVECTOR& newCenter, ID3D11DeviceContext* context)
{
if (enviroMap == nullptr)
return;
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
BindPrimitiveTopology(TRIANGLELIST,context);
//context->RSSetState(backFaceRS);
+3 -1
View File
@@ -31,7 +31,9 @@
#include "WickedHelper.h"
#include "InputManager.h"
#include "RenderableComponent.h"
#include "ForwardRenderableComponent.h"
#include "DeferredRenderableComponent.h"
+2
View File
@@ -329,6 +329,7 @@
<ClCompile Include="DirectInput.cpp" />
<ClCompile Include="EmittedParticle.cpp" />
<ClCompile Include="Font.cpp" />
<ClCompile Include="ForwardRenderableComponent.cpp" />
<ClCompile Include="FrameRate.cpp" />
<ClCompile Include="Frustum.cpp" />
<ClCompile Include="HairParticle.cpp" />
@@ -578,6 +579,7 @@
<ClInclude Include="Client.h" />
<ClInclude Include="CommonInclude.h" />
<ClInclude Include="DeferredRenderableComponent.h" />
<ClInclude Include="ForwardRenderableComponent.h" />
<ClInclude Include="RenderableComponent.h" />
<ClInclude Include="WickedEngine.h" />
<ClInclude Include="CpuInfo.h" />
@@ -590,6 +590,9 @@
<ClCompile Include="RenderableComponent.cpp">
<Filter>ComponentTemplates</Filter>
</ClCompile>
<ClCompile Include="ForwardRenderableComponent.cpp">
<Filter>ComponentTemplates</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="BackLog.h">
@@ -1375,6 +1378,9 @@
<ClInclude Include="CommonInclude.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ForwardRenderableComponent.h">
<Filter>ComponentTemplates</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\io_export_wicked_wi_bin.py" />
+1 -1
View File
@@ -20,7 +20,7 @@ float4 main( VertexToPixel PSIn ) : SV_TARGET
[branch]if(!unshaded){
float4 material = materialMap.SampleLevel(Sampler,screenPos,0);
float specular = material.w*specularMaximumIntensity;
uint specular_power = material.z*1000;
uint specular_power = material.z;
float3 normal = norU.xyz;
bool toonshaded = isToon(norU.w);
+1 -1
View File
@@ -95,7 +95,7 @@ PixelOutputType main(PixelInputType PSIn)
Out.col = float4((baseColor.rgb+colorMask.rgb)*(1+emit),1);
Out.nor = float4((normal.xyz),properties);
Out.vel = float4(PSIn.vel.xy*float2(-1,1),specular_power*0.001,spec.a);
Out.vel = float4(PSIn.vel.xy*float2(-1,1),specular_power,spec.a);
return Out;
+1 -1
View File
@@ -18,7 +18,7 @@ float4 main(VertexToPixel PSIn) : SV_TARGET
[branch]if(!unshaded){
float4 material = materialMap.SampleLevel(Sampler,screenPos,0);
float specular = material.w*specularMaximumIntensity;
uint specular_power = material.z*1000;
uint specular_power = material.z;
float3 normal = norU.xyz;
bool toonshaded = isToon(norU.w);
+1 -1
View File
@@ -22,7 +22,7 @@ float4 main(VertexToPixel PSIn) : SV_TARGET
[branch]if(!unshaded){
float4 material = materialMap.SampleLevel(Sampler,screenPos,0);
float specular = material.w*specularMaximumIntensity;
uint specular_power = material.z*1000;
uint specular_power = material.z;
float3 normal = norU.xyz;
bool toonshaded = isToon(norU.w);