wiRenderer moved to namespace (finally...)
This commit is contained in:
+2
-4
@@ -45,7 +45,7 @@ void Editor::Initialize()
|
||||
{
|
||||
// Call this before Maincomponent::Initialize if you want to load shaders from an other directory!
|
||||
// otherwise, shaders will be loaded from the working directory
|
||||
wiRenderer::SHADERPATH = wiHelper::GetOriginalWorkingDirectory() + "../WickedEngine/shaders/";
|
||||
wiRenderer::GetShaderPath() = wiHelper::GetOriginalWorkingDirectory() + "../WickedEngine/shaders/";
|
||||
wiFont::FONTPATH = wiHelper::GetOriginalWorkingDirectory() + "../WickedEngine/fonts/"; // search for fonts elsewhere
|
||||
MainComponent::Initialize();
|
||||
|
||||
@@ -56,9 +56,7 @@ void Editor::Initialize()
|
||||
infoDisplay.resolution = true;
|
||||
|
||||
wiRenderer::GetDevice()->SetVSyncEnabled(true);
|
||||
wiRenderer::EMITTERSENABLED = true;
|
||||
wiRenderer::HAIRPARTICLEENABLED = true;
|
||||
wiRenderer::physicsEngine = new wiBULLET();
|
||||
//wiRenderer::physicsEngine = new wiBULLET();
|
||||
wiRenderer::SetOcclusionCullingEnabled(true);
|
||||
|
||||
wiInputManager::GetInstance()->addXInput(new wiXInput());
|
||||
|
||||
@@ -108,7 +108,7 @@ ObjectWindow::ObjectWindow(wiGUI* gui) : GUI(gui)
|
||||
RigidBodyPhysicsComponent& rigidbody = scene.rigidbodies.Create(entity);
|
||||
rigidbody.kinematic = kinematicCheckBox->GetCheck();
|
||||
rigidbody.shape = (RigidBodyPhysicsComponent::CollisionShape)collisionShapeComboBox->GetSelected();
|
||||
wiRenderer::physicsEngine->addRigidBody(rigidbody, *mesh, *transform);
|
||||
//wiRenderer::physicsEngine->addRigidBody(rigidbody, *mesh, *transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +117,8 @@ ObjectWindow::ObjectWindow(wiGUI* gui) : GUI(gui)
|
||||
RigidBodyPhysicsComponent* physicscomponent = wiRenderer::GetScene().rigidbodies.GetComponent(entity);
|
||||
if (physicscomponent != nullptr)
|
||||
{
|
||||
wiRenderer::physicsEngine->removeRigidBody(*physicscomponent);
|
||||
scene.rigidbodies.Remove(entity);
|
||||
//wiRenderer::physicsEngine->removeRigidBody(*physicscomponent);
|
||||
//scene.rigidbodies.Remove(entity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+19
-23
@@ -222,29 +222,29 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
shadowProps2DComboBox->AddItem("2048");
|
||||
shadowProps2DComboBox->AddItem("4096");
|
||||
shadowProps2DComboBox->OnSelect([&](wiEventArgs args) {
|
||||
wiRenderer::SHADOWCOUNT_2D = 11;
|
||||
|
||||
switch (args.iValue)
|
||||
{
|
||||
case 0:
|
||||
wiRenderer::SetShadowProps2D(128, 0, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(64, 0, -1);
|
||||
break;
|
||||
case 1:
|
||||
wiRenderer::SetShadowProps2D(128, wiRenderer::SHADOWCOUNT_2D, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(128, -1, -1);
|
||||
break;
|
||||
case 2:
|
||||
wiRenderer::SetShadowProps2D(256, wiRenderer::SHADOWCOUNT_2D, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(256, -1, -1);
|
||||
break;
|
||||
case 3:
|
||||
wiRenderer::SetShadowProps2D(512, wiRenderer::SHADOWCOUNT_2D, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(512, -1, -1);
|
||||
break;
|
||||
case 4:
|
||||
wiRenderer::SetShadowProps2D(1024, wiRenderer::SHADOWCOUNT_2D, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(1024, -1, -1);
|
||||
break;
|
||||
case 5:
|
||||
wiRenderer::SetShadowProps2D(2048, wiRenderer::SHADOWCOUNT_2D, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(2048, -1, -1);
|
||||
break;
|
||||
case 6:
|
||||
wiRenderer::SetShadowProps2D(4096, wiRenderer::SHADOWCOUNT_2D, wiRenderer::SOFTSHADOWQUALITY_2D);
|
||||
wiRenderer::SetShadowProps2D(4096, -1, -1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -267,29 +267,28 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
shadowPropsCubeComboBox->AddItem("2048");
|
||||
shadowPropsCubeComboBox->AddItem("4096");
|
||||
shadowPropsCubeComboBox->OnSelect([&](wiEventArgs args) {
|
||||
wiRenderer::SHADOWCOUNT_CUBE = 5;
|
||||
switch (args.iValue)
|
||||
{
|
||||
case 0:
|
||||
wiRenderer::SetShadowPropsCube(128, 0);
|
||||
break;
|
||||
case 1:
|
||||
wiRenderer::SetShadowPropsCube(128, wiRenderer::SHADOWCOUNT_CUBE);
|
||||
wiRenderer::SetShadowPropsCube(128, -1);
|
||||
break;
|
||||
case 2:
|
||||
wiRenderer::SetShadowPropsCube(256, wiRenderer::SHADOWCOUNT_CUBE);
|
||||
wiRenderer::SetShadowPropsCube(256, -1);
|
||||
break;
|
||||
case 3:
|
||||
wiRenderer::SetShadowPropsCube(512, wiRenderer::SHADOWCOUNT_CUBE);
|
||||
wiRenderer::SetShadowPropsCube(512, -1);
|
||||
break;
|
||||
case 4:
|
||||
wiRenderer::SetShadowPropsCube(1024, wiRenderer::SHADOWCOUNT_CUBE);
|
||||
wiRenderer::SetShadowPropsCube(1024, -1);
|
||||
break;
|
||||
case 5:
|
||||
wiRenderer::SetShadowPropsCube(2048, wiRenderer::SHADOWCOUNT_CUBE);
|
||||
wiRenderer::SetShadowPropsCube(2048, -1);
|
||||
break;
|
||||
case 6:
|
||||
wiRenderer::SetShadowPropsCube(4096, wiRenderer::SHADOWCOUNT_CUBE);
|
||||
wiRenderer::SetShadowPropsCube(4096, -1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -359,8 +358,7 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
textureQualityComboBox->AddItem("Trilinear");
|
||||
textureQualityComboBox->AddItem("Anisotropic");
|
||||
textureQualityComboBox->OnSelect([&](wiEventArgs args) {
|
||||
wiGraphicsTypes::SamplerDesc desc = wiRenderer::samplers[SSLOT_OBJECTSHADER]->GetDesc();
|
||||
SAFE_DELETE(wiRenderer::samplers[SSLOT_OBJECTSHADER]);
|
||||
wiGraphicsTypes::SamplerDesc desc = wiRenderer::GetSampler(SSLOT_OBJECTSHADER)->GetDesc();
|
||||
|
||||
switch (args.iValue)
|
||||
{
|
||||
@@ -380,8 +378,8 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
break;
|
||||
}
|
||||
|
||||
wiRenderer::samplers[SSLOT_OBJECTSHADER] = new wiGraphicsTypes::Sampler;
|
||||
wiRenderer::GetDevice()->CreateSamplerState(&desc, wiRenderer::samplers[SSLOT_OBJECTSHADER]);
|
||||
wiRenderer::ModifySampler(desc, SSLOT_OBJECTSHADER);
|
||||
|
||||
});
|
||||
textureQualityComboBox->SetSelected(3);
|
||||
textureQualityComboBox->SetEnabled(true);
|
||||
@@ -393,11 +391,9 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
mipLodBiasSlider->SetSize(XMFLOAT2(100, 30));
|
||||
mipLodBiasSlider->SetPos(XMFLOAT2(x, y += 30));
|
||||
mipLodBiasSlider->OnSlide([&](wiEventArgs args) {
|
||||
wiGraphicsTypes::SamplerDesc desc = wiRenderer::samplers[SSLOT_OBJECTSHADER]->GetDesc();
|
||||
SAFE_DELETE(wiRenderer::samplers[SSLOT_OBJECTSHADER]);
|
||||
wiGraphicsTypes::SamplerDesc desc = wiRenderer::GetSampler(SSLOT_OBJECTSHADER)->GetDesc();
|
||||
desc.MipLODBias = args.fValue;
|
||||
wiRenderer::samplers[SSLOT_OBJECTSHADER] = new wiGraphicsTypes::Sampler;
|
||||
wiRenderer::GetDevice()->CreateSamplerState(&desc, wiRenderer::samplers[SSLOT_OBJECTSHADER]);
|
||||
wiRenderer::ModifySampler(desc, SSLOT_OBJECTSHADER);
|
||||
});
|
||||
rendererWindow->AddWidget(mipLodBiasSlider);
|
||||
|
||||
|
||||
+19
-19
@@ -28,12 +28,12 @@ void Translator::LoadShaders()
|
||||
{
|
||||
GraphicsPSODesc desc;
|
||||
|
||||
desc.vs = wiRenderer::vertexShaders[VSTYPE_LINE];
|
||||
desc.ps = wiRenderer::pixelShaders[PSTYPE_LINE];
|
||||
desc.il = wiRenderer::vertexLayouts[VLTYPE_LINE];
|
||||
desc.dss = wiRenderer::depthStencils[DSSTYPE_XRAY];
|
||||
desc.rs = wiRenderer::rasterizers[RSTYPE_DOUBLESIDED];
|
||||
desc.bs = wiRenderer::blendStates[BSTYPE_ADDITIVE];
|
||||
desc.vs = wiRenderer::GetVertexShader(VSTYPE_LINE);
|
||||
desc.ps = wiRenderer::GetPixelShader(PSTYPE_LINE);
|
||||
desc.il = wiRenderer::GetVertexLayout(VLTYPE_LINE);
|
||||
desc.dss = wiRenderer::GetDepthStencilState(DSSTYPE_XRAY);
|
||||
desc.rs = wiRenderer::GetRasterizerState(RSTYPE_DOUBLESIDED);
|
||||
desc.bs = wiRenderer::GetBlendState(BSTYPE_ADDITIVE);
|
||||
desc.pt = TRIANGLELIST;
|
||||
|
||||
pso_solidpart = new GraphicsPSO;
|
||||
@@ -43,12 +43,12 @@ void Translator::LoadShaders()
|
||||
{
|
||||
GraphicsPSODesc desc;
|
||||
|
||||
desc.vs = wiRenderer::vertexShaders[VSTYPE_LINE];
|
||||
desc.ps = wiRenderer::pixelShaders[PSTYPE_LINE];
|
||||
desc.il = wiRenderer::vertexLayouts[VLTYPE_LINE];
|
||||
desc.dss = wiRenderer::depthStencils[DSSTYPE_XRAY];
|
||||
desc.rs = wiRenderer::rasterizers[RSTYPE_WIRE_DOUBLESIDED_SMOOTH];
|
||||
desc.bs = wiRenderer::blendStates[BSTYPE_TRANSPARENT];
|
||||
desc.vs = wiRenderer::GetVertexShader(VSTYPE_LINE);
|
||||
desc.ps = wiRenderer::GetPixelShader(PSTYPE_LINE);
|
||||
desc.il = wiRenderer::GetVertexLayout(VLTYPE_LINE);
|
||||
desc.dss = wiRenderer::GetDepthStencilState(DSSTYPE_XRAY);
|
||||
desc.rs = wiRenderer::GetRasterizerState(RSTYPE_WIRE_DOUBLESIDED_SMOOTH);
|
||||
desc.bs = wiRenderer::GetBlendState(BSTYPE_TRANSPARENT);
|
||||
desc.pt = LINELIST;
|
||||
|
||||
pso_wirepart = new GraphicsPSO;
|
||||
@@ -472,19 +472,19 @@ void Translator::Draw(const CameraComponent& camera, GRAPHICSTHREAD threadID)
|
||||
// xy
|
||||
XMStoreFloat4x4(&sb.g_xTransform, matX);
|
||||
sb.g_xColor = state == TRANSLATOR_XY ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.2f, 0.2f, 0, 0.2f);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Plane, 0, threadID);
|
||||
|
||||
// xz
|
||||
XMStoreFloat4x4(&sb.g_xTransform, matZ);
|
||||
sb.g_xColor = state == TRANSLATOR_XZ ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.2f, 0.2f, 0, 0.2f);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Plane, 0, threadID);
|
||||
|
||||
// yz
|
||||
XMStoreFloat4x4(&sb.g_xTransform, matY);
|
||||
sb.g_xColor = state == TRANSLATOR_YZ ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.2f, 0.2f, 0, 0.2f);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Plane, 0, threadID);
|
||||
|
||||
// Lines:
|
||||
@@ -502,19 +502,19 @@ void Translator::Draw(const CameraComponent& camera, GRAPHICSTHREAD threadID)
|
||||
// x
|
||||
XMStoreFloat4x4(&sb.g_xTransform, matX);
|
||||
sb.g_xColor = state == TRANSLATOR_X ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(1, 0, 0, 1);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Axis, 0, threadID);
|
||||
|
||||
// y
|
||||
XMStoreFloat4x4(&sb.g_xTransform, matY);
|
||||
sb.g_xColor = state == TRANSLATOR_Y ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0, 1, 0, 1);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Axis, 0, threadID);
|
||||
|
||||
// z
|
||||
XMStoreFloat4x4(&sb.g_xTransform, matZ);
|
||||
sb.g_xColor = state == TRANSLATOR_Z ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0, 0, 1, 1);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Axis, 0, threadID);
|
||||
|
||||
// Origin:
|
||||
@@ -529,7 +529,7 @@ void Translator::Draw(const CameraComponent& camera, GRAPHICSTHREAD threadID)
|
||||
device->BindVertexBuffers(vbs, 0, ARRAYSIZE(vbs), strides, nullptr, threadID);
|
||||
XMStoreFloat4x4(&sb.g_xTransform, XMMatrixTranspose(mat));
|
||||
sb.g_xColor = state == TRANSLATOR_XYZ ? XMFLOAT4(1, 1, 1, 1) : XMFLOAT4(0.25f, 0.25f, 0.25f, 1);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &sb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &sb, threadID);
|
||||
device->Draw(vertexCount_Origin, 0, threadID);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
case WM_SIZE:
|
||||
{
|
||||
if (wiRenderer::graphicsDevice)
|
||||
if (wiRenderer::GetDevice() != nullptr)
|
||||
{
|
||||
int width = LOWORD(lParam);
|
||||
int height = HIWORD(lParam);
|
||||
|
||||
@@ -53,7 +53,7 @@ void MainComponent::Initialize()
|
||||
{
|
||||
|
||||
// User can also create a graphics device if custom logic is desired, but he must do before this function!
|
||||
if (wiRenderer::graphicsDevice == nullptr)
|
||||
if (wiRenderer::GetDevice() == nullptr)
|
||||
{
|
||||
|
||||
bool debugdevice = wiStartupArguments::HasArgument("debugdevice");
|
||||
@@ -61,8 +61,8 @@ void MainComponent::Initialize()
|
||||
if (wiStartupArguments::HasArgument("vulkan"))
|
||||
{
|
||||
#ifdef WICKEDENGINE_BUILD_VULKAN
|
||||
wiRenderer::SHADERPATH += "spirv/";
|
||||
wiRenderer::graphicsDevice = new GraphicsDevice_Vulkan(window, fullscreen, debugdevice);
|
||||
wiRenderer::GetShaderPath() += "spirv/";
|
||||
wiRenderer::SetDevice(new GraphicsDevice_Vulkan(window, fullscreen, debugdevice));
|
||||
#else
|
||||
wiHelper::messageBox("Vulkan SDK not found during building the application! Vulkan API disabled!", "Error");
|
||||
#endif
|
||||
@@ -71,13 +71,13 @@ void MainComponent::Initialize()
|
||||
{
|
||||
if (wiStartupArguments::HasArgument("hlsl6"))
|
||||
{
|
||||
wiRenderer::SHADERPATH += "hlsl6/";
|
||||
wiRenderer::GetShaderPath() += "hlsl6/";
|
||||
}
|
||||
wiRenderer::graphicsDevice = new GraphicsDevice_DX12(window, fullscreen, debugdevice);
|
||||
wiRenderer::SetDevice(new GraphicsDevice_DX12(window, fullscreen, debugdevice));
|
||||
}
|
||||
else
|
||||
{
|
||||
wiRenderer::graphicsDevice = new GraphicsDevice_DX11(window, fullscreen, debugdevice);
|
||||
wiRenderer::SetDevice(new GraphicsDevice_DX11(window, fullscreen, debugdevice));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -159,13 +159,21 @@ void MainComponent::Run()
|
||||
Update((float)elapsedTime);
|
||||
wiProfiler::GetInstance().EndRange(); // Update
|
||||
|
||||
|
||||
wiProfiler::GetInstance().BeginRange("Render", wiProfiler::DOMAIN_CPU);
|
||||
Render();
|
||||
wiProfiler::GetInstance().EndRange(); // Render
|
||||
|
||||
wiProfiler::GetInstance().EndRange(); // CPU Frame
|
||||
|
||||
wiRenderer::Present(bind(&MainComponent::Compose, this));
|
||||
|
||||
wiProfiler::GetInstance().BeginRange("Compose", wiProfiler::DOMAIN_CPU);
|
||||
wiRenderer::GetDevice()->PresentBegin();
|
||||
Compose();
|
||||
wiRenderer::GetDevice()->PresentEnd();
|
||||
wiProfiler::GetInstance().EndRange(); // Compose
|
||||
|
||||
wiRenderer::EndFrame();
|
||||
|
||||
static bool startupScriptProcessed = false;
|
||||
if (!startupScriptProcessed) {
|
||||
|
||||
@@ -203,9 +203,6 @@ void Renderable3DComponent::Initialize()
|
||||
void Renderable3DComponent::Load()
|
||||
{
|
||||
Renderable2DComponent::Load();
|
||||
|
||||
wiRenderer::HAIRPARTICLEENABLED = getHairParticlesEnabled();
|
||||
wiRenderer::EMITTERSENABLED = getEmittedParticlesEnabled();
|
||||
}
|
||||
|
||||
void Renderable3DComponent::Start()
|
||||
@@ -233,7 +230,7 @@ void Renderable3DComponent::Compose()
|
||||
|
||||
if (wiRenderer::GetDebugLightCulling())
|
||||
{
|
||||
wiImage::Draw((Texture2D*)wiRenderer::textures[TEXTYPE_2D_DEBUGUAV], wiImageEffects((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()), GRAPHICSTHREAD_IMMEDIATE);
|
||||
wiImage::Draw((Texture2D*)wiRenderer::GetTexture(TEXTYPE_2D_DEBUGUAV), wiImageEffects((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()), GRAPHICSTHREAD_IMMEDIATE);
|
||||
}
|
||||
|
||||
Renderable2DComponent::Compose();
|
||||
|
||||
@@ -139,7 +139,7 @@ void TiledDeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID)
|
||||
fx.process.setSSSS(dir);
|
||||
if (i == 0)
|
||||
{
|
||||
wiImage::Draw(static_cast<Texture2D*>(wiRenderer::textures[TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV]), fx, threadID);
|
||||
wiImage::Draw(static_cast<Texture2D*>(wiRenderer::GetTexture(TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV)), fx, threadID);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -157,7 +157,7 @@ void TiledDeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID)
|
||||
fx.stencilComp = STENCILMODE_DISABLED;
|
||||
fx.presentFullScreen = true;
|
||||
fx.hdr = true;
|
||||
wiImage::Draw(static_cast<Texture2D*>(wiRenderer::textures[TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV]), fx, threadID);
|
||||
wiImage::Draw(static_cast<Texture2D*>(wiRenderer::GetTexture(TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV)), fx, threadID);
|
||||
fx.stencilRef = STENCILREF_SKIN;
|
||||
fx.stencilComp = STENCILMODE_LESS;
|
||||
wiImage::Draw(rtSSS[1].GetTexture(), fx, threadID);
|
||||
@@ -169,8 +169,8 @@ void TiledDeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID)
|
||||
}
|
||||
|
||||
rtDeferred.Activate(threadID, rtGBuffer.depth); {
|
||||
wiImage::DrawDeferred((getSSSEnabled() ? rtSSS[0].GetTexture(0) : static_cast<Texture2D*>(wiRenderer::textures[TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV])),
|
||||
static_cast<Texture2D*>(wiRenderer::textures[TEXTYPE_2D_TILEDDEFERRED_SPECULARUAV])
|
||||
wiImage::DrawDeferred((getSSSEnabled() ? rtSSS[0].GetTexture(0) : static_cast<Texture2D*>(wiRenderer::GetTexture(TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV))),
|
||||
static_cast<Texture2D*>(wiRenderer::GetTexture(TEXTYPE_2D_TILEDDEFERRED_SPECULARUAV))
|
||||
, getSSAOEnabled() ? rtSSAO.back().GetTexture() : wiTextureHelper::getInstance()->getWhite()
|
||||
, threadID, STENCILREF_DEFAULT);
|
||||
wiRenderer::DrawSky(threadID);
|
||||
|
||||
@@ -591,28 +591,27 @@ void wiEmittedParticle::Draw(const CameraComponent& camera, const MaterialCompon
|
||||
|
||||
void wiEmittedParticle::LoadShaders()
|
||||
{
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticleVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
|
||||
pixelShader[SOFT] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticlePS_soft.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader[SOFT_DISTORTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticlePS_soft_distortion.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader[SIMPLEST] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticlePS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticleVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
pixelShader[SOFT] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticlePS_soft.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader[SOFT_DISTORTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticlePS_soft_distortion.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader[SIMPLEST] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticlePS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
kickoffUpdateCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_kickoffUpdateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
finishUpdateCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_finishUpdateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
emitCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_emitCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
emitCS_FROMMESH = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_emitCS_FROMMESH.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphpartitionCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_sphpartitionCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphpartitionoffsetsCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_sphpartitionoffsetsCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphpartitionoffsetsresetCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_sphpartitionoffsetsresetCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphdensityCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_sphdensityCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphforceCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_sphforceCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_simulateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS_SORTING = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_simulateCS_SORTING.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS_DEPTHCOLLISIONS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_simulateCS_DEPTHCOLLISIONS.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS_SORTING_DEPTHCOLLISIONS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "emittedparticle_simulateCS_SORTING_DEPTHCOLLISIONS.cso", wiResourceManager::COMPUTESHADER));
|
||||
kickoffUpdateCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_kickoffUpdateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
finishUpdateCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_finishUpdateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
emitCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_emitCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
emitCS_FROMMESH = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_emitCS_FROMMESH.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphpartitionCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_sphpartitionCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphpartitionoffsetsCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_sphpartitionoffsetsCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphpartitionoffsetsresetCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_sphpartitionoffsetsresetCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphdensityCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_sphdensityCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sphforceCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_sphforceCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_simulateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS_SORTING = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_simulateCS_SORTING.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS_DEPTHCOLLISIONS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_simulateCS_DEPTHCOLLISIONS.cso", wiResourceManager::COMPUTESHADER));
|
||||
simulateCS_SORTING_DEPTHCOLLISIONS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "emittedparticle_simulateCS_SORTING_DEPTHCOLLISIONS.cso", wiResourceManager::COMPUTESHADER));
|
||||
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
@@ -230,9 +230,10 @@ void fft512x512_destroy_plan(CSFFT512x512_Plan* plan)
|
||||
|
||||
void CSFFT_512x512_Data_t::LoadShaders()
|
||||
{
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
pRadix008A_CS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fft_512x512_c2c_CS.cso", wiResourceManager::COMPUTESHADER));
|
||||
pRadix008A_CS2 = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fft_512x512_c2c_v2_CS.cso", wiResourceManager::COMPUTESHADER));
|
||||
pRadix008A_CS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path+ "fft_512x512_c2c_CS.cso", wiResourceManager::COMPUTESHADER));
|
||||
pRadix008A_CS2 = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "fft_512x512_c2c_v2_CS.cso", wiResourceManager::COMPUTESHADER));
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
|
||||
+28
-35
@@ -37,11 +37,33 @@ wiFont::wiFont(const std::wstring& text, wiFontProps props, int style) : text(te
|
||||
}
|
||||
wiFont::~wiFont()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void wiFont::Initialize()
|
||||
{
|
||||
SetUpStates();
|
||||
LoadShaders();
|
||||
LoadVertexBuffer();
|
||||
LoadIndices();
|
||||
|
||||
// add default font:
|
||||
addFontStyle("default_font");
|
||||
}
|
||||
void wiFont::CleanUp()
|
||||
{
|
||||
for (unsigned int i = 0; i<fontStyles.size(); ++i)
|
||||
fontStyles[i].CleanUp();
|
||||
fontStyles.clear();
|
||||
|
||||
SAFE_DELETE(vertexBuffer);
|
||||
SAFE_DELETE(indexBuffer);
|
||||
SAFE_DELETE(vertexLayout);
|
||||
SAFE_DELETE(vertexShader);
|
||||
SAFE_DELETE(pixelShader);
|
||||
SAFE_DELETE(blendState);
|
||||
SAFE_DELETE(rasterizerState);
|
||||
SAFE_DELETE(depthStencilState);
|
||||
SAFE_DELETE(vertexBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,19 +145,20 @@ void wiFont::SetUpStates()
|
||||
}
|
||||
void wiFont::LoadShaders()
|
||||
{
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
VertexLayoutDesc layout[] =
|
||||
{
|
||||
{ "POSITION", 0, FORMAT_R32G32_FLOAT, 0, APPEND_ALIGNED_ELEMENT, INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TEXCOORD", 0, FORMAT_R16G16_FLOAT, 0, APPEND_ALIGNED_ELEMENT, INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fontVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path + "fontVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
vertexLayout = new VertexLayout;
|
||||
wiRenderer::GetDevice()->CreateInputLayout(layout, ARRAYSIZE(layout), vertexShader->code.data, vertexShader->code.size, vertexLayout);
|
||||
|
||||
|
||||
pixelShader = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fontPS.cso", wiResourceManager::PIXELSHADER));
|
||||
pixelShader = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "fontPS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
|
||||
GraphicsPSODesc desc;
|
||||
@@ -151,32 +174,6 @@ void wiFont::LoadShaders()
|
||||
PSO = new GraphicsPSO;
|
||||
wiRenderer::GetDevice()->CreateGraphicsPSO(&desc, PSO);
|
||||
}
|
||||
void wiFont::SetUpStaticComponents()
|
||||
{
|
||||
SetUpStates();
|
||||
LoadShaders();
|
||||
LoadVertexBuffer();
|
||||
LoadIndices();
|
||||
|
||||
// add default font:
|
||||
addFontStyle("default_font");
|
||||
}
|
||||
void wiFont::CleanUpStatic()
|
||||
{
|
||||
for(unsigned int i=0;i<fontStyles.size();++i)
|
||||
fontStyles[i].CleanUp();
|
||||
fontStyles.clear();
|
||||
|
||||
SAFE_DELETE(vertexBuffer);
|
||||
SAFE_DELETE(indexBuffer);
|
||||
SAFE_DELETE(vertexLayout);
|
||||
SAFE_DELETE(vertexShader);
|
||||
SAFE_DELETE(pixelShader);
|
||||
SAFE_DELETE(blendState);
|
||||
SAFE_DELETE(rasterizerState);
|
||||
SAFE_DELETE(depthStencilState);
|
||||
SAFE_DELETE(vertexBuffer);
|
||||
}
|
||||
|
||||
|
||||
void wiFont::ModifyGeo(volatile Vertex* vertexList, const std::wstring& text, wiFontProps props, int style)
|
||||
@@ -325,7 +322,7 @@ void wiFont::Draw(GRAPHICSTHREAD threadID)
|
||||
* device->GetScreenProjection()
|
||||
));
|
||||
cb.g_xColor = float4(newProps.shadowColor.R, newProps.shadowColor.G, newProps.shadowColor.B, newProps.shadowColor.A);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
|
||||
device->DrawIndexed((int)text.length() * 6, 0, 0, threadID);
|
||||
}
|
||||
@@ -336,7 +333,7 @@ void wiFont::Draw(GRAPHICSTHREAD threadID)
|
||||
* device->GetScreenProjection()
|
||||
));
|
||||
cb.g_xColor = float4(newProps.color.R, newProps.color.G, newProps.color.B, newProps.color.A);
|
||||
device->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
device->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
|
||||
device->DrawIndexed((int)text.length() * 6, 0, 0, threadID);
|
||||
|
||||
@@ -466,7 +463,3 @@ int wiFont::getFontStyleByName( const std::string& get ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wiFont::CleanUp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -91,8 +91,7 @@ private:
|
||||
|
||||
public:
|
||||
static void Initialize();
|
||||
static void SetUpStaticComponents();
|
||||
static void CleanUpStatic();
|
||||
static void CleanUp();
|
||||
|
||||
std::wstring text;
|
||||
wiFontProps props;
|
||||
@@ -116,6 +115,4 @@ public:
|
||||
void SetText(const std::wstring& text);
|
||||
std::wstring GetText();
|
||||
std::string GetTextA();
|
||||
|
||||
void CleanUp();
|
||||
};
|
||||
|
||||
@@ -41,15 +41,16 @@ void wiGPUSortLib::Initialize()
|
||||
|
||||
void wiGPUSortLib::LoadShaders()
|
||||
{
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
kickoffSortCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "gpusortlib_kickoffSortCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sortCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "gpusortlib_sortCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sortInnerCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "gpusortlib_sortInnerCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sortStepCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "gpusortlib_sortStepCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
kickoffSortCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "gpusortlib_kickoffSortCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sortCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "gpusortlib_sortCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sortInnerCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "gpusortlib_sortInnerCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
sortStepCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "gpusortlib_sortStepCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
|
||||
|
||||
|
||||
ComputePSODesc desc;
|
||||
|
||||
desc.cs = kickoffSortCS;
|
||||
|
||||
@@ -41,7 +41,9 @@ void wiHairParticle::CleanUpStatic()
|
||||
}
|
||||
void wiHairParticle::LoadShaders()
|
||||
{
|
||||
vs = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticleVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
vs = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticleVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
|
||||
for (int i = 0; i < SHADERTYPE_COUNT; ++i)
|
||||
@@ -49,10 +51,10 @@ void wiHairParticle::LoadShaders()
|
||||
SAFE_INIT(ps[i]);
|
||||
}
|
||||
|
||||
ps[SHADERTYPE_DEPTHONLY] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticlePS_alphatestonly.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_DEFERRED] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticlePS_deferred.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_FORWARD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticlePS_forward.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_TILEDFORWARD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticlePS_tiledforward.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_DEPTHONLY] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticlePS_alphatestonly.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_DEFERRED] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticlePS_deferred.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_FORWARD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticlePS_forward.cso", wiResourceManager::PIXELSHADER));
|
||||
ps[SHADERTYPE_TILEDFORWARD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticlePS_tiledforward.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
@@ -118,7 +120,7 @@ void wiHairParticle::LoadShaders()
|
||||
}
|
||||
|
||||
SAFE_INIT(ps_simplest);
|
||||
ps_simplest = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticlePS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
ps_simplest = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticlePS_simplest.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
{
|
||||
GraphicsPSODesc desc;
|
||||
@@ -134,7 +136,7 @@ void wiHairParticle::LoadShaders()
|
||||
}
|
||||
|
||||
SAFE_INIT(cs_simulate);
|
||||
cs_simulate = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "hairparticle_simulateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
cs_simulate = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "hairparticle_simulateCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
|
||||
{
|
||||
ComputePSODesc desc;
|
||||
|
||||
+40
-38
@@ -61,37 +61,39 @@ void wiImage::LoadBuffers()
|
||||
|
||||
void wiImage::LoadShaders()
|
||||
{
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imageVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
screenVS = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "screenVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
imagePS[IMAGE_SHADER_STANDARD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_SEPARATENORMALMAP] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS_separatenormalmap.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_DISTORTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS_distortion.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_DISTORTION_MASKED] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS_distortion_masked.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_MASKED] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "imagePS_masked.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_FULLSCREEN] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "screenPS.cso", wiResourceManager::PIXELSHADER));
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path + "imageVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
screenVS = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path + "screenVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
postprocessPS[POSTPROCESS_BLUR_H] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "horizontalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_BLUR_V] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "verticalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_LIGHTSHAFT] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lightShaftPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_OUTLINE] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "outlinePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_DEPTHOFFIELD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "depthofFieldPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_MOTIONBLUR] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "motionBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_BLOOMSEPARATE] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "bloomSeparatePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_FXAA] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "fxaa.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SSAO] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssao.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SSSS] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssss.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_LINEARDEPTH] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "linDepthPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_COLORGRADE] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "colorGradePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SSR] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "ssr.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_STEREOGRAM] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "stereogramPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_TONEMAP] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "toneMapPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_REPROJECTDEPTHBUFFER] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "reprojectDepthBufferPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_DOWNSAMPLEDEPTHBUFFER] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "downsampleDepthBuffer4xPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_TEMPORALAA] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "temporalAAResolvePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SHARPEN] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "sharpenPS.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_STANDARD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "imagePS.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_SEPARATENORMALMAP] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "imagePS_separatenormalmap.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_DISTORTION] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "imagePS_distortion.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_DISTORTION_MASKED] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "imagePS_distortion_masked.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_MASKED] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "imagePS_masked.cso", wiResourceManager::PIXELSHADER));
|
||||
imagePS[IMAGE_SHADER_FULLSCREEN] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "screenPS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
deferredPS = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "deferredPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_BLUR_H] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "horizontalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_BLUR_V] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "verticalBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_LIGHTSHAFT] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "lightShaftPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_OUTLINE] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "outlinePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_DEPTHOFFIELD] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "depthofFieldPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_MOTIONBLUR] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "motionBlurPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_BLOOMSEPARATE] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "bloomSeparatePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_FXAA] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "fxaa.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SSAO] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "ssao.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SSSS] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "ssss.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_LINEARDEPTH] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "linDepthPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_COLORGRADE] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "colorGradePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SSR] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "ssr.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_STEREOGRAM] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "stereogramPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_TONEMAP] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "toneMapPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_REPROJECTDEPTHBUFFER] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "reprojectDepthBufferPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_DOWNSAMPLEDEPTHBUFFER] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "downsampleDepthBuffer4xPS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_TEMPORALAA] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "temporalAAResolvePS.cso", wiResourceManager::PIXELSHADER));
|
||||
postprocessPS[POSTPROCESS_SHARPEN] = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "sharpenPS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
deferredPS = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "deferredPS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
@@ -355,29 +357,29 @@ void wiImage::Draw(Texture2D* texture, const wiImageEffects& effects,GRAPHICSTHR
|
||||
if (effects.quality == QUALITY_NEAREST)
|
||||
{
|
||||
if (effects.sampleFlag == SAMPLEMODE_MIRROR)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_POINT_MIRROR], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_POINT_MIRROR), SSLOT_ONDEMAND0, threadID);
|
||||
else if (effects.sampleFlag == SAMPLEMODE_WRAP)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_POINT_WRAP], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_POINT_WRAP), SSLOT_ONDEMAND0, threadID);
|
||||
else if (effects.sampleFlag == SAMPLEMODE_CLAMP)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_POINT_CLAMP], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_POINT_CLAMP), SSLOT_ONDEMAND0, threadID);
|
||||
}
|
||||
else if (effects.quality == QUALITY_BILINEAR)
|
||||
{
|
||||
if (effects.sampleFlag == SAMPLEMODE_MIRROR)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_LINEAR_MIRROR], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_LINEAR_MIRROR), SSLOT_ONDEMAND0, threadID);
|
||||
else if (effects.sampleFlag == SAMPLEMODE_WRAP)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_LINEAR_WRAP], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_LINEAR_WRAP), SSLOT_ONDEMAND0, threadID);
|
||||
else if (effects.sampleFlag == SAMPLEMODE_CLAMP)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_LINEAR_CLAMP], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_LINEAR_CLAMP), SSLOT_ONDEMAND0, threadID);
|
||||
}
|
||||
else if (effects.quality == QUALITY_ANISOTROPIC)
|
||||
{
|
||||
if (effects.sampleFlag == SAMPLEMODE_MIRROR)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_ANISO_MIRROR], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_ANISO_MIRROR), SSLOT_ONDEMAND0, threadID);
|
||||
else if (effects.sampleFlag == SAMPLEMODE_WRAP)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_ANISO_WRAP], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_ANISO_WRAP), SSLOT_ONDEMAND0, threadID);
|
||||
else if (effects.sampleFlag == SAMPLEMODE_CLAMP)
|
||||
device->BindSampler(PS, wiRenderer::samplers[SSLOT_ANISO_CLAMP], SSLOT_ONDEMAND0, threadID);
|
||||
device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_ANISO_CLAMP), SSLOT_ONDEMAND0, threadID);
|
||||
}
|
||||
|
||||
if (effects.presentFullScreen)
|
||||
@@ -670,7 +672,7 @@ void wiImage::DrawDeferred(Texture2D* lightmap_diffuse, Texture2D* lightmap_spec
|
||||
}
|
||||
|
||||
|
||||
void wiImage::Load()
|
||||
void wiImage::Initialize()
|
||||
{
|
||||
LoadBuffers();
|
||||
SetUpStates();
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
static void DrawDeferred(wiGraphicsTypes::Texture2D* lightmap_diffuse, wiGraphicsTypes::Texture2D* lightmap_specular,
|
||||
wiGraphicsTypes::Texture2D* ao, GRAPHICSTHREAD threadID, int stencilref = 0);
|
||||
|
||||
static void Load();
|
||||
static void Initialize();
|
||||
static void CleanUp();
|
||||
};
|
||||
|
||||
|
||||
@@ -23,18 +23,13 @@ namespace wiInitializer
|
||||
wiFrameRate::Initialize();
|
||||
wiCpuInfo::Initialize();
|
||||
|
||||
wiRenderer::SetUpStaticComponents();
|
||||
wiRenderer::Initialize();
|
||||
wiLensFlare::Initialize();
|
||||
|
||||
wiImage::Load();
|
||||
|
||||
wiImage::Initialize();
|
||||
wiFont::Initialize();
|
||||
wiFont::SetUpStaticComponents();
|
||||
|
||||
wiOcean::SetUpStatic();
|
||||
wiOcean::Initialize();
|
||||
|
||||
wiWidget::LoadShaders();
|
||||
|
||||
wiGPUSortLib::LoadShaders();
|
||||
|
||||
if (FAILED(wiSoundEffect::Initialize()) || FAILED(wiMusic::Initialize()))
|
||||
|
||||
@@ -67,12 +67,13 @@ void wiLensFlare::Draw(GRAPHICSTHREAD threadID, const XMVECTOR& lightPos, const
|
||||
|
||||
void wiLensFlare::LoadShaders()
|
||||
{
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlareVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
vertexShader = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path+ "lensFlareVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
pixelShader = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "lensFlarePS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
pixelShader = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlarePS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
geometryShader = static_cast<GeometryShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "lensFlareGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
geometryShader = static_cast<GeometryShader*>(wiResourceManager::GetShaderManager()->add(path + "lensFlareGS.cso", wiResourceManager::GEOMETRYSHADER));
|
||||
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
@@ -371,15 +371,17 @@ void wiOcean::Render(const CameraComponent& camera, float time, GRAPHICSTHREAD t
|
||||
void wiOcean::LoadShaders()
|
||||
{
|
||||
|
||||
m_pUpdateSpectrumCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "oceanSimulatorCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
m_pUpdateDisplacementMapCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "oceanUpdateDisplacementMapCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
m_pUpdateGradientFoldingCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "oceanUpdateGradientFoldingCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
std::string path = wiRenderer::GetShaderPath();
|
||||
|
||||
m_pUpdateSpectrumCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "oceanSimulatorCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
m_pUpdateDisplacementMapCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "oceanUpdateDisplacementMapCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
m_pUpdateGradientFoldingCS = static_cast<ComputeShader*>(wiResourceManager::GetShaderManager()->add(path + "oceanUpdateGradientFoldingCS.cso", wiResourceManager::COMPUTESHADER));
|
||||
|
||||
|
||||
g_pOceanSurfVS = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "oceanSurfaceVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
g_pOceanSurfVS = static_cast<VertexShader*>(wiResourceManager::GetShaderManager()->add(path + "oceanSurfaceVS.cso", wiResourceManager::VERTEXSHADER));
|
||||
|
||||
g_pOceanSurfPS = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "oceanSurfacePS.cso", wiResourceManager::PIXELSHADER));
|
||||
g_pWireframePS = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(wiRenderer::SHADERPATH + "oceanSurfaceSimplePS.cso", wiResourceManager::PIXELSHADER));
|
||||
g_pOceanSurfPS = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "oceanSurfacePS.cso", wiResourceManager::PIXELSHADER));
|
||||
g_pWireframePS = static_cast<PixelShader*>(wiResourceManager::GetShaderManager()->add(path + "oceanSurfaceSimplePS.cso", wiResourceManager::PIXELSHADER));
|
||||
|
||||
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
@@ -412,7 +414,7 @@ void wiOcean::LoadShaders()
|
||||
}
|
||||
}
|
||||
|
||||
void wiOcean::SetUpStatic()
|
||||
void wiOcean::Initialize()
|
||||
{
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
@@ -472,7 +474,7 @@ void wiOcean::SetUpStatic()
|
||||
fft512x512_create_plan(&m_fft_plan, 3);
|
||||
}
|
||||
|
||||
void wiOcean::CleanUpStatic()
|
||||
void wiOcean::CleanUp()
|
||||
{
|
||||
fft512x512_destroy_plan(&m_fft_plan);
|
||||
|
||||
|
||||
@@ -68,9 +68,10 @@ public:
|
||||
|
||||
const wiOceanParameter& getParameters();
|
||||
|
||||
|
||||
static void Initialize();
|
||||
static void CleanUp();
|
||||
static void LoadShaders();
|
||||
static void SetUpStatic();
|
||||
static void CleanUpStatic();
|
||||
|
||||
XMFLOAT3 waterColor = XMFLOAT3(powf(0.07f, 1.0f / 2.2f), powf(0.15f, 1.0f / 2.2f), powf(0.2f, 1.0f / 2.2f));
|
||||
float waterHeight = 0.0f;
|
||||
|
||||
+1263
-1091
File diff suppressed because it is too large
Load Diff
+167
-249
@@ -1,54 +1,18 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "ShaderInterop.h"
|
||||
#include "wiEnums.h"
|
||||
#include "wiGraphicsAPI.h"
|
||||
#include "wiWindowRegistration.h"
|
||||
#include "wiFrustum.h"
|
||||
#include "wiSceneSystem_Decl.h"
|
||||
#include "wiECS.h"
|
||||
|
||||
#include <unordered_set>
|
||||
#include <deque>
|
||||
|
||||
class wiSprite;
|
||||
class PHYSICS;
|
||||
class wiRenderTarget;
|
||||
class wiOcean;
|
||||
struct wiOceanParameter;
|
||||
struct RAY;
|
||||
|
||||
typedef std::unordered_map<wiECS::Entity, std::vector<wiECS::Entity>> CulledCollection;
|
||||
|
||||
struct RAY;
|
||||
|
||||
class wiRenderer
|
||||
namespace wiRenderer
|
||||
{
|
||||
public:
|
||||
static wiGraphicsTypes::GraphicsDevice* graphicsDevice;
|
||||
static wiGraphicsTypes::GraphicsDevice* GetDevice() { assert(graphicsDevice != nullptr); return graphicsDevice; }
|
||||
|
||||
|
||||
static void Present(std::function<void()> drawToScreen1=nullptr, std::function<void()> drawToScreen2=nullptr, std::function<void()> drawToScreen3=nullptr);
|
||||
|
||||
|
||||
static wiGraphicsTypes::Sampler *samplers[SSLOT_COUNT];
|
||||
static wiGraphicsTypes::VertexShader *vertexShaders[VSTYPE_LAST];
|
||||
static wiGraphicsTypes::PixelShader *pixelShaders[PSTYPE_LAST];
|
||||
static wiGraphicsTypes::GeometryShader *geometryShaders[GSTYPE_LAST];
|
||||
static wiGraphicsTypes::HullShader *hullShaders[HSTYPE_LAST];
|
||||
static wiGraphicsTypes::DomainShader *domainShaders[DSTYPE_LAST];
|
||||
static wiGraphicsTypes::ComputeShader *computeShaders[CSTYPE_LAST];
|
||||
static wiGraphicsTypes::VertexLayout *vertexLayouts[VLTYPE_LAST];
|
||||
static wiGraphicsTypes::RasterizerState *rasterizers[RSTYPE_LAST];
|
||||
static wiGraphicsTypes::DepthStencilState *depthStencils[DSSTYPE_LAST];
|
||||
static wiGraphicsTypes::BlendState *blendStates[BSTYPE_LAST];
|
||||
static wiGraphicsTypes::GPUBuffer *constantBuffers[CBTYPE_LAST];
|
||||
static wiGraphicsTypes::GPUBuffer *resourceBuffers[RBTYPE_LAST];
|
||||
static wiGraphicsTypes::Texture *textures[TEXTYPE_LAST];
|
||||
static wiGraphicsTypes::Sampler *customsamplers[SSTYPE_LAST];
|
||||
|
||||
static wiGraphicsTypes::GPURingBuffer *dynamicVertexBufferPool;
|
||||
|
||||
static const wiGraphicsTypes::FORMAT RTFormat_ldr = wiGraphicsTypes::FORMAT_R8G8B8A8_UNORM;
|
||||
static const wiGraphicsTypes::FORMAT RTFormat_hdr = wiGraphicsTypes::FORMAT_R16G16B16A16_FLOAT;
|
||||
static const wiGraphicsTypes::FORMAT RTFormat_gbuffer_0 = wiGraphicsTypes::FORMAT_R8G8B8A8_UNORM;
|
||||
@@ -73,199 +37,84 @@ public:
|
||||
static const wiGraphicsTypes::FORMAT DSFormat_full_alias = wiGraphicsTypes::FORMAT_R32G8X24_TYPELESS;
|
||||
static const wiGraphicsTypes::FORMAT DSFormat_small = wiGraphicsTypes::FORMAT_D16_UNORM;
|
||||
static const wiGraphicsTypes::FORMAT DSFormat_small_alias = wiGraphicsTypes::FORMAT_R16_TYPELESS;
|
||||
|
||||
static float GAMMA;
|
||||
static int SHADOWRES_2D, SHADOWRES_CUBE, SHADOWCOUNT_2D, SHADOWCOUNT_CUBE, SOFTSHADOWQUALITY_2D;
|
||||
static bool HAIRPARTICLEENABLED, EMITTERSENABLED;
|
||||
static float SPECULARAA;
|
||||
static float renderTime, renderTime_Prev, deltaTime;
|
||||
static XMFLOAT2 temporalAAJitter, temporalAAJitterPrev;
|
||||
static float RESOLUTIONSCALE;
|
||||
static bool TRANSPARENTSHADOWSENABLED;
|
||||
static bool ALPHACOMPOSITIONENABLED;
|
||||
|
||||
static void SetShadowProps2D(int resolution, int count, int softShadowQuality);
|
||||
static void SetShadowPropsCube(int resolution, int count);
|
||||
wiGraphicsTypes::Sampler* GetSampler(int slot);
|
||||
wiGraphicsTypes::VertexShader* GetVertexShader(VSTYPES id);
|
||||
wiGraphicsTypes::HullShader* GetHullShader(VSTYPES id);
|
||||
wiGraphicsTypes::DomainShader* GetDomainShader(VSTYPES id);
|
||||
wiGraphicsTypes::GeometryShader* GetGeometryShader(VSTYPES id);
|
||||
wiGraphicsTypes::PixelShader* GetPixelShader(PSTYPES id);
|
||||
wiGraphicsTypes::ComputeShader* GetComputeShader(PSTYPES id);
|
||||
wiGraphicsTypes::VertexLayout* GetVertexLayout(VLTYPES id);
|
||||
wiGraphicsTypes::RasterizerState* GetRasterizerState(RSTYPES id);
|
||||
wiGraphicsTypes::DepthStencilState* GetDepthStencilState(DSSTYPES id);
|
||||
wiGraphicsTypes::BlendState* GetBlendState(BSTYPES id);
|
||||
wiGraphicsTypes::GPUBuffer* GetConstantBuffer(CBTYPES id);
|
||||
wiGraphicsTypes::Texture* GetTexture(TEXTYPES id);
|
||||
|
||||
protected:
|
||||
|
||||
static bool wireRender, debugBoneLines, debugPartitionTree, debugEnvProbes, debugEmitters, debugForceFields, debugCameras, gridHelper, voxelHelper, advancedLightCulling, advancedRefractions;
|
||||
static bool ldsSkinningEnabled;
|
||||
static bool requestReflectionRendering;
|
||||
void ModifySampler(const wiGraphicsTypes::SamplerDesc& desc, int slot);
|
||||
|
||||
|
||||
static wiGraphicsTypes::Texture2D* enviroMap;
|
||||
static void LoadBuffers();
|
||||
static void LoadShaders();
|
||||
static void SetUpStates();
|
||||
void Initialize();
|
||||
void CleanUp();
|
||||
void LoadBuffers();
|
||||
void LoadShaders();
|
||||
void SetUpStates();
|
||||
void ClearWorld();
|
||||
|
||||
void SetDevice(wiGraphicsTypes::GraphicsDevice* newDevice);
|
||||
wiGraphicsTypes::GraphicsDevice* GetDevice();
|
||||
|
||||
std::string& GetShaderPath();
|
||||
void ReloadShaders(const std::string& path = "");
|
||||
|
||||
wiSceneSystem::Scene& GetScene();
|
||||
wiSceneSystem::CameraComponent& GetCamera();
|
||||
wiSceneSystem::CameraComponent& GetPrevCamera();
|
||||
wiSceneSystem::CameraComponent& GetRefCamera();
|
||||
|
||||
void FixedUpdate();
|
||||
void UpdatePerFrameData(float dt);
|
||||
void UpdateRenderData(GRAPHICSTHREAD threadID);
|
||||
|
||||
|
||||
static float GameSpeed;
|
||||
void BindPersistentState(GRAPHICSTHREAD threadID);
|
||||
void UpdateWorldCB(GRAPHICSTHREAD threadID);
|
||||
void UpdateFrameCB(GRAPHICSTHREAD threadID);
|
||||
void UpdateCameraCB(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
void SetClipPlane(const XMFLOAT4& clipPlane, GRAPHICSTHREAD threadID);
|
||||
void SetAlphaRef(float alphaRef, GRAPHICSTHREAD threadID);
|
||||
inline void ResetAlphaRef(GRAPHICSTHREAD threadID) { SetAlphaRef(0.75f, threadID); }
|
||||
void BindGBufferTextures(wiGraphicsTypes::Texture2D* slot0, wiGraphicsTypes::Texture2D* slot1, wiGraphicsTypes::Texture2D* slot2, wiGraphicsTypes::Texture2D* slot3, wiGraphicsTypes::Texture2D* slot4, GRAPHICSTHREAD threadID);
|
||||
void BindDepthTextures(wiGraphicsTypes::Texture2D* depth, wiGraphicsTypes::Texture2D* linearDepth, GRAPHICSTHREAD threadID);
|
||||
|
||||
static wiSceneSystem::Scene* scene;
|
||||
|
||||
static XMFLOAT4 waterPlane;
|
||||
|
||||
static bool debugLightCulling;
|
||||
static bool occlusionCulling;
|
||||
static bool temporalAA, temporalAADEBUG;
|
||||
static bool freezeCullingCamera;
|
||||
|
||||
struct VoxelizedSceneData
|
||||
{
|
||||
bool enabled;
|
||||
int res;
|
||||
float voxelsize;
|
||||
XMFLOAT3 center;
|
||||
XMFLOAT3 extents;
|
||||
int numCones;
|
||||
float rayStepSize;
|
||||
bool secondaryBounceEnabled;
|
||||
bool reflectionsEnabled;
|
||||
bool centerChangedThisFrame;
|
||||
UINT mips;
|
||||
|
||||
VoxelizedSceneData() :enabled(false), res(128), voxelsize(1.0f), center(XMFLOAT3(0, 0, 0)), extents(XMFLOAT3(0, 0, 0)), numCones(8),
|
||||
rayStepSize(0.5f), secondaryBounceEnabled(true), reflectionsEnabled(false), centerChangedThisFrame(true), mips(7)
|
||||
{}
|
||||
} static voxelSceneData;
|
||||
|
||||
static wiGraphicsTypes::GPUQuery occlusionQueries[256];
|
||||
|
||||
static UINT entityArrayOffset_Lights, entityArrayCount_Lights;
|
||||
static UINT entityArrayOffset_Decals, entityArrayCount_Decals;
|
||||
static UINT entityArrayOffset_ForceFields, entityArrayCount_ForceFields;
|
||||
static UINT entityArrayOffset_EnvProbes, entityArrayCount_EnvProbes;
|
||||
|
||||
public:
|
||||
static std::string SHADERPATH;
|
||||
|
||||
static void SetUpStaticComponents();
|
||||
static void CleanUpStatic();
|
||||
|
||||
static void FixedUpdate();
|
||||
// Render data that needs to be updated on the main thread!
|
||||
static void UpdatePerFrameData(float dt);
|
||||
static void UpdateRenderData(GRAPHICSTHREAD threadID);
|
||||
static void OcclusionCulling_Render(GRAPHICSTHREAD threadID);
|
||||
static void OcclusionCulling_Read();
|
||||
static void PutWaterRipple(const std::string& image, const XMFLOAT3& pos);
|
||||
static void ManageWaterRipples();
|
||||
static void DrawWaterRipples(GRAPHICSTHREAD threadID);
|
||||
static void SetGameSpeed(float value){GameSpeed=value; if(GameSpeed<0) GameSpeed=0;};
|
||||
static float GetGameSpeed();
|
||||
static void SetResolutionScale(float value) { RESOLUTIONSCALE = value; }
|
||||
static float GetResolutionScale() { return RESOLUTIONSCALE; }
|
||||
static void SetTransparentShadowsEnabled(float value) { TRANSPARENTSHADOWSENABLED = value; }
|
||||
static float GetTransparentShadowsEnabled() { return TRANSPARENTSHADOWSENABLED; }
|
||||
static XMUINT2 GetInternalResolution() { return XMUINT2((UINT)ceilf(GetDevice()->GetScreenWidth()*GetResolutionScale()), (UINT)ceilf(GetDevice()->GetScreenHeight()*GetResolutionScale())); }
|
||||
static bool ResolutionChanged();
|
||||
static void SetGamma(float value) { GAMMA = value; }
|
||||
static float GetGamma() { return GAMMA; }
|
||||
static void SetWireRender(bool value) { wireRender = value; }
|
||||
static bool IsWireRender() { return wireRender; }
|
||||
static void SetToDrawDebugBoneLines(bool param) { debugBoneLines = param; }
|
||||
static bool GetToDrawDebugBoneLines() { return debugBoneLines; }
|
||||
static void SetToDrawDebugPartitionTree(bool param){debugPartitionTree=param;}
|
||||
static bool GetToDrawDebugPartitionTree(){return debugPartitionTree;}
|
||||
static bool GetToDrawDebugEnvProbes() { return debugEnvProbes; }
|
||||
static void SetToDrawDebugEnvProbes(bool value) { debugEnvProbes = value; }
|
||||
static void SetToDrawDebugEmitters(bool param) { debugEmitters = param; }
|
||||
static bool GetToDrawDebugEmitters() { return debugEmitters; }
|
||||
static void SetToDrawDebugForceFields(bool param) { debugForceFields = param; }
|
||||
static bool GetToDrawDebugForceFields() { return debugForceFields; }
|
||||
static void SetToDrawDebugCameras(bool param) { debugCameras = param; }
|
||||
static bool GetToDrawDebugCameras() { return debugCameras; }
|
||||
static bool GetToDrawGridHelper() { return gridHelper; }
|
||||
static void SetToDrawGridHelper(bool value) { gridHelper = value; }
|
||||
static bool GetToDrawVoxelHelper() { return voxelHelper; }
|
||||
static void SetToDrawVoxelHelper(bool value) { voxelHelper = value; }
|
||||
static void SetDebugLightCulling(bool enabled) { debugLightCulling = enabled; }
|
||||
static bool GetDebugLightCulling() { return debugLightCulling; }
|
||||
static void SetAdvancedLightCulling(bool enabled) { advancedLightCulling = enabled; }
|
||||
static bool GetAdvancedLightCulling() { return advancedLightCulling; }
|
||||
static void SetAlphaCompositionEnabled(bool enabled) { ALPHACOMPOSITIONENABLED = enabled; }
|
||||
static bool GetAlphaCompositionEnabled() { return ALPHACOMPOSITIONENABLED; }
|
||||
static void SetOcclusionCullingEnabled(bool enabled); // also inits query pool!
|
||||
static bool GetOcclusionCullingEnabled() { return occlusionCulling; }
|
||||
static void SetLDSSkinningEnabled(bool enabled) { ldsSkinningEnabled = enabled; }
|
||||
static bool GetLDSSkinningEnabled() { return ldsSkinningEnabled; }
|
||||
static void SetTemporalAAEnabled(bool enabled) { temporalAA = enabled; }
|
||||
static bool GetTemporalAAEnabled() { return temporalAA; }
|
||||
static void SetTemporalAADebugEnabled(bool enabled) { temporalAADEBUG = enabled; }
|
||||
static bool GetTemporalAADebugEnabled() { return temporalAADEBUG; }
|
||||
static void SetFreezeCullingCameraEnabled(bool enabled) { freezeCullingCamera = enabled; }
|
||||
static bool GetFreezeCullingCameraEnabled() { return freezeCullingCamera; }
|
||||
static void SetVoxelRadianceEnabled(bool enabled) { voxelSceneData.enabled = enabled; }
|
||||
static bool GetVoxelRadianceEnabled() { return voxelSceneData.enabled; }
|
||||
static void SetVoxelRadianceSecondaryBounceEnabled(bool enabled) { voxelSceneData.secondaryBounceEnabled = enabled; }
|
||||
static bool GetVoxelRadianceSecondaryBounceEnabled() { return voxelSceneData.secondaryBounceEnabled; }
|
||||
static void SetVoxelRadianceReflectionsEnabled(bool enabled) { voxelSceneData.reflectionsEnabled = enabled; }
|
||||
static bool GetVoxelRadianceReflectionsEnabled() { return voxelSceneData.reflectionsEnabled; }
|
||||
static void SetVoxelRadianceVoxelSize(float value) { voxelSceneData.voxelsize = value; }
|
||||
static float GetVoxelRadianceVoxelSize() { return voxelSceneData.voxelsize; }
|
||||
//static void SetVoxelRadianceResolution(int value) { voxelSceneData.res = value; }
|
||||
static int GetVoxelRadianceResolution() { return voxelSceneData.res; }
|
||||
static void SetVoxelRadianceNumCones(int value) { voxelSceneData.numCones = value; }
|
||||
static int GetVoxelRadianceNumCones() { return voxelSceneData.numCones; }
|
||||
static float GetVoxelRadianceRayStepSize() { return voxelSceneData.rayStepSize; }
|
||||
static void SetVoxelRadianceRayStepSize(float value) { voxelSceneData.rayStepSize = value; }
|
||||
static void SetSpecularAAParam(float value) { SPECULARAA = value; }
|
||||
static float GetSpecularAAParam() { return SPECULARAA; }
|
||||
static void SetAdvancedRefractionsEnabled(bool value) { advancedRefractions = value; }
|
||||
static bool GetAdvancedRefractionsEnabled(); // also needs additional driver support for now...
|
||||
static bool IsRequestedReflectionRendering() { return requestReflectionRendering; }
|
||||
static void SetEnviromentMap(wiGraphicsTypes::Texture2D* tex){ enviroMap = tex; }
|
||||
static wiGraphicsTypes::Texture2D* GetEnviromentMap(){ return enviroMap; }
|
||||
static wiGraphicsTypes::Texture2D* GetLuminance(wiGraphicsTypes::Texture2D* sourceImage, GRAPHICSTHREAD threadID);
|
||||
static const XMFLOAT4& GetWaterPlane();
|
||||
|
||||
static void ReloadShaders(const std::string& path = "");
|
||||
static void BindPersistentState(GRAPHICSTHREAD threadID);
|
||||
|
||||
inline static XMUINT3 GetEntityCullingTileCount()
|
||||
{
|
||||
return XMUINT3(
|
||||
(UINT)ceilf((float)GetInternalResolution().x / (float)TILED_CULLING_BLOCKSIZE),
|
||||
(UINT)ceilf((float)GetInternalResolution().y / (float)TILED_CULLING_BLOCKSIZE),
|
||||
1);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
static void UpdateWorldCB(GRAPHICSTHREAD threadID);
|
||||
static void UpdateFrameCB(GRAPHICSTHREAD threadID);
|
||||
static void UpdateCameraCB(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
static void SetClipPlane(const XMFLOAT4& clipPlane, GRAPHICSTHREAD threadID);
|
||||
static void SetAlphaRef(float alphaRef, GRAPHICSTHREAD threadID);
|
||||
static void ResetAlphaRef(GRAPHICSTHREAD threadID) { SetAlphaRef(0.75f, threadID); }
|
||||
static void BindGBufferTextures(wiGraphicsTypes::Texture2D* slot0, wiGraphicsTypes::Texture2D* slot1, wiGraphicsTypes::Texture2D* slot2, wiGraphicsTypes::Texture2D* slot3, wiGraphicsTypes::Texture2D* slot4, GRAPHICSTHREAD threadID);
|
||||
static void BindDepthTextures(wiGraphicsTypes::Texture2D* depth, wiGraphicsTypes::Texture2D* linearDepth, GRAPHICSTHREAD threadID);
|
||||
|
||||
static void RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culledRenderer, SHADERTYPE shaderType, UINT renderTypeFlags, GRAPHICSTHREAD threadID,
|
||||
void RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culledRenderer, SHADERTYPE shaderType, UINT renderTypeFlags, GRAPHICSTHREAD threadID,
|
||||
bool tessellation = false, bool occlusionCulling = false, uint32_t layerMask = 0xFFFFFFFF);
|
||||
static void DrawSky(GRAPHICSTHREAD threadID);
|
||||
static void DrawSun(GRAPHICSTHREAD threadID);
|
||||
static void DrawWorld(const wiSceneSystem::CameraComponent& camera, bool tessellation, GRAPHICSTHREAD threadID, SHADERTYPE shaderType, bool grass, bool occlusionCulling, uint32_t layerMask = 0xFFFFFFFF);
|
||||
static void DrawForShadowMap(GRAPHICSTHREAD threadID, uint32_t layerMask = 0xFFFFFFFF);
|
||||
static void DrawWorldTransparent(const wiSceneSystem::CameraComponent& camera, SHADERTYPE shaderType, GRAPHICSTHREAD threadID, bool grass, bool occlusionCulling, uint32_t layerMask = 0xFFFFFFFF);
|
||||
static void DrawDebugWorld(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
static void DrawSoftParticles(const wiSceneSystem::CameraComponent& camera, bool distortion, GRAPHICSTHREAD threadID);
|
||||
static void DrawTrails(GRAPHICSTHREAD threadID, wiGraphicsTypes::Texture2D* refracRes);
|
||||
static void DrawLights(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
static void DrawLightVisualizers(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
static void DrawVolumeLights(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
static void DrawLensFlares(GRAPHICSTHREAD threadID);
|
||||
static void DrawDecals(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
static void RefreshEnvProbes(GRAPHICSTHREAD threadID);
|
||||
static void VoxelRadiance(GRAPHICSTHREAD threadID);
|
||||
void DrawSky(GRAPHICSTHREAD threadID);
|
||||
void DrawSun(GRAPHICSTHREAD threadID);
|
||||
void DrawWorld(const wiSceneSystem::CameraComponent& camera, bool tessellation, GRAPHICSTHREAD threadID, SHADERTYPE shaderType, bool grass, bool occlusionCulling, uint32_t layerMask = 0xFFFFFFFF);
|
||||
void DrawForShadowMap(GRAPHICSTHREAD threadID, uint32_t layerMask = 0xFFFFFFFF);
|
||||
void DrawWorldTransparent(const wiSceneSystem::CameraComponent& camera, SHADERTYPE shaderType, GRAPHICSTHREAD threadID, bool grass, bool occlusionCulling, uint32_t layerMask = 0xFFFFFFFF);
|
||||
void DrawDebugWorld(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
void DrawSoftParticles(const wiSceneSystem::CameraComponent& camera, bool distortion, GRAPHICSTHREAD threadID);
|
||||
void DrawTrails(GRAPHICSTHREAD threadID, wiGraphicsTypes::Texture2D* refracRes);
|
||||
void DrawLights(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
void DrawLightVisualizers(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
void DrawVolumeLights(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
void DrawLensFlares(GRAPHICSTHREAD threadID);
|
||||
void DrawDecals(const wiSceneSystem::CameraComponent& camera, GRAPHICSTHREAD threadID);
|
||||
void RefreshEnvProbes(GRAPHICSTHREAD threadID);
|
||||
void VoxelRadiance(GRAPHICSTHREAD threadID);
|
||||
void ComputeTiledLightCulling(bool deferred, GRAPHICSTHREAD threadID);
|
||||
void ResolveMSAADepthBuffer(wiGraphicsTypes::Texture2D* dst, wiGraphicsTypes::Texture2D* src, GRAPHICSTHREAD threadID);
|
||||
void BuildSceneBVH(GRAPHICSTHREAD threadID);
|
||||
void DrawTracedScene(const wiSceneSystem::CameraComponent& camera, wiGraphicsTypes::Texture2D* result, GRAPHICSTHREAD threadID);
|
||||
|
||||
static void ComputeTiledLightCulling(bool deferred, GRAPHICSTHREAD threadID);
|
||||
static void ResolveMSAADepthBuffer(wiGraphicsTypes::Texture2D* dst, wiGraphicsTypes::Texture2D* src, GRAPHICSTHREAD threadID);
|
||||
void OcclusionCulling_Render(GRAPHICSTHREAD threadID);
|
||||
void OcclusionCulling_Read();
|
||||
void EndFrame();
|
||||
|
||||
static void BuildSceneBVH(GRAPHICSTHREAD threadID);
|
||||
static void DrawTracedScene(const wiSceneSystem::CameraComponent& camera, wiGraphicsTypes::Texture2D* result, GRAPHICSTHREAD threadID);
|
||||
|
||||
enum MIPGENFILTER
|
||||
{
|
||||
@@ -274,9 +123,9 @@ public:
|
||||
MIPGENFILTER_LINEAR_MAXIMUM,
|
||||
MIPGENFILTER_GAUSSIAN,
|
||||
};
|
||||
static void GenerateMipChain(wiGraphicsTypes::Texture1D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID, int arrayIndex = -1);
|
||||
static void GenerateMipChain(wiGraphicsTypes::Texture2D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID, int arrayIndex = -1);
|
||||
static void GenerateMipChain(wiGraphicsTypes::Texture3D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID, int arrayIndex = -1);
|
||||
void GenerateMipChain(wiGraphicsTypes::Texture1D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID, int arrayIndex = -1);
|
||||
void GenerateMipChain(wiGraphicsTypes::Texture2D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID, int arrayIndex = -1);
|
||||
void GenerateMipChain(wiGraphicsTypes::Texture3D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID, int arrayIndex = -1);
|
||||
|
||||
enum BORDEREXPANDSTYLE
|
||||
{
|
||||
@@ -286,27 +135,104 @@ public:
|
||||
};
|
||||
// Performs copy operation even between different texture formats
|
||||
// Can also expand border region according to desired sampler func
|
||||
static void CopyTexture2D(wiGraphicsTypes::Texture2D* dst, UINT DstMIP, UINT DstX, UINT DstY, wiGraphicsTypes::Texture2D* src, UINT SrcMIP, GRAPHICSTHREAD threadID,
|
||||
void CopyTexture2D(wiGraphicsTypes::Texture2D* dst, UINT DstMIP, UINT DstX, UINT DstY, wiGraphicsTypes::Texture2D* src, UINT SrcMIP, GRAPHICSTHREAD threadID,
|
||||
BORDEREXPANDSTYLE borderExpand = BORDEREXPAND_DISABLE);
|
||||
|
||||
// dst: Texture2D with unordered access, the output will be written to this
|
||||
// refinementCount: 0: auto select, 1: perfect noise, greater numbers: smoother clouds, slower processing
|
||||
// randomness: random seed
|
||||
static void GenerateClouds(wiGraphicsTypes::Texture2D* dst, UINT refinementCount, float randomness, GRAPHICSTHREAD threadID);
|
||||
void GenerateClouds(wiGraphicsTypes::Texture2D* dst, UINT refinementCount, float randomness, GRAPHICSTHREAD threadID);
|
||||
|
||||
static void ManageDecalAtlas(GRAPHICSTHREAD threadID);
|
||||
void ManageDecalAtlas(GRAPHICSTHREAD threadID);
|
||||
void CreateImpostor(wiECS::Entity, GRAPHICSTHREAD threadID);
|
||||
|
||||
// The scene holds all models, and world information
|
||||
static wiSceneSystem::Scene& GetScene();
|
||||
|
||||
static std::deque<wiSprite*> waterRipples;
|
||||
static void ClearWorld();
|
||||
|
||||
static wiSceneSystem::CameraComponent& GetCamera();
|
||||
static wiSceneSystem::CameraComponent& GetPrevCamera();
|
||||
static wiSceneSystem::CameraComponent& GetRefCamera();
|
||||
void PutWaterRipple(const std::string& image, const XMFLOAT3& pos);
|
||||
void ManageWaterRipples();
|
||||
void DrawWaterRipples(GRAPHICSTHREAD threadID);
|
||||
|
||||
static RAY GetPickRay(long cursorX, long cursorY);
|
||||
|
||||
|
||||
// Set any param to -1 if don't want to modify
|
||||
void SetShadowProps2D(int resolution, int count, int softShadowQuality);
|
||||
// Set any param to -1 if don't want to modify
|
||||
void SetShadowPropsCube(int resolution, int count);
|
||||
|
||||
int GetShadowRes2D();
|
||||
int GetShadowResCube();
|
||||
|
||||
|
||||
|
||||
void SetResolutionScale(float value);
|
||||
float GetResolutionScale();
|
||||
void SetTransparentShadowsEnabled(float value);
|
||||
float GetTransparentShadowsEnabled();
|
||||
XMUINT2 GetInternalResolution();
|
||||
bool ResolutionChanged();
|
||||
void SetGamma(float value);
|
||||
float GetGamma();
|
||||
void SetWireRender(bool value);
|
||||
bool IsWireRender();
|
||||
void SetToDrawDebugBoneLines(bool param);
|
||||
bool GetToDrawDebugBoneLines();
|
||||
void SetToDrawDebugPartitionTree(bool param);
|
||||
bool GetToDrawDebugPartitionTree();
|
||||
bool GetToDrawDebugEnvProbes();
|
||||
void SetToDrawDebugEnvProbes(bool value);
|
||||
void SetToDrawDebugEmitters(bool param);
|
||||
bool GetToDrawDebugEmitters();
|
||||
void SetToDrawDebugForceFields(bool param);
|
||||
bool GetToDrawDebugForceFields();
|
||||
void SetToDrawDebugCameras(bool param);
|
||||
bool GetToDrawDebugCameras();
|
||||
bool GetToDrawGridHelper();
|
||||
void SetToDrawGridHelper(bool value);
|
||||
bool GetToDrawVoxelHelper();
|
||||
void SetToDrawVoxelHelper(bool value);
|
||||
void SetDebugLightCulling(bool enabled);
|
||||
bool GetDebugLightCulling();
|
||||
void SetAdvancedLightCulling(bool enabled);
|
||||
bool GetAdvancedLightCulling();
|
||||
void SetAlphaCompositionEnabled(bool enabled);
|
||||
bool GetAlphaCompositionEnabled();
|
||||
void SetOcclusionCullingEnabled(bool enabled);
|
||||
bool GetOcclusionCullingEnabled();
|
||||
void SetLDSSkinningEnabled(bool enabled);
|
||||
bool GetLDSSkinningEnabled();
|
||||
void SetTemporalAAEnabled(bool enabled);
|
||||
bool GetTemporalAAEnabled();
|
||||
void SetTemporalAADebugEnabled(bool enabled);
|
||||
bool GetTemporalAADebugEnabled();
|
||||
void SetFreezeCullingCameraEnabled(bool enabled);
|
||||
bool GetFreezeCullingCameraEnabled();
|
||||
void SetVoxelRadianceEnabled(bool enabled);
|
||||
bool GetVoxelRadianceEnabled();
|
||||
void SetVoxelRadianceSecondaryBounceEnabled(bool enabled);
|
||||
bool GetVoxelRadianceSecondaryBounceEnabled();
|
||||
void SetVoxelRadianceReflectionsEnabled(bool enabled);
|
||||
bool GetVoxelRadianceReflectionsEnabled();
|
||||
void SetVoxelRadianceVoxelSize(float value);
|
||||
float GetVoxelRadianceVoxelSize();
|
||||
int GetVoxelRadianceResolution();
|
||||
void SetVoxelRadianceNumCones(int value);
|
||||
int GetVoxelRadianceNumCones();
|
||||
float GetVoxelRadianceRayStepSize();
|
||||
void SetVoxelRadianceRayStepSize(float value);
|
||||
void SetSpecularAAParam(float value);
|
||||
float GetSpecularAAParam();
|
||||
void SetAdvancedRefractionsEnabled(bool value);
|
||||
bool GetAdvancedRefractionsEnabled();
|
||||
bool IsRequestedReflectionRendering();
|
||||
void SetEnviromentMap(wiGraphicsTypes::Texture2D* tex);
|
||||
wiGraphicsTypes::Texture2D* GetEnviromentMap();
|
||||
wiGraphicsTypes::Texture2D* GetLuminance(wiGraphicsTypes::Texture2D* sourceImage, GRAPHICSTHREAD threadID);
|
||||
const XMFLOAT4& GetWaterPlane();
|
||||
void SetGameSpeed(float value);
|
||||
float GetGameSpeed();
|
||||
void SetOceanEnabled(bool enabled, const wiOceanParameter& params);
|
||||
wiOcean* GetOcean();
|
||||
|
||||
|
||||
RAY GetPickRay(long cursorX, long cursorY);
|
||||
|
||||
struct RayIntersectWorldResult
|
||||
{
|
||||
@@ -316,21 +242,14 @@ public:
|
||||
float distance = FLT_MAX;
|
||||
int subsetIndex = -1;
|
||||
};
|
||||
static RayIntersectWorldResult RayIntersectWorld(const RAY& ray, UINT renderTypeMask = RENDERTYPE_OPAQUE, uint32_t layerMask = ~0);
|
||||
RayIntersectWorldResult RayIntersectWorld(const RAY& ray, UINT renderTypeMask = RENDERTYPE_OPAQUE, uint32_t layerMask = ~0);
|
||||
|
||||
|
||||
static PHYSICS* physicsEngine;
|
||||
static void SynchronizeWithPhysicsEngine(float dt = 1.0f / 60.0f);
|
||||
void SynchronizeWithPhysicsEngine(float dt = 1.0f / 60.0f);
|
||||
|
||||
static wiOcean* ocean;
|
||||
static void SetOceanEnabled(bool enabled, const wiOceanParameter& params);
|
||||
static wiOcean* GetOcean() { return ocean; }
|
||||
|
||||
static void CreateImpostor(wiECS::Entity, GRAPHICSTHREAD threadID);
|
||||
|
||||
static std::vector<std::pair<XMFLOAT4X4,XMFLOAT4>> renderableBoxes;
|
||||
// Add box to render in next frame
|
||||
static void AddRenderableBox(const XMFLOAT4X4& boxMatrix, const XMFLOAT4& color = XMFLOAT4(1,1,1,1));
|
||||
void AddRenderableBox(const XMFLOAT4X4& boxMatrix, const XMFLOAT4& color = XMFLOAT4(1,1,1,1));
|
||||
|
||||
struct RenderableLine
|
||||
{
|
||||
@@ -338,10 +257,9 @@ public:
|
||||
XMFLOAT3 end = XMFLOAT3(0, 0, 0);
|
||||
XMFLOAT4 color = XMFLOAT4(1, 1, 1, 1);
|
||||
};
|
||||
static std::vector<RenderableLine> renderableLines;
|
||||
static void AddRenderableLine(const RenderableLine& line);
|
||||
void AddRenderableLine(const RenderableLine& line);
|
||||
|
||||
static void AddDeferredMIPGen(wiGraphicsTypes::Texture2D* tex);
|
||||
void AddDeferredMIPGen(wiGraphicsTypes::Texture2D* tex);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -167,15 +167,16 @@ namespace wiRenderer_BindLua
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
wiRenderer::physicsEngine->rigidBodyPhysicsEnabled = wiLua::SGetBool(L, 1);
|
||||
if (argc > 1)
|
||||
{
|
||||
wiRenderer::physicsEngine->softBodyPhysicsEnabled = wiLua::SGetBool(L, 2);
|
||||
if (argc > 2)
|
||||
{
|
||||
wiRenderer::physicsEngine->softBodyIterationCount = wiLua::SGetInt(L, 3);
|
||||
}
|
||||
}
|
||||
assert(0);
|
||||
//wiRenderer::physicsEngine->rigidBodyPhysicsEnabled = wiLua::SGetBool(L, 1);
|
||||
//if (argc > 1)
|
||||
//{
|
||||
// wiRenderer::physicsEngine->softBodyPhysicsEnabled = wiLua::SGetBool(L, 2);
|
||||
// if (argc > 2)
|
||||
// {
|
||||
// wiRenderer::physicsEngine->softBodyIterationCount = wiLua::SGetInt(L, 3);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1419,46 +1419,46 @@ namespace wiSceneSystem
|
||||
float dt
|
||||
)
|
||||
{
|
||||
PHYSICS* physicsEngine = wiRenderer::physicsEngine;
|
||||
//PHYSICS* physicsEngine = wiRenderer::physicsEngine;
|
||||
|
||||
if (physicsEngine != nullptr)
|
||||
{
|
||||
physicsEngine->Update(dt);
|
||||
//if (physicsEngine != nullptr)
|
||||
//{
|
||||
// physicsEngine->Update(dt);
|
||||
|
||||
// Rigid bodies - Objects:
|
||||
for (size_t i = 0; i < rigidbodies.GetCount(); ++i)
|
||||
{
|
||||
RigidBodyPhysicsComponent& rigidbody = rigidbodies[i];
|
||||
Entity entity = rigidbodies.GetEntity(i);
|
||||
TransformComponent& transform = *transforms.GetComponent(entity);
|
||||
// // Rigid bodies - Objects:
|
||||
// for (size_t i = 0; i < rigidbodies.GetCount(); ++i)
|
||||
// {
|
||||
// RigidBodyPhysicsComponent& rigidbody = rigidbodies[i];
|
||||
// Entity entity = rigidbodies.GetEntity(i);
|
||||
// TransformComponent& transform = *transforms.GetComponent(entity);
|
||||
|
||||
if (rigidbody.kinematic)
|
||||
{
|
||||
//physicsEngine->transformBody(transform.rotation, transform.translation, rigidbody.physicsObjectID);
|
||||
}
|
||||
else
|
||||
{
|
||||
PHYSICS::PhysicsTransform* pt = physicsEngine->getObject(rigidbody.physicsObjectID);
|
||||
transform.translation_local = pt->position;
|
||||
transform.rotation_local = pt->rotation;
|
||||
transform.SetDirty();
|
||||
}
|
||||
// if (rigidbody.kinematic)
|
||||
// {
|
||||
// //physicsEngine->transformBody(transform.rotation, transform.translation, rigidbody.physicsObjectID);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PHYSICS::PhysicsTransform* pt = physicsEngine->getObject(rigidbody.physicsObjectID);
|
||||
// transform.translation_local = pt->position;
|
||||
// transform.rotation_local = pt->rotation;
|
||||
// transform.SetDirty();
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// Soft bodies - Meshes:
|
||||
for (size_t i = 0; i < softbodies.GetCount(); ++i)
|
||||
{
|
||||
SoftBodyPhysicsComponent& softbody = softbodies[i];
|
||||
Entity entity = softbodies.GetEntity(i);
|
||||
// // Soft bodies - Meshes:
|
||||
// for (size_t i = 0; i < softbodies.GetCount(); ++i)
|
||||
// {
|
||||
// SoftBodyPhysicsComponent& softbody = softbodies[i];
|
||||
// Entity entity = softbodies.GetEntity(i);
|
||||
|
||||
MeshComponent& mesh = *meshes.GetComponent(entity);
|
||||
mesh.SetDynamic(true);
|
||||
// MeshComponent& mesh = *meshes.GetComponent(entity);
|
||||
// mesh.SetDynamic(true);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
physicsEngine->NextRunWorld();
|
||||
}
|
||||
// physicsEngine->NextRunWorld();
|
||||
//}
|
||||
|
||||
}
|
||||
void RunTransformUpdateSystem(ComponentManager<TransformComponent>& transforms)
|
||||
@@ -1805,9 +1805,9 @@ namespace wiSceneSystem
|
||||
XMVECTOR d = XMVector3Unproject(XMVectorSet(screen.x * 0.5f, screen.y * 0.5f, 1, 1), 0, 0, screen.x, screen.y, 0.0f, 1.0f, projection, view, world);
|
||||
|
||||
// Avoid shadowmap texel swimming by aligning them to a discrete grid:
|
||||
float f0 = light.shadowCam_dirLight[0].size / (float)wiRenderer::SHADOWRES_2D;
|
||||
float f1 = light.shadowCam_dirLight[1].size / (float)wiRenderer::SHADOWRES_2D;
|
||||
float f2 = light.shadowCam_dirLight[2].size / (float)wiRenderer::SHADOWRES_2D;
|
||||
float f0 = light.shadowCam_dirLight[0].size / (float)wiRenderer::GetShadowRes2D();
|
||||
float f1 = light.shadowCam_dirLight[1].size / (float)wiRenderer::GetShadowRes2D();
|
||||
float f2 = light.shadowCam_dirLight[2].size / (float)wiRenderer::GetShadowRes2D();
|
||||
XMVECTOR e0 = XMVectorFloor(XMVectorLerp(c, d, lerp0) / f0) * f0;
|
||||
XMVECTOR e1 = XMVectorFloor(XMVectorLerp(c, d, lerp1) / f1) * f1;
|
||||
XMVECTOR e2 = XMVectorFloor(XMVectorLerp(c, d, lerp2) / f2) * f2;
|
||||
|
||||
+12
-12
@@ -237,12 +237,12 @@ void wiWidget::SetScissorRect(const wiGraphicsTypes::Rect& rect)
|
||||
void wiWidget::LoadShaders()
|
||||
{
|
||||
GraphicsPSODesc desc;
|
||||
desc.vs = wiRenderer::vertexShaders[VSTYPE_LINE];
|
||||
desc.ps = wiRenderer::pixelShaders[PSTYPE_LINE];
|
||||
desc.il = wiRenderer::vertexLayouts[VLTYPE_LINE];
|
||||
desc.dss = wiRenderer::depthStencils[DSSTYPE_XRAY];
|
||||
desc.bs = wiRenderer::blendStates[BSTYPE_OPAQUE];
|
||||
desc.rs = wiRenderer::rasterizers[RSTYPE_DOUBLESIDED];
|
||||
desc.vs = wiRenderer::GetVertexShader(VSTYPE_LINE);
|
||||
desc.ps = wiRenderer::GetPixelShader(PSTYPE_LINE);
|
||||
desc.il = wiRenderer::GetVertexLayout(VLTYPE_LINE);
|
||||
desc.dss = wiRenderer::GetDepthStencilState(DSSTYPE_XRAY);
|
||||
desc.bs = wiRenderer::GetBlendState(BSTYPE_OPAQUE);
|
||||
desc.rs = wiRenderer::GetRasterizerState(RSTYPE_DOUBLESIDED);
|
||||
desc.numRTs = 1;
|
||||
desc.RTFormats[0] = wiRenderer::GetDevice()->GetBackBufferFormat();
|
||||
desc.pt = TRIANGLESTRIP;
|
||||
@@ -1768,7 +1768,7 @@ void wiColorPicker::Render(wiGUI* gui)
|
||||
|
||||
XMMATRIX __cam = wiRenderer::GetDevice()->GetScreenProjection();
|
||||
|
||||
wiRenderer::GetDevice()->BindConstantBuffer(VS, wiRenderer::constantBuffers[CBTYPE_MISC], CBSLOT_RENDERER_MISC, threadID);
|
||||
wiRenderer::GetDevice()->BindConstantBuffer(VS, wiRenderer::GetConstantBuffer(CBTYPE_MISC), CBSLOT_RENDERER_MISC, threadID);
|
||||
wiRenderer::GetDevice()->BindGraphicsPSO(PSO_colorpicker, threadID);
|
||||
|
||||
MiscCB cb;
|
||||
@@ -1787,7 +1787,7 @@ void wiColorPicker::Render(wiGUI* gui)
|
||||
__cam
|
||||
));
|
||||
cb.g_xColor = XMFLOAT4(1, 1, 1, 1);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
GPUBuffer* vbs[] = {
|
||||
&vb_saturation,
|
||||
};
|
||||
@@ -1805,7 +1805,7 @@ void wiColorPicker::Render(wiGUI* gui)
|
||||
__cam
|
||||
));
|
||||
cb.g_xColor = float4(1, 1, 1, 1);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
GPUBuffer* vbs[] = {
|
||||
&vb_hue,
|
||||
};
|
||||
@@ -1823,7 +1823,7 @@ void wiColorPicker::Render(wiGUI* gui)
|
||||
__cam
|
||||
));
|
||||
cb.g_xColor = float4(1 - hue_color.x, 1 - hue_color.y, 1 - hue_color.z, 1);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
GPUBuffer* vbs[] = {
|
||||
&vb_picker,
|
||||
};
|
||||
@@ -1841,7 +1841,7 @@ void wiColorPicker::Render(wiGUI* gui)
|
||||
__cam
|
||||
));
|
||||
cb.g_xColor = float4(1 - final_color.x, 1 - final_color.y, 1 - final_color.z, 1);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
GPUBuffer* vbs[] = {
|
||||
&vb_picker,
|
||||
};
|
||||
@@ -1859,7 +1859,7 @@ void wiColorPicker::Render(wiGUI* gui)
|
||||
__cam
|
||||
));
|
||||
cb.g_xColor = GetPickColor();
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::constantBuffers[CBTYPE_MISC], &cb, threadID);
|
||||
wiRenderer::GetDevice()->UpdateBuffer(wiRenderer::GetConstantBuffer(CBTYPE_MISC), &cb, threadID);
|
||||
GPUBuffer* vbs[] = {
|
||||
&vb_preview,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user