From fb227f5f3a0bbc9f57cdb3305aa850c387072e66 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Sat, 17 Nov 2018 21:17:23 +0000 Subject: [PATCH] many refactors and starting postprocess refactor... --- Documentation/ScriptingAPI-Documentation.md | 12 +- Editor/Editor.cpp | 16 +- Tests/Tests.cpp | 2 +- Tests/test_script.lua | 6 +- WickedEngine/MainComponent.cpp | 8 +- WickedEngine/RenderPath2D.cpp | 2 +- WickedEngine/RenderPath3D.cpp | 11 +- WickedEngine/RenderPath3D.h | 2 +- WickedEngine/RenderPath3D_Deferred.cpp | 3 +- WickedEngine/RenderPath3D_Forward.cpp | 3 +- WickedEngine/RenderPath3D_PathTracing.cpp | 5 +- WickedEngine/RenderPath3D_TiledDeferred.cpp | 3 +- WickedEngine/RenderPath3D_TiledForward.cpp | 3 +- WickedEngine/WickedEngine.h | 2 +- WickedEngine/WickedEngine_SHARED.vcxitems | 7 +- .../WickedEngine_SHARED.vcxitems.filters | 21 +- WickedEngine/raytrace_lightsamplingCS.hlsl | 4 +- WickedEngine/wiBackLog.cpp | 5 +- WickedEngine/wiEmittedParticle.h | 2 +- WickedEngine/wiEnums.h | 10 + WickedEngine/wiFont.cpp | 8 +- WickedEngine/wiFont.h | 10 +- WickedEngine/wiImage.cpp | 161 ++++++++-------- WickedEngine/wiImage.h | 174 ++++++++++++++++- WickedEngine/wiImageEffects.h | 181 ------------------ ..._BindLua.cpp => wiImageParams_BindLua.cpp} | 68 +++---- ...ects_BindLua.h => wiImageParams_BindLua.h} | 16 +- WickedEngine/wiInitializer.cpp | 3 +- WickedEngine/wiJobSystem.cpp | 4 +- WickedEngine/wiJobSystem.h | 6 +- WickedEngine/wiLua.cpp | 4 +- WickedEngine/wiPhysicsEngine_Bullet.cpp | 4 +- WickedEngine/wiPostProcess.cpp | 25 +++ WickedEngine/wiPostProcess.h | 21 ++ WickedEngine/wiProfiler.cpp | 2 +- WickedEngine/wiSceneSystem.cpp | 24 +-- WickedEngine/wiSceneSystem.h | 1 - WickedEngine/wiSprite.cpp | 5 +- WickedEngine/wiSprite.h | 3 +- WickedEngine/wiSprite_BindLua.cpp | 20 +- WickedEngine/wiSprite_BindLua.h | 4 +- WickedEngine/wiVersion.cpp | 4 +- WickedEngine/wiWidget.cpp | 50 ++--- 43 files changed, 482 insertions(+), 443 deletions(-) delete mode 100644 WickedEngine/wiImageEffects.h rename WickedEngine/{wiImageEffects_BindLua.cpp => wiImageParams_BindLua.cpp} (56%) rename WickedEngine/{wiImageEffects_BindLua.h => wiImageParams_BindLua.h} (59%) create mode 100644 WickedEngine/wiPostProcess.cpp create mode 100644 WickedEngine/wiPostProcess.h diff --git a/Documentation/ScriptingAPI-Documentation.md b/Documentation/ScriptingAPI-Documentation.md index a25688156..22437bd70 100644 --- a/Documentation/ScriptingAPI-Documentation.md +++ b/Documentation/ScriptingAPI-Documentation.md @@ -11,7 +11,7 @@ The documentation completion is still pending.... 4. Utility Tools 1. Font 2. Sprite - 1. ImageEffects + 1. ImageParams 2. SpriteAnim 3. MovingTexAnim 4. DrawRecAnim @@ -164,16 +164,16 @@ Gives you the ability to render text with a custom font. ### Sprite Render images on the screen. - [constructor]Sprite(opt string texture, opt string maskTexture, opt string normalMapTexture) -- SetEffects(ImageEffects effects) -- GetEffects() : ImageEffects result +- SetParams(ImageParams effects) +- GetParams() : ImageParams result - SetAnim(SpriteAnim anim) - GetAnim() : SpriteAnim result - Destroy() -#### ImageEffects +#### ImageParams Specify Sprite properties, like position, size, etc. -- [constructor]ImageEffects(opt float width, opt float height) -- [constructor]ImageEffects(float posX, float posY, float width, opt float height) +- [constructor]ImageParams(opt float width, opt float height) +- [constructor]ImageParams(float posX, float posY, float width, opt float height) - GetPos() : Vector result - GetSize() : Vector result - GetOpacity() : float result diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 541c62f99..f833bd0bb 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -69,7 +69,7 @@ void Editor::Initialize() void EditorLoadingScreen::Load() { - font = wiFont("Loading...", wiFontProps((int)(wiRenderer::GetDevice()->GetScreenWidth()*0.5f), (int)(wiRenderer::GetDevice()->GetScreenHeight()*0.5f), 36, + font = wiFont("Loading...", wiFontParams((int)(wiRenderer::GetDevice()->GetScreenWidth()*0.5f), (int)(wiRenderer::GetDevice()->GetScreenHeight()*0.5f), 36, WIFALIGN_CENTER, WIFALIGN_CENTER)); addFont(&font); @@ -1486,7 +1486,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; @@ -1534,7 +1534,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; @@ -1569,7 +1569,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; @@ -1604,7 +1604,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; @@ -1638,7 +1638,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; @@ -1672,7 +1672,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; @@ -1706,7 +1706,7 @@ void EditorComponent::Compose() float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f; - wiImageEffects fx; + wiImageParams fx; fx.pos = transform.GetPosition(); fx.siz = XMFLOAT2(dist, dist); fx.typeFlag = ImageType::WORLD; diff --git a/Tests/Tests.cpp b/Tests/Tests.cpp index b1b1ee496..087560994 100644 --- a/Tests/Tests.cpp +++ b/Tests/Tests.cpp @@ -223,7 +223,7 @@ void TestsRenderer::RunJobSystemTest() { std::vector dataSet(itemCount); timer.record(); - wiJobSystem::Dispatch(itemCount, 1000, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch(itemCount, 1000, [&](wiJobDispatchArgs args) { dataSet[args.jobIndex].UpdateCamera(); }); wiJobSystem::Wait(); diff --git a/Tests/test_script.lua b/Tests/test_script.lua index 7e834667f..f3127de49 100644 --- a/Tests/test_script.lua +++ b/Tests/test_script.lua @@ -13,7 +13,7 @@ ToggleCameraAnimation(); -- Load an image: local sprite = Sprite("images/HelloWorld.png"); -sprite.SetEffects(ImageEffects(100,100,100,50)); +sprite.SetParams(ImageParams(100,100,100,50)); -- Set this image as renderable to the active component: local component = main.GetActivePath(); component.AddSprite(sprite); @@ -44,7 +44,7 @@ runProcess(function() while(true) do -- Bounce our sprite across the screen: - local fx = sprite.GetEffects(); + local fx = sprite.GetParams(); local pos = fx.GetPos(); local size = fx.GetSize(); @@ -65,7 +65,7 @@ runProcess(function() pos = vector.Add(pos, velocity); fx.SetPos(pos); - sprite.SetEffects(fx); + sprite.SetParams(fx); -- Rotate teapot by parent transform: local transform = scene.Component_GetTransform(parent); diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp index 941577af9..99a6c8f6c 100644 --- a/WickedEngine/MainComponent.cpp +++ b/WickedEngine/MainComponent.cpp @@ -7,7 +7,7 @@ #include "wiBackLog.h" #include "MainComponent_BindLua.h" #include "wiVersion.h" -#include "wiImageEffects.h" +#include "wiEnums.h" #include "wiTextureHelper.h" #include "wiProfiler.h" #include "wiInitializer.h" @@ -116,7 +116,7 @@ void MainComponent::Run() // Until engine is not loaded, present initialization screen... wiRenderer::GetDevice()->PresentBegin(); wiFont::BindPersistentState(GRAPHICSTHREAD_IMMEDIATE); - wiFont(wiBackLog::getText(), wiFontProps(4, 4, infoDisplay.size)).Draw(GRAPHICSTHREAD_IMMEDIATE); + wiFont(wiBackLog::getText(), wiFontParams(4, 4, infoDisplay.size)).Draw(GRAPHICSTHREAD_IMMEDIATE); wiRenderer::GetDevice()->PresentEnd(); return; } @@ -245,7 +245,7 @@ void MainComponent::Compose() if (fadeManager.IsActive()) { // display fade rect - static wiImageEffects fx; + static wiImageParams fx; fx.siz.x = (float)wiRenderer::GetDevice()->GetScreenWidth(); fx.siz.y = (float)wiRenderer::GetDevice()->GetScreenHeight(); fx.opacity = fadeManager.opacity; @@ -290,7 +290,7 @@ void MainComponent::Compose() ss << fixed << 1.0f / deltaTime << " FPS" << endl; } ss.precision(2); - wiFont(ss.str(), wiFontProps(4, 4, infoDisplay.size, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255,255,255,255), wiColor(0,0,0,255))).Draw(GRAPHICSTHREAD_IMMEDIATE); + wiFont(ss.str(), wiFontParams(4, 4, infoDisplay.size, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255,255,255,255), wiColor(0,0,0,255))).Draw(GRAPHICSTHREAD_IMMEDIATE); } wiProfiler::DrawData(4, 120, GRAPHICSTHREAD_IMMEDIATE); diff --git a/WickedEngine/RenderPath2D.cpp b/WickedEngine/RenderPath2D.cpp index 14e424e1b..289852e0b 100644 --- a/WickedEngine/RenderPath2D.cpp +++ b/WickedEngine/RenderPath2D.cpp @@ -129,7 +129,7 @@ void RenderPath2D::Render() } void RenderPath2D::Compose() { - wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); + wiImageParams fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.presentFullScreen = true; fx.blendFlag = BLENDMODE_PREMULTIPLIED; diff --git a/WickedEngine/RenderPath3D.cpp b/WickedEngine/RenderPath3D.cpp index c915869b4..b6586851a 100644 --- a/WickedEngine/RenderPath3D.cpp +++ b/WickedEngine/RenderPath3D.cpp @@ -1,7 +1,6 @@ #include "RenderPath3D.h" #include "wiRenderer.h" #include "wiImage.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "wiTextureHelper.h" #include "wiSceneSystem.h" @@ -229,7 +228,7 @@ void RenderPath3D::Compose() if (wiRenderer::GetDebugLightCulling()) { - wiImage::Draw((Texture2D*)wiRenderer::GetTexture(TEXTYPE_2D_DEBUGUAV), wiImageEffects((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()), GRAPHICSTHREAD_IMMEDIATE); + wiImage::Draw((Texture2D*)wiRenderer::GetTexture(TEXTYPE_2D_DEBUGUAV), wiImageParams((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()), GRAPHICSTHREAD_IMMEDIATE); } RenderPath2D::Compose(); @@ -312,7 +311,7 @@ void RenderPath3D::RenderShadows(GRAPHICSTHREAD threadID) } void RenderPath3D::RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, GRAPHICSTHREAD threadID) { - wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); + wiImageParams fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); fx.hdr = true; wiRenderer::GetDevice()->EventBegin("Downsample Depth Buffer", threadID); @@ -357,7 +356,7 @@ void RenderPath3D::RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& } rtSun[1].Activate(threadID); { - wiImageEffects fxs = fx; + wiImageParams fxs = fx; fxs.blendFlag = BLENDMODE_OPAQUE; XMVECTOR sunPos = XMVector3Project(sunDirection * 100000, 0, 0, (float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y, 0.1f, 1.0f, @@ -467,7 +466,7 @@ void RenderPath3D::RenderComposition(wiRenderTarget& shadedSceneRT, wiRenderTarg } wiProfiler::BeginRange("Post Processing", wiProfiler::DOMAIN_GPU, threadID); - wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); + wiImageParams fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); fx.hdr = true; if (wiRenderer::GetTemporalAAEnabled() && !wiRenderer::GetTemporalAADebugEnabled()) @@ -647,7 +646,7 @@ void RenderPath3D::RenderComposition(wiRenderTarget& shadedSceneRT, wiRenderTarg } void RenderPath3D::RenderColorGradedComposition() { - wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); + wiImageParams fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.blendFlag = BLENDMODE_PREMULTIPLIED; fx.quality = QUALITY_BILINEAR; diff --git a/WickedEngine/RenderPath3D.h b/WickedEngine/RenderPath3D.h index beba4be69..fd1587597 100644 --- a/WickedEngine/RenderPath3D.h +++ b/WickedEngine/RenderPath3D.h @@ -7,7 +7,7 @@ class RenderPath3D : public RenderPath2D { private: - float exposure; + float exposure = 1.0f; float lightShaftQuality; float bloomDownSample; float bloomStren; diff --git a/WickedEngine/RenderPath3D_Deferred.cpp b/WickedEngine/RenderPath3D_Deferred.cpp index f3c2da605..33305c368 100644 --- a/WickedEngine/RenderPath3D_Deferred.cpp +++ b/WickedEngine/RenderPath3D_Deferred.cpp @@ -1,7 +1,6 @@ #include "RenderPath3D_Deferred.h" #include "wiRenderer.h" #include "wiImage.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "wiTextureHelper.h" #include "wiSprite.h" @@ -101,7 +100,7 @@ void RenderPath3D_Deferred::RenderScene(GRAPHICSTHREAD threadID) wiRenderer::UpdateCameraCB(wiRenderer::GetCamera(), threadID); - wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); + wiImageParams fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); GPUResource* dsv[] = { rtGBuffer.depth->GetTexture() }; wiRenderer::GetDevice()->TransitionBarrier(dsv, ARRAYSIZE(dsv), RESOURCE_STATE_DEPTH_READ, RESOURCE_STATE_DEPTH_WRITE, threadID); diff --git a/WickedEngine/RenderPath3D_Forward.cpp b/WickedEngine/RenderPath3D_Forward.cpp index 098b12441..6411fccc9 100644 --- a/WickedEngine/RenderPath3D_Forward.cpp +++ b/WickedEngine/RenderPath3D_Forward.cpp @@ -1,7 +1,6 @@ #include "RenderPath3D_Forward.h" #include "wiRenderer.h" #include "wiImage.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "wiProfiler.h" #include "wiTextureHelper.h" @@ -86,7 +85,7 @@ void RenderPath3D_Forward::RenderScene(GRAPHICSTHREAD threadID) GPUResource* dsv[] = { rtMain.depth->GetTexture() }; wiRenderer::GetDevice()->TransitionBarrier(dsv, ARRAYSIZE(dsv), RESOURCE_STATE_DEPTH_READ, RESOURCE_STATE_DEPTH_WRITE, threadID); - wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); + wiImageParams fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); rtMain.Activate(threadID, 0, 0, 0, 0); { diff --git a/WickedEngine/RenderPath3D_PathTracing.cpp b/WickedEngine/RenderPath3D_PathTracing.cpp index b57a3a41b..c7b85ed66 100644 --- a/WickedEngine/RenderPath3D_PathTracing.cpp +++ b/WickedEngine/RenderPath3D_PathTracing.cpp @@ -1,7 +1,6 @@ #include "RenderPath3D_PathTracing.h" #include "wiRenderer.h" #include "wiImage.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "wiTextureHelper.h" #include "wiSprite.h" @@ -146,7 +145,7 @@ void RenderPath3D_PathTracing::RenderScene(GRAPHICSTHREAD threadID) - wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); + wiImageParams fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.hdr = true; @@ -166,7 +165,7 @@ void RenderPath3D_PathTracing::Compose() wiRenderer::GetDevice()->EventBegin("RenderPath3D_PathTracing::Compose", GRAPHICSTHREAD_IMMEDIATE); - wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); + wiImageParams fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.blendFlag = BLENDMODE_OPAQUE; fx.quality = QUALITY_BILINEAR; fx.process.setToneMap(true); diff --git a/WickedEngine/RenderPath3D_TiledDeferred.cpp b/WickedEngine/RenderPath3D_TiledDeferred.cpp index 4c9741be4..9564bfdd9 100644 --- a/WickedEngine/RenderPath3D_TiledDeferred.cpp +++ b/WickedEngine/RenderPath3D_TiledDeferred.cpp @@ -1,7 +1,6 @@ #include "RenderPath3D_TiledDeferred.h" #include "wiRenderer.h" #include "wiImage.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "wiTextureHelper.h" #include "wiSprite.h" @@ -29,7 +28,7 @@ void RenderPath3D_TiledDeferred::RenderScene(GRAPHICSTHREAD threadID) wiRenderer::UpdateCameraCB(wiRenderer::GetCamera(), threadID); - wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); + wiImageParams fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); GPUResource* dsv[] = { rtGBuffer.depth->GetTexture() }; wiRenderer::GetDevice()->TransitionBarrier(dsv, ARRAYSIZE(dsv), RESOURCE_STATE_DEPTH_READ, RESOURCE_STATE_DEPTH_WRITE, threadID); diff --git a/WickedEngine/RenderPath3D_TiledForward.cpp b/WickedEngine/RenderPath3D_TiledForward.cpp index abb978c1e..2b0e84ea0 100644 --- a/WickedEngine/RenderPath3D_TiledForward.cpp +++ b/WickedEngine/RenderPath3D_TiledForward.cpp @@ -1,7 +1,6 @@ #include "RenderPath3D_TiledForward.h" #include "wiRenderer.h" #include "wiImage.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "wiProfiler.h" #include "wiTextureHelper.h" @@ -23,7 +22,7 @@ void RenderPath3D_TiledForward::RenderScene(GRAPHICSTHREAD threadID) GPUResource* dsv[] = { rtMain.depth->GetTexture() }; wiRenderer::GetDevice()->TransitionBarrier(dsv, ARRAYSIZE(dsv), RESOURCE_STATE_DEPTH_READ, RESOURCE_STATE_DEPTH_WRITE, threadID); - wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); + wiImageParams fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); wiProfiler::BeginRange("Z-Prepass", wiProfiler::DOMAIN_GPU, threadID); rtMain.Activate(threadID, 0, 0, 0, 0, true); // depth prepass diff --git a/WickedEngine/WickedEngine.h b/WickedEngine/WickedEngine.h index ab39a5a5a..da47d3597 100644 --- a/WickedEngine/WickedEngine.h +++ b/WickedEngine/WickedEngine.h @@ -26,7 +26,7 @@ #include "wiDepthTarget.h" #include "wiBackLog.h" #include "wiFrustum.h" -#include "wiImageEffects.h" +#include "wiPostProcess.h" #include "wiImage.h" #include "wiSprite.h" #include "wiFont.h" diff --git a/WickedEngine/WickedEngine_SHARED.vcxitems b/WickedEngine/WickedEngine_SHARED.vcxitems index 4a1ac25f8..734164ff9 100644 --- a/WickedEngine/WickedEngine_SHARED.vcxitems +++ b/WickedEngine/WickedEngine_SHARED.vcxitems @@ -334,14 +334,14 @@ - - + + @@ -672,7 +672,7 @@ - + @@ -680,6 +680,7 @@ + diff --git a/WickedEngine/WickedEngine_SHARED.vcxitems.filters b/WickedEngine/WickedEngine_SHARED.vcxitems.filters index 56ba6a706..e0719b1ac 100644 --- a/WickedEngine/WickedEngine_SHARED.vcxitems.filters +++ b/WickedEngine/WickedEngine_SHARED.vcxitems.filters @@ -186,9 +186,6 @@ ENGINE\Scripting\LuaBindings - - ENGINE\Scripting\LuaBindings - ENGINE\Scripting\LuaBindings @@ -900,9 +897,6 @@ ENGINE\Graphics - - ENGINE\Graphics - ENGINE\Helpers @@ -1149,6 +1143,12 @@ ENGINE\Helpers + + ENGINE\Graphics + + + ENGINE\Scripting\LuaBindings + @@ -1283,9 +1283,6 @@ ENGINE\Scripting\LuaBindings - - ENGINE\Scripting\LuaBindings - ENGINE\Scripting\LuaBindings @@ -1940,6 +1937,12 @@ ENGINE\System + + ENGINE\Graphics + + + ENGINE\Scripting\LuaBindings + diff --git a/WickedEngine/raytrace_lightsamplingCS.hlsl b/WickedEngine/raytrace_lightsamplingCS.hlsl index 5e96dda1a..6c5b6da24 100644 --- a/WickedEngine/raytrace_lightsamplingCS.hlsl +++ b/WickedEngine/raytrace_lightsamplingCS.hlsl @@ -192,7 +192,7 @@ void main( uint3 DTid : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex) { L = light.positionWS - P; const float dist2 = dot(L, L); - const float dist = sqrt(dist2); + dist = sqrt(dist2); [branch] if (dist < light.range) @@ -219,7 +219,7 @@ void main( uint3 DTid : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex) { L = light.positionWS - surface.P; const float dist2 = dot(L, L); - const float dist = sqrt(dist2); + dist = sqrt(dist2); [branch] if (dist < light.range) diff --git a/WickedEngine/wiBackLog.cpp b/WickedEngine/wiBackLog.cpp index 62885ce5a..71bd4f925 100644 --- a/WickedEngine/wiBackLog.cpp +++ b/WickedEngine/wiBackLog.cpp @@ -1,7 +1,6 @@ #include "wiBackLog.h" #include "wiMath.h" #include "wiResourceManager.h" -#include "wiImageEffects.h" #include "wiRenderer.h" #include "wiTextureHelper.h" #include "wiSpinLock.h" @@ -91,7 +90,7 @@ namespace wiBackLog assert(SUCCEEDED(hr)); } - wiImageEffects fx = wiImageEffects((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); + wiImageParams fx = wiImageParams((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.pos = XMFLOAT3(0, pos, 0); fx.opacity = wiMath::Lerp(1, 0, -pos / wiRenderer::GetDevice()->GetScreenHeight()); wiImage::Draw(backgroundTex, fx, GRAPHICSTHREAD_IMMEDIATE); @@ -99,7 +98,7 @@ namespace wiBackLog font.props.posX = 50; font.props.posY = (int)pos + (int)scroll; font.Draw(GRAPHICSTHREAD_IMMEDIATE); - wiFont(inputArea.str().c_str(), wiFontProps(10, wiRenderer::GetDevice()->GetScreenHeight() - 10, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_BOTTOM)).Draw(GRAPHICSTHREAD_IMMEDIATE); + wiFont(inputArea.str().c_str(), wiFontParams(10, wiRenderer::GetDevice()->GetScreenHeight() - 10, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_BOTTOM)).Draw(GRAPHICSTHREAD_IMMEDIATE); } } diff --git a/WickedEngine/wiEmittedParticle.h b/WickedEngine/wiEmittedParticle.h index 804abdf0f..d79d2f607 100644 --- a/WickedEngine/wiEmittedParticle.h +++ b/WickedEngine/wiEmittedParticle.h @@ -3,7 +3,7 @@ #include "wiGraphicsDevice.h" #include "wiIntersectables.h" #include "ShaderInterop_EmittedParticle.h" -#include "wiImageEffects.h" +#include "wiEnums.h" #include "wiSceneSystem_Decl.h" #include "wiECS.h" diff --git a/WickedEngine/wiEnums.h b/WickedEngine/wiEnums.h index ba0008db0..eca49ba86 100644 --- a/WickedEngine/wiEnums.h +++ b/WickedEngine/wiEnums.h @@ -12,6 +12,16 @@ enum GRAPHICSTHREAD GRAPHICSTHREAD_COUNT }; +// Common blendmodes used across multiple systems +enum BLENDMODE +{ + BLENDMODE_OPAQUE, + BLENDMODE_ALPHA, + BLENDMODE_PREMULTIPLIED, + BLENDMODE_ADDITIVE, + BLENDMODE_COUNT +}; + // Do not alter order or value because it is bound to lua manually! enum RENDERTYPE { diff --git a/WickedEngine/wiFont.cpp b/WickedEngine/wiFont.cpp index 17ba52bfb..babd7b8dc 100644 --- a/WickedEngine/wiFont.cpp +++ b/WickedEngine/wiFont.cpp @@ -100,7 +100,7 @@ namespace wiFont_Internal XMHALF2 Tex; }; - int WriteVertices(volatile FontVertex* vertexList, const std::wstring& text, wiFontProps props, int style) + int WriteVertices(volatile FontVertex* vertexList, const std::wstring& text, wiFontParams props, int style) { int quadCount = 0; @@ -179,11 +179,11 @@ namespace wiFont_Internal using namespace wiFont_Internal; -wiFont::wiFont(const std::string& text, wiFontProps props, int style) : props(props), style(style) +wiFont::wiFont(const std::string& text, wiFontParams props, int style) : props(props), style(style) { SetText(text); } -wiFont::wiFont(const std::wstring& text, wiFontProps props, int style) : props(props), style(style) +wiFont::wiFont(const std::wstring& text, wiFontParams props, int style) : props(props), style(style) { SetText(text); } @@ -496,7 +496,7 @@ void wiFont::Draw(GRAPHICSTHREAD threadID) return; } - wiFontProps newProps = props; + wiFontParams newProps = props; if (props.h_align == WIFALIGN_CENTER) newProps.posX -= textWidth() / 2; diff --git a/WickedEngine/wiFont.h b/WickedEngine/wiFont.h index 0430fc9d0..a77e844dc 100644 --- a/WickedEngine/wiFont.h +++ b/WickedEngine/wiFont.h @@ -16,7 +16,7 @@ enum wiFontAlign static const int WIFONTSIZE_DEFAULT = 16; -struct wiFontProps +struct wiFontParams { int posX, posY; int size = WIFONTSIZE_DEFAULT; // line height in pixels @@ -26,7 +26,7 @@ struct wiFontProps wiColor color; wiColor shadowColor; - wiFontProps(int posX = 0, int posY = 0, int size = 16, wiFontAlign h_align = WIFALIGN_LEFT, wiFontAlign v_align = WIFALIGN_TOP + wiFontParams(int posX = 0, int posY = 0, int size = 16, wiFontAlign h_align = WIFALIGN_LEFT, wiFontAlign v_align = WIFALIGN_TOP , int spacingX = 0, int spacingY = 0, const wiColor& color = wiColor(255, 255, 255, 255), const wiColor& shadowColor = wiColor(0,0,0,0)) :posX(posX), posY(posY), size(size), h_align(h_align), v_align(v_align), spacingX(spacingX), spacingY(spacingY), color(color), shadowColor(shadowColor) {} @@ -49,11 +49,11 @@ public: static int AddFontStyle(const std::string& fontName); std::wstring text; - wiFontProps props; + wiFontParams props; int style; - wiFont(const std::string& text = "", wiFontProps props = wiFontProps(), int style = 0); - wiFont(const std::wstring& text, wiFontProps props = wiFontProps(), int style = 0); + wiFont(const std::string& text = "", wiFontParams props = wiFontParams(), int style = 0); + wiFont(const std::wstring& text, wiFontParams props = wiFontParams(), int style = 0); ~wiFont(); void Draw(GRAPHICSTHREAD threadID); diff --git a/WickedEngine/wiImage.cpp b/WickedEngine/wiImage.cpp index 2cdb68b7c..1023d90f6 100644 --- a/WickedEngine/wiImage.cpp +++ b/WickedEngine/wiImage.cpp @@ -1,7 +1,6 @@ #include "wiImage.h" #include "wiResourceManager.h" #include "wiRenderer.h" -#include "wiImageEffects.h" #include "wiHelper.h" #include "SamplerMapping.h" #include "ResourceMapping.h" @@ -76,7 +75,7 @@ namespace wiImage std::atomic_bool initialized = false; - void Draw(Texture2D* texture, const wiImageEffects& effects, GRAPHICSTHREAD threadID) + void Draw(Texture2D* texture, const wiImageParams& params, GRAPHICSTHREAD threadID) { if (!initialized.load()) { @@ -90,69 +89,69 @@ namespace wiImage device->BindResource(PS, texture, TEXSLOT_ONDEMAND0, threadID); - device->BindStencilRef(effects.stencilRef, threadID); + device->BindStencilRef(params.stencilRef, threadID); - if (effects.quality == QUALITY_NEAREST) + if (params.quality == QUALITY_NEAREST) { - if (effects.sampleFlag == SAMPLEMODE_MIRROR) + if (params.sampleFlag == SAMPLEMODE_MIRROR) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_POINT_MIRROR), SSLOT_ONDEMAND0, threadID); - else if (effects.sampleFlag == SAMPLEMODE_WRAP) + else if (params.sampleFlag == SAMPLEMODE_WRAP) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_POINT_WRAP), SSLOT_ONDEMAND0, threadID); - else if (effects.sampleFlag == SAMPLEMODE_CLAMP) + else if (params.sampleFlag == SAMPLEMODE_CLAMP) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_POINT_CLAMP), SSLOT_ONDEMAND0, threadID); } - else if (effects.quality == QUALITY_BILINEAR) + else if (params.quality == QUALITY_BILINEAR) { - if (effects.sampleFlag == SAMPLEMODE_MIRROR) + if (params.sampleFlag == SAMPLEMODE_MIRROR) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_LINEAR_MIRROR), SSLOT_ONDEMAND0, threadID); - else if (effects.sampleFlag == SAMPLEMODE_WRAP) + else if (params.sampleFlag == SAMPLEMODE_WRAP) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_LINEAR_WRAP), SSLOT_ONDEMAND0, threadID); - else if (effects.sampleFlag == SAMPLEMODE_CLAMP) + else if (params.sampleFlag == SAMPLEMODE_CLAMP) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_LINEAR_CLAMP), SSLOT_ONDEMAND0, threadID); } - else if (effects.quality == QUALITY_ANISOTROPIC) + else if (params.quality == QUALITY_ANISOTROPIC) { - if (effects.sampleFlag == SAMPLEMODE_MIRROR) + if (params.sampleFlag == SAMPLEMODE_MIRROR) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_ANISO_MIRROR), SSLOT_ONDEMAND0, threadID); - else if (effects.sampleFlag == SAMPLEMODE_WRAP) + else if (params.sampleFlag == SAMPLEMODE_WRAP) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_ANISO_WRAP), SSLOT_ONDEMAND0, threadID); - else if (effects.sampleFlag == SAMPLEMODE_CLAMP) + else if (params.sampleFlag == SAMPLEMODE_CLAMP) device->BindSampler(PS, wiRenderer::GetSampler(SSLOT_ANISO_CLAMP), SSLOT_ONDEMAND0, threadID); } - if (effects.presentFullScreen) + if (params.presentFullScreen) { - device->BindGraphicsPSO(&imagePSO[IMAGE_SHADER_FULLSCREEN][effects.blendFlag][effects.stencilComp][effects.hdr], threadID); + device->BindGraphicsPSO(&imagePSO[IMAGE_SHADER_FULLSCREEN][params.blendFlag][params.stencilComp][params.hdr], threadID); device->Draw(3, 0, threadID); device->EventEnd(threadID); return; } - if (!effects.blur) // NORMAL IMAGE + if (!params.blur) // NORMAL IMAGE { ImageCB cb; - if (!effects.process.active && !effects.bloom.separate && !effects.sunPos.x && !effects.sunPos.y) { - if (effects.typeFlag == SCREEN) + if (!params.process.active && !params.bloom.separate && !params.sunPos.x && !params.sunPos.y) { + if (params.typeFlag == SCREEN) { XMStoreFloat4x4(&cb.xTransform, XMMatrixTranspose( - XMMatrixScaling(effects.scale.x*effects.siz.x, effects.scale.y*effects.siz.y, 1) - * XMMatrixRotationZ(effects.rotation) - * XMMatrixTranslation(effects.pos.x, effects.pos.y, 0) + XMMatrixScaling(params.scale.x*params.siz.x, params.scale.y*params.siz.y, 1) + * XMMatrixRotationZ(params.rotation) + * XMMatrixTranslation(params.pos.x, params.pos.y, 0) * device->GetScreenProjection() )); } - else if (effects.typeFlag == WORLD) + else if (params.typeFlag == WORLD) { XMMATRIX faceRot = XMMatrixIdentity(); - if (effects.lookAt.w) + if (params.lookAt.w) { - XMVECTOR vvv = (effects.lookAt.x == 1 && !effects.lookAt.y && !effects.lookAt.z) ? XMVectorSet(0, 1, 0, 0) : XMVectorSet(1, 0, 0, 0); + XMVECTOR vvv = (params.lookAt.x == 1 && !params.lookAt.y && !params.lookAt.z) ? XMVectorSet(0, 1, 0, 0) : XMVectorSet(1, 0, 0, 0); faceRot = XMMatrixLookAtLH(XMVectorSet(0, 0, 0, 0) - , XMLoadFloat4(&effects.lookAt) + , XMLoadFloat4(¶ms.lookAt) , XMVector3Cross( - vvv, XMLoadFloat4(&effects.lookAt) + vvv, XMLoadFloat4(¶ms.lookAt) ) ); } @@ -168,34 +167,34 @@ namespace wiImage projection.r[2] = XMVectorSetY(projection.r[2], 0); XMStoreFloat4x4(&cb.xTransform, XMMatrixTranspose( - XMMatrixScaling(effects.scale.x*effects.siz.x, -1 * effects.scale.y*effects.siz.y, 1) - *XMMatrixRotationZ(effects.rotation) + XMMatrixScaling(params.scale.x*params.siz.x, -1 * params.scale.y*params.siz.y, 1) + *XMMatrixRotationZ(params.rotation) *faceRot - *XMMatrixTranslation(effects.pos.x, effects.pos.y, effects.pos.z) + *XMMatrixTranslation(params.pos.x, params.pos.y, params.pos.z) *view * projection )); } - // todo: effects.drawRec -> texmuladd! + // todo: params.drawRec -> texmuladd! - cb.xTexMulAdd = XMFLOAT4(1, 1, effects.texOffset.x, effects.texOffset.y); - cb.xColor = effects.col; - cb.xColor.x *= 1 - effects.fade; - cb.xColor.y *= 1 - effects.fade; - cb.xColor.z *= 1 - effects.fade; - cb.xColor.w *= effects.opacity; - cb.xPivot = effects.pivot; - cb.xMirror = effects.mirror; - cb.xPivot = effects.pivot; - cb.xMipLevel = effects.mipLevel; + cb.xTexMulAdd = XMFLOAT4(1, 1, params.texOffset.x, params.texOffset.y); + cb.xColor = params.col; + cb.xColor.x *= 1 - params.fade; + cb.xColor.y *= 1 - params.fade; + cb.xColor.z *= 1 - params.fade; + cb.xColor.w *= params.opacity; + cb.xPivot = params.pivot; + cb.xMirror = params.mirror; + cb.xPivot = params.pivot; + cb.xMipLevel = params.mipLevel; device->UpdateBuffer(&constantBuffer, &cb, threadID); // Determine relevant image rendering pixel shader: IMAGE_SHADER targetShader; - bool NormalmapSeparate = effects.extractNormalMap; - bool Mask = effects.maskMap != nullptr; - bool Distort = effects.distortionMap != nullptr; + bool NormalmapSeparate = params.extractNormalMap; + bool Mask = params.maskMap != nullptr; + bool Distort = params.distortionMap != nullptr; if (NormalmapSeparate) { targetShader = IMAGE_SHADER_SEPARATENORMALMAP; @@ -223,11 +222,11 @@ namespace wiImage } } - device->BindGraphicsPSO(&imagePSO[targetShader][effects.blendFlag][effects.stencilComp][effects.hdr], threadID); + device->BindGraphicsPSO(&imagePSO[targetShader][params.blendFlag][params.stencilComp][params.hdr], threadID); fullScreenEffect = false; } - else if (abs(effects.sunPos.x + effects.sunPos.y) < FLT_EPSILON) // POSTPROCESS + else if (abs(params.sunPos.x + params.sunPos.y) < FLT_EPSILON) // POSTPROCESS { PostProcessCB prcb; @@ -235,91 +234,91 @@ namespace wiImage POSTPROCESS targetShader; - if (effects.process.outline) + if (params.process.outline) { targetShader = POSTPROCESS_OUTLINE; - prcb.xPPParams0.y = effects.process.outline ? 1.0f : 0.0f; + prcb.xPPParams0.y = params.process.outline ? 1.0f : 0.0f; device->UpdateBuffer(&processCb, &prcb, threadID); } - else if (effects.process.motionBlur) + else if (params.process.motionBlur) { targetShader = POSTPROCESS_MOTIONBLUR; - prcb.xPPParams0.x = effects.process.motionBlur ? 1.0f : 0.0f; + prcb.xPPParams0.x = params.process.motionBlur ? 1.0f : 0.0f; device->UpdateBuffer(&processCb, &prcb, threadID); } - else if (effects.process.dofStrength) + else if (params.process.dofStrength) { targetShader = POSTPROCESS_DEPTHOFFIELD; - prcb.xPPParams0.z = effects.process.dofStrength; + prcb.xPPParams0.z = params.process.dofStrength; device->UpdateBuffer(&processCb, &prcb, threadID); } - else if (effects.process.fxaa) + else if (params.process.fxaa) { targetShader = POSTPROCESS_FXAA; } - else if (effects.process.ssao) + else if (params.process.ssao) { targetShader = POSTPROCESS_SSAO; } - else if (effects.process.linDepth) + else if (params.process.linDepth) { targetShader = POSTPROCESS_LINEARDEPTH; } - else if (effects.process.colorGrade) + else if (params.process.colorGrade) { targetShader = POSTPROCESS_COLORGRADE; } - else if (effects.process.ssr) + else if (params.process.ssr) { targetShader = POSTPROCESS_SSR; } - else if (effects.process.stereogram) + else if (params.process.stereogram) { targetShader = POSTPROCESS_STEREOGRAM; } - else if (effects.process.tonemap) + else if (params.process.tonemap) { targetShader = POSTPROCESS_TONEMAP; - prcb.xPPParams0.x = effects.process.exposure; + prcb.xPPParams0.x = params.process.exposure; device->UpdateBuffer(&processCb, &prcb, threadID); } - else if (effects.process.ssss.x + effects.process.ssss.y > 0) + else if (params.process.ssss.x + params.process.ssss.y > 0) { targetShader = POSTPROCESS_SSSS; - prcb.xPPParams0.x = effects.process.ssss.x; - prcb.xPPParams0.y = effects.process.ssss.y; + prcb.xPPParams0.x = params.process.ssss.x; + prcb.xPPParams0.y = params.process.ssss.y; device->UpdateBuffer(&processCb, &prcb, threadID); } - else if (effects.bloom.separate) + else if (params.bloom.separate) { targetShader = POSTPROCESS_BLOOMSEPARATE; - prcb.xPPParams1.x = effects.bloom.separate ? 1.0f : 0.0f; - prcb.xPPParams1.y = effects.bloom.threshold; - prcb.xPPParams1.z = effects.bloom.saturation; + prcb.xPPParams1.x = params.bloom.separate ? 1.0f : 0.0f; + prcb.xPPParams1.y = params.bloom.threshold; + prcb.xPPParams1.z = params.bloom.saturation; device->UpdateBuffer(&processCb, &prcb, threadID); } - else if (effects.process.reprojectDepthBuffer) + else if (params.process.reprojectDepthBuffer) { targetShader = POSTPROCESS_REPROJECTDEPTHBUFFER; } - else if (effects.process.downsampleDepthBuffer4x) + else if (params.process.downsampleDepthBuffer4x) { targetShader = POSTPROCESS_DOWNSAMPLEDEPTHBUFFER; } - else if (effects.process.temporalAAResolve) + else if (params.process.temporalAAResolve) { targetShader = POSTPROCESS_TEMPORALAA; } - else if (effects.process.sharpen > 0) + else if (params.process.sharpen > 0) { targetShader = POSTPROCESS_SHARPEN; - prcb.xPPParams0.x = effects.process.sharpen; + prcb.xPPParams0.x = params.process.sharpen; device->UpdateBuffer(&processCb, &prcb, threadID); } else @@ -340,16 +339,16 @@ namespace wiImage prcb.xPPParams0.y = 0.25f; prcb.xPPParams0.z = 0.945f; prcb.xPPParams0.w = 0.2f; - prcb.xPPParams1.x = effects.sunPos.x; - prcb.xPPParams1.y = effects.sunPos.y; + prcb.xPPParams1.x = params.sunPos.x; + prcb.xPPParams1.y = params.sunPos.y; device->UpdateBuffer(&processCb, &prcb, threadID); device->BindGraphicsPSO(&postprocessPSO[POSTPROCESS_LIGHTSHAFT], threadID); } - device->BindResource(PS, effects.maskMap, TEXSLOT_ONDEMAND1, threadID); - device->BindResource(PS, effects.distortionMap, TEXSLOT_ONDEMAND2, threadID); - device->BindResource(PS, effects.refractionSource, TEXSLOT_ONDEMAND3, threadID); + device->BindResource(PS, params.maskMap, TEXSLOT_ONDEMAND1, threadID); + device->BindResource(PS, params.distortionMap, TEXSLOT_ONDEMAND2, threadID); + device->BindResource(PS, params.refractionSource, TEXSLOT_ONDEMAND3, threadID); } else // BLUR { @@ -357,7 +356,7 @@ namespace wiImage fullScreenEffect = true; - if (effects.blurDir == 0) + if (params.blurDir == 0) { device->BindGraphicsPSO(&postprocessPSO[POSTPROCESS_BLUR_H], threadID); prcb.xPPParams1.w = 1.0f / wiRenderer::GetInternalResolution().x; @@ -379,8 +378,8 @@ namespace wiImage prcb.xPPParams0.z = weight2 * normalization; prcb.xPPParams0.w = weight3 * normalization; prcb.xPPParams1.x = weight4 * normalization; - prcb.xPPParams1.y = effects.blur; - prcb.xPPParams1.z = effects.mipLevel; + prcb.xPPParams1.y = params.blur; + prcb.xPPParams1.z = params.mipLevel; device->UpdateBuffer(&processCb, &prcb, threadID); diff --git a/WickedEngine/wiImage.h b/WickedEngine/wiImage.h index 8e10608e6..617001151 100644 --- a/WickedEngine/wiImage.h +++ b/WickedEngine/wiImage.h @@ -1,11 +1,13 @@ #pragma once #include "CommonInclude.h" #include "wiGraphicsDevice.h" -#include "wiImageEffects.h" +#include "wiEnums.h" + +struct wiImageParams; namespace wiImage { - void Draw(wiGraphicsTypes::Texture2D* texture, const wiImageEffects& effects, GRAPHICSTHREAD threadID); + void Draw(wiGraphicsTypes::Texture2D* texture, const wiImageParams& params, GRAPHICSTHREAD threadID); void DrawDeferred(wiGraphicsTypes::Texture2D* lightmap_diffuse, wiGraphicsTypes::Texture2D* lightmap_specular, wiGraphicsTypes::Texture2D* ao, GRAPHICSTHREAD threadID, int stencilref = 0); @@ -17,3 +19,171 @@ namespace wiImage void CleanUp(); }; +enum STENCILMODE +{ + STENCILMODE_DISABLED, + STENCILMODE_GREATER, + STENCILMODE_LESS, + STENCILMODE_EQUAL, + STENCILMODE_COUNT +}; +enum SAMPLEMODE +{ + SAMPLEMODE_CLAMP, + SAMPLEMODE_WRAP, + SAMPLEMODE_MIRROR, + SAMPLEMODE_COUNT +}; +enum QUALITY +{ + QUALITY_NEAREST, + QUALITY_BILINEAR, + QUALITY_ANISOTROPIC, + QUALITY_COUNT +}; +enum ImageType +{ + SCREEN, + WORLD, +}; + +struct wiImageParams +{ + XMFLOAT3 pos; + XMFLOAT2 siz; + XMFLOAT4 col; + XMFLOAT2 scale; + XMFLOAT4 drawRec; + XMFLOAT2 texOffset; + XMFLOAT2 sunPos; + //(x,y,z) : direction, (w) :isenabled? + XMFLOAT4 lookAt; + // (0,0) : upperleft, (0.5,0.5) : center, (1,1) : bottomright + XMFLOAT2 pivot; + // mirror horizontally + bool mirror; + float blur, blurDir; + float fade; + float opacity; + float rotation; + bool extractNormalMap; + float mipLevel; + bool hdr; + UINT stencilRef; + STENCILMODE stencilComp; + + // don't set anything, just fill the whole screen + bool presentFullScreen; + + BLENDMODE blendFlag; + ImageType typeFlag; + SAMPLEMODE sampleFlag; + QUALITY quality; + + struct Bloom { + bool separate; + float threshold; + float saturation; + + void clear() { separate = false; threshold = saturation = 0; } + Bloom() { clear(); } + }; + Bloom bloom; + struct Processing { + bool active; + bool motionBlur; + bool outline; + float dofStrength; + bool fxaa; + bool ssao; + XMFLOAT2 ssss; + bool ssr; + bool linDepth; + bool colorGrade; + bool stereogram; + bool tonemap; + bool reprojectDepthBuffer; + bool downsampleDepthBuffer4x; + bool temporalAAResolve; + float sharpen; + float exposure; + + void clear() { + active = motionBlur = outline = fxaa = ssao = linDepth = colorGrade = ssr = stereogram = tonemap = reprojectDepthBuffer = downsampleDepthBuffer4x = temporalAAResolve = false; + dofStrength = sharpen = 0; ssss = XMFLOAT2(0, 0); + } + void setDOF(float value) { dofStrength = value; active = value > FLT_EPSILON; } + void setMotionBlur(bool value) { motionBlur = value; active = value; } + void setOutline(bool value) { outline = value; active = value; } + void setFXAA(bool value) { fxaa = value; active = value; } + void setSSAO(bool value) { ssao = value; active = value; } + void setLinDepth(bool value) { linDepth = value; active = value; } + void setColorGrade(bool value) { colorGrade = value; active = value; } + //direction*Properties + void setSSSS(const XMFLOAT2& value) { ssss = value; active = value.x || value.y; } + void setSSR(bool value) { ssr = value; active = value; } + void setStereogram(bool value) { stereogram = value; active = value; } + void setToneMap(bool value) { tonemap = value; active = value; } + void setExposure(float value) { exposure = value; } + void setDepthBufferReprojection(bool value) { reprojectDepthBuffer = value; active = value; } + void setDepthBufferDownsampling(bool value) { downsampleDepthBuffer4x = value; active = value; } + void setTemporalAAResolve(bool value) { temporalAAResolve = value; active = value; } + void setSharpen(float value) { sharpen = value; active = value > FLT_EPSILON; } + Processing() { clear(); } + }; + Processing process; + bool deferred; + wiGraphicsTypes::Texture2D* maskMap, *distortionMap, *refractionSource; + // Generic texture + void setMaskMap(wiGraphicsTypes::Texture2D* view) { maskMap = view; } + // The normalmap texture which should distort the refraction source + void setDistortionMap(wiGraphicsTypes::Texture2D* view) { distortionMap = view; } + // The texture which should be distorted + void setRefractionSource(wiGraphicsTypes::Texture2D* view) { refractionSource = view; } + + void init() { + pos = XMFLOAT3(0, 0, 0); + siz = XMFLOAT2(1, 1); + col = XMFLOAT4(1, 1, 1, 1); + scale = XMFLOAT2(1, 1); + drawRec = XMFLOAT4(0, 0, 0, 0); + texOffset = XMFLOAT2(0, 0); + sunPos = XMFLOAT2(0, 0); + lookAt = XMFLOAT4(0, 0, 0, 0); + pivot = XMFLOAT2(0, 0); + mirror = false; + blur = blurDir = fade = rotation = 0.0f; + opacity = 1.0f; + extractNormalMap = false; + hdr = false; + mipLevel = 0.f; + stencilRef = 0; + stencilComp = STENCILMODE_DISABLED; + presentFullScreen = false; + blendFlag = BLENDMODE_ALPHA; + typeFlag = SCREEN; + sampleFlag = SAMPLEMODE_MIRROR; + quality = QUALITY_BILINEAR; + bloom = Bloom(); + process = Processing(); + deferred = false; + maskMap = nullptr; + distortionMap = nullptr; + refractionSource = nullptr; + } + + + wiImageParams() { + init(); + } + wiImageParams(float width, float height) { + init(); + siz = XMFLOAT2(width, height); + } + wiImageParams(float posX, float posY, float width, float height) { + init(); + pos.x = posX; + pos.y = posY; + siz = XMFLOAT2(width, height); + } +}; diff --git a/WickedEngine/wiImageEffects.h b/WickedEngine/wiImageEffects.h deleted file mode 100644 index 9a06d6bf0..000000000 --- a/WickedEngine/wiImageEffects.h +++ /dev/null @@ -1,181 +0,0 @@ -#pragma once -#include "CommonInclude.h" -#include "wiGraphicsDevice.h" - -enum BLENDMODE -{ - BLENDMODE_OPAQUE, - BLENDMODE_ALPHA, - BLENDMODE_PREMULTIPLIED, - BLENDMODE_ADDITIVE, - BLENDMODE_COUNT -}; -enum STENCILMODE -{ - STENCILMODE_DISABLED, - STENCILMODE_GREATER, - STENCILMODE_LESS, - STENCILMODE_EQUAL, - STENCILMODE_COUNT -}; -enum SAMPLEMODE -{ - SAMPLEMODE_CLAMP, - SAMPLEMODE_WRAP, - SAMPLEMODE_MIRROR, - SAMPLEMODE_COUNT -}; -enum QUALITY -{ - QUALITY_NEAREST, - QUALITY_BILINEAR, - QUALITY_ANISOTROPIC, - QUALITY_COUNT -}; -enum ImageType -{ - SCREEN, - WORLD, -}; - -class wiImageEffects { -public: - XMFLOAT3 pos; - XMFLOAT2 siz; - XMFLOAT4 col; - XMFLOAT2 scale; - XMFLOAT4 drawRec; - XMFLOAT2 texOffset; - XMFLOAT2 sunPos; - //(x,y,z) : direction, (w) :isenabled? - XMFLOAT4 lookAt; - // (0,0) : upperleft, (0.5,0.5) : center, (1,1) : bottomright - XMFLOAT2 pivot; - // mirror horizontally - bool mirror; - float blur, blurDir; - float fade; - float opacity; - float rotation; - bool extractNormalMap; - float mipLevel; - bool hdr; - UINT stencilRef; - STENCILMODE stencilComp; - - // don't set anything, just fill the whole screen - bool presentFullScreen; - - BLENDMODE blendFlag; - ImageType typeFlag; - SAMPLEMODE sampleFlag; - QUALITY quality; - - struct Bloom { - bool separate; - float threshold; - float saturation; - - void clear() { separate = false; threshold = saturation = 0; } - Bloom() { clear(); } - }; - Bloom bloom; - struct Processing { - bool active; - bool motionBlur; - bool outline; - float dofStrength; - bool fxaa; - bool ssao; - XMFLOAT2 ssss; - bool ssr; - bool linDepth; - bool colorGrade; - bool stereogram; - bool tonemap; - bool reprojectDepthBuffer; - bool downsampleDepthBuffer4x; - bool temporalAAResolve; - float sharpen; - float exposure; - - void clear() { - active = motionBlur = outline = fxaa = ssao = linDepth = colorGrade = ssr = stereogram = tonemap = reprojectDepthBuffer = downsampleDepthBuffer4x = temporalAAResolve = false; - dofStrength = sharpen = 0; ssss = XMFLOAT2(0, 0); - } - void setDOF(float value) { dofStrength = value; active = value > FLT_EPSILON; } - void setMotionBlur(bool value) { motionBlur = value; active = value; } - void setOutline(bool value) { outline = value; active = value; } - void setFXAA(bool value) { fxaa = value; active = value; } - void setSSAO(bool value) { ssao = value; active = value; } - void setLinDepth(bool value) { linDepth = value; active = value; } - void setColorGrade(bool value) { colorGrade = value; active = value; } - //direction*Properties - void setSSSS(const XMFLOAT2& value) { ssss = value; active = value.x || value.y; } - void setSSR(bool value) { ssr = value; active = value; } - void setStereogram(bool value) { stereogram = value; active = value; } - void setToneMap(bool value) { tonemap = value; active = value; } - void setExposure(float value) { exposure = value; } - void setDepthBufferReprojection(bool value) { reprojectDepthBuffer = value; active = value; } - void setDepthBufferDownsampling(bool value) { downsampleDepthBuffer4x = value; active = value; } - void setTemporalAAResolve(bool value) { temporalAAResolve = value; active = value; } - void setSharpen(float value) { sharpen = value; active = value > FLT_EPSILON; } - Processing() { clear(); } - }; - Processing process; - bool deferred; - wiGraphicsTypes::Texture2D* maskMap, *distortionMap, *refractionSource; - // Generic texture - void setMaskMap(wiGraphicsTypes::Texture2D* view) { maskMap = view; } - // The normalmap texture which should distort the refraction source - void setDistortionMap(wiGraphicsTypes::Texture2D* view) { distortionMap = view; } - // The texture which should be distorted - void setRefractionSource(wiGraphicsTypes::Texture2D* view) { refractionSource = view; } - - void init() { - pos = XMFLOAT3(0, 0, 0); - siz = XMFLOAT2(1, 1); - col = XMFLOAT4(1, 1, 1, 1); - scale = XMFLOAT2(1, 1); - drawRec = XMFLOAT4(0, 0, 0, 0); - texOffset = XMFLOAT2(0, 0); - sunPos = XMFLOAT2(0, 0); - lookAt = XMFLOAT4(0, 0, 0, 0); - pivot = XMFLOAT2(0, 0); - mirror = false; - blur = blurDir = fade = rotation = 0.0f; - opacity = 1.0f; - extractNormalMap = false; - hdr = false; - mipLevel = 0.f; - stencilRef = 0; - stencilComp = STENCILMODE_DISABLED; - presentFullScreen = false; - blendFlag = BLENDMODE_ALPHA; - typeFlag = SCREEN; - sampleFlag = SAMPLEMODE_MIRROR; - quality = QUALITY_BILINEAR; - bloom = Bloom(); - process = Processing(); - deferred = false; - maskMap = nullptr; - distortionMap = nullptr; - refractionSource = nullptr; - } - - - wiImageEffects() { - init(); - } - wiImageEffects(float width, float height) { - init(); - siz = XMFLOAT2(width, height); - } - wiImageEffects(float posX, float posY, float width, float height) { - init(); - pos.x = posX; - pos.y = posY; - siz = XMFLOAT2(width, height); - } -}; - diff --git a/WickedEngine/wiImageEffects_BindLua.cpp b/WickedEngine/wiImageParams_BindLua.cpp similarity index 56% rename from WickedEngine/wiImageEffects_BindLua.cpp rename to WickedEngine/wiImageParams_BindLua.cpp index 8cb48361f..c1d6ce2c8 100644 --- a/WickedEngine/wiImageEffects_BindLua.cpp +++ b/WickedEngine/wiImageParams_BindLua.cpp @@ -1,65 +1,65 @@ -#include "wiImageEffects_BindLua.h" +#include "wiImageParams_BindLua.h" #include "Vector_BindLua.h" -const char wiImageEffects_BindLua::className[] = "ImageEffects"; +const char wiImageParams_BindLua::className[] = "ImageParams"; -Luna::FunctionType wiImageEffects_BindLua::methods[] = { - lunamethod(wiImageEffects_BindLua, GetPos), - lunamethod(wiImageEffects_BindLua, GetSize), - lunamethod(wiImageEffects_BindLua, GetOpacity), - lunamethod(wiImageEffects_BindLua, GetFade), - lunamethod(wiImageEffects_BindLua, GetRotation), - lunamethod(wiImageEffects_BindLua, GetMipLevel), +Luna::FunctionType wiImageParams_BindLua::methods[] = { + lunamethod(wiImageParams_BindLua, GetPos), + lunamethod(wiImageParams_BindLua, GetSize), + lunamethod(wiImageParams_BindLua, GetOpacity), + lunamethod(wiImageParams_BindLua, GetFade), + lunamethod(wiImageParams_BindLua, GetRotation), + lunamethod(wiImageParams_BindLua, GetMipLevel), - lunamethod(wiImageEffects_BindLua, SetPos), - lunamethod(wiImageEffects_BindLua, SetSize), - lunamethod(wiImageEffects_BindLua, SetOpacity), - lunamethod(wiImageEffects_BindLua, SetFade), - lunamethod(wiImageEffects_BindLua, SetRotation), - lunamethod(wiImageEffects_BindLua, SetMipLevel), + lunamethod(wiImageParams_BindLua, SetPos), + lunamethod(wiImageParams_BindLua, SetSize), + lunamethod(wiImageParams_BindLua, SetOpacity), + lunamethod(wiImageParams_BindLua, SetFade), + lunamethod(wiImageParams_BindLua, SetRotation), + lunamethod(wiImageParams_BindLua, SetMipLevel), { NULL, NULL } }; -Luna::PropertyType wiImageEffects_BindLua::properties[] = { +Luna::PropertyType wiImageParams_BindLua::properties[] = { { NULL, NULL } }; -wiImageEffects_BindLua::wiImageEffects_BindLua(const wiImageEffects& effects) :effects(effects) +wiImageParams_BindLua::wiImageParams_BindLua(const wiImageParams& effects) :effects(effects) { } -int wiImageEffects_BindLua::GetPos(lua_State* L) +int wiImageParams_BindLua::GetPos(lua_State* L) { Luna::push(L, new Vector_BindLua(XMLoadFloat3(&effects.pos))); return 1; } -int wiImageEffects_BindLua::GetSize(lua_State* L) +int wiImageParams_BindLua::GetSize(lua_State* L) { Luna::push(L, new Vector_BindLua(XMLoadFloat2(&effects.siz))); return 1; } -int wiImageEffects_BindLua::GetOpacity(lua_State* L) +int wiImageParams_BindLua::GetOpacity(lua_State* L) { wiLua::SSetFloat(L, effects.opacity); return 1; } -int wiImageEffects_BindLua::GetFade(lua_State* L) +int wiImageParams_BindLua::GetFade(lua_State* L) { wiLua::SSetFloat(L, effects.fade); return 1; } -int wiImageEffects_BindLua::GetRotation(lua_State* L) +int wiImageParams_BindLua::GetRotation(lua_State* L) { wiLua::SSetFloat(L, effects.rotation); return 1; } -int wiImageEffects_BindLua::GetMipLevel(lua_State* L) +int wiImageParams_BindLua::GetMipLevel(lua_State* L) { wiLua::SSetFloat(L, effects.mipLevel); return 1; } -int wiImageEffects_BindLua::SetPos(lua_State* L) +int wiImageParams_BindLua::SetPos(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -76,7 +76,7 @@ int wiImageEffects_BindLua::SetPos(lua_State* L) } return 0; } -int wiImageEffects_BindLua::SetSize(lua_State* L) +int wiImageParams_BindLua::SetSize(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -93,7 +93,7 @@ int wiImageEffects_BindLua::SetSize(lua_State* L) } return 0; } -int wiImageEffects_BindLua::SetOpacity(lua_State* L) +int wiImageParams_BindLua::SetOpacity(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -106,7 +106,7 @@ int wiImageEffects_BindLua::SetOpacity(lua_State* L) } return 0; } -int wiImageEffects_BindLua::SetFade(lua_State* L) +int wiImageParams_BindLua::SetFade(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -119,7 +119,7 @@ int wiImageEffects_BindLua::SetFade(lua_State* L) } return 0; } -int wiImageEffects_BindLua::SetRotation(lua_State* L) +int wiImageParams_BindLua::SetRotation(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -132,7 +132,7 @@ int wiImageEffects_BindLua::SetRotation(lua_State* L) } return 0; } -int wiImageEffects_BindLua::SetMipLevel(lua_State* L) +int wiImageParams_BindLua::SetMipLevel(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -146,7 +146,7 @@ int wiImageEffects_BindLua::SetMipLevel(lua_State* L) return 0; } -wiImageEffects_BindLua::wiImageEffects_BindLua(lua_State *L) +wiImageParams_BindLua::wiImageParams_BindLua(lua_State *L) { float x = 0, y = 0, w = 100, h = 100; int argc = wiLua::SGetArgCount(L); @@ -170,20 +170,20 @@ wiImageEffects_BindLua::wiImageEffects_BindLua(lua_State *L) } } } - effects = wiImageEffects(x, y, w, h); + effects = wiImageParams(x, y, w, h); } -wiImageEffects_BindLua::~wiImageEffects_BindLua() +wiImageParams_BindLua::~wiImageParams_BindLua() { } -void wiImageEffects_BindLua::Bind() +void wiImageParams_BindLua::Bind() { static bool initialized = false; if (!initialized) { initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); + Luna::Register(wiLua::GetGlobal()->GetLuaState()); } } diff --git a/WickedEngine/wiImageEffects_BindLua.h b/WickedEngine/wiImageParams_BindLua.h similarity index 59% rename from WickedEngine/wiImageEffects_BindLua.h rename to WickedEngine/wiImageParams_BindLua.h index fbf7d063f..e54497aaf 100644 --- a/WickedEngine/wiImageEffects_BindLua.h +++ b/WickedEngine/wiImageParams_BindLua.h @@ -1,20 +1,20 @@ #pragma once #include "wiLua.h" #include "wiLuna.h" -#include "wiImageEffects.h" +#include "wiImage.h" -class wiImageEffects_BindLua +class wiImageParams_BindLua { public: - wiImageEffects effects; + wiImageParams effects; static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; - wiImageEffects_BindLua(const wiImageEffects& effects); - wiImageEffects_BindLua(lua_State *L); - ~wiImageEffects_BindLua(); + wiImageParams_BindLua(const wiImageParams& effects); + wiImageParams_BindLua(lua_State *L); + ~wiImageParams_BindLua(); int GetPos(lua_State* L); int GetSize(lua_State* L); diff --git a/WickedEngine/wiInitializer.cpp b/WickedEngine/wiInitializer.cpp index c7ce5019e..61501e9b0 100644 --- a/WickedEngine/wiInitializer.cpp +++ b/WickedEngine/wiInitializer.cpp @@ -23,10 +23,11 @@ namespace wiInitializer wiJobSystem::Initialize(); - wiJobSystem::Execute([] { wiRenderer::Initialize(); wiWidget::LoadShaders(); }); wiJobSystem::Execute([] { wiFont::Initialize(); }); wiJobSystem::Execute([] { wiImage::Initialize(); }); + wiJobSystem::Execute([] { wiRenderer::Initialize(); wiWidget::LoadShaders(); }); wiJobSystem::Execute([] { wiSoundEffect::Initialize(); wiMusic::Initialize(); }); + wiJobSystem::Execute([] { wiPostProcess::Initialize(); }); wiJobSystem::Execute([] { wiTextureHelper::Initialize(); }); wiJobSystem::Execute([] { wiSceneSystem::wiHairParticle::Initialize(); }); wiJobSystem::Execute([] { wiSceneSystem::wiEmittedParticle::Initialize(); }); diff --git a/WickedEngine/wiJobSystem.cpp b/WickedEngine/wiJobSystem.cpp index 232d42f91..48ee5198a 100644 --- a/WickedEngine/wiJobSystem.cpp +++ b/WickedEngine/wiJobSystem.cpp @@ -102,7 +102,7 @@ namespace wiJobSystem wakeCondition.notify_one(); // wake one thread } - void Dispatch(uint32_t jobCount, uint32_t groupSize, const std::function& job) + void Dispatch(uint32_t jobCount, uint32_t groupSize, const std::function& job) { if (jobCount == 0 || groupSize == 0) { @@ -124,7 +124,7 @@ namespace wiJobSystem const uint32_t groupJobOffset = groupIndex * groupSize; const uint32_t groupJobEnd = min(groupJobOffset + groupSize, jobCount); - JobDispatchArgs args; + wiJobDispatchArgs args; args.groupIndex = groupIndex; // Inside the group, loop through all job indices and execute job for each index: diff --git a/WickedEngine/wiJobSystem.h b/WickedEngine/wiJobSystem.h index f92ffa858..f0a86f783 100644 --- a/WickedEngine/wiJobSystem.h +++ b/WickedEngine/wiJobSystem.h @@ -2,7 +2,7 @@ #include -struct JobDispatchArgs +struct wiJobDispatchArgs { uint32_t jobIndex; uint32_t groupIndex; @@ -20,8 +20,8 @@ namespace wiJobSystem // Divide a job onto multiple jobs and execute in parallel. // jobCount : how many jobs to generate for this task. // groupSize : how many jobs to execute per thread. Jobs inside a group execute serially. It might be worth to increase for small jobs - // func : receives a JobDispatchArgs as parameter - void Dispatch(uint32_t jobCount, uint32_t groupSize, const std::function& job); + // func : receives a wiJobDispatchArgs as parameter + void Dispatch(uint32_t jobCount, uint32_t groupSize, const std::function& job); // Check if any threads are working currently or not bool IsBusy(); diff --git a/WickedEngine/wiLua.cpp b/WickedEngine/wiLua.cpp index b1f3c43aa..ceeb4e854 100644 --- a/WickedEngine/wiLua.cpp +++ b/WickedEngine/wiLua.cpp @@ -14,7 +14,7 @@ #include "wiRenderer_BindLua.h" #include "wiSound_BindLua.h" #include "wiSprite_BindLua.h" -#include "wiImageEffects_BindLua.h" +#include "wiImageParams_BindLua.h" #include "SpriteAnim_BindLua.h" #include "wiResourceManager_BindLua.h" #include "wiSceneSystem_BindLua.h" @@ -70,7 +70,7 @@ wiLua* wiLua::GetGlobal() wiSoundEffect_BindLua::Bind(); wiMusic_BindLua::Bind(); wiSprite_BindLua::Bind(); - wiImageEffects_BindLua::Bind(); + wiImageParams_BindLua::Bind(); SpriteAnim_BindLua::Bind(); wiResourceManager_BindLua::Bind(); wiSceneSystem_BindLua::Bind(); diff --git a/WickedEngine/wiPhysicsEngine_Bullet.cpp b/WickedEngine/wiPhysicsEngine_Bullet.cpp index e24c0e04a..920974b62 100644 --- a/WickedEngine/wiPhysicsEngine_Bullet.cpp +++ b/WickedEngine/wiPhysicsEngine_Bullet.cpp @@ -318,7 +318,7 @@ namespace wiPhysicsEngine btVector3 wind = btVector3(weather.windDirection.x, weather.windDirection.y, weather.windDirection.z); // System will register rigidbodies to objects, and update physics engine state for kinematics: - wiJobSystem::Dispatch((uint32_t)rigidbodies.GetCount(), 256, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)rigidbodies.GetCount(), 256, [&](wiJobDispatchArgs args) { RigidBodyPhysicsComponent& physicscomponent = rigidbodies[args.jobIndex]; Entity entity = rigidbodies.GetEntity(args.jobIndex); @@ -368,7 +368,7 @@ namespace wiPhysicsEngine }); // System will register softbodies to meshes and update physics engine state: - wiJobSystem::Dispatch((uint32_t)softbodies.GetCount(), 1, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)softbodies.GetCount(), 1, [&](wiJobDispatchArgs args) { SoftBodyPhysicsComponent& physicscomponent = softbodies[args.jobIndex]; Entity entity = softbodies.GetEntity(args.jobIndex); diff --git a/WickedEngine/wiPostProcess.cpp b/WickedEngine/wiPostProcess.cpp new file mode 100644 index 000000000..355dc3c15 --- /dev/null +++ b/WickedEngine/wiPostProcess.cpp @@ -0,0 +1,25 @@ +#include "wiPostProcess.h" +#include "wiBackLog.h" + +namespace wiPostProcess +{ + void Initialize() + { + LoadShaders(); + + wiBackLog::post("wiPostProcess Initialized"); + } + void Cleanuo() + { + + } + void LoadShaders() + { + + } + + void Draw(GRAPHICSTHREAD threadID) + { + + } +} diff --git a/WickedEngine/wiPostProcess.h b/WickedEngine/wiPostProcess.h new file mode 100644 index 000000000..643bbe35d --- /dev/null +++ b/WickedEngine/wiPostProcess.h @@ -0,0 +1,21 @@ +#pragma once +#include "CommonInclude.h" +#include "wiEnums.h" + +// TODO: bring the post process settings here from wiImageParams! + +struct wiPostProcessParams; + +namespace wiPostProcess +{ + void Initialize(); + void Cleanup(); + void LoadShaders(); + + void Draw(const wiPostProcessParams& params, GRAPHICSTHREAD threadID); +} + +struct wiPostProcessParams +{ + +}; diff --git a/WickedEngine/wiProfiler.cpp b/WickedEngine/wiProfiler.cpp index 03cea0558..9c08f4611 100644 --- a/WickedEngine/wiProfiler.cpp +++ b/WickedEngine/wiProfiler.cpp @@ -191,7 +191,7 @@ namespace wiProfiler ss << endl; } - wiFont(ss.str(), wiFontProps(x, y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255, 255, 255, 255), wiColor(0, 0, 0, 255))).Draw(threadID); + wiFont(ss.str(), wiFontParams(x, y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255, 255, 255, 255), wiColor(0, 0, 0, 255))).Draw(threadID); } void SetEnabled(bool value) diff --git a/WickedEngine/wiSceneSystem.cpp b/WickedEngine/wiSceneSystem.cpp index 408e3097a..abffe79db 100644 --- a/WickedEngine/wiSceneSystem.cpp +++ b/WickedEngine/wiSceneSystem.cpp @@ -1341,7 +1341,7 @@ namespace wiSceneSystem ComponentManager& prev_transforms ) { - wiJobSystem::Dispatch((uint32_t)prev_transforms.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)prev_transforms.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { PreviousFrameTransformComponent& prev_transform = prev_transforms[args.jobIndex]; Entity entity = prev_transforms.GetEntity(args.jobIndex); @@ -1475,7 +1475,7 @@ namespace wiSceneSystem } void RunTransformUpdateSystem(ComponentManager& transforms) { - wiJobSystem::Dispatch((uint32_t)transforms.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)transforms.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { TransformComponent& transform = transforms[args.jobIndex]; transform.UpdateTransform(); @@ -1516,7 +1516,7 @@ namespace wiSceneSystem ComponentManager& armatures ) { - wiJobSystem::Dispatch((uint32_t)armatures.GetCount(), 1, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)armatures.GetCount(), 1, [&](wiJobDispatchArgs args) { ArmatureComponent& armature = armatures[args.jobIndex]; @@ -1543,7 +1543,7 @@ namespace wiSceneSystem } void RunMaterialUpdateSystem(ComponentManager& materials, float dt) { - wiJobSystem::Dispatch((uint32_t)materials.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)materials.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { MaterialComponent& material = materials[args.jobIndex]; @@ -1566,7 +1566,7 @@ namespace wiSceneSystem } void RunImpostorUpdateSystem(ComponentManager& impostors) { - wiJobSystem::Dispatch((uint32_t)impostors.GetCount(), 1, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)impostors.GetCount(), 1, [&](wiJobDispatchArgs args) { ImpostorComponent& impostor = impostors[args.jobIndex]; impostor.aabb = AABB(); @@ -1708,7 +1708,7 @@ namespace wiSceneSystem ComponentManager& cameras ) { - wiJobSystem::Dispatch((uint32_t)cameras.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)cameras.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { CameraComponent& camera = cameras[args.jobIndex]; Entity entity = cameras.GetEntity(args.jobIndex); @@ -1729,7 +1729,7 @@ namespace wiSceneSystem { assert(decals.GetCount() == aabb_decals.GetCount()); - wiJobSystem::Dispatch((uint32_t)decals.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)decals.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { DecalComponent& decal = decals[args.jobIndex]; Entity entity = decals.GetEntity(args.jobIndex); @@ -1767,7 +1767,7 @@ namespace wiSceneSystem { assert(probes.GetCount() == aabb_probes.GetCount()); - wiJobSystem::Dispatch((uint32_t)probes.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)probes.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { EnvironmentProbeComponent& probe = probes[args.jobIndex]; Entity entity = probes.GetEntity(args.jobIndex); @@ -1794,7 +1794,7 @@ namespace wiSceneSystem ComponentManager& forces ) { - wiJobSystem::Dispatch((uint32_t)forces.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)forces.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { ForceFieldComponent& force = forces[args.jobIndex]; Entity entity = forces.GetEntity(args.jobIndex); @@ -1811,7 +1811,7 @@ namespace wiSceneSystem { assert(lights.GetCount() == aabb_lights.GetCount()); - wiJobSystem::Dispatch((uint32_t)lights.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)lights.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { LightComponent& light = lights[args.jobIndex]; Entity entity = lights.GetEntity(args.jobIndex); @@ -1858,13 +1858,13 @@ namespace wiSceneSystem float dt ) { - wiJobSystem::Dispatch((uint32_t)emitters.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)emitters.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { wiEmittedParticle& emitter = emitters[args.jobIndex]; emitter.Update(dt); }); - wiJobSystem::Dispatch((uint32_t)hairs.GetCount(), small_subtask_groupsize, [&](JobDispatchArgs args) { + wiJobSystem::Dispatch((uint32_t)hairs.GetCount(), small_subtask_groupsize, [&](wiJobDispatchArgs args) { wiHairParticle& hair = hairs[args.jobIndex]; Entity entity = hairs.GetEntity(args.jobIndex); diff --git a/WickedEngine/wiSceneSystem.h b/WickedEngine/wiSceneSystem.h index 4823ce6a7..8e3bb3094 100644 --- a/WickedEngine/wiSceneSystem.h +++ b/WickedEngine/wiSceneSystem.h @@ -1,7 +1,6 @@ #pragma once #include "CommonInclude.h" #include "wiEnums.h" -#include "wiImageEffects.h" #include "wiIntersectables.h" #include "wiFrustum.h" #include "wiRenderTarget.h" diff --git a/WickedEngine/wiSprite.cpp b/WickedEngine/wiSprite.cpp index cdc06be35..506b4a621 100644 --- a/WickedEngine/wiSprite.cpp +++ b/WickedEngine/wiSprite.cpp @@ -1,6 +1,5 @@ #include "wiSprite.h" #include "wiResourceManager.h" -#include "wiImageEffects.h" #include "wiImage.h" #include "wiRenderer.h" @@ -36,7 +35,7 @@ void wiSprite::Init(){ normal=""; name=""; texturePointer=maskPointer=normalPointer=nullptr; - effects=wiImageEffects(); + effects=wiImageParams(); anim=Anim(); } void wiSprite::CreateReference(const std::string& newTexture, const std::string& newMask, const std::string& newNormal){ @@ -74,7 +73,7 @@ void wiSprite::DrawNormal(GRAPHICSTHREAD threadID){ if(normalPointer && effects.opacity>0 && ((effects.blendFlag==BLENDMODE_ADDITIVE && effects.fade<1) || effects.blendFlag!=BLENDMODE_ADDITIVE)){ //effects.setRefractionMap(refracRes); - wiImageEffects effectsMod(effects); + wiImageParams effectsMod(effects); effectsMod.blendFlag=BLENDMODE_ADDITIVE; effectsMod.extractNormalMap=true; wiImage::Draw(normalPointer,effectsMod,threadID); diff --git a/WickedEngine/wiSprite.h b/WickedEngine/wiSprite.h index 43407ce06..7c2221aad 100644 --- a/WickedEngine/wiSprite.h +++ b/WickedEngine/wiSprite.h @@ -1,6 +1,5 @@ #pragma once #include "wiImage.h" -#include "wiImageEffects.h" #include "wiGraphicsDevice.h" class wiResourceManager; @@ -28,7 +27,7 @@ public: std::string name; - wiImageEffects effects; + wiImageParams effects; struct Anim{ struct MovingTexData{ diff --git a/WickedEngine/wiSprite_BindLua.cpp b/WickedEngine/wiSprite_BindLua.cpp index 440d17ddd..61cbf668e 100644 --- a/WickedEngine/wiSprite_BindLua.cpp +++ b/WickedEngine/wiSprite_BindLua.cpp @@ -1,5 +1,5 @@ #include "wiSprite_BindLua.h" -#include "wiImageEffects_BindLua.h" +#include "wiImageParams_BindLua.h" #include "SpriteAnim_BindLua.h" using namespace std; @@ -7,8 +7,8 @@ using namespace std; const char wiSprite_BindLua::className[] = "Sprite"; Luna::FunctionType wiSprite_BindLua::methods[] = { - lunamethod(wiSprite_BindLua, SetEffects), - lunamethod(wiSprite_BindLua, GetEffects), + lunamethod(wiSprite_BindLua, SetParams), + lunamethod(wiSprite_BindLua, GetParams), lunamethod(wiSprite_BindLua, SetAnim), lunamethod(wiSprite_BindLua, GetAnim), @@ -47,17 +47,17 @@ wiSprite_BindLua::~wiSprite_BindLua() { } -int wiSprite_BindLua::SetEffects(lua_State *L) +int wiSprite_BindLua::SetParams(lua_State *L) { if (sprite == nullptr) { - wiLua::SError(L, "GetEffects() sprite is null!"); + wiLua::SError(L, "GetParams() sprite is null!"); return 0; } int argc = wiLua::SGetArgCount(L); if (argc > 0) { - wiImageEffects_BindLua* effects = Luna::check(L, 1); + wiImageParams_BindLua* effects = Luna::check(L, 1); if (effects != nullptr) { sprite->effects = effects->effects; @@ -65,18 +65,18 @@ int wiSprite_BindLua::SetEffects(lua_State *L) } else { - wiLua::SError(L, "SetEffects(ImageEffects effects) not enough arguments!"); + wiLua::SError(L, "SetParams(ImageEffects effects) not enough arguments!"); } return 0; } -int wiSprite_BindLua::GetEffects(lua_State *L) +int wiSprite_BindLua::GetParams(lua_State *L) { if (sprite == nullptr) { - wiLua::SError(L, "GetEffects() sprite is null!"); + wiLua::SError(L, "GetParams() sprite is null!"); return 0; } - Luna::push(L, new wiImageEffects_BindLua(sprite->effects)); + Luna::push(L, new wiImageParams_BindLua(sprite->effects)); return 1; } int wiSprite_BindLua::SetAnim(lua_State *L) diff --git a/WickedEngine/wiSprite_BindLua.h b/WickedEngine/wiSprite_BindLua.h index 45ddb206d..c2cf944fd 100644 --- a/WickedEngine/wiSprite_BindLua.h +++ b/WickedEngine/wiSprite_BindLua.h @@ -16,8 +16,8 @@ public: wiSprite_BindLua(lua_State *L); ~wiSprite_BindLua(); - int SetEffects(lua_State *L); - int GetEffects(lua_State *L); + int SetParams(lua_State *L); + int GetParams(lua_State *L); int SetAnim(lua_State *L); int GetAnim(lua_State *L); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index a40595789..7fcedd907 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -7,9 +7,9 @@ namespace wiVersion // main engine core const int major = 0; // minor features, major updates - const int minor = 22; + const int minor = 23; // minor bug fixes, alterations, refactors, updates - const int revision = 21; + const int revision = 0; long GetVersion() diff --git a/WickedEngine/wiWidget.cpp b/WickedEngine/wiWidget.cpp index 4da66ab33..9a69898b3 100644 --- a/WickedEngine/wiWidget.cpp +++ b/WickedEngine/wiWidget.cpp @@ -103,7 +103,7 @@ void wiWidget::RenderTooltip(wiGUI* gui) { tooltipPos.y += 40; } - wiFontProps fontProps = wiFontProps((int)tooltipPos.x, (int)tooltipPos.y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP); + wiFontParams fontProps = wiFontParams((int)tooltipPos.x, (int)tooltipPos.y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP); fontProps.color = wiColor(25, 25, 25, 255); wiFont tooltipFont = wiFont(tooltip, fontProps); if (!scriptTip.empty()) @@ -121,7 +121,7 @@ void wiWidget::RenderTooltip(wiGUI* gui) static const float _border = 2; float fontWidth = (float)tooltipFont.textWidth() + _border * 2; float fontHeight = (float)tooltipFont.textHeight() + _border * 2; - wiImage::Draw(wiTextureHelper::getColor(wiColor(255, 234, 165)), wiImageEffects(tooltipPos.x - _border, tooltipPos.y - _border, fontWidth, fontHeight), gui->GetGraphicsThread()); + wiImage::Draw(wiTextureHelper::getColor(wiColor(255, 234, 165)), wiImageParams(tooltipPos.x - _border, tooltipPos.y - _border, fontWidth, fontHeight), gui->GetGraphicsThread()); tooltipFont.SetText(tooltip); tooltipFont.Draw(gui->GetGraphicsThread()); if (!scriptTip.empty()) @@ -389,7 +389,7 @@ void wiButton::Render(wiGUI* gui) gui->ResetScissor(); wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); + , wiImageParams(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); @@ -398,7 +398,7 @@ void wiButton::Render(wiGUI* gui) scissorRect.right = (LONG)(translation.x + scale.x); scissorRect.top = (LONG)(translation.y); wiRenderer::GetDevice()->BindScissorRects(1, &scissorRect, gui->GetGraphicsThread()); - wiFont(text, wiFontProps((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, + wiFont(text, wiFontParams((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); } @@ -460,7 +460,7 @@ void wiLabel::Render(wiGUI* gui) gui->ResetScissor(); wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); + , wiImageParams(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); scissorRect.bottom = (LONG)(translation.y + scale.y); @@ -468,7 +468,7 @@ void wiLabel::Render(wiGUI* gui) scissorRect.right = (LONG)(translation.x + scale.x); scissorRect.top = (LONG)(translation.y); wiRenderer::GetDevice()->BindScissorRects(1, &scissorRect, gui->GetGraphicsThread()); - wiFont(text, wiFontProps((int)translation.x + 2, (int)translation.y + 2, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, + wiFont(text, wiFontParams((int)translation.x + 2, (int)translation.y + 2, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); } @@ -616,7 +616,7 @@ void wiTextInputField::Render(wiGUI* gui) gui->ResetScissor(); wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); + , wiImageParams(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); @@ -635,7 +635,7 @@ void wiTextInputField::Render(wiGUI* gui) { activeText = value; } - wiFont(activeText, wiFontProps((int)(translation.x + 2), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_CENTER, 0, 0, + wiFont(activeText, wiFontParams((int)(translation.x + 2), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); } @@ -811,24 +811,24 @@ void wiSlider::Render(wiGUI* gui) // trail wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x - headWidth * 0.5f, translation.y + scale.y * 0.5f - scale.y*0.1f, scale.x + headWidth, scale.y * 0.2f), gui->GetGraphicsThread()); + , wiImageParams(translation.x - headWidth * 0.5f, translation.y + scale.y * 0.5f - scale.y*0.1f, scale.x + headWidth, scale.y * 0.2f), gui->GetGraphicsThread()); // head float headPosX = wiMath::Lerp(translation.x, translation.x + scale.x, wiMath::Clamp(wiMath::InverseLerp(start, end, value), 0, 1)); wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(headPosX - headWidth * 0.5f, translation.y, headWidth, scale.y), gui->GetGraphicsThread()); + , wiImageParams(headPosX - headWidth * 0.5f, translation.y, headWidth, scale.y), gui->GetGraphicsThread()); if (parent != gui) { wiRenderer::GetDevice()->BindScissorRects(1, &scissorRect, gui->GetGraphicsThread()); } // text - wiFont(text, wiFontProps((int)(translation.x - headWidth * 0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_RIGHT, WIFALIGN_CENTER, 0, 0, + wiFont(text, wiFontParams((int)(translation.x - headWidth * 0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_RIGHT, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); //// value //stringstream ss(""); //ss << value; - //wiFont(ss.str(), wiFontProps((int)(translation.x + scale.x + headWidth), (int)(translation.y + scale.y*0.5f), -1, WIFALIGN_LEFT, WIFALIGN_CENTER, 0, 0, + //wiFont(ss.str(), wiFontParams((int)(translation.x + scale.x + headWidth), (int)(translation.y + scale.y*0.5f), -1, WIFALIGN_LEFT, WIFALIGN_CENTER, 0, 0, // textColor, textShadowColor )).Draw(gui->GetGraphicsThread(), parent != nullptr); @@ -944,13 +944,13 @@ void wiCheckBox::Render(wiGUI* gui) // control wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); + , wiImageParams(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); // check if (GetCheck()) { wiImage::Draw(wiTextureHelper::getColor(wiColor::lerp(color, wiColor::White(), 0.8f)) - , wiImageEffects(translation.x + scale.x*0.25f, translation.y + scale.y*0.25f, scale.x*0.5f, scale.y*0.5f) + , wiImageParams(translation.x + scale.x*0.25f, translation.y + scale.y*0.25f, scale.x*0.5f, scale.y*0.5f) , gui->GetGraphicsThread()); } @@ -958,7 +958,7 @@ void wiCheckBox::Render(wiGUI* gui) { wiRenderer::GetDevice()->BindScissorRects(1, &scissorRect, gui->GetGraphicsThread()); } - wiFont(text, wiFontProps((int)(translation.x), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_RIGHT, WIFALIGN_CENTER, 0, 0, + wiFont(text, wiFontParams((int)(translation.x), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_RIGHT, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); } @@ -1134,11 +1134,11 @@ void wiComboBox::Render(wiGUI* gui) // control-base wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); + , wiImageParams(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); // control-arrow wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x + scale.x + 1, translation.y, scale.y, scale.y), gui->GetGraphicsThread()); - wiFont("V", wiFontProps((int)(translation.x + scale.x + scale.y*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, + , wiImageParams(translation.x + scale.x + 1, translation.y, scale.y, scale.y), gui->GetGraphicsThread()); + wiFont("V", wiFontParams((int)(translation.x + scale.x + scale.y*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); @@ -1146,12 +1146,12 @@ void wiComboBox::Render(wiGUI* gui) { wiRenderer::GetDevice()->BindScissorRects(1, &scissorRect, gui->GetGraphicsThread()); } - wiFont(text, wiFontProps((int)(translation.x), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_RIGHT, WIFALIGN_CENTER, 0, 0, + wiFont(text, wiFontParams((int)(translation.x), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_RIGHT, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); if (selected >= 0) { - wiFont(items[selected], wiFontProps((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, + wiFont(items[selected], wiFontParams((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); } @@ -1183,8 +1183,8 @@ void wiComboBox::Render(wiGUI* gui) } } wiImage::Draw(wiTextureHelper::getColor(col) - , wiImageEffects(translation.x, translation.y + _GetItemOffset(i), scale.x, scale.y), gui->GetGraphicsThread()); - wiFont(x, wiFontProps((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f + _GetItemOffset(i)), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, + , wiImageParams(translation.x, translation.y + _GetItemOffset(i), scale.x, scale.y), gui->GetGraphicsThread()); + wiFont(x, wiFontParams((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f + _GetItemOffset(i)), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); i++; } @@ -1456,7 +1456,7 @@ void wiWindow::Render(wiGUI* gui) if (!IsMinimized()) { wiImage::Draw(wiTextureHelper::getColor(color) - , wiImageEffects(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); + , wiImageParams(translation.x, translation.y, scale.x, scale.y), gui->GetGraphicsThread()); } for (auto& x : childrenWidgets) @@ -1473,7 +1473,7 @@ void wiWindow::Render(wiGUI* gui) scissorRect.right = (LONG)(translation.x + scale.x); scissorRect.top = (LONG)(translation.y); wiRenderer::GetDevice()->BindScissorRects(1, &scissorRect, gui->GetGraphicsThread()); - wiFont(text, wiFontProps((int)(translation.x + resizeDragger_UpperLeft->scale.x + 2), (int)(translation.y), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, + wiFont(text, wiFontParams((int)(translation.x + resizeDragger_UpperLeft->scale.x + 2), (int)(translation.y), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, textColor, textShadowColor)).Draw(gui->GetGraphicsThread()); } @@ -1893,7 +1893,7 @@ void wiColorPicker::Render(wiGUI* gui) _rgb << "R: " << (int)(final_color.x * 255) << endl; _rgb << "G: " << (int)(final_color.y * 255) << endl; _rgb << "B: " << (int)(final_color.z * 255) << endl; - wiFont(_rgb.str(), wiFontProps((int)(translation.x + 200), (int)(translation.y + 200), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, + wiFont(_rgb.str(), wiFontParams((int)(translation.x + 200), (int)(translation.y + 200), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, textColor, textShadowColor)).Draw(threadID); }