refactor
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
#define WICKEDENGINE_COMMONINCLUDE_H
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
#include <d3d11_2.h>
|
||||
#include <DirectXMath.h>
|
||||
#include <DirectXCollision.h>
|
||||
#include <DXGI1_2.h>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <math.h>
|
||||
|
||||
@@ -78,7 +78,7 @@ void DeferredRenderableComponent::Render(){
|
||||
}
|
||||
|
||||
|
||||
void DeferredRenderableComponent::RenderScene(wiRenderer::DeviceContext context){
|
||||
void DeferredRenderableComponent::RenderScene(DeviceContext context){
|
||||
static const int tessellationQuality = 0;
|
||||
|
||||
wiRenderer::UpdatePerFrameCB(context);
|
||||
|
||||
@@ -8,7 +8,7 @@ class DeferredRenderableComponent :
|
||||
protected:
|
||||
wiRenderTarget rtGBuffer, rtDeferred, rtLight;
|
||||
|
||||
virtual void RenderScene(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderScene(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
wiRenderTarget& GetFinalRT();
|
||||
|
||||
public:
|
||||
|
||||
@@ -66,7 +66,7 @@ void ForwardRenderableComponent::Render(){
|
||||
}
|
||||
|
||||
|
||||
void ForwardRenderableComponent::RenderScene(wiRenderer::DeviceContext context)
|
||||
void ForwardRenderableComponent::RenderScene(DeviceContext context)
|
||||
{
|
||||
rtMain.Activate(context, 0, 0, 0, 1);
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ class ForwardRenderableComponent :
|
||||
protected:
|
||||
wiRenderTarget rtMain;
|
||||
|
||||
virtual void RenderScene(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderScene(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
public:
|
||||
ForwardRenderableComponent();
|
||||
~ForwardRenderableComponent();
|
||||
|
||||
@@ -188,7 +188,7 @@ void Renderable3DComponent::Compose(){
|
||||
Renderable2DComponent::Compose();
|
||||
}
|
||||
|
||||
void Renderable3DComponent::RenderFrameSetUp(wiRenderer::DeviceContext context) {
|
||||
void Renderable3DComponent::RenderFrameSetUp(DeviceContext context) {
|
||||
if (!_needToUpdateRenderData.load())
|
||||
{
|
||||
return;
|
||||
@@ -199,7 +199,7 @@ void Renderable3DComponent::RenderFrameSetUp(wiRenderer::DeviceContext context)
|
||||
|
||||
_needToUpdateRenderData.store(false);
|
||||
}
|
||||
void Renderable3DComponent::RenderReflections(wiRenderer::DeviceContext context){
|
||||
void Renderable3DComponent::RenderReflections(DeviceContext context){
|
||||
if (!getReflectionsEnabled() || getReflectionQuality() < 0.01f)
|
||||
{
|
||||
return;
|
||||
@@ -225,7 +225,7 @@ void Renderable3DComponent::RenderReflections(wiRenderer::DeviceContext context)
|
||||
wiRenderer::DrawSky(context);
|
||||
}
|
||||
}
|
||||
void Renderable3DComponent::RenderShadows(wiRenderer::DeviceContext context){
|
||||
void Renderable3DComponent::RenderShadows(DeviceContext context){
|
||||
if (!getShadowsEnabled())
|
||||
{
|
||||
return;
|
||||
@@ -234,7 +234,7 @@ void Renderable3DComponent::RenderShadows(wiRenderer::DeviceContext context){
|
||||
wiRenderer::ClearShadowMaps(context);
|
||||
wiRenderer::DrawForShadowMap(context);
|
||||
}
|
||||
void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, wiRenderer::DeviceContext context)
|
||||
void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, DeviceContext context)
|
||||
{
|
||||
if (getLensFlareEnabled())
|
||||
{
|
||||
@@ -270,7 +270,7 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende
|
||||
}
|
||||
|
||||
}
|
||||
void Renderable3DComponent::RenderBloom(wiRenderer::DeviceContext context){
|
||||
void Renderable3DComponent::RenderBloom(DeviceContext context){
|
||||
|
||||
wiImageEffects fx((float)wiRenderer::GetScreenWidth(), (float)wiRenderer::GetScreenHeight());
|
||||
|
||||
@@ -305,7 +305,7 @@ void Renderable3DComponent::RenderBloom(wiRenderer::DeviceContext context){
|
||||
wiImage::Draw(rtBloom[1].shaderResource.back(), fx, context);
|
||||
}
|
||||
}
|
||||
void Renderable3DComponent::RenderLightShafts(wiRenderTarget& mainRT, wiRenderer::DeviceContext context){
|
||||
void Renderable3DComponent::RenderLightShafts(wiRenderTarget& mainRT, DeviceContext context){
|
||||
if (!getLightShaftsEnabled())
|
||||
{
|
||||
return;
|
||||
@@ -330,7 +330,7 @@ void Renderable3DComponent::RenderLightShafts(wiRenderTarget& mainRT, wiRenderer
|
||||
}
|
||||
}
|
||||
}
|
||||
void Renderable3DComponent::RenderComposition1(wiRenderTarget& shadedSceneRT, wiRenderer::DeviceContext context){
|
||||
void Renderable3DComponent::RenderComposition1(wiRenderTarget& shadedSceneRT, DeviceContext context){
|
||||
wiImageEffects fx((float)wiRenderer::GetScreenWidth(), (float)wiRenderer::GetScreenHeight());
|
||||
//wiImage::BatchBegin(context);
|
||||
|
||||
@@ -358,7 +358,7 @@ void Renderable3DComponent::RenderComposition1(wiRenderTarget& shadedSceneRT, wi
|
||||
wiImage::Draw(rtLensFlare.shaderResource.back(), fx, context);
|
||||
}
|
||||
}
|
||||
void Renderable3DComponent::RenderComposition2(wiRenderer::DeviceContext context){
|
||||
void Renderable3DComponent::RenderComposition2(DeviceContext context){
|
||||
wiImageEffects fx((float)wiRenderer::GetScreenWidth(), (float)wiRenderer::GetScreenHeight());
|
||||
fx.blendFlag = BLENDMODE_OPAQUE;
|
||||
//wiImage::BatchBegin(context);
|
||||
|
||||
@@ -63,15 +63,15 @@ protected:
|
||||
|
||||
vector<wiTaskThread*> workerThreads;
|
||||
|
||||
virtual void RenderFrameSetUp(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderReflections(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderShadows(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderScene(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext()) = 0;
|
||||
virtual void RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderBloom(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderLightShafts(wiRenderTarget& mainRT, wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderComposition1(wiRenderTarget& shadedSceneRT, wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderComposition2(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderFrameSetUp(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderReflections(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderShadows(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderScene(DeviceContext context = wiRenderer::getImmediateContext()) = 0;
|
||||
virtual void RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderBloom(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderLightShafts(wiRenderTarget& mainRT, DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderComposition1(wiRenderTarget& shadedSceneRT, DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderComposition2(DeviceContext context = wiRenderer::getImmediateContext());
|
||||
virtual void RenderColorGradedComposition();
|
||||
public:
|
||||
inline float getLightShaftQuality(){ return lightShaftQuality; }
|
||||
|
||||
@@ -9,7 +9,7 @@ Luna<Texture_BindLua>::PropertyType Texture_BindLua::properties[] = {
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
Texture_BindLua::Texture_BindLua(wiRenderer::TextureView texture) :texture(texture)
|
||||
Texture_BindLua::Texture_BindLua(TextureView texture) :texture(texture)
|
||||
{
|
||||
}
|
||||
Texture_BindLua::Texture_BindLua(lua_State *L)
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
class Texture_BindLua
|
||||
{
|
||||
public:
|
||||
wiRenderer::TextureView texture;
|
||||
TextureView texture;
|
||||
|
||||
static const char className[];
|
||||
static Luna<Texture_BindLua>::FunctionType methods[];
|
||||
static Luna<Texture_BindLua>::PropertyType properties[];
|
||||
|
||||
Texture_BindLua(wiRenderer::TextureView texture = nullptr);
|
||||
Texture_BindLua(TextureView texture = nullptr);
|
||||
Texture_BindLua(lua_State *L);
|
||||
~Texture_BindLua();
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "wiInitializer.h"
|
||||
#include "wiLua.h"
|
||||
#include "wiLuna.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
#include "RenderableComponent.h"
|
||||
#include "Renderable2DComponent.h"
|
||||
|
||||
@@ -501,6 +501,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DeferredRenderableComponent_BindLua.h" />
|
||||
<ClInclude Include="ForwardRenderableComponent_BindLua.h" />
|
||||
<ClInclude Include="wiGraphicsAPI.h" />
|
||||
<ClInclude Include="LoadingScreenComponent_BindLua.h" />
|
||||
<ClInclude Include="MainComponent_BindLua.h" />
|
||||
<ClInclude Include="Matrix_BindLua.h" />
|
||||
|
||||
@@ -1786,6 +1786,9 @@
|
||||
<ClInclude Include="wiEnums.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wiGraphicsAPI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\io_export_wicked_wi_bin.py" />
|
||||
|
||||
@@ -15,7 +15,7 @@ float wiBackLog::pos;
|
||||
int wiBackLog::scroll;
|
||||
stringstream wiBackLog::inputArea;
|
||||
int wiBackLog::historyPos=0;
|
||||
ID3D11ShaderResourceView* wiBackLog::backgroundTex = nullptr;
|
||||
TextureView wiBackLog::backgroundTex = nullptr;
|
||||
wiFont wiBackLog::font;
|
||||
|
||||
void wiBackLog::Initialize(){
|
||||
@@ -144,7 +144,7 @@ void wiBackLog::historyNext(){
|
||||
}
|
||||
}
|
||||
|
||||
void wiBackLog::setBackground(ID3D11ShaderResourceView* texture)
|
||||
void wiBackLog::setBackground(TextureView texture)
|
||||
{
|
||||
backgroundTex = texture;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
|
||||
static bool isActive(){return state==IDLE;}
|
||||
|
||||
static void setBackground(ID3D11ShaderResourceView* texture);
|
||||
static void setBackground(TextureView texture);
|
||||
|
||||
static ID3D11ShaderResourceView* backgroundTex;
|
||||
static TextureView backgroundTex;
|
||||
static wiFont font;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "wiCube.h"
|
||||
#include "wiRenderer.h"
|
||||
|
||||
ID3D11Buffer* Cube::vertexBuffer;
|
||||
ID3D11Buffer* Cube::indexBuffer;
|
||||
BufferResource Cube::vertexBuffer;
|
||||
BufferResource Cube::indexBuffer;
|
||||
|
||||
Cube::Cube(const XMFLOAT3& center, const XMFLOAT3& halfwidth, const XMFLOAT4& color)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class Cube
|
||||
{
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
|
||||
Description desc;
|
||||
|
||||
static ID3D11Buffer* vertexBuffer;
|
||||
static ID3D11Buffer* indexBuffer;
|
||||
static BufferResource vertexBuffer;
|
||||
static BufferResource indexBuffer;
|
||||
static void LoadStatic();
|
||||
static void CleanUpStatic();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ wiDepthTarget::~wiDepthTarget()
|
||||
|
||||
void wiDepthTarget::Initialize(int width, int height, UINT MSAAC, UINT MSAAQ)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC depthBufferDesc;
|
||||
Texture2DDesc depthBufferDesc;
|
||||
ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
|
||||
|
||||
// Set up the description of the depth buffer.
|
||||
@@ -61,7 +61,7 @@ void wiDepthTarget::Initialize(int width, int height, UINT MSAAC, UINT MSAAQ)
|
||||
}
|
||||
void wiDepthTarget::InitializeCube(int size)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC depthBufferDesc;
|
||||
Texture2DDesc depthBufferDesc;
|
||||
ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
|
||||
|
||||
// Set up the description of the depth buffer.
|
||||
@@ -104,11 +104,11 @@ void wiDepthTarget::InitializeCube(int size)
|
||||
wiRenderer::graphicsDevice->CreateShaderResourceView(texture2D, &shaderResourceViewDesc, &shaderResource);
|
||||
}
|
||||
|
||||
void wiDepthTarget::Clear(ID3D11DeviceContext* context)
|
||||
void wiDepthTarget::Clear(DeviceContext context)
|
||||
{
|
||||
context->ClearDepthStencilView( depthTarget, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
|
||||
}
|
||||
void wiDepthTarget::CopyFrom(const wiDepthTarget& from, ID3D11DeviceContext* context)
|
||||
void wiDepthTarget::CopyFrom(const wiDepthTarget& from, DeviceContext context)
|
||||
{
|
||||
if(shaderResource) shaderResource->Release();
|
||||
static D3D11_SHADER_RESOURCE_VIEW_DESC desc;
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class wiDepthTarget
|
||||
{
|
||||
public:
|
||||
ID3D11Texture2D* texture2D;
|
||||
ID3D11DepthStencilView* depthTarget;
|
||||
ID3D11ShaderResourceView* shaderResource;
|
||||
Texture2D texture2D;
|
||||
DepthStencilView depthTarget;
|
||||
TextureView shaderResource;
|
||||
|
||||
wiDepthTarget();
|
||||
~wiDepthTarget();
|
||||
|
||||
void Initialize(int width, int height, UINT MSAAC, UINT MSAAQ);
|
||||
void InitializeCube(int size);
|
||||
void Clear(ID3D11DeviceContext*);
|
||||
void CopyFrom(const wiDepthTarget&, ID3D11DeviceContext*);
|
||||
void Clear(DeviceContext context);
|
||||
void CopyFrom(const wiDepthTarget&, DeviceContext);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
#include "wiRandom.h"
|
||||
|
||||
//ID3D11Buffer *wiEmittedParticle::vertexBuffer;
|
||||
ID3D11InputLayout *wiEmittedParticle::vertexLayout;
|
||||
ID3D11VertexShader *wiEmittedParticle::vertexShader;
|
||||
ID3D11PixelShader *wiEmittedParticle::pixelShader,*wiEmittedParticle::simplestPS;
|
||||
ID3D11GeometryShader*wiEmittedParticle::geometryShader;
|
||||
ID3D11Buffer* wiEmittedParticle::constantBuffer;
|
||||
ID3D11BlendState* wiEmittedParticle::blendStateAlpha,*wiEmittedParticle::blendStateAdd;
|
||||
ID3D11SamplerState* wiEmittedParticle::sampleState;
|
||||
ID3D11RasterizerState* wiEmittedParticle::rasterizerState,*wiEmittedParticle::wireFrameRS;
|
||||
ID3D11DepthStencilState* wiEmittedParticle::depthStencilState;
|
||||
VertexLayout wiEmittedParticle::vertexLayout;
|
||||
VertexShader wiEmittedParticle::vertexShader;
|
||||
PixelShader wiEmittedParticle::pixelShader,wiEmittedParticle::simplestPS;
|
||||
GeometryShader wiEmittedParticle::geometryShader;
|
||||
BufferResource wiEmittedParticle::constantBuffer;
|
||||
BlendState wiEmittedParticle::blendStateAlpha,wiEmittedParticle::blendStateAdd;
|
||||
Sampler wiEmittedParticle::sampleState;
|
||||
RasterizerState wiEmittedParticle::rasterizerState,wiEmittedParticle::wireFrameRS;
|
||||
DepthStencilState wiEmittedParticle::depthStencilState;
|
||||
set<wiEmittedParticle*> wiEmittedParticle::systems;
|
||||
|
||||
wiEmittedParticle::wiEmittedParticle(std::string newName, std::string newMat, Object* newObject, float newSize, float newRandomFac, float newNormalFac
|
||||
@@ -228,7 +228,7 @@ void wiEmittedParticle::Burst(float num)
|
||||
}
|
||||
|
||||
|
||||
void wiEmittedParticle::Draw(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, int FLAG)
|
||||
void wiEmittedParticle::Draw(Camera* camera, ID3D11DeviceContext *context, TextureView depth, int FLAG)
|
||||
{
|
||||
if(!points.empty()){
|
||||
|
||||
@@ -240,12 +240,7 @@ void wiEmittedParticle::Draw(Camera* camera, ID3D11DeviceContext *context, ID3D1
|
||||
|
||||
bool additive = (material->blendFlag==BLENDMODE_ADDITIVE || material->premultipliedTexture);
|
||||
|
||||
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_POINTLIST );
|
||||
//context->IASetInputLayout( vertexLayout );
|
||||
//context->VSSetShader( vertexShader, NULL, 0 );
|
||||
//context->GSSetShader( geometryShader, NULL, 0 );
|
||||
//context->PSSetShader( wireRender?simplestPS:pixelShader, NULL, 0 );
|
||||
wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::POINTLIST,context);
|
||||
wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::POINTLIST,context);
|
||||
wiRenderer::BindVertexLayout(vertexLayout,context);
|
||||
wiRenderer::BindPS(wireRender?simplestPS:pixelShader,context);
|
||||
wiRenderer::BindVS(vertexShader,context);
|
||||
@@ -261,57 +256,32 @@ void wiEmittedParticle::Draw(Camera* camera, ID3D11DeviceContext *context, ID3D1
|
||||
(*cb).mAdd.y = (FLAG==DRAW_DARK?true:false);
|
||||
(*cb).mMotionBlurAmount = motionBlurAmount;
|
||||
|
||||
//context->UpdateSubresource( constantBuffer, 0, NULL, &cb, 0, 0 );
|
||||
|
||||
wiRenderer::UpdateBuffer(constantBuffer,cb,context);
|
||||
//D3D11_MAPPED_SUBRESOURCE mappedResource;
|
||||
//ConstantBuffer* dataPtr;
|
||||
//context->Map(constantBuffer,0,D3D11_MAP_WRITE_DISCARD,0,&mappedResource);
|
||||
//dataPtr = (ConstantBuffer*)mappedResource.pData;
|
||||
//memcpy(dataPtr,&cb,sizeof(ConstantBuffer));
|
||||
//context->Unmap(constantBuffer,0);
|
||||
|
||||
//context->RSSetState(wireRender?wireFrameRS:rasterizerState);
|
||||
//context->OMSetDepthStencilState(depthStencilState, 1);
|
||||
wiRenderer::BindRasterizerState(wireRender?wireFrameRS:rasterizerState,context);
|
||||
wiRenderer::BindDepthStencilState(depthStencilState,1,context);
|
||||
|
||||
//float blendFactor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
//UINT sampleMask = 0xffffffff;
|
||||
//context->OMSetBlendState((additive?blendStateAdd:blendStateAlpha), blendFactor, sampleMask);
|
||||
wiRenderer::BindBlendState((additive?blendStateAdd:blendStateAlpha),context);
|
||||
|
||||
//context->GSSetConstantBuffers( 0, 1, &constantBuffer );
|
||||
//context->PSSetSamplers(0, 1, &sampleState);
|
||||
wiRenderer::BindConstantBufferGS(constantBuffer,0,context);
|
||||
wiRenderer::BindSamplerPS(sampleState,0,context);
|
||||
|
||||
|
||||
//context->UpdateSubresource( vertexBuffer, 0, 0, points.data(), 0, 0 );
|
||||
|
||||
|
||||
//UINT stride = sizeof( Point );
|
||||
//UINT offset = 0;
|
||||
//context->IASetVertexBuffers( 0, 1, &vertexBuffer, &stride, &offset );
|
||||
wiRenderer::BindVertexBuffer(vertexBuffer,0,sizeof(Point),context);
|
||||
|
||||
if(!wireRender && material->texture) wiRenderer::BindTexturePS(material->texture,0,context);
|
||||
//context->Draw( renderPoints.size(),0);
|
||||
wiRenderer::Draw(renderPoints.size(),context);
|
||||
|
||||
|
||||
//context->GSSetShader(0,0,0);
|
||||
wiRenderer::BindGS(nullptr,context);
|
||||
//context->GSSetConstantBuffers(0,0,0);
|
||||
wiRenderer::BindConstantBufferGS(nullptr,0,context);
|
||||
}
|
||||
}
|
||||
}
|
||||
void wiEmittedParticle::DrawPremul(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, int FLAG){
|
||||
void wiEmittedParticle::DrawPremul(Camera* camera, ID3D11DeviceContext *context, TextureView depth, int FLAG){
|
||||
if(material->premultipliedTexture)
|
||||
Draw(camera,context,depth,FLAG);
|
||||
}
|
||||
void wiEmittedParticle::DrawNonPremul(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, int FLAG){
|
||||
void wiEmittedParticle::DrawNonPremul(Camera* camera, ID3D11DeviceContext *context, TextureView depth, int FLAG){
|
||||
if(!material->premultipliedTexture)
|
||||
Draw(camera,context,depth,FLAG);
|
||||
}
|
||||
@@ -336,7 +306,7 @@ void wiEmittedParticle::CleanUp()
|
||||
|
||||
void wiEmittedParticle::LoadShaders()
|
||||
{
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@@ -345,17 +315,17 @@ void wiEmittedParticle::LoadShaders()
|
||||
{ "VELOCITY", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
UINT numElements = ARRAYSIZE(layout);
|
||||
wiRenderer::VertexShaderInfo* vsinfo = static_cast<wiRenderer::VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspriteVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
VertexShaderInfo* vsinfo = static_cast<VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspriteVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
if (vsinfo != nullptr){
|
||||
vertexShader = vsinfo->vertexShader;
|
||||
vertexLayout = vsinfo->vertexLayout;
|
||||
}
|
||||
|
||||
|
||||
pixelShader = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspritePS.cso", wiResourceManager::PIXELSHADER));
|
||||
simplestPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspritePS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspritePS.cso", wiResourceManager::PIXELSHADER));
|
||||
simplestPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspritePS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
geometryShader = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspriteGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
geometryShader = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "pointspriteGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
|
||||
|
||||
|
||||
@@ -377,7 +347,7 @@ void wiEmittedParticle::LoadShaders()
|
||||
|
||||
|
||||
// // Define the input layout
|
||||
// D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
// VertexLayoutDesc layout[] =
|
||||
// {
|
||||
// { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
// { "TEXCOORD", 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
|
||||
@@ -50,16 +50,16 @@ private:
|
||||
|
||||
ALIGN_16
|
||||
};
|
||||
ID3D11Buffer *vertexBuffer;
|
||||
static ID3D11InputLayout *vertexLayout;
|
||||
static ID3D11VertexShader *vertexShader;
|
||||
static ID3D11PixelShader *pixelShader,*simplestPS;
|
||||
static ID3D11GeometryShader*geometryShader;
|
||||
static ID3D11Buffer* constantBuffer;
|
||||
static ID3D11BlendState* blendStateAlpha,*blendStateAdd;
|
||||
static ID3D11SamplerState* sampleState;
|
||||
static ID3D11RasterizerState* rasterizerState,*wireFrameRS;
|
||||
static ID3D11DepthStencilState* depthStencilState;
|
||||
BufferResource vertexBuffer;
|
||||
static VertexLayout vertexLayout;
|
||||
static VertexShader vertexShader;
|
||||
static PixelShader pixelShader,simplestPS;
|
||||
static GeometryShader geometryShader;
|
||||
static BufferResource constantBuffer;
|
||||
static BlendState blendStateAlpha,blendStateAdd;
|
||||
static Sampler sampleState;
|
||||
static RasterizerState rasterizerState,wireFrameRS;
|
||||
static DepthStencilState depthStencilState;
|
||||
|
||||
public:
|
||||
static void LoadShaders();
|
||||
@@ -101,12 +101,12 @@ public:
|
||||
|
||||
#define DRAW_DEFAULT 0
|
||||
#define DRAW_DARK 1
|
||||
void Draw(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, int FLAG = DRAW_DEFAULT);
|
||||
void DrawPremul(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, int FLAG = DRAW_DEFAULT);
|
||||
void DrawNonPremul(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, int FLAG = DRAW_DEFAULT);
|
||||
void Draw(Camera* camera, ID3D11DeviceContext *context, TextureView depth, int FLAG = DRAW_DEFAULT);
|
||||
void DrawPremul(Camera* camera, ID3D11DeviceContext *context, TextureView depth, int FLAG = DRAW_DEFAULT);
|
||||
void DrawNonPremul(Camera* camera, ID3D11DeviceContext *context, TextureView depth, int FLAG = DRAW_DEFAULT);
|
||||
void CleanUp();
|
||||
|
||||
std::string name;
|
||||
string name;
|
||||
//std::string material;
|
||||
Material* material;
|
||||
Light* light;
|
||||
|
||||
+16
-53
@@ -5,15 +5,15 @@
|
||||
#include "wiLoader.h"
|
||||
|
||||
|
||||
ID3D11Buffer *wiFont::vertexBuffer,*wiFont::indexBuffer;
|
||||
ID3D11InputLayout *wiFont::vertexLayout;
|
||||
ID3D11VertexShader *wiFont::vertexShader;
|
||||
ID3D11PixelShader *wiFont::pixelShader;
|
||||
ID3D11BlendState* wiFont::blendState;
|
||||
ID3D11Buffer* wiFont::constantBuffer;
|
||||
ID3D11SamplerState* wiFont::sampleState;
|
||||
ID3D11RasterizerState* wiFont::rasterizerState;
|
||||
ID3D11DepthStencilState* wiFont::depthStencilState;
|
||||
BufferResource wiFont::vertexBuffer,wiFont::indexBuffer;
|
||||
VertexLayout wiFont::vertexLayout;
|
||||
VertexShader wiFont::vertexShader;
|
||||
PixelShader wiFont::pixelShader;
|
||||
BlendState wiFont::blendState;
|
||||
BufferResource wiFont::constantBuffer;
|
||||
Sampler wiFont::sampleState;
|
||||
RasterizerState wiFont::rasterizerState;
|
||||
DepthStencilState wiFont::depthStencilState;
|
||||
vector<wiFont::Vertex> wiFont::vertexList;
|
||||
vector<wiFont::wiFontStyle> wiFont::fontStyles;
|
||||
|
||||
@@ -133,58 +133,21 @@ void wiFont::SetUpCB()
|
||||
void wiFont::LoadShaders()
|
||||
{
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
UINT numElements = ARRAYSIZE(layout);
|
||||
wiRenderer::VertexShaderInfo* vsinfo = static_cast<wiRenderer::VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fontVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
VertexShaderInfo* vsinfo = static_cast<VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fontVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
if (vsinfo != nullptr){
|
||||
vertexShader = vsinfo->vertexShader;
|
||||
vertexLayout = vsinfo->vertexLayout;
|
||||
}
|
||||
|
||||
|
||||
pixelShader = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fontPS.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fontPS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ID3DBlob* pVSBlob = NULL;
|
||||
|
||||
//if(FAILED(D3DReadFileToBlob(L"shaders/fontVS.cso", &pVSBlob))){MessageBox(0,L"Failed To load fontVS.cso",0,0);}
|
||||
//wiRenderer::graphicsDevice->CreateVertexShader( pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), NULL, &vertexShader );
|
||||
|
||||
|
||||
|
||||
|
||||
// // Define the input layout
|
||||
// D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
// {
|
||||
// { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
// { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
// };
|
||||
//UINT numElements = ARRAYSIZE( layout );
|
||||
//
|
||||
// // Create the input layout
|
||||
//wiRenderer::graphicsDevice->CreateInputLayout( layout, numElements, pVSBlob->GetBufferPointer(),
|
||||
// pVSBlob->GetBufferSize(), &vertexLayout );
|
||||
//pVSBlob->Release();
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
//ID3DBlob* pPSBlob = NULL;
|
||||
|
||||
//if(FAILED(D3DReadFileToBlob(L"shaders/fontPS.cso", &pPSBlob))){MessageBox(0,L"Failed To load fontPS.cso",0,0);}
|
||||
//wiRenderer::graphicsDevice->CreatePixelShader( pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), NULL, &pixelShader );
|
||||
//pPSBlob->Release();
|
||||
}
|
||||
void wiFont::SetUpStaticComponents()
|
||||
{
|
||||
@@ -214,7 +177,7 @@ void wiFont::CleanUpStatic()
|
||||
}
|
||||
|
||||
|
||||
void wiFont::ModifyGeo(const wstring& text, wiFontProps props, int style, ID3D11DeviceContext* context)
|
||||
void wiFont::ModifyGeo(const wstring& text, wiFontProps props, int style, DeviceContext context)
|
||||
{
|
||||
int line = 0, pos = 0;
|
||||
vertexList.resize(text.length()*4);
|
||||
@@ -300,7 +263,7 @@ void wiFont::LoadIndices()
|
||||
wiRenderer::graphicsDevice->CreateBuffer( &bd, &InitData, &indexBuffer );
|
||||
}
|
||||
|
||||
void wiFont::Draw(wiRenderer::DeviceContext context){
|
||||
void wiFont::Draw(DeviceContext context){
|
||||
|
||||
wiFontProps newProps = props;
|
||||
|
||||
@@ -323,7 +286,7 @@ void wiFont::Draw(wiRenderer::DeviceContext context){
|
||||
if (context == nullptr)
|
||||
return;
|
||||
|
||||
wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::TRIANGLELIST,context);
|
||||
wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLELIST,context);
|
||||
wiRenderer::BindVertexLayout(vertexLayout,context);
|
||||
wiRenderer::BindVS(vertexShader,context);
|
||||
wiRenderer::BindPS(pixelShader,context);
|
||||
@@ -416,7 +379,7 @@ wiFont::wiFontStyle::wiFontStyle(const string& newName){
|
||||
ss1<<"fonts/"<<name<<".dds";
|
||||
std::ifstream file(ss.str());
|
||||
if(file.is_open()){
|
||||
texture = (wiRenderer::TextureView)wiResourceManager::GetGlobal()->add(ss1.str());
|
||||
texture = (TextureView)wiResourceManager::GetGlobal()->add(ss1.str());
|
||||
file>>texWidth>>texHeight>>recSize>>charSize;
|
||||
int i=0;
|
||||
while(!file.eof()){
|
||||
|
||||
+12
-11
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
#define MAX_TEXT 20000
|
||||
|
||||
// Do not alter order because it is bound to lua manually
|
||||
@@ -50,16 +51,16 @@ protected:
|
||||
|
||||
ALIGN_16
|
||||
};
|
||||
static ID3D11Buffer* vertexBuffer,*indexBuffer;
|
||||
static BufferResource vertexBuffer,indexBuffer;
|
||||
|
||||
static ID3D11InputLayout *vertexLayout;
|
||||
static ID3D11VertexShader *vertexShader;
|
||||
static ID3D11PixelShader *pixelShader;
|
||||
static ID3D11BlendState* blendState;
|
||||
static ID3D11Buffer* constantBuffer;
|
||||
static ID3D11SamplerState* sampleState;
|
||||
static ID3D11RasterizerState* rasterizerState;
|
||||
static ID3D11DepthStencilState* depthStencilState;
|
||||
static VertexLayout vertexLayout;
|
||||
static VertexShader vertexShader;
|
||||
static PixelShader pixelShader;
|
||||
static BlendState blendState;
|
||||
static BufferResource constantBuffer;
|
||||
static Sampler sampleState;
|
||||
static RasterizerState rasterizerState;
|
||||
static DepthStencilState depthStencilState;
|
||||
|
||||
static void SetUpStates();
|
||||
static void SetUpCB();
|
||||
@@ -89,7 +90,7 @@ private:
|
||||
static vector<wiFontStyle> fontStyles;
|
||||
|
||||
|
||||
static void ModifyGeo(const wstring& text, wiFontProps props, int style, ID3D11DeviceContext* context = nullptr);
|
||||
static void ModifyGeo(const wstring& text, wiFontProps props, int style, DeviceContext context = nullptr);
|
||||
|
||||
public:
|
||||
static void Initialize();
|
||||
@@ -105,7 +106,7 @@ public:
|
||||
~wiFont();
|
||||
|
||||
|
||||
void Draw(ID3D11DeviceContext* context = nullptr);
|
||||
void Draw(DeviceContext context = nullptr);
|
||||
|
||||
|
||||
int textWidth();
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
|
||||
#include <d3d11_2.h>
|
||||
#include <DXGI1_2.h>
|
||||
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
|
||||
|
||||
#ifndef WINSTORE_SUPPORT
|
||||
typedef IDXGISwapChain* SwapChain;
|
||||
#else
|
||||
typedef IDXGISwapChain1* SwapChain;
|
||||
#endif
|
||||
typedef IUnknown* APIInterface;
|
||||
typedef ID3D11DeviceContext* DeviceContext;
|
||||
typedef ID3D11Device* GraphicsDevice;
|
||||
typedef D3D11_VIEWPORT ViewPort;
|
||||
typedef ID3D11CommandList* CommandList;
|
||||
typedef ID3D11RenderTargetView* RenderTargetView;
|
||||
typedef ID3D11ShaderResourceView* TextureView;
|
||||
typedef ID3D11Texture2D* Texture2D;
|
||||
typedef ID3D11SamplerState* Sampler;
|
||||
typedef ID3D11Resource* APIResource;
|
||||
typedef ID3D11Buffer* BufferResource;
|
||||
typedef ID3D11VertexShader* VertexShader;
|
||||
typedef ID3D11PixelShader* PixelShader;
|
||||
typedef ID3D11GeometryShader* GeometryShader;
|
||||
typedef ID3D11HullShader* HullShader;
|
||||
typedef ID3D11DomainShader* DomainShader;
|
||||
typedef ID3D11ComputeShader* ComputeShader;
|
||||
typedef ID3D11InputLayout* VertexLayout;
|
||||
typedef D3D11_INPUT_ELEMENT_DESC VertexLayoutDesc;
|
||||
typedef ID3D11BlendState* BlendState;
|
||||
typedef ID3D11DepthStencilState* DepthStencilState;
|
||||
typedef ID3D11DepthStencilView* DepthStencilView;
|
||||
typedef ID3D11RasterizerState* RasterizerState;
|
||||
typedef D3D11_SO_DECLARATION_ENTRY StreamOutDeclaration;
|
||||
typedef D3D11_TEXTURE2D_DESC Texture2DDesc;
|
||||
|
||||
|
||||
enum PRIMITIVETOPOLOGY {
|
||||
TRIANGLELIST = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
||||
TRIANGLESTRIP = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
||||
POINTLIST = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST,
|
||||
LINELIST = D3D11_PRIMITIVE_TOPOLOGY_LINELIST,
|
||||
PATCHLIST = D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
|
||||
};
|
||||
|
||||
struct VertexShaderInfo {
|
||||
VertexShader vertexShader;
|
||||
VertexLayout vertexLayout;
|
||||
|
||||
VertexShaderInfo() {
|
||||
vertexShader = nullptr;
|
||||
vertexLayout = VertexLayout();
|
||||
}
|
||||
};
|
||||
@@ -6,15 +6,15 @@
|
||||
#include "wiFrustum.h"
|
||||
#include "wiRandom.h"
|
||||
|
||||
ID3D11InputLayout* wiHairParticle::il;
|
||||
ID3D11VertexShader* wiHairParticle::vs;
|
||||
ID3D11PixelShader* wiHairParticle::ps,*wiHairParticle::qps;
|
||||
ID3D11GeometryShader* wiHairParticle::gs[],*wiHairParticle::qgs[];
|
||||
ID3D11Buffer* wiHairParticle::cbgs;
|
||||
ID3D11DepthStencilState* wiHairParticle::dss;
|
||||
ID3D11RasterizerState* wiHairParticle::rs,* wiHairParticle::ncrs;
|
||||
ID3D11SamplerState* wiHairParticle::ss;
|
||||
ID3D11BlendState* wiHairParticle::bs;
|
||||
VertexLayout wiHairParticle::il;
|
||||
VertexShader wiHairParticle::vs;
|
||||
PixelShader wiHairParticle::ps,wiHairParticle::qps;
|
||||
GeometryShader wiHairParticle::gs[],wiHairParticle::qgs[];
|
||||
BufferResource wiHairParticle::cbgs;
|
||||
DepthStencilState wiHairParticle::dss;
|
||||
RasterizerState wiHairParticle::rs, wiHairParticle::ncrs;
|
||||
Sampler wiHairParticle::ss;
|
||||
BlendState wiHairParticle::bs;
|
||||
int wiHairParticle::LOD[3];
|
||||
|
||||
wiHairParticle::wiHairParticle()
|
||||
@@ -69,14 +69,14 @@ void wiHairParticle::CleanUpStatic(){
|
||||
void wiHairParticle::LoadShaders()
|
||||
{
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TANGENT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
UINT numElements = ARRAYSIZE(layout);
|
||||
wiRenderer::VertexShaderInfo* vsinfo = static_cast<wiRenderer::VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
VertexShaderInfo* vsinfo = static_cast<VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
if (vsinfo != nullptr) {
|
||||
vs = vsinfo->vertexShader;
|
||||
il = vsinfo->vertexLayout;
|
||||
@@ -84,15 +84,15 @@ void wiHairParticle::LoadShaders()
|
||||
|
||||
|
||||
|
||||
ps = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassPS.cso", wiResourceManager::PIXELSHADER));
|
||||
qps = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "qGrassPS.cso", wiResourceManager::PIXELSHADER));
|
||||
ps = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassPS.cso", wiResourceManager::PIXELSHADER));
|
||||
qps = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "qGrassPS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
gs[0] = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassL0GS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
gs[1] = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassL1GS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
gs[2] = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassL2GS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
gs[0] = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassL0GS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
gs[1] = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassL1GS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
gs[2] = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "grassL2GS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
|
||||
qgs[0] = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "qGrassLCloseGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
qgs[1] = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "qGrassLDistGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
qgs[0] = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "qGrassLCloseGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
qgs[1] = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "qGrassLDistGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
|
||||
}
|
||||
void wiHairParticle::SetUpStatic(){
|
||||
@@ -109,7 +109,7 @@ void wiHairParticle::SetUpStatic(){
|
||||
|
||||
|
||||
// // Define the input layout
|
||||
// D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
// VertexLayoutDesc layout[] =
|
||||
// {
|
||||
// { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
// { "NORMAL", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@@ -457,9 +457,9 @@ void wiHairParticle::Draw(Camera* camera, ID3D11DeviceContext *context)
|
||||
|
||||
if(!culledPatches.empty())
|
||||
{
|
||||
ID3D11ShaderResourceView* texture = material->texture;
|
||||
TextureView texture = material->texture;
|
||||
|
||||
wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::POINTLIST,context);
|
||||
wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::POINTLIST,context);
|
||||
wiRenderer::BindVertexLayout(il,context);
|
||||
wiRenderer::BindPS(texture?qps:ps,context);
|
||||
wiRenderer::BindVS(vs,context);
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
{
|
||||
vector<Point> p;
|
||||
XMFLOAT3 min, max;
|
||||
//ID3D11Buffer* vb;
|
||||
//BufferResource vb;
|
||||
Patch();
|
||||
void add(const Point&);
|
||||
void CleanUp();
|
||||
@@ -45,15 +45,15 @@ private:
|
||||
|
||||
ALIGN_16
|
||||
};
|
||||
static ID3D11InputLayout* il;
|
||||
static ID3D11VertexShader* vs;
|
||||
static ID3D11PixelShader* ps,*qps;
|
||||
static ID3D11GeometryShader* gs[3],*qgs[2];
|
||||
static ID3D11Buffer* cbgs;
|
||||
static ID3D11DepthStencilState* dss;
|
||||
static ID3D11RasterizerState* rs,*ncrs;
|
||||
static ID3D11SamplerState* ss;
|
||||
static ID3D11BlendState* bs;
|
||||
static VertexLayout il;
|
||||
static VertexShader vs;
|
||||
static PixelShader ps, qps;
|
||||
static GeometryShader gs[3],qgs[2];
|
||||
static BufferResource cbgs;
|
||||
static DepthStencilState dss;
|
||||
static RasterizerState rs,ncrs;
|
||||
static Sampler ss;
|
||||
static BlendState bs;
|
||||
static int LOD[3];
|
||||
public:
|
||||
static void LoadShaders();
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace wiHelper
|
||||
ss << name;
|
||||
wstringstream wss(L"");
|
||||
wss << ss.str().c_str();
|
||||
ID3D11Resource* res = nullptr;
|
||||
APIResource res = nullptr;
|
||||
wiRenderer::renderTargetView->GetResource(&res);
|
||||
HRESULT h = SaveWICTextureToFile(wiRenderer::immediateContext, res, GUID_ContainerFormatPng, wss.str().c_str());
|
||||
if (FAILED(h))
|
||||
|
||||
+40
-40
@@ -6,17 +6,17 @@
|
||||
#include "wiHelper.h"
|
||||
|
||||
#pragma region STATICS
|
||||
ID3D11BlendState* wiImage::blendState, *wiImage::blendStateAdd, *wiImage::blendStateNoBlend, *wiImage::blendStateAvg;
|
||||
ID3D11Buffer* wiImage::constantBuffer,*wiImage::PSCb,*wiImage::blurCb,*wiImage::processCb,*wiImage::shaftCb,*wiImage::deferredCb;
|
||||
BlendState wiImage::blendState, wiImage::blendStateAdd, wiImage::blendStateNoBlend, wiImage::blendStateAvg;
|
||||
BufferResource wiImage::constantBuffer,wiImage::PSCb,wiImage::blurCb,wiImage::processCb,wiImage::shaftCb,wiImage::deferredCb;
|
||||
|
||||
ID3D11VertexShader* wiImage::vertexShader,*wiImage::screenVS;
|
||||
ID3D11PixelShader* wiImage::pixelShader,*wiImage::blurHPS,*wiImage::blurVPS,*wiImage::shaftPS,*wiImage::outlinePS
|
||||
,*wiImage::dofPS,*wiImage::motionBlurPS,*wiImage::bloomSeparatePS,*wiImage::fxaaPS,*wiImage::ssaoPS,*wiImage::deferredPS
|
||||
,*wiImage::ssssPS,*wiImage::linDepthPS,*wiImage::colorGradePS,*wiImage::ssrPS;
|
||||
VertexShader wiImage::vertexShader,wiImage::screenVS;
|
||||
PixelShader wiImage::pixelShader,wiImage::blurHPS,wiImage::blurVPS,wiImage::shaftPS,wiImage::outlinePS
|
||||
,wiImage::dofPS,wiImage::motionBlurPS,wiImage::bloomSeparatePS,wiImage::fxaaPS,wiImage::ssaoPS,wiImage::deferredPS
|
||||
,wiImage::ssssPS,wiImage::linDepthPS,wiImage::colorGradePS,wiImage::ssrPS;
|
||||
|
||||
|
||||
ID3D11RasterizerState* wiImage::rasterizerState;
|
||||
ID3D11DepthStencilState* wiImage::depthStencilStateGreater,*wiImage::depthStencilStateLess,*wiImage::depthNoStencilState;
|
||||
RasterizerState wiImage::rasterizerState;
|
||||
DepthStencilState wiImage::depthStencilStateGreater,wiImage::depthStencilStateLess,wiImage::depthNoStencilState;
|
||||
|
||||
|
||||
//map<string,wiImage::ImageResource> wiImage::images;
|
||||
@@ -79,24 +79,24 @@ void wiImage::LoadShaders()
|
||||
{
|
||||
|
||||
|
||||
vertexShader = static_cast<wiRenderer::VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imageVS.cso", wiResourceManager::VERTEXSHADER))->vertexShader;
|
||||
screenVS = static_cast<wiRenderer::VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "screenVS.cso", wiResourceManager::VERTEXSHADER))->vertexShader;
|
||||
vertexShader = static_cast<VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imageVS.cso", wiResourceManager::VERTEXSHADER))->vertexShader;
|
||||
screenVS = static_cast<VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "screenVS.cso", wiResourceManager::VERTEXSHADER))->vertexShader;
|
||||
|
||||
pixelShader = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS.cso", wiResourceManager::PIXELSHADER));
|
||||
blurHPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "horizontalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
blurVPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "verticalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
shaftPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lightShaftPS.cso", wiResourceManager::PIXELSHADER));
|
||||
outlinePS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "outlinePS.cso", wiResourceManager::PIXELSHADER));
|
||||
dofPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "depthofFieldPS.cso", wiResourceManager::PIXELSHADER));
|
||||
motionBlurPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "motionBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
bloomSeparatePS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "bloomSeparatePS.cso", wiResourceManager::PIXELSHADER));
|
||||
fxaaPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fxaa.cso", wiResourceManager::PIXELSHADER));
|
||||
ssaoPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssao.cso", wiResourceManager::PIXELSHADER));
|
||||
ssssPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssss.cso", wiResourceManager::PIXELSHADER));
|
||||
linDepthPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "linDepthPS.cso", wiResourceManager::PIXELSHADER));
|
||||
colorGradePS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "colorGradePS.cso", wiResourceManager::PIXELSHADER));
|
||||
deferredPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "deferredPS.cso", wiResourceManager::PIXELSHADER));
|
||||
ssrPS = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssr.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS.cso", wiResourceManager::PIXELSHADER));
|
||||
blurHPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "horizontalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
blurVPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "verticalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
shaftPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lightShaftPS.cso", wiResourceManager::PIXELSHADER));
|
||||
outlinePS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "outlinePS.cso", wiResourceManager::PIXELSHADER));
|
||||
dofPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "depthofFieldPS.cso", wiResourceManager::PIXELSHADER));
|
||||
motionBlurPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "motionBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
bloomSeparatePS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "bloomSeparatePS.cso", wiResourceManager::PIXELSHADER));
|
||||
fxaaPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fxaa.cso", wiResourceManager::PIXELSHADER));
|
||||
ssaoPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssao.cso", wiResourceManager::PIXELSHADER));
|
||||
ssssPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssss.cso", wiResourceManager::PIXELSHADER));
|
||||
linDepthPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "linDepthPS.cso", wiResourceManager::PIXELSHADER));
|
||||
colorGradePS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "colorGradePS.cso", wiResourceManager::PIXELSHADER));
|
||||
deferredPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "deferredPS.cso", wiResourceManager::PIXELSHADER));
|
||||
ssrPS = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssr.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
|
||||
|
||||
@@ -285,16 +285,16 @@ void wiImage::SetUpStates()
|
||||
}
|
||||
|
||||
|
||||
void wiImage::Draw(wiRenderer::TextureView texture, const wiImageEffects& effects){
|
||||
void wiImage::Draw(TextureView texture, const wiImageEffects& effects){
|
||||
Draw(texture,effects,wiRenderer::getImmediateContext());
|
||||
}
|
||||
void wiImage::Draw(wiRenderer::TextureView texture, const wiImageEffects& effects,ID3D11DeviceContext* context){
|
||||
void wiImage::Draw(TextureView texture, const wiImageEffects& effects,DeviceContext context){
|
||||
if(!context)
|
||||
return;
|
||||
|
||||
{
|
||||
// This equals the old BatchBegin
|
||||
wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::TRIANGLESTRIP, context);
|
||||
wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLESTRIP, context);
|
||||
wiRenderer::BindRasterizerState(rasterizerState, context);
|
||||
switch (effects.stencilComp)
|
||||
{
|
||||
@@ -558,10 +558,10 @@ void wiImage::Draw(wiRenderer::TextureView texture, const wiImageEffects& effect
|
||||
wiRenderer::Draw(4,context);
|
||||
}
|
||||
|
||||
void wiImage::DrawDeferred(wiRenderer::TextureView texture
|
||||
, wiRenderer::TextureView depth, wiRenderer::TextureView lightmap, wiRenderer::TextureView normal
|
||||
, wiRenderer::TextureView ao, ID3D11DeviceContext* context, int stencilRef){
|
||||
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
|
||||
void wiImage::DrawDeferred(TextureView texture
|
||||
, TextureView depth, TextureView lightmap, TextureView normal
|
||||
, TextureView ao, DeviceContext context, int stencilRef){
|
||||
//context->IASetPrimitiveTopology( PRIMITIVETOPOLOGY_TRIANGLESTRIP );
|
||||
|
||||
//UINT stride = sizeof( Vertex );
|
||||
//UINT offset = 0;
|
||||
@@ -571,7 +571,7 @@ void wiImage::DrawDeferred(wiRenderer::TextureView texture
|
||||
//context->RSSetState(rasterizerState);
|
||||
//context->OMSetDepthStencilState(depthStencilStateLess, stencilRef);
|
||||
|
||||
wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::TRIANGLESTRIP,context);
|
||||
wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLESTRIP,context);
|
||||
wiRenderer::BindRasterizerState(rasterizerState,context);
|
||||
wiRenderer::BindDepthStencilState(depthNoStencilState,stencilRef,context);
|
||||
|
||||
@@ -630,15 +630,15 @@ void wiImage::DrawDeferred(wiRenderer::TextureView texture
|
||||
//{
|
||||
// BatchBegin(wiRenderer::getImmediateContext());
|
||||
//}
|
||||
//void wiImage::BatchBegin(ID3D11DeviceContext* context)
|
||||
//void wiImage::BatchBegin(DeviceContext context)
|
||||
//{
|
||||
// //context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
|
||||
// //context->IASetPrimitiveTopology( PRIMITIVETOPOLOGY_TRIANGLESTRIP );
|
||||
//
|
||||
// //context->RSSetState(rasterizerState);
|
||||
// //context->OMSetDepthStencilState(depthNoStencilState, 0);
|
||||
//
|
||||
//
|
||||
// wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::TRIANGLESTRIP,context);
|
||||
// wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLESTRIP,context);
|
||||
// wiRenderer::BindRasterizerState(rasterizerState,context);
|
||||
// wiRenderer::BindDepthStencilState(depthNoStencilState, 0, context);
|
||||
//
|
||||
@@ -653,14 +653,14 @@ void wiImage::DrawDeferred(wiRenderer::TextureView texture
|
||||
// wiRenderer::BindVS(vertexShader,context);
|
||||
// wiRenderer::BindPS(pixelShader,context);
|
||||
//}
|
||||
//void wiImage::BatchBegin(ID3D11DeviceContext* context, unsigned int stencilref, bool stencilOpLess)
|
||||
//void wiImage::BatchBegin(DeviceContext context, unsigned int stencilref, bool stencilOpLess)
|
||||
//{
|
||||
// //context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
|
||||
// //context->IASetPrimitiveTopology( PRIMITIVETOPOLOGY_TRIANGLESTRIP );
|
||||
//
|
||||
// //context->RSSetState(rasterizerState);
|
||||
// //context->OMSetDepthStencilState(stencilOpLess?depthStencilStateLess:depthStencilStateGreater, stencilref);
|
||||
//
|
||||
// wiRenderer::BindPrimitiveTopology(wiRenderer::PRIMITIVETOPOLOGY::TRIANGLESTRIP,context);
|
||||
// wiRenderer::BindPrimitiveTopology(PRIMITIVETOPOLOGY::TRIANGLESTRIP,context);
|
||||
// wiRenderer::BindRasterizerState(rasterizerState,context);
|
||||
// wiRenderer::BindDepthStencilState(stencilOpLess?depthStencilStateLess:depthStencilStateGreater, stencilref, context);
|
||||
//
|
||||
@@ -737,7 +737,7 @@ wiImage::ImageResource::ImageResource(const string& newDirectory, const string&
|
||||
MessageBoxA(0,ss.str().c_str(),"Loading Image Failed!",0);
|
||||
}
|
||||
}
|
||||
wiRenderer::TextureView wiImage::getImageByName(const string& get){
|
||||
TextureView wiImage::getImageByName(const string& get){
|
||||
map<string,ImageResource>::iterator iter = images.find(get);
|
||||
if(iter!=images.end())
|
||||
return iter->second.texture;
|
||||
|
||||
+15
-14
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class wiImageEffects;
|
||||
enum BLENDMODE;
|
||||
@@ -62,17 +63,17 @@ protected:
|
||||
ALIGN_16
|
||||
};
|
||||
|
||||
static ID3D11BlendState* blendState, *blendStateAdd, *blendStateNoBlend, *blendStateAvg;
|
||||
static ID3D11Buffer* constantBuffer,*PSCb,*blurCb,*processCb,*shaftCb,*deferredCb;
|
||||
static BlendState blendState, blendStateAdd, blendStateNoBlend, blendStateAvg;
|
||||
static BufferResource constantBuffer,PSCb,blurCb,processCb,shaftCb,deferredCb;
|
||||
|
||||
static ID3D11VertexShader* vertexShader,*screenVS;
|
||||
static ID3D11PixelShader* pixelShader,*blurHPS,*blurVPS,*shaftPS,*outlinePS,*dofPS,*motionBlurPS,*bloomSeparatePS
|
||||
,*fxaaPS,*ssaoPS,*ssssPS,*deferredPS,*linDepthPS,*colorGradePS,*ssrPS;
|
||||
static VertexShader vertexShader,screenVS;
|
||||
static PixelShader pixelShader,blurHPS,blurVPS,shaftPS,outlinePS,dofPS,motionBlurPS,bloomSeparatePS
|
||||
,fxaaPS,ssaoPS,ssssPS,deferredPS,linDepthPS,colorGradePS,ssrPS;
|
||||
|
||||
|
||||
|
||||
static ID3D11RasterizerState* rasterizerState;
|
||||
static ID3D11DepthStencilState* depthStencilStateGreater,*depthStencilStateLess,*depthNoStencilState;
|
||||
static RasterizerState rasterizerState;
|
||||
static DepthStencilState depthStencilStateGreater,depthStencilStateLess,depthNoStencilState;
|
||||
|
||||
public:
|
||||
static void LoadShaders();
|
||||
@@ -83,20 +84,20 @@ private:
|
||||
public:
|
||||
wiImage();
|
||||
|
||||
static void Draw(ID3D11ShaderResourceView* texture, const wiImageEffects& effects);
|
||||
static void Draw(ID3D11ShaderResourceView* texture, const wiImageEffects& effects,ID3D11DeviceContext* context);
|
||||
static void Draw(TextureView texture, const wiImageEffects& effects);
|
||||
static void Draw(TextureView texture, const wiImageEffects& effects,DeviceContext context);
|
||||
|
||||
static void DrawDeferred(ID3D11ShaderResourceView* texture
|
||||
, ID3D11ShaderResourceView* depth, ID3D11ShaderResourceView* lightmap, ID3D11ShaderResourceView* normal
|
||||
, ID3D11ShaderResourceView* ao, ID3D11DeviceContext* context, int stencilref = 0);
|
||||
static void DrawDeferred(TextureView texture
|
||||
, TextureView depth, TextureView lightmap, TextureView normal
|
||||
, TextureView ao, DeviceContext context, int stencilref = 0);
|
||||
|
||||
|
||||
//// DEPRECATED
|
||||
//static void BatchBegin();
|
||||
//// DEPRECATED
|
||||
//static void BatchBegin(ID3D11DeviceContext* context);
|
||||
//static void BatchBegin(DeviceContext context);
|
||||
//// DEPRECATED
|
||||
//static void BatchBegin(ID3D11DeviceContext* context, unsigned int stencilref, bool stencilOpLess=true);
|
||||
//static void BatchBegin(DeviceContext context, unsigned int stencilref, bool stencilOpLess=true);
|
||||
|
||||
static void Load();
|
||||
static void CleanUp();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
enum BLENDMODE{
|
||||
BLENDMODE_OPAQUE,
|
||||
@@ -88,12 +89,12 @@ public:
|
||||
};
|
||||
Processing process;
|
||||
bool deferred;
|
||||
ID3D11ShaderResourceView *normalMap, *depthMap, *velocityMap, *refractionMap, *maskMap;
|
||||
void setMaskMap(ID3D11ShaderResourceView*view) { maskMap = view; }
|
||||
void setRefractionMap(ID3D11ShaderResourceView*view) { refractionMap = view; }
|
||||
void setVelocityMap(ID3D11ShaderResourceView*view) { velocityMap = view; }
|
||||
void setDepthMap(ID3D11ShaderResourceView*view) { depthMap = view; }
|
||||
void setNormalMap(ID3D11ShaderResourceView*view) { normalMap = view; }
|
||||
TextureView normalMap, depthMap, velocityMap, refractionMap, maskMap;
|
||||
void setMaskMap(TextureView view) { maskMap = view; }
|
||||
void setRefractionMap(TextureView view) { refractionMap = view; }
|
||||
void setVelocityMap(TextureView view) { velocityMap = view; }
|
||||
void setDepthMap(TextureView view) { depthMap = view; }
|
||||
void setNormalMap(TextureView view) { normalMap = view; }
|
||||
|
||||
void init() {
|
||||
pos = XMFLOAT3(0, 0, 0);
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
#include "wiResourceManager.h"
|
||||
|
||||
|
||||
ID3D11Buffer* wiLensFlare::constantBuffer;
|
||||
ID3D11PixelShader* wiLensFlare::pixelShader;
|
||||
ID3D11GeometryShader* wiLensFlare::geometryShader;
|
||||
ID3D11VertexShader* wiLensFlare::vertexShader;
|
||||
ID3D11InputLayout* wiLensFlare::inputLayout;
|
||||
ID3D11SamplerState* wiLensFlare::samplerState;
|
||||
ID3D11RasterizerState* wiLensFlare::rasterizerState;
|
||||
ID3D11DepthStencilState* wiLensFlare::depthStencilState;
|
||||
ID3D11BlendState* wiLensFlare::blendState;
|
||||
BufferResource wiLensFlare::constantBuffer;
|
||||
PixelShader wiLensFlare::pixelShader;
|
||||
GeometryShader wiLensFlare::geometryShader;
|
||||
VertexShader wiLensFlare::vertexShader;
|
||||
VertexLayout wiLensFlare::inputLayout;
|
||||
Sampler wiLensFlare::samplerState;
|
||||
RasterizerState wiLensFlare::rasterizerState;
|
||||
DepthStencilState wiLensFlare::depthStencilState;
|
||||
BlendState wiLensFlare::blendState;
|
||||
|
||||
void wiLensFlare::Initialize(){
|
||||
LoadShaders();
|
||||
@@ -31,17 +31,13 @@ void wiLensFlare::CleanUp(){
|
||||
if(blendState) blendState->Release(); blendState = NULL;
|
||||
if(depthStencilState) depthStencilState->Release(); depthStencilState = NULL;
|
||||
}
|
||||
void wiLensFlare::Draw(ID3D11ShaderResourceView* depthMap, ID3D11DeviceContext* context, const XMVECTOR& lightPos
|
||||
, vector<wiRenderer::TextureView>& rims){
|
||||
void wiLensFlare::Draw(TextureView depthMap, DeviceContext context, const XMVECTOR& lightPos
|
||||
, vector<TextureView>& rims){
|
||||
|
||||
if(!rims.empty()){
|
||||
|
||||
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_POINTLIST );
|
||||
wiRenderer::BindPrimitiveTopology(wiRenderer::POINTLIST,context);
|
||||
wiRenderer::BindPrimitiveTopology(POINTLIST,context);
|
||||
wiRenderer::BindVertexLayout(inputLayout,context);
|
||||
//context->IASetInputLayout( inputLayout );
|
||||
//context->VSSetShader( vertexShader, NULL, 0 );
|
||||
//context->GSSetShader( geometryShader, NULL, 0 );
|
||||
wiRenderer::BindPS(pixelShader,context);
|
||||
wiRenderer::BindVS(vertexShader,context);
|
||||
wiRenderer::BindGS(geometryShader,context);
|
||||
@@ -53,13 +49,6 @@ void wiLensFlare::Draw(ID3D11ShaderResourceView* depthMap, ID3D11DeviceContext*
|
||||
wiRenderer::UpdateBuffer(constantBuffer,cb,context);
|
||||
|
||||
|
||||
//context->RSSetState(rasterizerState);
|
||||
//context->OMSetDepthStencilState(depthStencilState, 1);
|
||||
//float blendFactor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
//UINT sampleMask = 0xffffffff;
|
||||
//context->OMSetBlendState(blendState, blendFactor, sampleMask);
|
||||
|
||||
//context->GSSetConstantBuffers( 0, 1, &constantBuffer );
|
||||
wiRenderer::BindRasterizerState(rasterizerState,context);
|
||||
wiRenderer::BindDepthStencilState(depthStencilState,1,context);
|
||||
wiRenderer::BindBlendState(blendState,context);
|
||||
@@ -73,7 +62,7 @@ void wiLensFlare::Draw(ID3D11ShaderResourceView* depthMap, ID3D11DeviceContext*
|
||||
wiRenderer::BindSamplerGS(samplerState,0,context);
|
||||
|
||||
int i=0;
|
||||
for(wiRenderer::TextureView x : rims){
|
||||
for(TextureView x : rims){
|
||||
if(x!=nullptr){
|
||||
wiRenderer::BindTexturePS(x,i+1,context);
|
||||
wiRenderer::BindTextureGS(x,i+1,context);
|
||||
@@ -95,57 +84,22 @@ void wiLensFlare::Draw(ID3D11ShaderResourceView* depthMap, ID3D11DeviceContext*
|
||||
|
||||
void wiLensFlare::LoadShaders(){
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
UINT numElements = ARRAYSIZE(layout);
|
||||
wiRenderer::VertexShaderInfo* vsinfo = static_cast<wiRenderer::VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlareVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
VertexShaderInfo* vsinfo = static_cast<VertexShaderInfo*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlareVS.cso", wiResourceManager::VERTEXSHADER, layout, numElements));
|
||||
if (vsinfo != nullptr){
|
||||
vertexShader = vsinfo->vertexShader;
|
||||
inputLayout = vsinfo->vertexLayout;
|
||||
}
|
||||
|
||||
|
||||
pixelShader = static_cast<wiRenderer::PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlarePS.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader = static_cast<PixelShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlarePS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
geometryShader = static_cast<wiRenderer::GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlareGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
geometryShader = static_cast<GeometryShader>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlareGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//ID3DBlob* pVSBlob = NULL;
|
||||
|
||||
//if(FAILED(D3DReadFileToBlob(L"shaders/lensFlareVS.cso", &pVSBlob))){MessageBox(0,L"Failed To load lensFlareVS.cso",0,0);}
|
||||
//wiRenderer::graphicsDevice->CreateVertexShader( pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), NULL, &vertexShader );
|
||||
|
||||
// // Define the input layout
|
||||
// D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
// {
|
||||
// { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
// };
|
||||
//UINT numElements = ARRAYSIZE( layout );
|
||||
//
|
||||
// // Create the input layout
|
||||
//wiRenderer::graphicsDevice->CreateInputLayout( layout, numElements, pVSBlob->GetBufferPointer(),
|
||||
// pVSBlob->GetBufferSize(), &inputLayout );
|
||||
|
||||
//if(pVSBlob){ pVSBlob->Release();pVSBlob=NULL; }
|
||||
//
|
||||
|
||||
//ID3DBlob* pPSBlob = NULL;
|
||||
|
||||
//if(FAILED(D3DReadFileToBlob(L"shaders/lensFlarePS.cso", &pPSBlob))){MessageBox(0,L"Failed To load lensFlarePS.cso",0,0);}
|
||||
//wiRenderer::graphicsDevice->CreatePixelShader( pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), NULL, &pixelShader );
|
||||
//if(pPSBlob){ pPSBlob->Release();pPSBlob=NULL; }
|
||||
|
||||
|
||||
//ID3DBlob* pGSBlob = NULL;
|
||||
|
||||
//if(FAILED(D3DReadFileToBlob(L"shaders/lensFlareGS.cso", &pGSBlob))){MessageBox(0,L"Failed To load lensFlareGS.cso",0,0);}
|
||||
//wiRenderer::graphicsDevice->CreateGeometryShader( pGSBlob->GetBufferPointer(), pGSBlob->GetBufferSize(), NULL, &geometryShader );
|
||||
//if(pGSBlob){ pGSBlob->Release();pGSBlob=NULL; }
|
||||
}
|
||||
void wiLensFlare::SetUpCB()
|
||||
{
|
||||
|
||||
+12
-11
@@ -1,19 +1,20 @@
|
||||
#ifndef LENSFLARE
|
||||
#define LENSFLARE
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class wiLensFlare
|
||||
{
|
||||
private:
|
||||
static ID3D11Buffer* constantBuffer;
|
||||
static ID3D11PixelShader* pixelShader;
|
||||
static ID3D11GeometryShader* geometryShader;
|
||||
static ID3D11VertexShader* vertexShader;
|
||||
static ID3D11InputLayout* inputLayout;
|
||||
static ID3D11SamplerState* samplerState;
|
||||
static ID3D11RasterizerState* rasterizerState;
|
||||
static ID3D11DepthStencilState* depthStencilState;
|
||||
static ID3D11BlendState* blendState;
|
||||
static BufferResource constantBuffer;
|
||||
static PixelShader pixelShader;
|
||||
static GeometryShader geometryShader;
|
||||
static VertexShader vertexShader;
|
||||
static VertexLayout inputLayout;
|
||||
static Sampler samplerState;
|
||||
static RasterizerState rasterizerState;
|
||||
static DepthStencilState depthStencilState;
|
||||
static BlendState blendState;
|
||||
|
||||
GFX_STRUCT ConstantBuffer
|
||||
{
|
||||
@@ -31,8 +32,8 @@ private:
|
||||
public:
|
||||
static void Initialize();
|
||||
static void CleanUp();
|
||||
static void Draw(ID3D11ShaderResourceView* depthMap, ID3D11DeviceContext* context, const XMVECTOR& lightPos
|
||||
, vector<ID3D11ShaderResourceView*>& rims);
|
||||
static void Draw(TextureView depthMap, DeviceContext context, const XMVECTOR& lightPos
|
||||
, vector<TextureView>& rims);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class Lines
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
Description desc;
|
||||
int parentArmature,parentBone;
|
||||
|
||||
ID3D11Buffer* vertexBuffer;
|
||||
BufferResource vertexBuffer;
|
||||
|
||||
ALIGN_16
|
||||
};
|
||||
|
||||
+11
-11
@@ -9,7 +9,7 @@
|
||||
#include "wiDepthTarget.h"
|
||||
|
||||
thread_local vector<Instance> Mesh::instances;
|
||||
ID3D11Buffer* Mesh::meshInstanceBuffer=nullptr;
|
||||
BufferResource Mesh::meshInstanceBuffer=nullptr;
|
||||
|
||||
|
||||
void Mesh::LoadFromFile(const string& newName, const string& fname
|
||||
@@ -427,7 +427,7 @@ void Mesh::AddRenderableInstance(const Instance& instance, int numerator)
|
||||
}
|
||||
instances[numerator] = instance;
|
||||
}
|
||||
void Mesh::UpdateRenderableInstances(int count, wiRenderer::DeviceContext context)
|
||||
void Mesh::UpdateRenderableInstances(int count, DeviceContext context)
|
||||
{
|
||||
wiRenderer::UpdateBuffer(meshInstanceBuffer, instances.data(), context, sizeof(Instance)*count);
|
||||
}
|
||||
@@ -611,7 +611,7 @@ void LoadWiMaterialLibrary(const string& directory, const string& name, const st
|
||||
stringstream ss("");
|
||||
ss<<directory<<texturesDir<<resourceName.c_str();
|
||||
currentMat->refMapName=ss.str();
|
||||
currentMat->refMap = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
currentMat->refMap = (TextureView)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
}
|
||||
if(currentMat->refMap!=0)
|
||||
currentMat->hasRefMap = true;
|
||||
@@ -623,7 +623,7 @@ void LoadWiMaterialLibrary(const string& directory, const string& name, const st
|
||||
stringstream ss("");
|
||||
ss<<directory<<texturesDir<<resourceName.c_str();
|
||||
currentMat->normalMapName=ss.str();
|
||||
currentMat->normalMap = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
currentMat->normalMap = (TextureView)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
}
|
||||
if(currentMat->normalMap!=0)
|
||||
currentMat->hasNormalMap = true;
|
||||
@@ -635,7 +635,7 @@ void LoadWiMaterialLibrary(const string& directory, const string& name, const st
|
||||
stringstream ss("");
|
||||
ss<<directory<<texturesDir<<resourceName.c_str();
|
||||
currentMat->textureName=ss.str();
|
||||
currentMat->texture = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
currentMat->texture = (TextureView)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
}
|
||||
if(currentMat->texture!=0)
|
||||
currentMat->hasTexture=true;
|
||||
@@ -648,7 +648,7 @@ void LoadWiMaterialLibrary(const string& directory, const string& name, const st
|
||||
stringstream ss("");
|
||||
ss<<directory<<texturesDir<<resourceName.c_str();
|
||||
currentMat->displacementMapName=ss.str();
|
||||
currentMat->displacementMap = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
currentMat->displacementMap = (TextureView)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
}
|
||||
if(currentMat->displacementMap!=0)
|
||||
currentMat->hasDisplacementMap=true;
|
||||
@@ -660,7 +660,7 @@ void LoadWiMaterialLibrary(const string& directory, const string& name, const st
|
||||
stringstream ss("");
|
||||
ss<<directory<<texturesDir<<resourceName.c_str();
|
||||
currentMat->specularMapName=ss.str();
|
||||
currentMat->specularMap = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
currentMat->specularMap = (TextureView)wiResourceManager::GetGlobal()->add(ss.str());
|
||||
}
|
||||
if(currentMat->specularMap!=0)
|
||||
currentMat->hasSpecularMap=true;
|
||||
@@ -1365,8 +1365,8 @@ void LoadWiLights(const string& directory, const string& name, const string& ide
|
||||
file>>t;
|
||||
stringstream rim("");
|
||||
rim<<directory<<"rims/"<<t;
|
||||
wiRenderer::TextureView tex=nullptr;
|
||||
if ((tex = (wiRenderer::TextureView)wiResourceManager::GetGlobal()->add(rim.str())) != nullptr){
|
||||
TextureView tex=nullptr;
|
||||
if ((tex = (TextureView)wiResourceManager::GetGlobal()->add(rim.str())) != nullptr){
|
||||
lights.back()->lensFlareRimTextures.push_back(tex);
|
||||
lights.back()->lensFlareNames.push_back(rim.str());
|
||||
}
|
||||
@@ -2146,13 +2146,13 @@ void Decal::Update(){
|
||||
void Decal::addTexture(const string& tex){
|
||||
texName=tex;
|
||||
if(!tex.empty()){
|
||||
texture = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(tex);
|
||||
texture = (TextureView)wiResourceManager::GetGlobal()->add(tex);
|
||||
}
|
||||
}
|
||||
void Decal::addNormal(const string& nor){
|
||||
norName=nor;
|
||||
if(!nor.empty()){
|
||||
normal = (ID3D11ShaderResourceView*)wiResourceManager::GetGlobal()->add(nor);
|
||||
normal = (TextureView)wiResourceManager::GetGlobal()->add(nor);
|
||||
}
|
||||
}
|
||||
void Decal::CleanUp(){
|
||||
|
||||
+15
-15
@@ -100,25 +100,25 @@ struct Material
|
||||
|
||||
bool hasRefMap;
|
||||
string refMapName;
|
||||
ID3D11ShaderResourceView* refMap;
|
||||
TextureView refMap;
|
||||
|
||||
bool hasTexture;
|
||||
string textureName;
|
||||
ID3D11ShaderResourceView* texture;
|
||||
TextureView texture;
|
||||
bool premultipliedTexture;
|
||||
BLENDMODE blendFlag;
|
||||
|
||||
bool hasNormalMap;
|
||||
string normalMapName;
|
||||
ID3D11ShaderResourceView* normalMap;
|
||||
TextureView normalMap;
|
||||
|
||||
bool hasDisplacementMap;
|
||||
string displacementMapName;
|
||||
ID3D11ShaderResourceView* displacementMap;
|
||||
TextureView displacementMap;
|
||||
|
||||
bool hasSpecularMap;
|
||||
string specularMapName;
|
||||
ID3D11ShaderResourceView* specularMap;
|
||||
TextureView specularMap;
|
||||
|
||||
bool subsurface_scattering;
|
||||
bool toonshading;
|
||||
@@ -296,11 +296,11 @@ struct Mesh{
|
||||
|
||||
static thread_local vector<Instance> instances;
|
||||
|
||||
ID3D11Buffer* meshVertBuff;
|
||||
static ID3D11Buffer* meshInstanceBuffer;
|
||||
ID3D11Buffer* meshIndexBuff;
|
||||
ID3D11Buffer* boneBuffer;
|
||||
ID3D11Buffer* sOutBuffer;
|
||||
BufferResource meshVertBuff;
|
||||
static BufferResource meshInstanceBuffer;
|
||||
BufferResource meshIndexBuff;
|
||||
BufferResource boneBuffer;
|
||||
BufferResource sOutBuffer;
|
||||
|
||||
vector<string> materialNames;
|
||||
vector<int> materialIndices;
|
||||
@@ -354,7 +354,7 @@ struct Mesh{
|
||||
void CreateBuffers();
|
||||
void CreateVertexArrays();
|
||||
static void AddRenderableInstance(const Instance& instance, int numerator);
|
||||
static void UpdateRenderableInstances(int count, ID3D11DeviceContext* context);
|
||||
static void UpdateRenderableInstances(int count, DeviceContext context);
|
||||
void init(){
|
||||
parent="";
|
||||
vertices.resize(0);
|
||||
@@ -520,8 +520,8 @@ struct Object : public Streamable, public Transform
|
||||
|
||||
//RIBBON TRAIL
|
||||
deque<RibbonVertex> trail;
|
||||
ID3D11Buffer* trailBuff;
|
||||
ID3D11ShaderResourceView* trailDistortTex;
|
||||
BufferResource trailBuff;
|
||||
TextureView trailDistortTex;
|
||||
|
||||
int physicsObjectI;
|
||||
|
||||
@@ -905,7 +905,7 @@ struct Light : public Cullable , public Transform
|
||||
XMFLOAT4 enerDis;
|
||||
bool noHalo;
|
||||
bool shadow;
|
||||
vector<ID3D11ShaderResourceView*> lensFlareRimTextures;
|
||||
vector<TextureView> lensFlareRimTextures;
|
||||
vector<string> lensFlareNames;
|
||||
|
||||
//vector<wiRenderTarget> shadowMap;
|
||||
@@ -943,7 +943,7 @@ struct Light : public Cullable , public Transform
|
||||
struct Decal : public Cullable, public Transform
|
||||
{
|
||||
string texName,norName;
|
||||
ID3D11ShaderResourceView* texture,*normal;
|
||||
TextureView texture,normal;
|
||||
XMFLOAT4X4 view,projection;
|
||||
XMFLOAT3 front;
|
||||
float life,fadeStart;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
#define MAX_PARTICLES 10000
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
void wiRenderTarget::clear(){
|
||||
textureDesc = { 0 };
|
||||
numViews = 0;
|
||||
viewPort = D3D11_VIEWPORT();
|
||||
viewPort = ViewPort();
|
||||
depth = NULL;
|
||||
retargetted = false;
|
||||
}
|
||||
@@ -152,11 +152,11 @@ void wiRenderTarget::InitializeCube(UINT size, int numViews, bool hasDepth)
|
||||
InitializeCube(size,numViews,hasDepth,DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||
}
|
||||
|
||||
void wiRenderTarget::Activate(ID3D11DeviceContext* context)
|
||||
void wiRenderTarget::Activate(DeviceContext context)
|
||||
{
|
||||
Activate(context,0,0,0,0);
|
||||
}
|
||||
void wiRenderTarget::Activate(ID3D11DeviceContext* context, float r, float g, float b, float a)
|
||||
void wiRenderTarget::Activate(DeviceContext context, float r, float g, float b, float a)
|
||||
{
|
||||
if(context!=nullptr){
|
||||
Set(context);
|
||||
@@ -166,7 +166,7 @@ void wiRenderTarget::Activate(ID3D11DeviceContext* context, float r, float g, fl
|
||||
if(depth) depth->Clear(context);
|
||||
}
|
||||
}
|
||||
void wiRenderTarget::Activate(ID3D11DeviceContext* context, wiDepthTarget* getDepth, float r, float g, float b, float a)
|
||||
void wiRenderTarget::Activate(DeviceContext context, wiDepthTarget* getDepth, float r, float g, float b, float a)
|
||||
{
|
||||
if(context!=nullptr){
|
||||
Set(context,getDepth);
|
||||
@@ -175,22 +175,22 @@ void wiRenderTarget::Activate(ID3D11DeviceContext* context, wiDepthTarget* getDe
|
||||
context->ClearRenderTargetView(renderTarget[i], ClearColor);
|
||||
}
|
||||
}
|
||||
void wiRenderTarget::Activate(ID3D11DeviceContext* context, wiDepthTarget* getDepth)
|
||||
void wiRenderTarget::Activate(DeviceContext context, wiDepthTarget* getDepth)
|
||||
{
|
||||
Activate(context,getDepth,0,0,0,0);
|
||||
}
|
||||
void wiRenderTarget::Set(ID3D11DeviceContext* context)
|
||||
void wiRenderTarget::Set(DeviceContext context)
|
||||
{
|
||||
//ID3D11ShaderResourceView* t[]={nullptr};
|
||||
//TextureView t[]={nullptr};
|
||||
//context->PSSetShaderResources(6,1,t);
|
||||
if(context!=nullptr){
|
||||
context->RSSetViewports(1, &viewPort);
|
||||
context->OMSetRenderTargets(numViews, renderTarget.data(),(depth?depth->depthTarget:nullptr));
|
||||
}
|
||||
}
|
||||
void wiRenderTarget::Set(ID3D11DeviceContext* context, wiDepthTarget* getDepth)
|
||||
void wiRenderTarget::Set(DeviceContext context, wiDepthTarget* getDepth)
|
||||
{
|
||||
//ID3D11ShaderResourceView* t[]={nullptr};
|
||||
//TextureView t[]={nullptr};
|
||||
//context->PSSetShaderResources(6,1,t);
|
||||
if(context!=nullptr){
|
||||
depth = getDepth;
|
||||
@@ -198,7 +198,7 @@ void wiRenderTarget::Set(ID3D11DeviceContext* context, wiDepthTarget* getDepth)
|
||||
context->OMSetRenderTargets(numViews, renderTarget.data(),(depth?depth->depthTarget:nullptr));
|
||||
}
|
||||
}
|
||||
void wiRenderTarget::Retarget(ID3D11ShaderResourceView* resource)
|
||||
void wiRenderTarget::Retarget(TextureView resource)
|
||||
{
|
||||
retargetted=true;
|
||||
for(unsigned int i=0;i<shaderResource.size();++i){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class wiDepthTarget;
|
||||
|
||||
@@ -8,14 +9,14 @@ class wiRenderTarget
|
||||
private:
|
||||
int numViews;
|
||||
bool retargetted;
|
||||
vector<ID3D11ShaderResourceView*> SAVEDshaderResource;
|
||||
vector<TextureView> SAVEDshaderResource;
|
||||
void clear();
|
||||
D3D11_TEXTURE2D_DESC textureDesc;
|
||||
Texture2DDesc textureDesc;
|
||||
public:
|
||||
D3D11_VIEWPORT viewPort;
|
||||
vector<ID3D11Texture2D*> texture2D;
|
||||
vector<ID3D11RenderTargetView*> renderTarget;
|
||||
vector<ID3D11ShaderResourceView*> shaderResource;
|
||||
ViewPort viewPort;
|
||||
vector<Texture2D> texture2D;
|
||||
vector<RenderTargetView> renderTarget;
|
||||
vector<TextureView> shaderResource;
|
||||
wiDepthTarget* depth;
|
||||
|
||||
wiRenderTarget();
|
||||
@@ -25,16 +26,16 @@ public:
|
||||
void Initialize(UINT width, UINT height, int numViews = 1, bool hasDepth = false, UINT MSAAC = 1, UINT MSAAQ = 0, DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM, UINT mipMapLevelCount = 1);
|
||||
void InitializeCube(UINT size, int numViews, bool hasDepth, DXGI_FORMAT format);
|
||||
void InitializeCube(UINT size, int numViews, bool hasDepth);
|
||||
void Activate(ID3D11DeviceContext*);
|
||||
void Activate(ID3D11DeviceContext* context, float r, float g, float b, float a);
|
||||
void Activate(ID3D11DeviceContext* context, wiDepthTarget*, float r, float g, float b, float a);
|
||||
void Activate(ID3D11DeviceContext* context, wiDepthTarget*);
|
||||
void Set(ID3D11DeviceContext* context);
|
||||
void Set(ID3D11DeviceContext* context, wiDepthTarget*);
|
||||
void Retarget(ID3D11ShaderResourceView* resource);
|
||||
void Activate(DeviceContext);
|
||||
void Activate(DeviceContext context, float r, float g, float b, float a);
|
||||
void Activate(DeviceContext context, wiDepthTarget*, float r, float g, float b, float a);
|
||||
void Activate(DeviceContext context, wiDepthTarget*);
|
||||
void Set(DeviceContext context);
|
||||
void Set(DeviceContext context, wiDepthTarget*);
|
||||
void Retarget(TextureView resource);
|
||||
void Restore();
|
||||
|
||||
D3D11_TEXTURE2D_DESC GetDesc() const{ return textureDesc; }
|
||||
Texture2DDesc GetDesc() const{ return textureDesc; }
|
||||
UINT GetMipCount();
|
||||
};
|
||||
|
||||
|
||||
+75
-78
@@ -24,47 +24,47 @@
|
||||
#pragma region STATICS
|
||||
D3D_DRIVER_TYPE wiRenderer::driverType;
|
||||
D3D_FEATURE_LEVEL wiRenderer::featureLevel;
|
||||
wiRenderer::SwapChain wiRenderer::swapChain;
|
||||
wiRenderer::RenderTargetView wiRenderer::renderTargetView;
|
||||
wiRenderer::ViewPort wiRenderer::viewPort;
|
||||
wiRenderer::GraphicsDevice wiRenderer::graphicsDevice;
|
||||
wiRenderer::DeviceContext wiRenderer::immediateContext;
|
||||
SwapChain wiRenderer::swapChain;
|
||||
RenderTargetView wiRenderer::renderTargetView;
|
||||
ViewPort wiRenderer::viewPort;
|
||||
GraphicsDevice wiRenderer::graphicsDevice;
|
||||
DeviceContext wiRenderer::immediateContext;
|
||||
bool wiRenderer::DX11 = false,wiRenderer::VSYNC=true,wiRenderer::DEFERREDCONTEXT_SUPPORT=false;
|
||||
wiRenderer::DeviceContext wiRenderer::deferredContexts[];
|
||||
wiRenderer::CommandList wiRenderer::commandLists[];
|
||||
DeviceContext wiRenderer::deferredContexts[];
|
||||
CommandList wiRenderer::commandLists[];
|
||||
mutex wiRenderer::graphicsMutex;
|
||||
wiRenderer::Sampler wiRenderer::ssClampLin,wiRenderer::ssClampPoi,wiRenderer::ssMirrorLin,wiRenderer::ssMirrorPoi,wiRenderer::ssWrapLin,wiRenderer::ssWrapPoi
|
||||
Sampler wiRenderer::ssClampLin,wiRenderer::ssClampPoi,wiRenderer::ssMirrorLin,wiRenderer::ssMirrorPoi,wiRenderer::ssWrapLin,wiRenderer::ssWrapPoi
|
||||
,wiRenderer::ssClampAni,wiRenderer::ssWrapAni,wiRenderer::ssMirrorAni,wiRenderer::ssComp;
|
||||
|
||||
map<wiRenderer::DeviceContext,long> wiRenderer::drawCalls;
|
||||
map<DeviceContext,long> wiRenderer::drawCalls;
|
||||
|
||||
int wiRenderer::SCREENWIDTH=1280,wiRenderer::SCREENHEIGHT=720,wiRenderer::SHADOWMAPRES=1024,wiRenderer::SOFTSHADOW=2
|
||||
,wiRenderer::POINTLIGHTSHADOW=2,wiRenderer::POINTLIGHTSHADOWRES=256, wiRenderer::SPOTLIGHTSHADOW=2, wiRenderer::SPOTLIGHTSHADOWRES=512;
|
||||
bool wiRenderer::HAIRPARTICLEENABLED=true,wiRenderer::EMITTERSENABLED=true;
|
||||
bool wiRenderer::wireRender = false, wiRenderer::debugSpheres = false, wiRenderer::debugBoneLines = false, wiRenderer::debugBoxes = false;
|
||||
ID3D11BlendState *wiRenderer::blendState, *wiRenderer::blendStateTransparent, *wiRenderer::blendStateAdd;
|
||||
ID3D11Buffer *wiRenderer::constantBuffer, *wiRenderer::staticCb, *wiRenderer::shCb, *wiRenderer::pixelCB, *wiRenderer::matCb
|
||||
, *wiRenderer::lightCb[3], *wiRenderer::tessBuf, *wiRenderer::lineBuffer, *wiRenderer::skyCb
|
||||
, *wiRenderer::trailCB, *wiRenderer::lightStaticCb, *wiRenderer::vLightCb,*wiRenderer::cubeShCb,*wiRenderer::fxCb
|
||||
, *wiRenderer::decalCbVS, *wiRenderer::decalCbPS, *wiRenderer::viewPropCB;
|
||||
ID3D11VertexShader *wiRenderer::vertexShader10, *wiRenderer::vertexShader, *wiRenderer::shVS, *wiRenderer::lineVS, *wiRenderer::trailVS
|
||||
,*wiRenderer::waterVS,*wiRenderer::lightVS[3],*wiRenderer::vSpotLightVS,*wiRenderer::vPointLightVS,*wiRenderer::cubeShVS,*wiRenderer::sOVS,*wiRenderer::decalVS;
|
||||
ID3D11PixelShader *wiRenderer::pixelShader, *wiRenderer::shPS, *wiRenderer::linePS, *wiRenderer::trailPS, *wiRenderer::simplestPS,*wiRenderer::blackoutPS
|
||||
,*wiRenderer::textureonlyPS,*wiRenderer::waterPS,*wiRenderer::transparentPS,*wiRenderer::lightPS[3],*wiRenderer::vLightPS,*wiRenderer::cubeShPS
|
||||
,*wiRenderer::decalPS,*wiRenderer::fowardSimplePS;
|
||||
ID3D11GeometryShader *wiRenderer::cubeShGS,*wiRenderer::sOGS;
|
||||
ID3D11HullShader *wiRenderer::hullShader;
|
||||
ID3D11DomainShader *wiRenderer::domainShader;
|
||||
ID3D11InputLayout *wiRenderer::vertexLayout, *wiRenderer::lineIL,*wiRenderer::trailIL, *wiRenderer::sOIL;
|
||||
ID3D11SamplerState *wiRenderer::texSampler, *wiRenderer::mapSampler, *wiRenderer::comparisonSampler, *wiRenderer::mirSampler,*wiRenderer::pointSampler;
|
||||
ID3D11RasterizerState *wiRenderer::rasterizerState, *wiRenderer::rssh, *wiRenderer::nonCullRSsh, *wiRenderer::wireRS, *wiRenderer::nonCullRS,*wiRenderer::nonCullWireRS
|
||||
,*wiRenderer::backFaceRS;
|
||||
ID3D11DepthStencilState *wiRenderer::depthStencilState,*wiRenderer::xRayStencilState,*wiRenderer::depthReadStencilState,*wiRenderer::stencilReadState
|
||||
,*wiRenderer::stencilReadMatch;
|
||||
ID3D11PixelShader *wiRenderer::skyPS;
|
||||
ID3D11VertexShader *wiRenderer::skyVS;
|
||||
ID3D11SamplerState *wiRenderer::skySampler;
|
||||
wiRenderer::TextureView wiRenderer::noiseTex,wiRenderer::trailDistortTex,wiRenderer::enviroMap,wiRenderer::colorGrading;
|
||||
BlendState wiRenderer::blendState, wiRenderer::blendStateTransparent, wiRenderer::blendStateAdd;
|
||||
BufferResource wiRenderer::constantBuffer, wiRenderer::staticCb, wiRenderer::shCb, wiRenderer::pixelCB, wiRenderer::matCb
|
||||
, wiRenderer::lightCb[3], wiRenderer::tessBuf, wiRenderer::lineBuffer, wiRenderer::skyCb
|
||||
, wiRenderer::trailCB, wiRenderer::lightStaticCb, wiRenderer::vLightCb,wiRenderer::cubeShCb,wiRenderer::fxCb
|
||||
, wiRenderer::decalCbVS, wiRenderer::decalCbPS, wiRenderer::viewPropCB;
|
||||
VertexShader wiRenderer::vertexShader10, wiRenderer::vertexShader, wiRenderer::shVS, wiRenderer::lineVS, wiRenderer::trailVS
|
||||
,wiRenderer::waterVS,wiRenderer::lightVS[3],wiRenderer::vSpotLightVS,wiRenderer::vPointLightVS,wiRenderer::cubeShVS,wiRenderer::sOVS,wiRenderer::decalVS;
|
||||
PixelShader wiRenderer::pixelShader, wiRenderer::shPS, wiRenderer::linePS, wiRenderer::trailPS, wiRenderer::simplestPS,wiRenderer::blackoutPS
|
||||
,wiRenderer::textureonlyPS,wiRenderer::waterPS,wiRenderer::transparentPS,wiRenderer::lightPS[3],wiRenderer::vLightPS,wiRenderer::cubeShPS
|
||||
,wiRenderer::decalPS,wiRenderer::fowardSimplePS;
|
||||
GeometryShader wiRenderer::cubeShGS,wiRenderer::sOGS;
|
||||
HullShader wiRenderer::hullShader;
|
||||
DomainShader wiRenderer::domainShader;
|
||||
VertexLayout wiRenderer::vertexLayout, wiRenderer::lineIL,wiRenderer::trailIL, wiRenderer::sOIL;
|
||||
Sampler wiRenderer::texSampler, wiRenderer::mapSampler, wiRenderer::comparisonSampler, wiRenderer::mirSampler,wiRenderer::pointSampler;
|
||||
RasterizerState wiRenderer::rasterizerState, wiRenderer::rssh, wiRenderer::nonCullRSsh, wiRenderer::wireRS, wiRenderer::nonCullRS,wiRenderer::nonCullWireRS
|
||||
,wiRenderer::backFaceRS;
|
||||
DepthStencilState wiRenderer::depthStencilState,wiRenderer::xRayStencilState,wiRenderer::depthReadStencilState,wiRenderer::stencilReadState
|
||||
,wiRenderer::stencilReadMatch;
|
||||
PixelShader wiRenderer::skyPS;
|
||||
VertexShader wiRenderer::skyVS;
|
||||
Sampler wiRenderer::skySampler;
|
||||
TextureView wiRenderer::noiseTex,wiRenderer::trailDistortTex,wiRenderer::enviroMap,wiRenderer::colorGrading;
|
||||
float wiRenderer::GameSpeed=1,wiRenderer::overrideGameSpeed=1;
|
||||
int wiRenderer::visibleCount;
|
||||
wiRenderTarget wiRenderer::normalMapRT, wiRenderer::imagesRT, wiRenderer::imagesRTAdd;
|
||||
@@ -73,9 +73,6 @@ PHYSICS* wiRenderer::physicsEngine = nullptr;
|
||||
Wind wiRenderer::wind;
|
||||
WorldInfo wiRenderer::worldInfo;
|
||||
|
||||
vector<wiRenderer::TextureView> wiRenderer::textureSlotsPS(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT);
|
||||
wiRenderer::PixelShader wiRenderer::boundPS=nullptr;
|
||||
|
||||
string wiRenderer::SHADERPATH = "shaders/";
|
||||
#pragma endregion
|
||||
|
||||
@@ -202,7 +199,7 @@ HRESULT wiRenderer::InitDevice(Windows::UI::Core::CoreWindow^ window)
|
||||
pDXGIAdapter->GetParent(__uuidof(IDXGIFactory2), (void **)&pIDXGIFactory);
|
||||
|
||||
|
||||
hr = pIDXGIFactory->CreateSwapChainForCoreWindow(graphicsDevice, reinterpret_cast<IUnknown*>(window), &sd
|
||||
hr = pIDXGIFactory->CreateSwapChainForCoreWindow(graphicsDevice, reinterpret_cast<APIInterface>(window), &sd
|
||||
, nullptr, &swapChain);
|
||||
|
||||
if (FAILED(hr)){
|
||||
@@ -237,7 +234,7 @@ HRESULT wiRenderer::InitDevice(Windows::UI::Core::CoreWindow^ window)
|
||||
|
||||
|
||||
// Create a render target view
|
||||
ID3D11Texture2D* pBackBuffer = NULL;
|
||||
Texture2D pBackBuffer = NULL;
|
||||
hr = swapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer );
|
||||
if( FAILED( hr ) ){
|
||||
wiHelper::messageBox("BackBuffer creation Failed!", "Error!", nullptr);
|
||||
@@ -946,7 +943,7 @@ void wiRenderer::LoadBuffers()
|
||||
void wiRenderer::LoadBasicShaders()
|
||||
{
|
||||
{
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@@ -968,7 +965,7 @@ void wiRenderer::LoadBasicShaders()
|
||||
|
||||
{
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC oslayout[] =
|
||||
VertexLayoutDesc oslayout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@@ -987,7 +984,7 @@ void wiRenderer::LoadBasicShaders()
|
||||
}
|
||||
|
||||
{
|
||||
D3D11_SO_DECLARATION_ENTRY pDecl[] =
|
||||
StreamOutDeclaration pDecl[] =
|
||||
{
|
||||
// semantic name, semantic index, start component, component count, output slot
|
||||
{ 0, "SV_POSITION", 0, 0, 4, 0 }, // output all components of position
|
||||
@@ -1022,7 +1019,7 @@ void wiRenderer::LoadBasicShaders()
|
||||
}
|
||||
void wiRenderer::LoadLineShaders()
|
||||
{
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
@@ -1070,7 +1067,7 @@ void wiRenderer::LoadWaterShaders()
|
||||
|
||||
}
|
||||
void wiRenderer::LoadTrailShaders(){
|
||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
@@ -2004,7 +2001,7 @@ void wiRenderer::Update(float amount)
|
||||
|
||||
}
|
||||
}
|
||||
void wiRenderer::UpdateRenderInfo(ID3D11DeviceContext* context)
|
||||
void wiRenderer::UpdateRenderInfo(DeviceContext context)
|
||||
{
|
||||
UpdateObjects();
|
||||
|
||||
@@ -2105,7 +2102,7 @@ void wiRenderer::UpdateSoftBodyPinning(){
|
||||
}
|
||||
}
|
||||
}
|
||||
void wiRenderer::UpdateSkinnedVB(ID3D11DeviceContext* context){
|
||||
void wiRenderer::UpdateSkinnedVB(DeviceContext context){
|
||||
wiRenderer::graphicsMutex.lock();
|
||||
for(MeshCollection::iterator iter=meshes.begin(); iter!=meshes.end(); ++iter){
|
||||
Mesh* m = iter->second;
|
||||
@@ -2164,17 +2161,17 @@ void wiRenderer::ManageWaterRipples(){
|
||||
)
|
||||
waterRipples.pop_front();
|
||||
}
|
||||
void wiRenderer::DrawWaterRipples(ID3D11DeviceContext* context){
|
||||
void wiRenderer::DrawWaterRipples(DeviceContext context){
|
||||
//wiImage::BatchBegin(context);
|
||||
for(wiSprite* i:waterRipples){
|
||||
i->DrawNormal(context);
|
||||
}
|
||||
}
|
||||
|
||||
void wiRenderer::DrawDebugSpheres(Camera* camera, ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawDebugSpheres(Camera* camera, DeviceContext context)
|
||||
{
|
||||
if(debugSpheres){
|
||||
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
|
||||
//context->IASetPrimitiveTopology( PRIMITIVETOPOLOGY_TRIANGLESTRIP );
|
||||
//context->IASetInputLayout( lineIL );
|
||||
BindPrimitiveTopology(TRIANGLESTRIP,context);
|
||||
BindVertexLayout(lineIL,context);
|
||||
@@ -2239,7 +2236,7 @@ void wiRenderer::DrawDebugSpheres(Camera* camera, ID3D11DeviceContext* context)
|
||||
}
|
||||
|
||||
}
|
||||
void wiRenderer::DrawDebugBoneLines(Camera* camera, ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawDebugBoneLines(Camera* camera, DeviceContext context)
|
||||
{
|
||||
if(debugBoneLines){
|
||||
BindPrimitiveTopology(LINELIST,context);
|
||||
@@ -2270,7 +2267,7 @@ void wiRenderer::DrawDebugBoneLines(Camera* camera, ID3D11DeviceContext* context
|
||||
}
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawDebugLines(Camera* camera, ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawDebugLines(Camera* camera, DeviceContext context)
|
||||
{
|
||||
if (linesTemp.empty())
|
||||
return;
|
||||
@@ -2306,10 +2303,10 @@ void wiRenderer::DrawDebugLines(Camera* camera, ID3D11DeviceContext* context)
|
||||
delete x;
|
||||
linesTemp.clear();
|
||||
}
|
||||
void wiRenderer::DrawDebugBoxes(Camera* camera, ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawDebugBoxes(Camera* camera, DeviceContext context)
|
||||
{
|
||||
if(debugBoxes){
|
||||
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_LINELIST );
|
||||
//context->IASetPrimitiveTopology( PRIMITIVETOPOLOGY_LINELIST );
|
||||
//context->IASetInputLayout( lineIL );
|
||||
BindPrimitiveTopology(LINELIST,context);
|
||||
BindVertexLayout(lineIL,context);
|
||||
@@ -2382,7 +2379,7 @@ void wiRenderer::DrawDebugBoxes(Camera* camera, ID3D11DeviceContext* context)
|
||||
}
|
||||
}
|
||||
|
||||
void wiRenderer::DrawSoftParticles(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, bool dark)
|
||||
void wiRenderer::DrawSoftParticles(Camera* camera, ID3D11DeviceContext *context, TextureView depth, bool dark)
|
||||
{
|
||||
struct particlesystem_comparator {
|
||||
bool operator() (const wiEmittedParticle* a, const wiEmittedParticle* b) const{
|
||||
@@ -2411,7 +2408,7 @@ void wiRenderer::DrawSoftParticles(Camera* camera, ID3D11DeviceContext *context,
|
||||
// }
|
||||
//}
|
||||
}
|
||||
void wiRenderer::DrawSoftPremulParticles(Camera* camera, ID3D11DeviceContext *context, ID3D11ShaderResourceView* depth, bool dark)
|
||||
void wiRenderer::DrawSoftPremulParticles(Camera* camera, ID3D11DeviceContext *context, TextureView depth, bool dark)
|
||||
{
|
||||
for(map<string,vector<wiEmittedParticle*>>::iterator iter=emitterSystems.begin();iter!=emitterSystems.end();++iter){
|
||||
for(wiEmittedParticle* e:iter->second)
|
||||
@@ -2427,8 +2424,8 @@ void wiRenderer::DrawSoftPremulParticles(Camera* camera, ID3D11DeviceContext *co
|
||||
// }
|
||||
//}
|
||||
}
|
||||
void wiRenderer::DrawTrails(ID3D11DeviceContext* context, ID3D11ShaderResourceView* refracRes){
|
||||
//context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
|
||||
void wiRenderer::DrawTrails(DeviceContext context, TextureView refracRes){
|
||||
//context->IASetPrimitiveTopology( PRIMITIVETOPOLOGY_TRIANGLESTRIP );
|
||||
//context->IASetInputLayout( trailIL );
|
||||
BindPrimitiveTopology(TRIANGLESTRIP,context);
|
||||
BindVertexLayout(trailIL,context);
|
||||
@@ -2520,12 +2517,12 @@ void wiRenderer::DrawTrails(ID3D11DeviceContext* context, ID3D11ShaderResourceVi
|
||||
}
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawImagesAdd(ID3D11DeviceContext* context, ID3D11ShaderResourceView* refracRes){
|
||||
void wiRenderer::DrawImagesAdd(DeviceContext context, TextureView refracRes){
|
||||
imagesRTAdd.Activate(context,0,0,0,1);
|
||||
//wiImage::BatchBegin(context);
|
||||
for(wiSprite* x : images){
|
||||
if(x->effects.blendFlag==BLENDMODE_ADDITIVE){
|
||||
/*ID3D11ShaderResourceView* nor = x->effects.normalMap;
|
||||
/*TextureView nor = x->effects.normalMap;
|
||||
x->effects.setNormalMap(nullptr);
|
||||
bool changedBlend=false;
|
||||
if(x->effects.blendFlag==BLENDMODE_OPAQUE && nor){
|
||||
@@ -2539,12 +2536,12 @@ void wiRenderer::DrawImagesAdd(ID3D11DeviceContext* context, ID3D11ShaderResourc
|
||||
}
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawImages(ID3D11DeviceContext* context, ID3D11ShaderResourceView* refracRes){
|
||||
void wiRenderer::DrawImages(DeviceContext context, TextureView refracRes){
|
||||
imagesRT.Activate(context,0,0,0,0);
|
||||
//wiImage::BatchBegin(context);
|
||||
for(wiSprite* x : images){
|
||||
if(x->effects.blendFlag==BLENDMODE_ALPHA || x->effects.blendFlag==BLENDMODE_OPAQUE){
|
||||
/*ID3D11ShaderResourceView* nor = x->effects.normalMap;
|
||||
/*TextureView nor = x->effects.normalMap;
|
||||
x->effects.setNormalMap(nullptr);
|
||||
bool changedBlend=false;
|
||||
if(x->effects.blendFlag==BLENDMODE_OPAQUE && nor){
|
||||
@@ -2558,15 +2555,15 @@ void wiRenderer::DrawImages(ID3D11DeviceContext* context, ID3D11ShaderResourceVi
|
||||
}
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawImagesNormals(ID3D11DeviceContext* context, ID3D11ShaderResourceView* refracRes){
|
||||
void wiRenderer::DrawImagesNormals(DeviceContext context, TextureView refracRes){
|
||||
normalMapRT.Activate(context,0,0,0,0);
|
||||
//wiImage::BatchBegin(context);
|
||||
for(wiSprite* x : images){
|
||||
x->DrawNormal(context);
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawLights(Camera* camera, ID3D11DeviceContext* context
|
||||
, ID3D11ShaderResourceView* depth, ID3D11ShaderResourceView* normal, ID3D11ShaderResourceView* material
|
||||
void wiRenderer::DrawLights(Camera* camera, DeviceContext context
|
||||
, TextureView depth, TextureView normal, TextureView material
|
||||
, unsigned int stencilRef){
|
||||
|
||||
|
||||
@@ -2682,7 +2679,7 @@ void wiRenderer::DrawLights(Camera* camera, ID3D11DeviceContext* context
|
||||
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawVolumeLights(Camera* camera, ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawVolumeLights(Camera* camera, DeviceContext context)
|
||||
{
|
||||
|
||||
static thread_local Frustum frustum = Frustum();
|
||||
@@ -2770,7 +2767,7 @@ void wiRenderer::DrawVolumeLights(Camera* camera, ID3D11DeviceContext* context)
|
||||
}
|
||||
|
||||
|
||||
void wiRenderer::DrawLensFlares(ID3D11DeviceContext* context, ID3D11ShaderResourceView* depth){
|
||||
void wiRenderer::DrawLensFlares(DeviceContext context, TextureView depth){
|
||||
|
||||
|
||||
CulledList culledObjects;
|
||||
@@ -2796,7 +2793,7 @@ void wiRenderer::DrawLensFlares(ID3D11DeviceContext* context, ID3D11ShaderResour
|
||||
)*100000;
|
||||
}
|
||||
|
||||
XMVECTOR flarePos = XMVector3Project(POS,0.f,0.f,GetScreenWidth(),GetScreenHeight(),0.1f,1.0f,getCamera()->GetProjection(),getCamera()->GetView(),XMMatrixIdentity());
|
||||
XMVECTOR flarePos = XMVector3Project(POS,0.f,0.f,(float)GetScreenWidth(),(float)GetScreenHeight(),0.1f,1.0f,getCamera()->GetProjection(),getCamera()->GetView(),XMMatrixIdentity());
|
||||
|
||||
if( XMVectorGetX(XMVector3Dot( XMVectorSubtract(POS,getCamera()->GetEye()),getCamera()->GetAt() ))>0 )
|
||||
wiLensFlare::Draw(depth,context,flarePos,l->lensFlareRimTextures);
|
||||
@@ -2805,7 +2802,7 @@ void wiRenderer::DrawLensFlares(ID3D11DeviceContext* context, ID3D11ShaderResour
|
||||
|
||||
}
|
||||
}
|
||||
void wiRenderer::ClearShadowMaps(ID3D11DeviceContext* context){
|
||||
void wiRenderer::ClearShadowMaps(DeviceContext context){
|
||||
if (GetGameSpeed())
|
||||
{
|
||||
for (unsigned int index = 0; index < Light::shadowMaps_pointLight.size(); ++index) {
|
||||
@@ -2824,7 +2821,7 @@ void wiRenderer::ClearShadowMaps(ID3D11DeviceContext* context){
|
||||
//}
|
||||
}
|
||||
}
|
||||
void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawForShadowMap(DeviceContext context)
|
||||
{
|
||||
if (GameSpeed) {
|
||||
|
||||
@@ -3417,7 +3414,7 @@ void wiRenderer::DrawForShadowMap(ID3D11DeviceContext* context)
|
||||
// BindGS(nullptr, context);
|
||||
//}
|
||||
}
|
||||
void wiRenderer::DrawForSO(ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawForSO(DeviceContext context)
|
||||
{
|
||||
BindPrimitiveTopology(POINTLIST,context);
|
||||
BindVertexLayout(sOIL,context);
|
||||
@@ -3470,9 +3467,9 @@ void wiRenderer::SetSpotLightShadowProps(int shadowMapCount, int resolution)
|
||||
}
|
||||
}
|
||||
|
||||
void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, ID3D11DeviceContext* context
|
||||
void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, DeviceContext context
|
||||
, bool BlackOut, SHADERTYPE shaded
|
||||
, ID3D11ShaderResourceView* refRes, bool grass, GRAPHICSTHREAD thread)
|
||||
, TextureView refRes, bool grass, GRAPHICSTHREAD thread)
|
||||
{
|
||||
if (objects.empty())
|
||||
{
|
||||
@@ -3644,8 +3641,8 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, ID3D11Device
|
||||
|
||||
}
|
||||
|
||||
void wiRenderer::DrawWorldTransparent(Camera* camera, ID3D11ShaderResourceView* refracRes, ID3D11ShaderResourceView* refRes
|
||||
, ID3D11ShaderResourceView* waterRippleNormals, ID3D11ShaderResourceView* depth, ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawWorldTransparent(Camera* camera, TextureView refracRes, TextureView refRes
|
||||
, TextureView waterRippleNormals, TextureView depth, DeviceContext context)
|
||||
{
|
||||
if (objects.empty())
|
||||
{
|
||||
@@ -3778,7 +3775,7 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, ID3D11ShaderResourceView*
|
||||
}
|
||||
|
||||
|
||||
void wiRenderer::DrawSky(ID3D11DeviceContext* context)
|
||||
void wiRenderer::DrawSky(DeviceContext context)
|
||||
{
|
||||
if (enviroMap == nullptr)
|
||||
return;
|
||||
@@ -3859,7 +3856,7 @@ void wiRenderer::DrawDecals(Camera* camera, DeviceContext context, TextureView d
|
||||
}
|
||||
|
||||
|
||||
void wiRenderer::UpdatePerWorldCB(ID3D11DeviceContext* context){
|
||||
void wiRenderer::UpdatePerWorldCB(DeviceContext context){
|
||||
static thread_local PixelCB* pcb = new PixelCB;
|
||||
(*pcb).mSun=XMVector3Normalize( GetSunPosition() );
|
||||
(*pcb).mHorizon=worldInfo.horizon;
|
||||
@@ -3868,7 +3865,7 @@ void wiRenderer::UpdatePerWorldCB(ID3D11DeviceContext* context){
|
||||
(*pcb).mFogSEH=worldInfo.fogSEH;
|
||||
UpdateBuffer(pixelCB, pcb, context);
|
||||
}
|
||||
void wiRenderer::UpdatePerFrameCB(ID3D11DeviceContext* context){
|
||||
void wiRenderer::UpdatePerFrameCB(DeviceContext context){
|
||||
static thread_local ViewPropCB* cb = new ViewPropCB;
|
||||
(*cb).mZFarP=cam->zFarP;
|
||||
(*cb).mZNearP=cam->zNearP;
|
||||
@@ -3878,7 +3875,7 @@ void wiRenderer::UpdatePerFrameCB(ID3D11DeviceContext* context){
|
||||
|
||||
BindConstantBufferPS(viewPropCB,10,context);
|
||||
}
|
||||
void wiRenderer::UpdatePerRenderCB(ID3D11DeviceContext* context, int tessF){
|
||||
void wiRenderer::UpdatePerRenderCB(DeviceContext context, int tessF){
|
||||
if(tessF){
|
||||
static thread_local TessBuffer* tb = new TessBuffer;
|
||||
(*tb).g_f4Eye = cam->GetEye();
|
||||
@@ -3887,7 +3884,7 @@ void wiRenderer::UpdatePerRenderCB(ID3D11DeviceContext* context, int tessF){
|
||||
}
|
||||
|
||||
}
|
||||
void wiRenderer::UpdatePerViewCB(ID3D11DeviceContext* context, Camera* camera, Camera* refCamera, const XMFLOAT4& newClipPlane){
|
||||
void wiRenderer::UpdatePerViewCB(DeviceContext context, Camera* camera, Camera* refCamera, const XMFLOAT4& newClipPlane){
|
||||
|
||||
|
||||
static thread_local StaticCB* cb = new StaticCB;
|
||||
@@ -3915,7 +3912,7 @@ void wiRenderer::UpdatePerViewCB(ID3D11DeviceContext* context, Camera* camera, C
|
||||
(*lcb).mProjInv = XMMatrixInverse(0, XMMatrixTranspose(camera->GetViewProjection()));
|
||||
UpdateBuffer(lightStaticCb,lcb,context);
|
||||
}
|
||||
void wiRenderer::UpdatePerEffectCB(ID3D11DeviceContext* context, const XMFLOAT4& blackoutBlackWhiteInvCol, const XMFLOAT4 colorMask){
|
||||
void wiRenderer::UpdatePerEffectCB(DeviceContext context, const XMFLOAT4& blackoutBlackWhiteInvCol, const XMFLOAT4 colorMask){
|
||||
static thread_local FxCB* fb = new FxCB;
|
||||
(*fb).mFx = blackoutBlackWhiteInvCol;
|
||||
(*fb).colorMask=colorMask;
|
||||
|
||||
+207
-599
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,7 @@ const wiResourceManager::Resource* wiResourceManager::get(const string& name)
|
||||
}
|
||||
|
||||
void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
, wiRenderer::VertexLayoutDesc* vertexLayoutDesc, UINT elementCount, D3D11_SO_DECLARATION_ENTRY* streamOutDecl)
|
||||
, VertexLayoutDesc* vertexLayoutDesc, UINT elementCount, StreamOutDeclaration* streamOutDecl)
|
||||
{
|
||||
if (types.empty())
|
||||
SetUp();
|
||||
@@ -82,7 +82,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
switch(type){
|
||||
case Data_Type::IMAGE:
|
||||
{
|
||||
wiRenderer::TextureView image=nullptr;
|
||||
TextureView image=nullptr;
|
||||
if(
|
||||
!ext.compare("jpg")
|
||||
|| !ext.compare("JPG")
|
||||
@@ -104,7 +104,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
break;
|
||||
case Data_Type::IMAGE_STAGING:
|
||||
{
|
||||
wiRenderer::APIResource image=nullptr;
|
||||
APIResource image=nullptr;
|
||||
if(!ext.compare("dds")){
|
||||
CreateDDSTextureFromFileEx(wiRenderer::graphicsDevice,(wchar_t*)(wstring(name.begin(),name.end()).c_str()),0
|
||||
,D3D11_USAGE_STAGING,0,D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE,0,false
|
||||
@@ -130,7 +130,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
BYTE* buffer;
|
||||
size_t bufferSize;
|
||||
if (wiHelper::readByteData(name, &buffer, bufferSize)){
|
||||
wiRenderer::VertexShaderInfo* vertexShaderInfo = new wiRenderer::VertexShaderInfo;
|
||||
VertexShaderInfo* vertexShaderInfo = new VertexShaderInfo;
|
||||
wiRenderer::graphicsDevice->CreateVertexShader(buffer, bufferSize, NULL, &vertexShaderInfo->vertexShader);
|
||||
if (vertexLayoutDesc != nullptr && elementCount > 0){
|
||||
wiRenderer::graphicsDevice->CreateInputLayout(vertexLayoutDesc, elementCount, buffer, bufferSize, &vertexShaderInfo->vertexLayout);
|
||||
@@ -159,7 +159,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
BYTE* buffer;
|
||||
size_t bufferSize;
|
||||
if (wiHelper::readByteData(name, &buffer, bufferSize)){
|
||||
wiRenderer::PixelShader shader = nullptr;
|
||||
PixelShader shader = nullptr;
|
||||
wiRenderer::graphicsDevice->CreatePixelShader(buffer, bufferSize, nullptr, &shader);
|
||||
delete[] buffer;
|
||||
success = shader;
|
||||
@@ -174,7 +174,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
BYTE* buffer;
|
||||
size_t bufferSize;
|
||||
if (wiHelper::readByteData(name, &buffer, bufferSize)){
|
||||
wiRenderer::GeometryShader shader = nullptr;
|
||||
GeometryShader shader = nullptr;
|
||||
wiRenderer::graphicsDevice->CreateGeometryShader(buffer, bufferSize, nullptr, &shader);
|
||||
if (streamOutDecl != nullptr && elementCount > 0){
|
||||
wiRenderer::graphicsDevice->CreateGeometryShaderWithStreamOutput(buffer, bufferSize, streamOutDecl,
|
||||
@@ -193,7 +193,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
BYTE* buffer;
|
||||
size_t bufferSize;
|
||||
if (wiHelper::readByteData(name, &buffer, bufferSize)){
|
||||
wiRenderer::HullShader shader = nullptr;
|
||||
HullShader shader = nullptr;
|
||||
wiRenderer::graphicsDevice->CreateHullShader(buffer, bufferSize, nullptr, &shader);
|
||||
delete[] buffer;
|
||||
success = shader;
|
||||
@@ -208,7 +208,7 @@ void* wiResourceManager::add(const string& name, Data_Type newType
|
||||
BYTE* buffer;
|
||||
size_t bufferSize;
|
||||
if (wiHelper::readByteData(name, &buffer, bufferSize)){
|
||||
wiRenderer::DomainShader shader = nullptr;
|
||||
DomainShader shader = nullptr;
|
||||
wiRenderer::graphicsDevice->CreateDomainShader(buffer, bufferSize, nullptr, &shader);
|
||||
delete[] buffer;
|
||||
success = shader;
|
||||
@@ -255,30 +255,30 @@ bool wiResourceManager::del(const string& name)
|
||||
switch(res->type){
|
||||
case Data_Type::IMAGE:
|
||||
case Data_Type::IMAGE_STAGING:
|
||||
wiRenderer::SafeRelease(reinterpret_cast<wiRenderer::TextureView&>(res->data));
|
||||
wiRenderer::SafeRelease(reinterpret_cast<TextureView&>(res->data));
|
||||
break;
|
||||
case Data_Type::VERTEXSHADER:
|
||||
{
|
||||
wiRenderer::VertexShaderInfo* vsinfo = (wiRenderer::VertexShaderInfo*)res->data;
|
||||
VertexShaderInfo* vsinfo = (VertexShaderInfo*)res->data;
|
||||
wiRenderer::SafeRelease(vsinfo->vertexLayout);
|
||||
wiRenderer::SafeRelease(vsinfo->vertexShader);
|
||||
delete vsinfo;
|
||||
}
|
||||
break;
|
||||
case Data_Type::PIXELSHADER:
|
||||
wiRenderer::SafeRelease(reinterpret_cast<wiRenderer::PixelShader&>(res->data));
|
||||
wiRenderer::SafeRelease(reinterpret_cast<PixelShader&>(res->data));
|
||||
break;
|
||||
case Data_Type::GEOMETRYSHADER:
|
||||
wiRenderer::SafeRelease(reinterpret_cast<wiRenderer::GeometryShader&>(res->data));
|
||||
wiRenderer::SafeRelease(reinterpret_cast<GeometryShader&>(res->data));
|
||||
break;
|
||||
case Data_Type::HULLSHADER:
|
||||
wiRenderer::SafeRelease(reinterpret_cast<wiRenderer::HullShader&>(res->data));
|
||||
wiRenderer::SafeRelease(reinterpret_cast<HullShader&>(res->data));
|
||||
break;
|
||||
case Data_Type::DOMAINSHADER:
|
||||
wiRenderer::SafeRelease(reinterpret_cast<wiRenderer::DomainShader&>(res->data));
|
||||
wiRenderer::SafeRelease(reinterpret_cast<DomainShader&>(res->data));
|
||||
break;
|
||||
case Data_Type::COMPUTESHADER:
|
||||
wiRenderer::SafeRelease(reinterpret_cast<wiRenderer::ComputeShader&>(res->data));
|
||||
wiRenderer::SafeRelease(reinterpret_cast<ComputeShader&>(res->data));
|
||||
break;
|
||||
case Data_Type::SOUND:
|
||||
case Data_Type::MUSIC:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiThreadSafeManager.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class wiSound;
|
||||
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
const Resource* get(const string& name);
|
||||
//specify datatype for shaders
|
||||
void* add(const string& name, Data_Type newType = Data_Type::DYNAMIC
|
||||
, D3D11_INPUT_ELEMENT_DESC* vertexLayoutDesc = nullptr, UINT elementCount = 0, D3D11_SO_DECLARATION_ENTRY* streamOutDecl = nullptr);
|
||||
, VertexLayoutDesc* vertexLayoutDesc = nullptr, UINT elementCount = 0, StreamOutDeclaration* streamOutDecl = nullptr);
|
||||
bool del(const string& name);
|
||||
bool CleanUp();
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ int wiResourceManager_BindLua::Get(lua_State *L)
|
||||
switch (data->type)
|
||||
{
|
||||
case wiResourceManager::Data_Type::IMAGE:
|
||||
Luna<Texture_BindLua>::push(L, new Texture_BindLua((wiRenderer::TextureView)data->data));
|
||||
Luna<Texture_BindLua>::push(L, new Texture_BindLua((TextureView)data->data));
|
||||
return 1;
|
||||
break;
|
||||
case wiResourceManager::Data_Type::MUSIC:
|
||||
|
||||
@@ -40,15 +40,15 @@ void wiSprite::Init(){
|
||||
void wiSprite::CreateReference(const string& newTexture, const string& newMask, const string& newNormal){
|
||||
if(newTexture.length()) {
|
||||
texture = newTexture;
|
||||
texturePointer = (ID3D11ShaderResourceView*)ContentHolder->add(newTexture);
|
||||
texturePointer = (TextureView)ContentHolder->add(newTexture);
|
||||
}
|
||||
if(newMask.length()) {
|
||||
maskPointer = (ID3D11ShaderResourceView*)ContentHolder->add(newMask);
|
||||
maskPointer = (TextureView)ContentHolder->add(newMask);
|
||||
effects.setMaskMap( maskPointer );
|
||||
mask = newMask;
|
||||
}
|
||||
if(newNormal.length()) {
|
||||
normalPointer = (ID3D11ShaderResourceView*)ContentHolder->add(newNormal);
|
||||
normalPointer = (TextureView)ContentHolder->add(newNormal);
|
||||
//effects.setNormalMap( normalPointer );
|
||||
normal = newNormal;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ void wiSprite::CleanUp(){
|
||||
ContentHolder->del(mask);
|
||||
}
|
||||
|
||||
void wiSprite::Draw(ID3D11ShaderResourceView* refracRes, ID3D11DeviceContext* context){
|
||||
void wiSprite::Draw(TextureView refracRes, DeviceContext context){
|
||||
if(effects.opacity>0 && ((effects.blendFlag==BLENDMODE_ADDITIVE && effects.fade<1) || effects.blendFlag!=BLENDMODE_ADDITIVE) ){
|
||||
effects.setRefractionMap(refracRes);
|
||||
wiImage::Draw(texturePointer,effects,context);
|
||||
@@ -68,7 +68,7 @@ void wiSprite::Draw(ID3D11ShaderResourceView* refracRes, ID3D11DeviceContext* co
|
||||
void wiSprite::Draw(){
|
||||
wiSprite::Draw(NULL,wiRenderer::getImmediateContext());
|
||||
}
|
||||
void wiSprite::DrawNormal(ID3D11DeviceContext* context){
|
||||
void wiSprite::DrawNormal(DeviceContext context){
|
||||
if(normalPointer && effects.opacity>0 && ((effects.blendFlag==BLENDMODE_ADDITIVE && effects.fade<1) || effects.blendFlag!=BLENDMODE_ADDITIVE)){
|
||||
//effects.setRefractionMap(refracRes);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "wiImage.h"
|
||||
#include "wiImageEffects.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
|
||||
class wiResourceManager;
|
||||
|
||||
@@ -8,7 +9,7 @@ class wiSprite : public wiImage
|
||||
{
|
||||
private:
|
||||
string texture, mask, normal;
|
||||
ID3D11ShaderResourceView* texturePointer,*normalPointer,*maskPointer;
|
||||
TextureView texturePointer,normalPointer,maskPointer;
|
||||
wiResourceManager* ContentHolder;
|
||||
public:
|
||||
wiSprite(wiResourceManager* contentHolder = nullptr);
|
||||
@@ -21,9 +22,9 @@ public:
|
||||
|
||||
void Update(float);
|
||||
void Update();
|
||||
void Draw(ID3D11ShaderResourceView* refracRes, ID3D11DeviceContext* context);
|
||||
void Draw(TextureView refracRes, DeviceContext context);
|
||||
void Draw();
|
||||
void DrawNormal(ID3D11DeviceContext* context);
|
||||
void DrawNormal(DeviceContext context);
|
||||
|
||||
string name;
|
||||
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
};
|
||||
Anim anim;
|
||||
|
||||
ID3D11ShaderResourceView* getTexture(){return texturePointer;}
|
||||
void setTexture(ID3D11ShaderResourceView* value){texturePointer=value;}
|
||||
TextureView getTexture(){return texturePointer;}
|
||||
void setTexture(TextureView value){texturePointer=value;}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ wiTextureHelper::wiTextureHelperInstance::~wiTextureHelperInstance()
|
||||
|
||||
|
||||
|
||||
wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getRandom64x64()
|
||||
TextureView wiTextureHelper::wiTextureHelperInstance::getRandom64x64()
|
||||
{
|
||||
if (helperTextures[HELPERTEXTURE_RANDOM64X64] != nullptr)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getRandom64x64
|
||||
return helperTextures[HELPERTEXTURE_RANDOM64X64];
|
||||
}
|
||||
|
||||
wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getColorGradeDefault()
|
||||
TextureView wiTextureHelper::wiTextureHelperInstance::getColorGradeDefault()
|
||||
{
|
||||
if (helperTextures[HELPERTEXTURE_COLORGRADEDEFAULT] != nullptr)
|
||||
{
|
||||
@@ -93,22 +93,22 @@ wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getColorGradeD
|
||||
return helperTextures[HELPERTEXTURE_COLORGRADEDEFAULT];
|
||||
}
|
||||
|
||||
wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getNormalMapDefault()
|
||||
TextureView wiTextureHelper::wiTextureHelperInstance::getNormalMapDefault()
|
||||
{
|
||||
return getColor(wiColor(127, 127, 255, 255));
|
||||
}
|
||||
|
||||
wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getWhite()
|
||||
TextureView wiTextureHelper::wiTextureHelperInstance::getWhite()
|
||||
{
|
||||
return getColor(wiColor(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getBlack()
|
||||
TextureView wiTextureHelper::wiTextureHelperInstance::getBlack()
|
||||
{
|
||||
return getColor(wiColor(0, 0, 0, 255));
|
||||
}
|
||||
|
||||
wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getColor(const wiColor& color)
|
||||
TextureView wiTextureHelper::wiTextureHelperInstance::getColor(const wiColor& color)
|
||||
{
|
||||
if (colorTextures.find(color.rgba) != colorTextures.end())
|
||||
{
|
||||
@@ -125,7 +125,7 @@ wiRenderer::TextureView wiTextureHelper::wiTextureHelperInstance::getColor(const
|
||||
data[i + 3] = color.a;
|
||||
}
|
||||
|
||||
wiRenderer::TextureView texture;
|
||||
TextureView texture;
|
||||
if (FAILED(CreateTexture(texture, data, 2, 2, 4)))
|
||||
{
|
||||
delete[] data;
|
||||
|
||||
@@ -17,20 +17,20 @@ private:
|
||||
HELPERTEXTURE_NORMALMAPDEFAULT,
|
||||
HELPERTEXTURE_COUNT
|
||||
};
|
||||
wiRenderer::TextureView helperTextures[HELPERTEXTURE_COUNT];
|
||||
TextureView helperTextures[HELPERTEXTURE_COUNT];
|
||||
|
||||
unordered_map<unsigned long, wiRenderer::TextureView> colorTextures;
|
||||
unordered_map<unsigned long, TextureView> colorTextures;
|
||||
public:
|
||||
wiTextureHelperInstance();
|
||||
~wiTextureHelperInstance();
|
||||
|
||||
wiRenderer::TextureView getRandom64x64();
|
||||
wiRenderer::TextureView getColorGradeDefault();
|
||||
wiRenderer::TextureView getNormalMapDefault();
|
||||
TextureView getRandom64x64();
|
||||
TextureView getColorGradeDefault();
|
||||
TextureView getNormalMapDefault();
|
||||
|
||||
wiRenderer::TextureView getWhite();
|
||||
wiRenderer::TextureView getBlack();
|
||||
wiRenderer::TextureView getColor(const wiColor& color);
|
||||
TextureView getWhite();
|
||||
TextureView getBlack();
|
||||
TextureView getColor(const wiColor& color);
|
||||
};
|
||||
|
||||
static wiTextureHelperInstance* instance;
|
||||
@@ -45,14 +45,14 @@ public:
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static HRESULT CreateTexture(wiRenderer::TextureView& texture, T* data, UINT width, UINT height, UINT channelCount, DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM)
|
||||
static HRESULT CreateTexture(TextureView& texture, T* data, UINT width, UINT height, UINT channelCount, DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM)
|
||||
{
|
||||
if (data == nullptr)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
D3D11_TEXTURE2D_DESC textureDesc;
|
||||
Texture2DDesc textureDesc;
|
||||
ZeroMemory(&textureDesc, sizeof(textureDesc));
|
||||
textureDesc.Width = width;
|
||||
textureDesc.Height = height;
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
InitData.pSysMem = data;
|
||||
InitData.SysMemPitch = static_cast<UINT>(width * channelCount);
|
||||
|
||||
ID3D11Texture2D* texture2D = nullptr;
|
||||
Texture2D texture2D = nullptr;
|
||||
HRESULT hr;
|
||||
hr = wiRenderer::graphicsDevice->CreateTexture2D(&textureDesc, &InitData, &texture2D);
|
||||
if (FAILED(hr))
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace wiVersion
|
||||
// minor features, major bug fixes
|
||||
const int minor = 4;
|
||||
// minor bug fixes, alterations
|
||||
const int revision = 2;
|
||||
const int revision = 3;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user