From be2595e4f38f7d5bf65c70d9d0ebf279a6d6f52b Mon Sep 17 00:00:00 2001 From: Turanszki Janos Date: Sat, 3 Nov 2018 13:48:29 +0000 Subject: [PATCH] refactored high level systems; added some documentation --- Documentation/ScriptingAPI-Documentation.md | 58 +-- Documentation/WickedEngine-Documentation.md | 80 +++- Editor/Editor.cpp | 16 +- Editor/Editor.h | 6 +- Editor/PostprocessWindow.cpp | 32 +- Editor/PostprocessWindow.h | 6 +- Editor/RendererWindow.cpp | 14 +- Editor/RendererWindow.h | 2 +- Editor/startup.lua | 74 --- README.md | 4 +- Tests/Tests.cpp | 2 +- Tests/Tests.h | 2 +- Tests/test_script.lua | 2 +- WickedEngine/DeferredRenderableComponent.h | 27 -- .../DeferredRenderableComponent_BindLua.cpp | 91 ---- .../DeferredRenderableComponent_BindLua.h | 19 - WickedEngine/ForwardRenderableComponent.h | 26 - .../ForwardRenderableComponent_BindLua.cpp | 91 ---- .../ForwardRenderableComponent_BindLua.h | 20 - WickedEngine/LoadingScreen.cpp | 117 +++++ ...adingScreenComponent.h => LoadingScreen.h} | 12 +- WickedEngine/LoadingScreenComponent.cpp | 117 ----- .../LoadingScreenComponent_BindLua.cpp | 103 ---- WickedEngine/LoadingScreenComponent_BindLua.h | 23 - WickedEngine/LoadingScreen_BindLua.cpp | 103 ++++ WickedEngine/LoadingScreen_BindLua.h | 23 + WickedEngine/MainComponent.cpp | 20 +- WickedEngine/MainComponent.h | 16 +- WickedEngine/MainComponent_BindLua.cpp | 96 ++-- WickedEngine/MainComponent_BindLua.h | 4 +- WickedEngine/PathTracingRenderableComponent.h | 32 -- ...RenderableComponent.cpp => RenderPath.cpp} | 8 +- .../{RenderableComponent.h => RenderPath.h} | 6 +- ...erable2DComponent.cpp => RenderPath2D.cpp} | 70 +-- ...Renderable2DComponent.h => RenderPath2D.h} | 10 +- ...t_BindLua.cpp => RenderPath2D_BindLua.cpp} | 152 +++--- ...onent_BindLua.h => RenderPath2D_BindLua.h} | 16 +- ...erable3DComponent.cpp => RenderPath3D.cpp} | 78 +-- ...Renderable3DComponent.h => RenderPath3D.h} | 22 +- WickedEngine/RenderPath3D_BindLua.cpp | 444 ++++++++++++++++++ ...onent_BindLua.h => RenderPath3D_BindLua.h} | 16 +- ...omponent.cpp => RenderPath3D_Deferred.cpp} | 36 +- WickedEngine/RenderPath3D_Deferred.h | 27 ++ .../RenderPath3D_Deferred_BindLua.cpp | 91 ++++ WickedEngine/RenderPath3D_Deferred_BindLua.h | 19 + ...Component.cpp => RenderPath3D_Forward.cpp} | 34 +- WickedEngine/RenderPath3D_Forward.h | 26 + WickedEngine/RenderPath3D_Forward_BindLua.cpp | 91 ++++ WickedEngine/RenderPath3D_Forward_BindLua.h | 20 + ...onent.cpp => RenderPath3D_PathTracing.cpp} | 46 +- WickedEngine/RenderPath3D_PathTracing.h | 32 ++ ...ent.cpp => RenderPath3D_TiledDeferred.cpp} | 12 +- WickedEngine/RenderPath3D_TiledDeferred.h | 14 + .../RenderPath3D_TiledDeferred_BindLua.cpp | 91 ++++ .../RenderPath3D_TiledDeferred_BindLua.h | 20 + ...nent.cpp => RenderPath3D_TiledForward.cpp} | 12 +- WickedEngine/RenderPath3D_TiledForward.h | 14 + .../RenderPath3D_TiledForward_BindLua.cpp | 91 ++++ .../RenderPath3D_TiledForward_BindLua.h | 20 + ...ent_BindLua.cpp => RenderPath_BindLua.cpp} | 76 +-- ...mponent_BindLua.h => RenderPath_BindLua.h} | 16 +- .../Renderable3DComponent_BindLua.cpp | 444 ------------------ WickedEngine/ResourceMapping.h | 2 +- .../TiledDeferredRenderableComponent.h | 14 - ...ledDeferredRenderableComponent_BindLua.cpp | 91 ---- ...TiledDeferredRenderableComponent_BindLua.h | 20 - .../TiledForwardRenderableComponent.h | 14 - ...iledForwardRenderableComponent_BindLua.cpp | 91 ---- .../TiledForwardRenderableComponent_BindLua.h | 20 - WickedEngine/WickedEngine.h | 18 +- WickedEngine/WickedEngine_SHARED.vcxitems | 68 +-- .../WickedEngine_SHARED.vcxitems.filters | 214 ++++----- WickedEngine/objectHF.hlsli | 2 +- WickedEngine/wiBackLog.cpp | 3 +- WickedEngine/wiLua.cpp | 32 +- WickedEngine/wiVersion.cpp | 4 +- 76 files changed, 1942 insertions(+), 1943 deletions(-) delete mode 100644 WickedEngine/DeferredRenderableComponent.h delete mode 100644 WickedEngine/DeferredRenderableComponent_BindLua.cpp delete mode 100644 WickedEngine/DeferredRenderableComponent_BindLua.h delete mode 100644 WickedEngine/ForwardRenderableComponent.h delete mode 100644 WickedEngine/ForwardRenderableComponent_BindLua.cpp delete mode 100644 WickedEngine/ForwardRenderableComponent_BindLua.h create mode 100644 WickedEngine/LoadingScreen.cpp rename WickedEngine/{LoadingScreenComponent.h => LoadingScreen.h} (84%) delete mode 100644 WickedEngine/LoadingScreenComponent.cpp delete mode 100644 WickedEngine/LoadingScreenComponent_BindLua.cpp delete mode 100644 WickedEngine/LoadingScreenComponent_BindLua.h create mode 100644 WickedEngine/LoadingScreen_BindLua.cpp create mode 100644 WickedEngine/LoadingScreen_BindLua.h delete mode 100644 WickedEngine/PathTracingRenderableComponent.h rename WickedEngine/{RenderableComponent.cpp => RenderPath.cpp} (54%) rename WickedEngine/{RenderableComponent.h => RenderPath.h} (92%) rename WickedEngine/{Renderable2DComponent.cpp => RenderPath2D.cpp} (75%) rename WickedEngine/{Renderable2DComponent.h => RenderPath2D.h} (91%) rename WickedEngine/{Renderable2DComponent_BindLua.cpp => RenderPath2D_BindLua.cpp} (58%) rename WickedEngine/{Renderable2DComponent_BindLua.h => RenderPath2D_BindLua.h} (54%) rename WickedEngine/{Renderable3DComponent.cpp => RenderPath3D.cpp} (91%) rename WickedEngine/{Renderable3DComponent.h => RenderPath3D.h} (94%) create mode 100644 WickedEngine/RenderPath3D_BindLua.cpp rename WickedEngine/{Renderable3DComponent_BindLua.h => RenderPath3D_BindLua.h} (71%) rename WickedEngine/{DeferredRenderableComponent.cpp => RenderPath3D_Deferred.cpp} (89%) create mode 100644 WickedEngine/RenderPath3D_Deferred.h create mode 100644 WickedEngine/RenderPath3D_Deferred_BindLua.cpp create mode 100644 WickedEngine/RenderPath3D_Deferred_BindLua.h rename WickedEngine/{ForwardRenderableComponent.cpp => RenderPath3D_Forward.cpp} (87%) create mode 100644 WickedEngine/RenderPath3D_Forward.h create mode 100644 WickedEngine/RenderPath3D_Forward_BindLua.cpp create mode 100644 WickedEngine/RenderPath3D_Forward_BindLua.h rename WickedEngine/{PathTracingRenderableComponent.cpp => RenderPath3D_PathTracing.cpp} (74%) create mode 100644 WickedEngine/RenderPath3D_PathTracing.h rename WickedEngine/{TiledDeferredRenderableComponent.cpp => RenderPath3D_TiledDeferred.cpp} (94%) create mode 100644 WickedEngine/RenderPath3D_TiledDeferred.h create mode 100644 WickedEngine/RenderPath3D_TiledDeferred_BindLua.cpp create mode 100644 WickedEngine/RenderPath3D_TiledDeferred_BindLua.h rename WickedEngine/{TiledForwardRenderableComponent.cpp => RenderPath3D_TiledForward.cpp} (92%) create mode 100644 WickedEngine/RenderPath3D_TiledForward.h create mode 100644 WickedEngine/RenderPath3D_TiledForward_BindLua.cpp create mode 100644 WickedEngine/RenderPath3D_TiledForward_BindLua.h rename WickedEngine/{RenderableComponent_BindLua.cpp => RenderPath_BindLua.cpp} (55%) rename WickedEngine/{RenderableComponent_BindLua.h => RenderPath_BindLua.h} (62%) delete mode 100644 WickedEngine/Renderable3DComponent_BindLua.cpp delete mode 100644 WickedEngine/TiledDeferredRenderableComponent.h delete mode 100644 WickedEngine/TiledDeferredRenderableComponent_BindLua.cpp delete mode 100644 WickedEngine/TiledDeferredRenderableComponent_BindLua.h delete mode 100644 WickedEngine/TiledForwardRenderableComponent.h delete mode 100644 WickedEngine/TiledForwardRenderableComponent_BindLua.cpp delete mode 100644 WickedEngine/TiledForwardRenderableComponent_BindLua.h diff --git a/Documentation/ScriptingAPI-Documentation.md b/Documentation/ScriptingAPI-Documentation.md index 1f93b418f..8f23d3bd2 100644 --- a/Documentation/ScriptingAPI-Documentation.md +++ b/Documentation/ScriptingAPI-Documentation.md @@ -24,12 +24,12 @@ The documentation completion is still pending.... 7. Scene TODO 8. MainComponent - 9. RenderableComponent - 1. Renderable2DComponent - 2. Renderable3DComponent - 1. ForwardRenderableComponent - 2. DeferredRenderableComponent - 4. LoadingScreenComponent + 9. RenderPath + 1. RenderPath2D + 2. RenderPath3D + 1. RenderPath3D_Forward + 2. RenderPath3D_Deferred + 4. LoadingScreen 10. Network 1. Server 2. Client @@ -310,8 +310,8 @@ The main component which holds information and manages the running of the curren - [outer]main : MainComponent - [void-constructor]MainComponent() - GetContent() : Resource? result -- GetActiveComponent() : RenderableComponent? result -- SetActiveComponent(RenderableComponent component, opt float fadeSeconds,fadeColorR,fadeColorG,fadeColorB) +- GetActivePath() : RenderPath? result +- SetActivePath(RenderPath path, opt float fadeSeconds,fadeColorR,fadeColorG,fadeColorB) - SetFrameSkip(bool enabled) - SetInfoDisplay(bool active) - SetWatermarkDisplay(bool active) @@ -319,9 +319,9 @@ The main component which holds information and manages the running of the curren - SetCPUDisplay(bool active) - [outer]SetProfilerEnabled(bool enabled) -### RenderableComponent -A RenderableComponent describes a scene wich can render itself. -- [constructor]RenderableComponent() +### RenderPath +A RenderPath describes a scene wich can render itself. +- [constructor]RenderPath() - GetContent() : Resource result - Initialize() - Load() @@ -337,9 +337,9 @@ A RenderableComponent describes a scene wich can render itself. - GetLayerMask() : uint result - SetLayerMask(uint mask) -#### Renderable2DComponent +#### RenderPath2D It can hold Sprites and Fonts and can sort them by layers, update and render them. -- [constructor]Renderable2DComponent() +- [constructor]RenderPath2D() - AddSprite(Sprite sprite, opt string layer) - AddFont(Font font, opt string layer) - RemoveFont(Font font) @@ -353,10 +353,10 @@ It can hold Sprites and Fonts and can sort them by layers, update and render the - SetSpriteOrder(Sprite sprite, int order) - SetFontOrder(Font font, int order) -#### Renderable3DComponent +#### RenderPath3D A 3D scene can either be rendered by a Forward or Deferred render path. -It inherits functions from Renderable2DComponent, so it can render a 2D overlay. -- [void-constructor]Renderable3DComponent() +It inherits functions from RenderPath2D, so it can render a 2D overlay. +- [void-constructor]RenderPath3D() - SetSSAOEnabled(bool value) - SetSSREnabled(bool value) - SetShadowsEnabled(bool value) @@ -382,28 +382,28 @@ It inherits functions from Renderable2DComponent, so it can render a 2D overlay. - SetSharpenFilterEnabled(bool value) - SetSharpenFilterAmount(bool value) -##### ForwardRenderableComponent +##### RenderPath3D_Forward It renders the scene contained by the Renderer in a forward render path. The component does not hold the scene information, only the effects to render the scene. The scene is managed and ultimately rendered by the Renderer. -It inherits functions from Renderable3DComponent. -- [constructor]ForwardRenderableComponent() +It inherits functions from RenderPath3D. +- [constructor]RenderPath3D_Forward() -##### TiledForwardRenderableComponent +##### RenderPath3D_TiledForward It renders the scene contained by the Renderer in a tiled forward render path. The component does not hold the scene information, only the effects to render the scene. The scene is managed and ultimately rendered by the Renderer. -It inherits functions from ForwardRenderable3DComponent. -- [constructor]TiledForwardRenderableComponent() +It inherits functions from RenderPath3D_Forward3D. +- [constructor]RenderPath3D_TiledForward() -##### DeferredRenderableComponent +##### RenderPath3D_Deferred It renders the scene contained by the Renderer in a deferred render path. The component does not hold the scene information, only the effects to render the scene. The scene is managed and ultimately rendered by the Renderer. -It inherits functions from Renderable3DComponent. -- [constructor]DeferredRenderableComponent() +It inherits functions from RenderPath3D. +- [constructor]RenderPath3D_Deferred() -#### LoadingScreenComponent -It is a Renderable2DComponent but one that internally manages resource loading and can display information about the process. -It inherits functions from Renderable2DComponent. -- [constructor]LoadingScreenComponent() +#### LoadingScreen +It is a RenderPath2D but one that internally manages resource loading and can display information about the process. +It inherits functions from RenderPath2D. +- [constructor]LoadingScreen() - AddLoadingTask(string taskScript) - OnFinished(string taskScript) diff --git a/Documentation/WickedEngine-Documentation.md b/Documentation/WickedEngine-Documentation.md index 02ff2aee3..dcb79222c 100644 --- a/Documentation/WickedEngine-Documentation.md +++ b/Documentation/WickedEngine-Documentation.md @@ -1,12 +1,86 @@ # WickedEngine Documentation (work in progress) -## Graphics +## High Level Interface +The high level interface consists of classes that allow for extending the engine with custom functionality. This is usually done by overriding the classes. -![InformationSheet](information_sheet.png) +- MainComponent + - This is the main runtime component that has the Run() function. It should be included in the application entry point while calling Run() in an infinite loop + - It has a SetWindow function that expects a platform specific window handle. It is necessary to call SetWindow() before calling Run() + - Once Run() is called in a loop, it will perform Initialize(), Update(), FixedUpdate(), Render(), Compose() functions. + - ActivatePath() will activate a render path and optionally fade the screen to transition between them. Refer to RenderPath for additional details. + - Refer to the order of execution diagram below for an overview: Order of execution: ![OrderOfExecution](orderofexecution.png)
(Diagram generated with draw.io) -TODO: Rewrite documentation +- RenderPath + - This is an empty base class that can be activated with a MainComponent. It calls its Start(), Update(), FixedUpdate(), Render(), Compose(), Stop() functions as needed. Override this to perform custom gameplay or rendering logic. + - It has several ready to use variants, such as RenderPath2D, RenderPath3D_Deferred, LoadingScreen, etc. + +- RenderPath2D + - Capable of handling 2D rendering to offscreen buffer in Render() function, or just the screen in Compose() function. + - It has some functionality to render wiSprite and wiFont onto rendering layers + +- RenderPath3D + - By itself, it only does everything that RenderPath2D can do. + - It must be specialized for a specific 3D rendering algorithm, such as RenderPath3D_Deferred, Forward, TiledForward, etc. + +- RenderPath3D_Forward + - Implements simple Forward rendering. It uses few render targets, but not very efficient with many lights + +- RenderPath3D_Defered + - Implements old school Deferred rendering. It uses many render target, capable of advanced post processing effects, and good to render many lights. + +- RenderPath3D_TiledForward + - Implements an advanced method of Forward rendering to be able to render many lights efficiently. It uses few render targets, so memory efficient. + +- RenderPath3D_TiledDeferred + - Implements and advanced method of Deferred rendering to be able to render many lights with reduced memory bandwidth requirements. + +- RenderPath3D_PathTracing + - Implements a compute shader based path tracing solution. In a static scene, the rendering will converge to ground truth. + +## System +You can find out more about the Entity-Component system under ENGINE/System filter in the solution. + +- wiECS + - This is the core entity-component relationship handler class: ComponentManager + - Entity is a number, it can reference any number of different components through ComponentManager containers + - Component is not defined, it can be any data, that is stored inside a ComponentManager along entities + +- wiSceneSystem + - This contains Scene, a class that is responsible of holding and managing everything in the world + - There are also all of the Component types, like TransformComponent, MeshCOmponent, etc. + +## Physics +You can find the physics system related functionality under ENGINE/Physics filter in the solution. +It uses the entity-component system to perform updating all physics components in the world. + +- wiPhysicsEngine_Bullet + - Bullet physics engine library implementation of the physics update system + +## Graphics +You can find the Graphics related classes un der ENGINE/Graphics filter in the solution. The most notable classes are the folowing: + +- wiRenderer + - This is a collection of functions that facilitate an engine-level rendering logic, like RenderScene + +- wiImage + - This can render images to the screen + +- wiFont + - This can render fonts to the screen + +- wiGraphicsDevice + - This is the low-level rendering interface. It must implement either DirectX1, DirectX12 or Vulkan (at the moment) + - See wiGraphicsDevice_DX11 for DirectX11 rendering interface + - See wiGraphicsDevice_DX12 for DirectX12 rendering interface + - See wiGraphicsDevice_Vulkan for Vulkan rendering interface + +- There are many other classes that you can find here, such as wiEmittedParticle, to render emitter components. + +You can see a quickstart guide on the following picture regarding the most common rendering resources: + +![InformationSheet](information_sheet.png) diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index dabe8245f..91bf36caa 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -64,7 +64,7 @@ void Editor::Initialize() loader->addLoadingComponent(renderComponent, this); - activateComponent(loader); + ActivatePath(loader); } @@ -107,19 +107,19 @@ void EditorComponent::ChangeRenderPath(RENDERPATH path) switch (path) { case EditorComponent::RENDERPATH_FORWARD: - renderPath = new ForwardRenderableComponent; + renderPath = new RenderPath3D_Forward; break; case EditorComponent::RENDERPATH_DEFERRED: - renderPath = new DeferredRenderableComponent; + renderPath = new RenderPath3D_Deferred; break; case EditorComponent::RENDERPATH_TILEDFORWARD: - renderPath = new TiledForwardRenderableComponent; + renderPath = new RenderPath3D_TiledForward; break; case EditorComponent::RENDERPATH_TILEDDEFERRED: - renderPath = new TiledDeferredRenderableComponent; + renderPath = new RenderPath3D_TiledDeferred; break; case EditorComponent::RENDERPATH_PATHTRACING: - renderPath = new PathTracingRenderableComponent; + renderPath = new RenderPath3D_PathTracing; break; default: assert(0); @@ -468,10 +468,10 @@ void EditorComponent::Load() } }); loader->onFinished([=] { - main->activateComponent(this, 0.2f, wiColor::Black); + main->ActivatePath(this, 0.2f, wiColor::Black); weatherWnd->UpdateFromRenderer(); }); - main->activateComponent(loader, 0.2f, wiColor::Black); + main->ActivatePath(loader, 0.2f, wiColor::Black); ResetHistory(); } }).detach(); diff --git a/Editor/Editor.h b/Editor/Editor.h index 90e510b45..934148caf 100644 --- a/Editor/Editor.h +++ b/Editor/Editor.h @@ -18,7 +18,7 @@ class HairParticleWindow; class ForceFieldWindow; class OceanWindow; -class EditorLoadingScreen : public LoadingScreenComponent +class EditorLoadingScreen : public LoadingScreen { private: wiSprite sprite; @@ -30,7 +30,7 @@ public: }; class Editor; -class EditorComponent : public Renderable2DComponent +class EditorComponent : public RenderPath2D { private: wiGraphicsTypes::Texture2D pointLightTex, spotLightTex, dirLightTex, areaLightTex, decalTex, forceFieldTex, emitterTex, hairTex, cameraTex, armatureTex; @@ -56,7 +56,7 @@ public: wiCheckBox* cinemaModeCheckBox = nullptr; EditorLoadingScreen* loader = nullptr; - Renderable3DComponent* renderPath = nullptr; + RenderPath3D* renderPath = nullptr; enum RENDERPATH { RENDERPATH_FORWARD, diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp index 4e8dd6b77..2d4729d14 100644 --- a/Editor/PostprocessWindow.cpp +++ b/Editor/PostprocessWindow.cpp @@ -9,7 +9,7 @@ using namespace std; using namespace wiGraphicsTypes; -PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : GUI(gui), component(comp) +PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), component(comp) { assert(component && "PostprocessWnd invalid component!"); assert(GUI && "Invalid GUI!"); @@ -26,7 +26,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : lensFlareCheckBox = new wiCheckBox("LensFlare: "); lensFlareCheckBox->SetTooltip("Toggle visibility of light source flares. Additional setup needed per light for a lensflare to be visible."); - lensFlareCheckBox->SetScriptTip("Renderable3DComponent::SetLensFlareEnabled(bool value)"); + lensFlareCheckBox->SetScriptTip("RenderPath3D::SetLensFlareEnabled(bool value)"); lensFlareCheckBox->SetPos(XMFLOAT2(x, y += 35)); lensFlareCheckBox->SetCheck(component->getLensFlareEnabled()); lensFlareCheckBox->OnClick([&](wiEventArgs args) { @@ -36,7 +36,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : lightShaftsCheckBox = new wiCheckBox("LightShafts: "); lightShaftsCheckBox->SetTooltip("Enable light shaft for directional light sources."); - lightShaftsCheckBox->SetScriptTip("Renderable3DComponent::SetLightShaftsEnabled(bool value)"); + lightShaftsCheckBox->SetScriptTip("RenderPath3D::SetLightShaftsEnabled(bool value)"); lightShaftsCheckBox->SetPos(XMFLOAT2(x, y += 35)); lightShaftsCheckBox->SetCheck(component->getLightShaftsEnabled()); lightShaftsCheckBox->OnClick([&](wiEventArgs args) { @@ -46,7 +46,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : ssaoCheckBox = new wiCheckBox("SSAO: "); ssaoCheckBox->SetTooltip("Enable Screen Space Ambient Occlusion."); - ssaoCheckBox->SetScriptTip("Renderable3DComponent::SetSSAOEnabled(bool value)"); + ssaoCheckBox->SetScriptTip("RenderPath3D::SetSSAOEnabled(bool value)"); ssaoCheckBox->SetPos(XMFLOAT2(x, y += 35)); ssaoCheckBox->SetCheck(component->getSSAOEnabled()); ssaoCheckBox->OnClick([&](wiEventArgs args) { @@ -56,7 +56,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : ssrCheckBox = new wiCheckBox("SSR: "); ssrCheckBox->SetTooltip("Enable Screen Space Reflections."); - ssrCheckBox->SetScriptTip("Renderable3DComponent::SetSSREnabled(bool value)"); + ssrCheckBox->SetScriptTip("RenderPath3D::SetSSREnabled(bool value)"); ssrCheckBox->SetPos(XMFLOAT2(x, y += 35)); ssrCheckBox->SetCheck(component->getSSREnabled()); ssrCheckBox->OnClick([&](wiEventArgs args) { @@ -66,7 +66,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : sssCheckBox = new wiCheckBox("SSS: "); sssCheckBox->SetTooltip("Enable Subsurface Scattering. (Deferred only for now)"); - sssCheckBox->SetScriptTip("Renderable3DComponent::SetSSSEnabled(bool value)"); + sssCheckBox->SetScriptTip("RenderPath3D::SetSSSEnabled(bool value)"); sssCheckBox->SetPos(XMFLOAT2(x, y += 35)); sssCheckBox->SetCheck(component->getSSSEnabled()); sssCheckBox->OnClick([&](wiEventArgs args) { @@ -85,7 +85,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : motionBlurCheckBox = new wiCheckBox("MotionBlur: "); motionBlurCheckBox->SetTooltip("Enable motion blur for camera movement and animated meshes."); - motionBlurCheckBox->SetScriptTip("Renderable3DComponent::SetMotionBlurEnabled(bool value)"); + motionBlurCheckBox->SetScriptTip("RenderPath3D::SetMotionBlurEnabled(bool value)"); motionBlurCheckBox->SetPos(XMFLOAT2(x, y += 35)); motionBlurCheckBox->SetCheck(component->getMotionBlurEnabled()); motionBlurCheckBox->OnClick([&](wiEventArgs args) { @@ -95,7 +95,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : depthOfFieldCheckBox = new wiCheckBox("DepthOfField: "); depthOfFieldCheckBox->SetTooltip("Enable Depth of field effect. Additional focus and strength setup required."); - depthOfFieldCheckBox->SetScriptTip("Renderable3DComponent::SetDepthOfFieldEnabled(bool value)"); + depthOfFieldCheckBox->SetScriptTip("RenderPath3D::SetDepthOfFieldEnabled(bool value)"); depthOfFieldCheckBox->SetPos(XMFLOAT2(x, y += 35)); depthOfFieldCheckBox->SetCheck(component->getDepthOfFieldEnabled()); depthOfFieldCheckBox->OnClick([&](wiEventArgs args) { @@ -105,7 +105,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : depthOfFieldFocusSlider = new wiSlider(0.01f, 600, 100, 10000, "Focus: "); depthOfFieldFocusSlider->SetTooltip("Set the focus distance from the camera. The picture will be sharper near the focus, and blurrier further from it."); - depthOfFieldFocusSlider->SetScriptTip("Renderable3DComponent::SetDepthOfFieldFocus(float value)"); + depthOfFieldFocusSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldFocus(float value)"); depthOfFieldFocusSlider->SetSize(XMFLOAT2(100, 20)); depthOfFieldFocusSlider->SetPos(XMFLOAT2(x + 100, y)); depthOfFieldFocusSlider->SetValue(component->getDepthOfFieldFocus()); @@ -116,7 +116,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : depthOfFieldStrengthSlider = new wiSlider(0.01f, 4, 100, 1000, "Strength: "); depthOfFieldStrengthSlider->SetTooltip("Set depth of field blur strength."); - depthOfFieldStrengthSlider->SetScriptTip("Renderable3DComponent::SetDepthOfFieldStrength(float value)"); + depthOfFieldStrengthSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldStrength(float value)"); depthOfFieldStrengthSlider->SetSize(XMFLOAT2(100, 20)); depthOfFieldStrengthSlider->SetPos(XMFLOAT2(x + 100, y += 35)); depthOfFieldStrengthSlider->SetValue(component->getDepthOfFieldStrength()); @@ -127,7 +127,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : bloomCheckBox = new wiCheckBox("Bloom: "); bloomCheckBox->SetTooltip("Enable bloom. The effect adds color bleeding to the brightest parts of the scene."); - bloomCheckBox->SetScriptTip("Renderable3DComponent::SetBloomEnabled(bool value)"); + bloomCheckBox->SetScriptTip("RenderPath3D::SetBloomEnabled(bool value)"); bloomCheckBox->SetPos(XMFLOAT2(x, y += 35)); bloomCheckBox->SetCheck(component->getBloomEnabled()); bloomCheckBox->OnClick([&](wiEventArgs args) { @@ -137,7 +137,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : fxaaCheckBox = new wiCheckBox("FXAA: "); fxaaCheckBox->SetTooltip("Fast Approximate Anti Aliasing. A fast antialiasing method, but can be a bit too blurry."); - fxaaCheckBox->SetScriptTip("Renderable3DComponent::SetFXAAEnabled(bool value)"); + fxaaCheckBox->SetScriptTip("RenderPath3D::SetFXAAEnabled(bool value)"); fxaaCheckBox->SetPos(XMFLOAT2(x, y += 35)); fxaaCheckBox->SetCheck(component->getFXAAEnabled()); fxaaCheckBox->OnClick([&](wiEventArgs args) { @@ -147,7 +147,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : colorGradingCheckBox = new wiCheckBox("Color Grading: "); colorGradingCheckBox->SetTooltip("Enable color grading of the final render. An additional lookup texture must be set for it to take effect."); - colorGradingCheckBox->SetScriptTip("Renderable3DComponent::SetColorGradingEnabled(bool value)"); + colorGradingCheckBox->SetScriptTip("RenderPath3D::SetColorGradingEnabled(bool value)"); colorGradingCheckBox->SetPos(XMFLOAT2(x, y += 35)); colorGradingCheckBox->SetCheck(component->getColorGradingEnabled()); colorGradingCheckBox->OnClick([&](wiEventArgs args) { @@ -206,7 +206,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : stereogramCheckBox = new wiCheckBox("Stereogram: "); stereogramCheckBox->SetTooltip("Compute a stereogram from the depth buffer. It produces a 3D silhouette image when viewed cross eyed."); - stereogramCheckBox->SetScriptTip("Renderable3DComponent::SetStereogramEnabled(bool value)"); + stereogramCheckBox->SetScriptTip("RenderPath3D::SetStereogramEnabled(bool value)"); stereogramCheckBox->SetPos(XMFLOAT2(x, y += 35)); stereogramCheckBox->SetCheck(component->getStereogramEnabled()); stereogramCheckBox->OnClick([&](wiEventArgs args) { @@ -216,7 +216,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : sharpenFilterCheckBox = new wiCheckBox("Sharpen Filter: "); sharpenFilterCheckBox->SetTooltip("Toggle sharpening post process of the final image."); - sharpenFilterCheckBox->SetScriptTip("Renderable3DComponent::SetSharpenFilterEnabled(bool value)"); + sharpenFilterCheckBox->SetScriptTip("RenderPath3D::SetSharpenFilterEnabled(bool value)"); sharpenFilterCheckBox->SetPos(XMFLOAT2(x, y += 35)); sharpenFilterCheckBox->SetCheck(component->getSharpenFilterEnabled()); sharpenFilterCheckBox->OnClick([&](wiEventArgs args) { @@ -226,7 +226,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : sharpenFilterAmountSlider = new wiSlider(0, 4, 1, 1000, "Amount: "); sharpenFilterAmountSlider->SetTooltip("Set sharpness filter strength."); - sharpenFilterAmountSlider->SetScriptTip("Renderable3DComponent::SetSharpenFilterAmount(float value)"); + sharpenFilterAmountSlider->SetScriptTip("RenderPath3D::SetSharpenFilterAmount(float value)"); sharpenFilterAmountSlider->SetSize(XMFLOAT2(100, 20)); sharpenFilterAmountSlider->SetPos(XMFLOAT2(x + 100, y)); sharpenFilterAmountSlider->SetValue(component->getSharpenFilterAmount()); diff --git a/Editor/PostprocessWindow.h b/Editor/PostprocessWindow.h index 54e84e8ad..e3ef7c8ae 100644 --- a/Editor/PostprocessWindow.h +++ b/Editor/PostprocessWindow.h @@ -1,6 +1,6 @@ #pragma once -class Renderable3DComponent; +class RenderPath3D; class wiGUI; class wiWindow; @@ -12,11 +12,11 @@ class wiButton; class PostprocessWindow { public: - PostprocessWindow(wiGUI* gui, Renderable3DComponent* component); + PostprocessWindow(wiGUI* gui, RenderPath3D* component); ~PostprocessWindow(); wiGUI* GUI; - Renderable3DComponent* component; + RenderPath3D* component; wiWindow* ppWindow; wiCheckBox* lensFlareCheckBox; diff --git a/Editor/RendererWindow.cpp b/Editor/RendererWindow.cpp index 625901ec6..e998a55f1 100644 --- a/Editor/RendererWindow.cpp +++ b/Editor/RendererWindow.cpp @@ -1,9 +1,9 @@ #include "stdafx.h" #include "RendererWindow.h" -#include "Renderable3DComponent.h" +#include "RenderPath3D.h" -RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : GUI(gui) +RendererWindow::RendererWindow(wiGUI* gui, RenderPath3D* path) : GUI(gui) { assert(GUI && "Invalid GUI!"); @@ -168,7 +168,7 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G tessellationCheckBox->SetTooltip("Enable tessellation feature. You also need to specify a tessellation factor for individual objects."); tessellationCheckBox->SetPos(XMFLOAT2(x, y += step)); tessellationCheckBox->OnClick([=](wiEventArgs args) { - component->setTessellationEnabled(args.bValue); + path->setTessellationEnabled(args.bValue); }); tessellationCheckBox->SetCheck(false); rendererWindow->AddWidget(tessellationCheckBox); @@ -311,16 +311,16 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G switch (args.iValue) { case 0: - component->setMSAASampleCount(1); + path->setMSAASampleCount(1); break; case 1: - component->setMSAASampleCount(2); + path->setMSAASampleCount(2); break; case 2: - component->setMSAASampleCount(4); + path->setMSAASampleCount(4); break; case 3: - component->setMSAASampleCount(8); + path->setMSAASampleCount(8); break; default: break; diff --git a/Editor/RendererWindow.h b/Editor/RendererWindow.h index 37ba4585d..726567d64 100644 --- a/Editor/RendererWindow.h +++ b/Editor/RendererWindow.h @@ -24,7 +24,7 @@ enum PICKTYPE class RendererWindow { public: - RendererWindow(wiGUI* gui, Renderable3DComponent* component); + RendererWindow(wiGUI* gui, RenderPath3D* path); ~RendererWindow(); wiGUI* GUI; diff --git a/Editor/startup.lua b/Editor/startup.lua index d2dfe2e37..e69de29bb 100644 --- a/Editor/startup.lua +++ b/Editor/startup.lua @@ -1,74 +0,0 @@ --- s = Sprite("HelloWorldDemo/HelloWorld.png"); --- s.SetEffects(ImageEffects(100,-100,400,400)); --- f = Font("Hello World Font renderer"); --- f.SetPos(Vector(20,-150)); - --- runProcess(function() --- local isserver = false --- local isclient = false --- while true do --- --- if(input.Press(string.byte('S'))) then --- isserver = true --- server = Server() --- end --- if(input.Press(string.byte('C'))) then --- isclient = true --- client = Client() --- end --- --- if(isserver) then --- server.Poll() --- end --- if(isclient) then --- client.Poll() --- end --- --- update() --- end --- end) - ---LoadModel("C:/PROJECTS/glTF-Sample-Models-master/2.0/CesiumMan/glTF/CesiumMan.gltf") ---LoadModel("C:/PROJECTS/WickedEngine/models/girl/girl.wimf", matrix.Translation(Vector(5))) ---LoadModel("C:/PROJECTS/WickedEngine/models/girl/girl", matrix.Translation(Vector(10))) ---SetDebugBonesEnabled(true) - -main.SetResolutionDisplay(true); -runProcess(function() - while true do - - if(input.Press(VK_F11)) then - ReloadShaders("C:\\PROJECTS\\WickedEngine\\WickedEngine\\shaders\\") - end - - if(input.Press(VK_F10)) then - s = SoundEffect("C:\\PROJECTS\\DXProject\\DXProject\\sound\\1.wav") - s.Play() - end - - if(input.Press(VK_F4)) then - main.GetActiveComponent().SetPreferredThreadingCount(2); - end - if(input.Press(VK_F5)) then - main.GetActiveComponent().SetPreferredThreadingCount(3); - end - if(input.Press(VK_F6)) then - main.GetActiveComponent().SetPreferredThreadingCount(4); - end - - if(input.Press(VK_F7)) then - runProcess(function() - local row = 16 - for i = 1, row do - for j = 1, row do - LoadModel("../models/Stormtrooper/model.wimf",matrix.Translation(Vector(i*2-row,0,j*2-row))); - waitSeconds(0.05) - end - end - end) - end - - - update() - end -end) \ No newline at end of file diff --git a/README.md b/README.md index f94a05691..5898c6eac 100644 --- a/README.md +++ b/README.md @@ -113,8 +113,8 @@ Then set the following dependencies to this library in Visual Studio this way in When your project settings are set up, time to #include "WickedEngine.h" in your source. I recommend to include this in the precompiled header file. This will enable the use of all the engine features and link the necessary binaries. After this, you should already be able to build your project. But this will not render anything for you yet, because first you must initialize the engine. For this, you should create a main program component by deriving from MainComponent class of -Wicked Engine and initialize it appropriately by calling its Initialize() and SetWindow() functions, and calling its run() function inside the main message loop. -You should also activate a RenderableComponent for the rendering to begin. You can see an example for this inside the Tests and Editor projects. +Wicked Engine and initialize it appropriately by calling the SetWindow() and Run() functions inside the main message loop. +You should also ActivatePath() for the rendering to begin. You can see an example for this inside the Tests and Editor projects. If you want to create an UWP application, #define WINSTORE_SUPPORT preprocessor for the whole implementing project and link against the WickedEngine_UWP library. diff --git a/Tests/Tests.cpp b/Tests/Tests.cpp index fd605b22d..25d1178d6 100644 --- a/Tests/Tests.cpp +++ b/Tests/Tests.cpp @@ -24,7 +24,7 @@ void Tests::Initialize() infoDisplay.cpuinfo = false; infoDisplay.resolution = true; - activateComponent(new TestsRenderer); + ActivatePath(new TestsRenderer); } diff --git a/Tests/Tests.h b/Tests/Tests.h index d1c2273a6..c1e6673d1 100644 --- a/Tests/Tests.h +++ b/Tests/Tests.h @@ -11,7 +11,7 @@ public: }; -class TestsRenderer : public DeferredRenderableComponent +class TestsRenderer : public RenderPath3D_Deferred { public: TestsRenderer(); diff --git a/Tests/test_script.lua b/Tests/test_script.lua index 277af14d1..7e834667f 100644 --- a/Tests/test_script.lua +++ b/Tests/test_script.lua @@ -15,7 +15,7 @@ ToggleCameraAnimation(); local sprite = Sprite("images/HelloWorld.png"); sprite.SetEffects(ImageEffects(100,100,100,50)); -- Set this image as renderable to the active component: -local component = main.GetActiveComponent(); +local component = main.GetActivePath(); component.AddSprite(sprite); diff --git a/WickedEngine/DeferredRenderableComponent.h b/WickedEngine/DeferredRenderableComponent.h deleted file mode 100644 index e55ea9750..000000000 --- a/WickedEngine/DeferredRenderableComponent.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include "Renderable3DComponent.h" - - -class DeferredRenderableComponent : - public Renderable3DComponent -{ -protected: - static wiRenderTarget rtGBuffer, rtDeferred, rtLight, rtSSS[2]; - - virtual void ResizeBuffers(); - - virtual void RenderScene(GRAPHICSTHREAD threadID) override; - wiRenderTarget& GetFinalRT(); - -public: - DeferredRenderableComponent(); - virtual ~DeferredRenderableComponent(); - - virtual wiDepthTarget* GetDepthBuffer() override; - - virtual void Initialize() override; - virtual void Load() override; - virtual void Start() override; - virtual void Render() override; -}; - diff --git a/WickedEngine/DeferredRenderableComponent_BindLua.cpp b/WickedEngine/DeferredRenderableComponent_BindLua.cpp deleted file mode 100644 index 05a41c899..000000000 --- a/WickedEngine/DeferredRenderableComponent_BindLua.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "DeferredRenderableComponent_BindLua.h" - -const char DeferredRenderableComponent_BindLua::className[] = "DeferredRenderableComponent"; - -Luna::FunctionType DeferredRenderableComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - - lunamethod(RenderableComponent_BindLua, GetContent), - lunamethod(RenderableComponent_BindLua, Initialize), - lunamethod(RenderableComponent_BindLua, Load), - lunamethod(RenderableComponent_BindLua, Unload), - lunamethod(RenderableComponent_BindLua, Start), - lunamethod(RenderableComponent_BindLua, Stop), - lunamethod(RenderableComponent_BindLua, FixedUpdate), - lunamethod(RenderableComponent_BindLua, Update), - lunamethod(RenderableComponent_BindLua, Render), - lunamethod(RenderableComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), - - lunamethod(Renderable3DComponent_BindLua, SetSSAOEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSREnabled), - lunamethod(Renderable3DComponent_BindLua, SetShadowsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetReflectionsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetFXAAEnabled), - lunamethod(Renderable3DComponent_BindLua, SetBloomEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingTexture), - lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldEnabled), - lunamethod(Renderable3DComponent_BindLua, SetStereogramEnabled), - lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount), - - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldFocus), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldStrength), - - { NULL, NULL } -}; -Luna::PropertyType DeferredRenderableComponent_BindLua::properties[] = { - { NULL, NULL } -}; - -DeferredRenderableComponent_BindLua::DeferredRenderableComponent_BindLua(DeferredRenderableComponent* component) -{ - this->component = component; -} - -DeferredRenderableComponent_BindLua::DeferredRenderableComponent_BindLua(lua_State *L) -{ - component = new DeferredRenderableComponent(); -} - - -DeferredRenderableComponent_BindLua::~DeferredRenderableComponent_BindLua() -{ -} - -void DeferredRenderableComponent_BindLua::Bind() -{ - static bool initialized = false; - if (!initialized) - { - initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); - } -} diff --git a/WickedEngine/DeferredRenderableComponent_BindLua.h b/WickedEngine/DeferredRenderableComponent_BindLua.h deleted file mode 100644 index ed822a6f6..000000000 --- a/WickedEngine/DeferredRenderableComponent_BindLua.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "wiLua.h" -#include "wiLuna.h" -#include "DeferredRenderableComponent.h" -#include "Renderable3DComponent_BindLua.h" - -class DeferredRenderableComponent_BindLua : public Renderable3DComponent_BindLua -{ -public: - static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; - - DeferredRenderableComponent_BindLua(DeferredRenderableComponent* component = nullptr); - DeferredRenderableComponent_BindLua(lua_State *L); - ~DeferredRenderableComponent_BindLua(); - - static void Bind(); -}; diff --git a/WickedEngine/ForwardRenderableComponent.h b/WickedEngine/ForwardRenderableComponent.h deleted file mode 100644 index a9184fd60..000000000 --- a/WickedEngine/ForwardRenderableComponent.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "Renderable3DComponent.h" - - -class ForwardRenderableComponent : - public Renderable3DComponent -{ -protected: - - static wiRenderTarget rtMain; - - virtual void ResizeBuffers(); - - virtual void RenderScene(GRAPHICSTHREAD threadID) override; -public: - ForwardRenderableComponent(); - virtual ~ForwardRenderableComponent(); - - virtual wiDepthTarget* GetDepthBuffer() override; - - virtual void Initialize() override; - virtual void Load() override; - virtual void Start() override; - virtual void Render() override; -}; - diff --git a/WickedEngine/ForwardRenderableComponent_BindLua.cpp b/WickedEngine/ForwardRenderableComponent_BindLua.cpp deleted file mode 100644 index c9abfc303..000000000 --- a/WickedEngine/ForwardRenderableComponent_BindLua.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "ForwardRenderableComponent_BindLua.h" - -const char ForwardRenderableComponent_BindLua::className[] = "ForwardRenderableComponent"; - -Luna::FunctionType ForwardRenderableComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - - lunamethod(RenderableComponent_BindLua, GetContent), - lunamethod(RenderableComponent_BindLua, Initialize), - lunamethod(RenderableComponent_BindLua, Load), - lunamethod(RenderableComponent_BindLua, Unload), - lunamethod(RenderableComponent_BindLua, Start), - lunamethod(RenderableComponent_BindLua, Stop), - lunamethod(RenderableComponent_BindLua, FixedUpdate), - lunamethod(RenderableComponent_BindLua, Update), - lunamethod(RenderableComponent_BindLua, Render), - lunamethod(RenderableComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), - - lunamethod(Renderable3DComponent_BindLua, SetSSAOEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSREnabled), - lunamethod(Renderable3DComponent_BindLua, SetShadowsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetReflectionsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetFXAAEnabled), - lunamethod(Renderable3DComponent_BindLua, SetBloomEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingTexture), - lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldEnabled), - lunamethod(Renderable3DComponent_BindLua, SetStereogramEnabled), - lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMSAASampleCount), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount), - - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldFocus), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldStrength), - { NULL, NULL } -}; -Luna::PropertyType ForwardRenderableComponent_BindLua::properties[] = { - { NULL, NULL } -}; - -ForwardRenderableComponent_BindLua::ForwardRenderableComponent_BindLua(ForwardRenderableComponent* component) -{ - this->component = component; -} - -ForwardRenderableComponent_BindLua::ForwardRenderableComponent_BindLua(lua_State *L) -{ - component = new ForwardRenderableComponent(); -} - - -ForwardRenderableComponent_BindLua::~ForwardRenderableComponent_BindLua() -{ -} - -void ForwardRenderableComponent_BindLua::Bind() -{ - static bool initialized = false; - if (!initialized) - { - initialized = true; - //Luna::Register(wiLua::GetGlobal()->GetLuaState()); - } -} diff --git a/WickedEngine/ForwardRenderableComponent_BindLua.h b/WickedEngine/ForwardRenderableComponent_BindLua.h deleted file mode 100644 index 09d6489fd..000000000 --- a/WickedEngine/ForwardRenderableComponent_BindLua.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "wiLua.h" -#include "wiLuna.h" -#include "ForwardRenderableComponent.h" -#include "Renderable3DComponent_BindLua.h" - -class ForwardRenderableComponent_BindLua : public Renderable3DComponent_BindLua -{ -public: - static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; - - ForwardRenderableComponent_BindLua(ForwardRenderableComponent* component = nullptr); - ForwardRenderableComponent_BindLua(lua_State *L); - ~ForwardRenderableComponent_BindLua(); - - static void Bind(); -}; - diff --git a/WickedEngine/LoadingScreen.cpp b/WickedEngine/LoadingScreen.cpp new file mode 100644 index 000000000..f99fd797d --- /dev/null +++ b/WickedEngine/LoadingScreen.cpp @@ -0,0 +1,117 @@ +#include "LoadingScreen.h" +#include "MainComponent.h" + +using namespace std; + +LoadingScreen::LoadingScreen() : RenderPath2D() +{ + loaders.clear(); + finish = nullptr; +} + + +LoadingScreen::~LoadingScreen() +{ +} + +bool LoadingScreen::isActive() +{ + for (LoaderTask& x : loaders) + { + if (x.active.load()) + { + return true; + } + } + return false; +} + +void LoadingScreen::addLoadingFunction(function loadingFunction) +{ + if (loadingFunction != nullptr) + { + loaders.push_back(LoaderTask(loadingFunction)); + } +} + +void LoadingScreen::addLoadingComponent(RenderPath* component, MainComponent* main) +{ + addLoadingFunction([=] { + component->Load(); + }); + onFinished([=] { + main->ActivatePath(component); + }); + //addLoadingFunction(bind(&RenderPath::Load, this, component)); + //onFinished(bind(&RenderPath::Start, this, component)); +} + +void LoadingScreen::onFinished(function finishFunction) +{ + if (finishFunction != nullptr) + finish = finishFunction; +} + +void LoadingScreen::waitForFinish() +{ + worker.join(); + if (finish != nullptr) + finish(); +} + +void LoadingScreen::doLoadingTasks() +{ + std::vector loaderThreads(0); + + for (LoaderTask& x : loaders) + { + x.active.store(true); + loaderThreads.push_back(thread(x.functionBody)); + } + + int i = 0; + for (thread& x : loaderThreads) + { + x.join(); + loaders[i].active.store(false); + i++; + } +} + +int LoadingScreen::getPercentageComplete() +{ + const int numberOfLoaders = (int)loaders.size(); + int completed = 0; + + for (LoaderTask& x : loaders) + { + if (!x.active.load()) + { + completed++; + } + } + + return (int)(((float)completed / (float)numberOfLoaders)*100.f); +} + +void LoadingScreen::Unload() +{ + RenderPath2D::Unload(); +} + +void LoadingScreen::Start() +{ + worker = thread(&LoadingScreen::doLoadingTasks, this); + thread(&LoadingScreen::waitForFinish, this).detach(); + + RenderPath2D::Start(); +} + +void LoadingScreen::Stop() +{ + loaders.clear(); + finish = nullptr; + + RenderPath2D::Stop(); +} + diff --git a/WickedEngine/LoadingScreenComponent.h b/WickedEngine/LoadingScreen.h similarity index 84% rename from WickedEngine/LoadingScreenComponent.h rename to WickedEngine/LoadingScreen.h index bcdaf88cd..fd522a36d 100644 --- a/WickedEngine/LoadingScreenComponent.h +++ b/WickedEngine/LoadingScreen.h @@ -1,5 +1,5 @@ #pragma once -#include "Renderable2DComponent.h" +#include "RenderPath2D.h" #include #include @@ -7,8 +7,8 @@ class MainComponent; -class LoadingScreenComponent : - public Renderable2DComponent +class LoadingScreen : + public RenderPath2D { private: struct LoaderTask @@ -33,14 +33,14 @@ private: std::function finish; std::thread worker; public: - LoadingScreenComponent(); - virtual ~LoadingScreenComponent(); + LoadingScreen(); + virtual ~LoadingScreen(); //Add a loading task which should be executed //use std::bind( YourFunctionPointer ) void addLoadingFunction(std::function loadingFunction); //Helper for loading a whole renderable component - void addLoadingComponent(RenderableComponent* component, MainComponent* main); + void addLoadingComponent(RenderPath* component, MainComponent* main); //Set a function that should be called when the loading finishes //use std::bind( YourFunctionPointer ) void onFinished(std::function finishFunction); diff --git a/WickedEngine/LoadingScreenComponent.cpp b/WickedEngine/LoadingScreenComponent.cpp deleted file mode 100644 index 3e163e6e9..000000000 --- a/WickedEngine/LoadingScreenComponent.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "LoadingScreenComponent.h" -#include "MainComponent.h" - -using namespace std; - -LoadingScreenComponent::LoadingScreenComponent() : Renderable2DComponent() -{ - loaders.clear(); - finish = nullptr; -} - - -LoadingScreenComponent::~LoadingScreenComponent() -{ -} - -bool LoadingScreenComponent::isActive() -{ - for (LoaderTask& x : loaders) - { - if (x.active.load()) - { - return true; - } - } - return false; -} - -void LoadingScreenComponent::addLoadingFunction(function loadingFunction) -{ - if (loadingFunction != nullptr) - { - loaders.push_back(LoaderTask(loadingFunction)); - } -} - -void LoadingScreenComponent::addLoadingComponent(RenderableComponent* component, MainComponent* main) -{ - addLoadingFunction([=] { - component->Load(); - }); - onFinished([=] { - main->activateComponent(component); - }); - //addLoadingFunction(bind(&RenderableComponent::Load, this, component)); - //onFinished(bind(&RenderableComponent::Start, this, component)); -} - -void LoadingScreenComponent::onFinished(function finishFunction) -{ - if (finishFunction != nullptr) - finish = finishFunction; -} - -void LoadingScreenComponent::waitForFinish() -{ - worker.join(); - if (finish != nullptr) - finish(); -} - -void LoadingScreenComponent::doLoadingTasks() -{ - std::vector loaderThreads(0); - - for (LoaderTask& x : loaders) - { - x.active.store(true); - loaderThreads.push_back(thread(x.functionBody)); - } - - int i = 0; - for (thread& x : loaderThreads) - { - x.join(); - loaders[i].active.store(false); - i++; - } -} - -int LoadingScreenComponent::getPercentageComplete() -{ - const int numberOfLoaders = (int)loaders.size(); - int completed = 0; - - for (LoaderTask& x : loaders) - { - if (!x.active.load()) - { - completed++; - } - } - - return (int)(((float)completed / (float)numberOfLoaders)*100.f); -} - -void LoadingScreenComponent::Unload() -{ - Renderable2DComponent::Unload(); -} - -void LoadingScreenComponent::Start() -{ - worker = thread(&LoadingScreenComponent::doLoadingTasks, this); - thread(&LoadingScreenComponent::waitForFinish, this).detach(); - - Renderable2DComponent::Start(); -} - -void LoadingScreenComponent::Stop() -{ - loaders.clear(); - finish = nullptr; - - Renderable2DComponent::Stop(); -} - diff --git a/WickedEngine/LoadingScreenComponent_BindLua.cpp b/WickedEngine/LoadingScreenComponent_BindLua.cpp deleted file mode 100644 index e0afbc8bd..000000000 --- a/WickedEngine/LoadingScreenComponent_BindLua.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "LoadingScreenComponent_BindLua.h" - -using namespace std; - -const char LoadingScreenComponent_BindLua::className[] = "LoadingScreenComponent"; - -Luna::FunctionType LoadingScreenComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - - lunamethod(LoadingScreenComponent_BindLua, Initialize), - lunamethod(LoadingScreenComponent_BindLua, Load), - lunamethod(LoadingScreenComponent_BindLua, Unload), - lunamethod(LoadingScreenComponent_BindLua, Start), - lunamethod(LoadingScreenComponent_BindLua, Stop), - lunamethod(LoadingScreenComponent_BindLua, FixedUpdate), - lunamethod(LoadingScreenComponent_BindLua, Update), - lunamethod(LoadingScreenComponent_BindLua, Render), - lunamethod(LoadingScreenComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), - - lunamethod(LoadingScreenComponent_BindLua, AddLoadingTask), - lunamethod(LoadingScreenComponent_BindLua, OnFinished), - { NULL, NULL } -}; -Luna::PropertyType LoadingScreenComponent_BindLua::properties[] = { - { NULL, NULL } -}; - -LoadingScreenComponent_BindLua::LoadingScreenComponent_BindLua(LoadingScreenComponent* component) -{ - this->component = component; -} - -LoadingScreenComponent_BindLua::LoadingScreenComponent_BindLua(lua_State *L) -{ - component = new LoadingScreenComponent(); -} - -LoadingScreenComponent_BindLua::~LoadingScreenComponent_BindLua() -{ -} - -int LoadingScreenComponent_BindLua::AddLoadingTask(lua_State* L) -{ - int argc = wiLua::SGetArgCount(L); - if (argc > 0) - { - string task = wiLua::SGetString(L, 1); - LoadingScreenComponent* loading = dynamic_cast(component); - if (loading != nullptr) - { - loading->addLoadingFunction(bind(&wiLua::RunText,wiLua::GetGlobal(),task)); - } - else - wiLua::SError(L, "AddLoader(string taskScript) component is not a LoadingScreenComponent!"); - } - else - wiLua::SError(L, "AddLoader(string taskScript) not enough arguments!"); - return 0; -} -int LoadingScreenComponent_BindLua::OnFinished(lua_State* L) -{ - int argc = wiLua::SGetArgCount(L); - if (argc > 0) - { - string task = wiLua::SGetString(L, 1); - LoadingScreenComponent* loading = dynamic_cast(component); - if (loading != nullptr) - { - loading->onFinished(bind(&wiLua::RunText, wiLua::GetGlobal(), task)); - } - else - wiLua::SError(L, "OnFinished(string taskScript) component is not a LoadingScreenComponent!"); - } - else - wiLua::SError(L, "OnFinished(string taskScript) not enough arguments!"); - return 0; -} - -void LoadingScreenComponent_BindLua::Bind() -{ - static bool initialized = false; - if (!initialized) - { - initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); - } -} diff --git a/WickedEngine/LoadingScreenComponent_BindLua.h b/WickedEngine/LoadingScreenComponent_BindLua.h deleted file mode 100644 index 842a4c997..000000000 --- a/WickedEngine/LoadingScreenComponent_BindLua.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#include "wiLua.h" -#include "wiLuna.h" -#include "LoadingScreenComponent.h" -#include "Renderable2DComponent_BindLua.h" - -class LoadingScreenComponent_BindLua : public Renderable2DComponent_BindLua -{ -public: - static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; - - LoadingScreenComponent_BindLua(LoadingScreenComponent* component = nullptr); - LoadingScreenComponent_BindLua(lua_State *L); - ~LoadingScreenComponent_BindLua(); - - int AddLoadingTask(lua_State* L); - int OnFinished(lua_State* L); - - static void Bind(); -}; - diff --git a/WickedEngine/LoadingScreen_BindLua.cpp b/WickedEngine/LoadingScreen_BindLua.cpp new file mode 100644 index 000000000..61a40c2f1 --- /dev/null +++ b/WickedEngine/LoadingScreen_BindLua.cpp @@ -0,0 +1,103 @@ +#include "LoadingScreen_BindLua.h" + +using namespace std; + +const char LoadingScreen_BindLua::className[] = "LoadingScreen"; + +Luna::FunctionType LoadingScreen_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + + lunamethod(LoadingScreen_BindLua, Initialize), + lunamethod(LoadingScreen_BindLua, Load), + lunamethod(LoadingScreen_BindLua, Unload), + lunamethod(LoadingScreen_BindLua, Start), + lunamethod(LoadingScreen_BindLua, Stop), + lunamethod(LoadingScreen_BindLua, FixedUpdate), + lunamethod(LoadingScreen_BindLua, Update), + lunamethod(LoadingScreen_BindLua, Render), + lunamethod(LoadingScreen_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), + + lunamethod(LoadingScreen_BindLua, AddLoadingTask), + lunamethod(LoadingScreen_BindLua, OnFinished), + { NULL, NULL } +}; +Luna::PropertyType LoadingScreen_BindLua::properties[] = { + { NULL, NULL } +}; + +LoadingScreen_BindLua::LoadingScreen_BindLua(LoadingScreen* component) +{ + this->component = component; +} + +LoadingScreen_BindLua::LoadingScreen_BindLua(lua_State *L) +{ + component = new LoadingScreen(); +} + +LoadingScreen_BindLua::~LoadingScreen_BindLua() +{ +} + +int LoadingScreen_BindLua::AddLoadingTask(lua_State* L) +{ + int argc = wiLua::SGetArgCount(L); + if (argc > 0) + { + string task = wiLua::SGetString(L, 1); + LoadingScreen* loading = dynamic_cast(component); + if (loading != nullptr) + { + loading->addLoadingFunction(bind(&wiLua::RunText,wiLua::GetGlobal(),task)); + } + else + wiLua::SError(L, "AddLoader(string taskScript) component is not a LoadingScreen!"); + } + else + wiLua::SError(L, "AddLoader(string taskScript) not enough arguments!"); + return 0; +} +int LoadingScreen_BindLua::OnFinished(lua_State* L) +{ + int argc = wiLua::SGetArgCount(L); + if (argc > 0) + { + string task = wiLua::SGetString(L, 1); + LoadingScreen* loading = dynamic_cast(component); + if (loading != nullptr) + { + loading->onFinished(bind(&wiLua::RunText, wiLua::GetGlobal(), task)); + } + else + wiLua::SError(L, "OnFinished(string taskScript) component is not a LoadingScreen!"); + } + else + wiLua::SError(L, "OnFinished(string taskScript) not enough arguments!"); + return 0; +} + +void LoadingScreen_BindLua::Bind() +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + Luna::Register(wiLua::GetGlobal()->GetLuaState()); + } +} diff --git a/WickedEngine/LoadingScreen_BindLua.h b/WickedEngine/LoadingScreen_BindLua.h new file mode 100644 index 000000000..e2560b1af --- /dev/null +++ b/WickedEngine/LoadingScreen_BindLua.h @@ -0,0 +1,23 @@ +#pragma once +#include "wiLua.h" +#include "wiLuna.h" +#include "LoadingScreen.h" +#include "RenderPath2D_BindLua.h" + +class LoadingScreen_BindLua : public RenderPath2D_BindLua +{ +public: + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + LoadingScreen_BindLua(LoadingScreen* component = nullptr); + LoadingScreen_BindLua(lua_State *L); + ~LoadingScreen_BindLua(); + + int AddLoadingTask(lua_State* L); + int OnFinished(lua_State* L); + + static void Bind(); +}; + diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp index cfa1f5a8a..f17afeb33 100644 --- a/WickedEngine/MainComponent.cpp +++ b/WickedEngine/MainComponent.cpp @@ -1,5 +1,5 @@ #include "MainComponent.h" -#include "RenderableComponent.h" +#include "RenderPath.h" #include "wiRenderer.h" #include "wiHelper.h" #include "wiTimer.h" @@ -79,7 +79,7 @@ void MainComponent::Initialize() wiLua::GetGlobal()->RegisterObject(MainComponent_BindLua::className, "main", new MainComponent_BindLua(this)); } -void MainComponent::activateComponent(RenderableComponent* component, float fadeSeconds, const wiColor& fadeColor) +void MainComponent::ActivatePath(RenderPath* component, float fadeSeconds, const wiColor& fadeColor) { if (component == nullptr) { @@ -205,9 +205,9 @@ void MainComponent::Update(float dt) { wiCpuInfo::UpdateFrame(); - if (getActiveComponent() != nullptr) + if (GetActivePath() != nullptr) { - getActiveComponent()->Update(dt); + GetActivePath()->Update(dt); } wiLua::GetGlobal()->Update(); @@ -218,9 +218,9 @@ void MainComponent::FixedUpdate() wiBackLog::Update(); wiLua::GetGlobal()->FixedUpdate(); - if (getActiveComponent() != nullptr) + if (GetActivePath() != nullptr) { - getActiveComponent()->FixedUpdate(); + GetActivePath()->FixedUpdate(); } } @@ -232,18 +232,18 @@ void MainComponent::Render() wiRenderer::BindPersistentState(GRAPHICSTHREAD_IMMEDIATE); wiImage::BindPersistentState(GRAPHICSTHREAD_IMMEDIATE); wiFont::BindPersistentState(GRAPHICSTHREAD_IMMEDIATE); - if (getActiveComponent() != nullptr) + if (GetActivePath() != nullptr) { - getActiveComponent()->Render(); + GetActivePath()->Render(); } wiProfiler::EndRange(GRAPHICSTHREAD_IMMEDIATE); // GPU Frame } void MainComponent::Compose() { - if (getActiveComponent() != nullptr) + if (GetActivePath() != nullptr) { - getActiveComponent()->Compose(); + GetActivePath()->Compose(); } if (fadeManager.IsActive()) diff --git a/WickedEngine/MainComponent.h b/WickedEngine/MainComponent.h index 7e7dd89a5..4d8472a2f 100644 --- a/WickedEngine/MainComponent.h +++ b/WickedEngine/MainComponent.h @@ -5,12 +5,12 @@ #include "wiFadeManager.h" #include "wiWindowRegistration.h" -class RenderableComponent; +class RenderPath; class MainComponent { protected: - RenderableComponent* activeComponent = nullptr; + RenderPath* activeComponent = nullptr; float targetFrameRate = 60; bool frameskip = true; bool initialized = false; @@ -28,10 +28,10 @@ public: // Runs the main engine loop void Run(); - // This will activate a RenderableComponent as the active one, so it will run its Update, FixedUpdate, Render and Compose functions + // This will activate a RenderPath as the active one, so it will run its Update, FixedUpdate, Render and Compose functions // You can set a fade time and fade screen color so that switching components will happen when the screen is faded out. Then it will fade back to the new component - void activateComponent(RenderableComponent* component, float fadeSeconds = 0, const wiColor& fadeColor = wiColor(0,0,0,255)); - inline RenderableComponent* getActiveComponent(){ return activeComponent; } + void ActivatePath(RenderPath* component, float fadeSeconds = 0, const wiColor& fadeColor = wiColor(0,0,0,255)); + inline RenderPath* GetActivePath(){ return activeComponent; } // You can use this as a self-contained resource manager if you want to avoid using the wiResourceManager::GetGlobal() wiResourceManager Content; @@ -48,13 +48,13 @@ public: // This is where the critical initializations happen (before any rendering or anything else) virtual void Initialize(); // This is where application-wide updates get executed once per frame. - // RenderableComponent::Update is also called from here for the active component + // RenderPath::Update is also called from here for the active component virtual void Update(float dt); // This is where application-wide updates get executed in a fixed timestep based manner. - // RenderableComponent::FixedUpdate is also called from here for the active component + // RenderPath::FixedUpdate is also called from here for the active component virtual void FixedUpdate(); // This is where application-wide rendering happens to offscreen buffers. - // RenderableComponent::Render is also called from here for the active component + // RenderPath::Render is also called from here for the active component virtual void Render(); // This is where the application will render to the screen (backbuffer) virtual void Compose(); diff --git a/WickedEngine/MainComponent_BindLua.cpp b/WickedEngine/MainComponent_BindLua.cpp index e52a9c68d..46399a385 100644 --- a/WickedEngine/MainComponent_BindLua.cpp +++ b/WickedEngine/MainComponent_BindLua.cpp @@ -1,12 +1,12 @@ #include "MainComponent_BindLua.h" -#include "RenderableComponent_BindLua.h" -#include "Renderable3DComponent_BindLua.h" -#include "Renderable2DComponent_BindLua.h" -#include "DeferredRenderableComponent_BindLua.h" -#include "ForwardRenderableComponent_BindLua.h" -#include "TiledForwardRenderableComponent_BindLua.h" -#include "TiledDeferredRenderableComponent_BindLua.h" -#include "LoadingScreenComponent_BindLua.h" +#include "RenderPath_BindLua.h" +#include "RenderPath3D_BindLua.h" +#include "RenderPath2D_BindLua.h" +#include "RenderPath3D_Deferred_BindLua.h" +#include "RenderPath3D_Forward_BindLua.h" +#include "RenderPath3D_TiledForward_BindLua.h" +#include "RenderPath3D_TiledDeferred_BindLua.h" +#include "LoadingScreen_BindLua.h" #include "wiResourceManager_BindLua.h" #include "wiProfiler.h" @@ -14,8 +14,8 @@ const char MainComponent_BindLua::className[] = "MainComponent"; Luna::FunctionType MainComponent_BindLua::methods[] = { lunamethod(MainComponent_BindLua, GetContent), - lunamethod(MainComponent_BindLua, GetActiveComponent), - lunamethod(MainComponent_BindLua, SetActiveComponent), + lunamethod(MainComponent_BindLua, GetActivePath), + lunamethod(MainComponent_BindLua, SetActivePath), lunamethod(MainComponent_BindLua, SetFrameSkip), lunamethod(MainComponent_BindLua, SetInfoDisplay), lunamethod(MainComponent_BindLua, SetWatermarkDisplay), @@ -51,86 +51,86 @@ int MainComponent_BindLua::GetContent(lua_State *L) Luna::push(L, new wiResourceManager_BindLua(&component->Content)); return 1; } -int MainComponent_BindLua::GetActiveComponent(lua_State *L) +int MainComponent_BindLua::GetActivePath(lua_State *L) { if (component == nullptr) { - wiLua::SError(L, "GetActiveComponent() component is empty!"); + wiLua::SError(L, "GetActivePath() component is empty!"); return 0; } //return deferred 3d component if the active one is of that type - DeferredRenderableComponent* compDef3D = dynamic_cast(component->getActiveComponent()); + RenderPath3D_Deferred* compDef3D = dynamic_cast(component->GetActivePath()); if (compDef3D != nullptr) { - Luna::push(L, new DeferredRenderableComponent_BindLua(compDef3D)); + Luna::push(L, new RenderPath3D_Deferred_BindLua(compDef3D)); return 1; } //return tiled deferred 3d component if the active one is of that type - TiledDeferredRenderableComponent* compTDef3D = dynamic_cast(component->getActiveComponent()); + RenderPath3D_TiledDeferred* compTDef3D = dynamic_cast(component->GetActivePath()); if (compTDef3D != nullptr) { - Luna::push(L, new TiledDeferredRenderableComponent_BindLua(compTDef3D)); + Luna::push(L, new RenderPath3D_TiledDeferred_BindLua(compTDef3D)); return 1; } //return tiled forward 3d component if the active one is of that type - TiledForwardRenderableComponent* compTFwd3D = dynamic_cast(component->getActiveComponent()); + RenderPath3D_TiledForward* compTFwd3D = dynamic_cast(component->GetActivePath()); if (compTFwd3D != nullptr) { - Luna::push(L, new TiledForwardRenderableComponent_BindLua(compTFwd3D)); + Luna::push(L, new RenderPath3D_TiledForward_BindLua(compTFwd3D)); return 1; } //return forward 3d component if the active one is of that type - ForwardRenderableComponent* compFwd3D = dynamic_cast(component->getActiveComponent()); + RenderPath3D_Forward* compFwd3D = dynamic_cast(component->GetActivePath()); if (compFwd3D != nullptr) { - Luna::push(L, new ForwardRenderableComponent_BindLua(compFwd3D)); + Luna::push(L, new RenderPath3D_Forward_BindLua(compFwd3D)); return 1; } //return 3d component if the active one is of that type - Renderable3DComponent* comp3D = dynamic_cast(component->getActiveComponent()); + RenderPath3D* comp3D = dynamic_cast(component->GetActivePath()); if (comp3D != nullptr) { - Luna::push(L, new Renderable3DComponent_BindLua(comp3D)); + Luna::push(L, new RenderPath3D_BindLua(comp3D)); return 1; } //return loading component if the active one is of that type - LoadingScreenComponent* compLoad = dynamic_cast(component->getActiveComponent()); + LoadingScreen* compLoad = dynamic_cast(component->GetActivePath()); if (compLoad != nullptr) { - Luna::push(L, new LoadingScreenComponent_BindLua(compLoad)); + Luna::push(L, new LoadingScreen_BindLua(compLoad)); return 1; } //return 2d component if the active one is of that type - Renderable2DComponent* comp2D = dynamic_cast(component->getActiveComponent()); + RenderPath2D* comp2D = dynamic_cast(component->GetActivePath()); if (comp2D != nullptr) { - Luna::push(L, new Renderable2DComponent_BindLua(comp2D)); + Luna::push(L, new RenderPath2D_BindLua(comp2D)); return 1; } //return component if the active one is of that type - RenderableComponent* comp = dynamic_cast(component->getActiveComponent()); + RenderPath* comp = dynamic_cast(component->GetActivePath()); if (comp != nullptr) { - Luna::push(L, new RenderableComponent_BindLua(comp)); + Luna::push(L, new RenderPath_BindLua(comp)); return 1; } - wiLua::SError(L, "GetActiveComponent() Warning: type of active component not registered!"); + wiLua::SError(L, "GetActivePath() Warning: type of active component not registered!"); return 0; } -int MainComponent_BindLua::SetActiveComponent(lua_State *L) +int MainComponent_BindLua::SetActivePath(lua_State *L) { if (component == nullptr) { - wiLua::SError(L, "SetActiveComponent(RenderableComponent component) component is empty!"); + wiLua::SError(L, "SetActivePath(RenderPath component) component is empty!"); return 0; } @@ -156,65 +156,65 @@ int MainComponent_BindLua::SetActiveComponent(lua_State *L) } } - ForwardRenderableComponent_BindLua* compFwd3D = Luna::lightcheck(L, 1); + RenderPath3D_Forward_BindLua* compFwd3D = Luna::lightcheck(L, 1); if (compFwd3D != nullptr) { - component->activateComponent(compFwd3D->component, fadeSeconds, fadeColor); + component->ActivatePath(compFwd3D->component, fadeSeconds, fadeColor); return 0; } - DeferredRenderableComponent_BindLua* compDef3D = Luna::lightcheck(L, 1); + RenderPath3D_Deferred_BindLua* compDef3D = Luna::lightcheck(L, 1); if (compDef3D != nullptr) { - component->activateComponent(compDef3D->component, fadeSeconds, fadeColor); + component->ActivatePath(compDef3D->component, fadeSeconds, fadeColor); return 0; } - TiledDeferredRenderableComponent_BindLua* compTDef3D = Luna::lightcheck(L, 1); + RenderPath3D_TiledDeferred_BindLua* compTDef3D = Luna::lightcheck(L, 1); if (compTDef3D != nullptr) { - component->activateComponent(compTDef3D->component, fadeSeconds, fadeColor); + component->ActivatePath(compTDef3D->component, fadeSeconds, fadeColor); return 0; } - TiledForwardRenderableComponent_BindLua* compTFwd3D = Luna::lightcheck(L, 1); + RenderPath3D_TiledForward_BindLua* compTFwd3D = Luna::lightcheck(L, 1); if (compTFwd3D != nullptr) { - component->activateComponent(compTFwd3D->component, fadeSeconds, fadeColor); + component->ActivatePath(compTFwd3D->component, fadeSeconds, fadeColor); return 0; } - Renderable3DComponent_BindLua* comp3D = Luna::lightcheck(L, 1); + RenderPath3D_BindLua* comp3D = Luna::lightcheck(L, 1); if (comp3D != nullptr) { - component->activateComponent(comp3D->component, fadeSeconds, fadeColor); + component->ActivatePath(comp3D->component, fadeSeconds, fadeColor); return 0; } - LoadingScreenComponent_BindLua* compLoad = Luna::lightcheck(L, 1); + LoadingScreen_BindLua* compLoad = Luna::lightcheck(L, 1); if (compLoad != nullptr) { - component->activateComponent(compLoad->component, fadeSeconds, fadeColor); + component->ActivatePath(compLoad->component, fadeSeconds, fadeColor); return 0; } - Renderable2DComponent_BindLua* comp2D = Luna::lightcheck(L, 1); + RenderPath2D_BindLua* comp2D = Luna::lightcheck(L, 1); if (comp2D != nullptr) { - component->activateComponent(comp2D->component, fadeSeconds, fadeColor); + component->ActivatePath(comp2D->component, fadeSeconds, fadeColor); return 0; } - RenderableComponent_BindLua* comp = Luna::lightcheck(L, 1); + RenderPath_BindLua* comp = Luna::lightcheck(L, 1); if (comp != nullptr) { - component->activateComponent(comp->component, fadeSeconds, fadeColor); + component->ActivatePath(comp->component, fadeSeconds, fadeColor); return 0; } } else { - wiLua::SError(L, "SetActiveComponent(RenderableComponent component, opt int fadeFrames,fadeColorR,fadeColorG,fadeColorB) not enought arguments!"); + wiLua::SError(L, "SetActivePath(RenderPath component, opt int fadeFrames,fadeColorR,fadeColorG,fadeColorB) not enought arguments!"); return 0; } return 0; diff --git a/WickedEngine/MainComponent_BindLua.h b/WickedEngine/MainComponent_BindLua.h index a78e7b902..d208fcd66 100644 --- a/WickedEngine/MainComponent_BindLua.h +++ b/WickedEngine/MainComponent_BindLua.h @@ -17,8 +17,8 @@ public: ~MainComponent_BindLua(); int GetContent(lua_State *L); - int GetActiveComponent(lua_State *L); - int SetActiveComponent(lua_State *L); + int GetActivePath(lua_State *L); + int SetActivePath(lua_State *L); int SetFrameSkip(lua_State *L); int SetInfoDisplay(lua_State *L); int SetWatermarkDisplay(lua_State *L); diff --git a/WickedEngine/PathTracingRenderableComponent.h b/WickedEngine/PathTracingRenderableComponent.h deleted file mode 100644 index ec1491878..000000000 --- a/WickedEngine/PathTracingRenderableComponent.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once -#include "Renderable3DComponent.h" - - -class PathTracingRenderableComponent : - public Renderable3DComponent -{ -private: - int sam = -1; - -protected: - static wiGraphicsTypes::Texture2D* traceResult; - static wiRenderTarget rtAccumulation; - - virtual void ResizeBuffers(); - - virtual void RenderFrameSetUp(GRAPHICSTHREAD threadID) override; - virtual void RenderScene(GRAPHICSTHREAD threadID) override; - -public: - PathTracingRenderableComponent(); - virtual ~PathTracingRenderableComponent(); - - virtual wiDepthTarget* GetDepthBuffer() override { return nullptr; }; - - virtual void Initialize() override; - virtual void Load() override; - virtual void Start() override; - virtual void Update(float dt) override; - virtual void Render() override; - virtual void Compose() override; -}; diff --git a/WickedEngine/RenderableComponent.cpp b/WickedEngine/RenderPath.cpp similarity index 54% rename from WickedEngine/RenderableComponent.cpp rename to WickedEngine/RenderPath.cpp index b5d19360a..22352eeb0 100644 --- a/WickedEngine/RenderableComponent.cpp +++ b/WickedEngine/RenderPath.cpp @@ -1,7 +1,7 @@ -#include "Renderable2DComponent.h" +#include "RenderPath2D.h" #include "wiRenderer.h" -void RenderableComponent::Update(float dt) +void RenderPath::Update(float dt) { if (wiRenderer::ResolutionChanged()) { @@ -9,14 +9,14 @@ void RenderableComponent::Update(float dt) } } -void RenderableComponent::Start() { +void RenderPath::Start() { if (onStart != nullptr) { onStart(); } }; -void RenderableComponent::Stop() { +void RenderPath::Stop() { if (onStop != nullptr) { onStop(); diff --git a/WickedEngine/RenderableComponent.h b/WickedEngine/RenderPath.h similarity index 92% rename from WickedEngine/RenderableComponent.h rename to WickedEngine/RenderPath.h index 8f6bd8638..8fe6c256f 100644 --- a/WickedEngine/RenderableComponent.h +++ b/WickedEngine/RenderPath.h @@ -4,7 +4,7 @@ #include "wiDepthTarget.h" #include "wiResourceManager.h" -class RenderableComponent +class RenderPath { private: uint32_t layerMask = 0xFFFFFFFF; @@ -17,8 +17,8 @@ public: std::function onStart; std::function onStop; - RenderableComponent(){} - virtual ~RenderableComponent() { Unload(); } + RenderPath(){} + virtual ~RenderPath() { Unload(); } // initialize component virtual void Initialize() {} diff --git a/WickedEngine/Renderable2DComponent.cpp b/WickedEngine/RenderPath2D.cpp similarity index 75% rename from WickedEngine/Renderable2DComponent.cpp rename to WickedEngine/RenderPath2D.cpp index 4e3470185..14e424e1b 100644 --- a/WickedEngine/Renderable2DComponent.cpp +++ b/WickedEngine/RenderPath2D.cpp @@ -1,4 +1,4 @@ -#include "Renderable2DComponent.h" +#include "RenderPath2D.h" #include "wiResourceManager.h" #include "wiSprite.h" #include "wiFont.h" @@ -6,20 +6,20 @@ using namespace wiGraphicsTypes; -Renderable2DComponent::Renderable2DComponent() : RenderableComponent() +RenderPath2D::RenderPath2D() : RenderPath() { addLayer(DEFAULT_RENDERLAYER); GUI = wiGUI(GRAPHICSTHREAD_IMMEDIATE); } -Renderable2DComponent::~Renderable2DComponent() +RenderPath2D::~RenderPath2D() { Unload(); } -wiRenderTarget Renderable2DComponent::rtFinal; -void Renderable2DComponent::ResizeBuffers() +wiRenderTarget RenderPath2D::rtFinal; +void RenderPath2D::ResizeBuffers() { wiRenderer::GetDevice()->WaitForGPU(); @@ -44,18 +44,18 @@ void Renderable2DComponent::ResizeBuffers() rtFinal.Initialize(wiRenderer::GetDevice()->GetScreenWidth(), wiRenderer::GetDevice()->GetScreenHeight(), false, defaultTextureFormat); } -void Renderable2DComponent::Initialize() +void RenderPath2D::Initialize() { ResizeBuffers(); - RenderableComponent::Initialize(); + RenderPath::Initialize(); } -void Renderable2DComponent::Load() +void RenderPath2D::Load() { - RenderableComponent::Load(); + RenderPath::Load(); } -void Renderable2DComponent::Unload() +void RenderPath2D::Unload() { for (auto& x : layers) { @@ -74,19 +74,19 @@ void Renderable2DComponent::Unload() } } - RenderableComponent::Unload(); + RenderPath::Unload(); } -void Renderable2DComponent::Start() +void RenderPath2D::Start() { - RenderableComponent::Start(); + RenderPath::Start(); } -void Renderable2DComponent::Update(float dt) +void RenderPath2D::Update(float dt) { GetGUI().Update(dt); - RenderableComponent::Update(dt); + RenderPath::Update(dt); } -void Renderable2DComponent::FixedUpdate() +void RenderPath2D::FixedUpdate() { for (auto& x : layers) @@ -100,9 +100,9 @@ void Renderable2DComponent::FixedUpdate() } } - RenderableComponent::FixedUpdate(); + RenderPath::FixedUpdate(); } -void Renderable2DComponent::Render() +void RenderPath2D::Render() { rtFinal.Activate(GRAPHICSTHREAD_IMMEDIATE, 0.0f, 0.0f, 0.0f, 0.0f); @@ -125,9 +125,9 @@ void Renderable2DComponent::Render() GetGUI().Render(); - RenderableComponent::Render(); + RenderPath::Render(); } -void Renderable2DComponent::Compose() +void RenderPath2D::Compose() { wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.presentFullScreen = true; @@ -135,11 +135,11 @@ void Renderable2DComponent::Compose() wiImage::Draw(rtFinal.GetTexture(), fx, GRAPHICSTHREAD_IMMEDIATE); - RenderableComponent::Compose(); + RenderPath::Compose(); } -void Renderable2DComponent::addSprite(wiSprite* sprite, const std::string& layer) +void RenderPath2D::addSprite(wiSprite* sprite, const std::string& layer) { for (auto& x : layers) { @@ -152,7 +152,7 @@ void Renderable2DComponent::addSprite(wiSprite* sprite, const std::string& layer } SortLayers(); } -void Renderable2DComponent::removeSprite(wiSprite* sprite) +void RenderPath2D::removeSprite(wiSprite* sprite) { for (auto& x : layers) { @@ -166,7 +166,7 @@ void Renderable2DComponent::removeSprite(wiSprite* sprite) } CleanLayers(); } -void Renderable2DComponent::clearSprites() +void RenderPath2D::clearSprites() { for (auto& x : layers) { @@ -177,7 +177,7 @@ void Renderable2DComponent::clearSprites() } CleanLayers(); } -int Renderable2DComponent::getSpriteOrder(wiSprite* sprite) +int RenderPath2D::getSpriteOrder(wiSprite* sprite) { for (auto& x : layers) { @@ -192,7 +192,7 @@ int Renderable2DComponent::getSpriteOrder(wiSprite* sprite) return 0; } -void Renderable2DComponent::addFont(wiFont* font, const std::string& layer) +void RenderPath2D::addFont(wiFont* font, const std::string& layer) { for (auto& x : layers) { @@ -205,7 +205,7 @@ void Renderable2DComponent::addFont(wiFont* font, const std::string& layer) } SortLayers(); } -void Renderable2DComponent::removeFont(wiFont* font) +void RenderPath2D::removeFont(wiFont* font) { for (auto& x : layers) { @@ -219,7 +219,7 @@ void Renderable2DComponent::removeFont(wiFont* font) } CleanLayers(); } -void Renderable2DComponent::clearFonts() +void RenderPath2D::clearFonts() { for (auto& x : layers) { @@ -230,7 +230,7 @@ void Renderable2DComponent::clearFonts() } CleanLayers(); } -int Renderable2DComponent::getFontOrder(wiFont* font) +int RenderPath2D::getFontOrder(wiFont* font) { for (auto& x : layers) { @@ -246,7 +246,7 @@ int Renderable2DComponent::getFontOrder(wiFont* font) } -void Renderable2DComponent::addLayer(const std::string& name) +void RenderPath2D::addLayer(const std::string& name) { for (auto& x : layers) { @@ -258,7 +258,7 @@ void Renderable2DComponent::addLayer(const std::string& name) layers.push_back(layer); layers.back().items.clear(); } -void Renderable2DComponent::setLayerOrder(const std::string& name, int order) +void RenderPath2D::setLayerOrder(const std::string& name, int order) { for (auto& x : layers) { @@ -270,7 +270,7 @@ void Renderable2DComponent::setLayerOrder(const std::string& name, int order) } SortLayers(); } -void Renderable2DComponent::SetSpriteOrder(wiSprite* sprite, int order) +void RenderPath2D::SetSpriteOrder(wiSprite* sprite, int order) { for (auto& x : layers) { @@ -284,7 +284,7 @@ void Renderable2DComponent::SetSpriteOrder(wiSprite* sprite, int order) } SortLayers(); } -void Renderable2DComponent::SetFontOrder(wiFont* font, int order) +void RenderPath2D::SetFontOrder(wiFont* font, int order) { for (auto& x : layers) { @@ -298,7 +298,7 @@ void Renderable2DComponent::SetFontOrder(wiFont* font, int order) } SortLayers(); } -void Renderable2DComponent::SortLayers() +void RenderPath2D::SortLayers() { if (layers.empty()) { @@ -338,7 +338,7 @@ void Renderable2DComponent::SortLayers() } } -void Renderable2DComponent::CleanLayers() +void RenderPath2D::CleanLayers() { for (auto& x : layers) { diff --git a/WickedEngine/Renderable2DComponent.h b/WickedEngine/RenderPath2D.h similarity index 91% rename from WickedEngine/Renderable2DComponent.h rename to WickedEngine/RenderPath2D.h index 204ae88bf..717e5eb1f 100644 --- a/WickedEngine/Renderable2DComponent.h +++ b/WickedEngine/RenderPath2D.h @@ -1,5 +1,5 @@ #pragma once -#include "RenderableComponent.h" +#include "RenderPath.h" #include "wiGUI.h" #include @@ -29,8 +29,8 @@ struct RenderLayer2D RenderLayer2D(const std::string& name) :name(name) {} }; -class Renderable2DComponent : - public RenderableComponent +class RenderPath2D : + public RenderPath { private: static wiRenderTarget rtFinal; @@ -40,8 +40,8 @@ private: protected: void ResizeBuffers() override; public: - Renderable2DComponent(); - virtual ~Renderable2DComponent(); + RenderPath2D(); + virtual ~RenderPath2D(); void Initialize() override; void Load() override; diff --git a/WickedEngine/Renderable2DComponent_BindLua.cpp b/WickedEngine/RenderPath2D_BindLua.cpp similarity index 58% rename from WickedEngine/Renderable2DComponent_BindLua.cpp rename to WickedEngine/RenderPath2D_BindLua.cpp index 555b630c5..ed9bb75a5 100644 --- a/WickedEngine/Renderable2DComponent_BindLua.cpp +++ b/WickedEngine/RenderPath2D_BindLua.cpp @@ -1,4 +1,4 @@ -#include "Renderable2DComponent_BindLua.h" +#include "RenderPath2D_BindLua.h" #include "wiResourceManager_BindLua.h" #include "wiSprite_BindLua.h" #include "wiFont_BindLua.h" @@ -7,58 +7,58 @@ using namespace std; -const char Renderable2DComponent_BindLua::className[] = "Renderable2DComponent"; +const char RenderPath2D_BindLua::className[] = "RenderPath2D"; -Luna::FunctionType Renderable2DComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, GetContent), - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - lunamethod(Renderable2DComponent_BindLua, Initialize), - lunamethod(Renderable2DComponent_BindLua, Load), - lunamethod(Renderable2DComponent_BindLua, Unload), - lunamethod(Renderable2DComponent_BindLua, Start), - lunamethod(Renderable2DComponent_BindLua, Stop), - lunamethod(Renderable2DComponent_BindLua, FixedUpdate), - lunamethod(Renderable2DComponent_BindLua, Update), - lunamethod(Renderable2DComponent_BindLua, Render), - lunamethod(Renderable2DComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), +Luna::FunctionType RenderPath2D_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, GetContent), + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + lunamethod(RenderPath2D_BindLua, Initialize), + lunamethod(RenderPath2D_BindLua, Load), + lunamethod(RenderPath2D_BindLua, Unload), + lunamethod(RenderPath2D_BindLua, Start), + lunamethod(RenderPath2D_BindLua, Stop), + lunamethod(RenderPath2D_BindLua, FixedUpdate), + lunamethod(RenderPath2D_BindLua, Update), + lunamethod(RenderPath2D_BindLua, Render), + lunamethod(RenderPath2D_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), { NULL, NULL } }; -Luna::PropertyType Renderable2DComponent_BindLua::properties[] = { +Luna::PropertyType RenderPath2D_BindLua::properties[] = { { NULL, NULL } }; -Renderable2DComponent_BindLua::Renderable2DComponent_BindLua(Renderable2DComponent* component) +RenderPath2D_BindLua::RenderPath2D_BindLua(RenderPath2D* component) { this->component = component; } -Renderable2DComponent_BindLua::Renderable2DComponent_BindLua(lua_State *L) +RenderPath2D_BindLua::RenderPath2D_BindLua(lua_State *L) { - component = new Renderable2DComponent(); + component = new RenderPath2D(); } -Renderable2DComponent_BindLua::~Renderable2DComponent_BindLua() +RenderPath2D_BindLua::~RenderPath2D_BindLua() { } -int Renderable2DComponent_BindLua::AddSprite(lua_State *L) +int RenderPath2D_BindLua::AddSprite(lua_State *L) { if (component == nullptr) { @@ -71,7 +71,7 @@ int Renderable2DComponent_BindLua::AddSprite(lua_State *L) wiSprite_BindLua* sprite = Luna::lightcheck(L, 1); if (sprite != nullptr) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { if(argc>1) @@ -81,7 +81,7 @@ int Renderable2DComponent_BindLua::AddSprite(lua_State *L) } else { - wiLua::SError(L, "AddSprite(Sprite sprite, opt string layer) not a Renderable2DComponent!"); + wiLua::SError(L, "AddSprite(Sprite sprite, opt string layer) not a RenderPath2D!"); } } else @@ -93,7 +93,7 @@ int Renderable2DComponent_BindLua::AddSprite(lua_State *L) } return 0; } -int Renderable2DComponent_BindLua::AddFont(lua_State* L) +int RenderPath2D_BindLua::AddFont(lua_State* L) { if (component == nullptr) { @@ -106,7 +106,7 @@ int Renderable2DComponent_BindLua::AddFont(lua_State* L) wiFont_BindLua* font = Luna::lightcheck(L, 1); if (font != nullptr) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { if (argc > 1) @@ -116,7 +116,7 @@ int Renderable2DComponent_BindLua::AddFont(lua_State* L) } else { - wiLua::SError(L, "AddFont(Font font, opt string layer) not a Renderable2DComponent!"); + wiLua::SError(L, "AddFont(Font font, opt string layer) not a RenderPath2D!"); } } else @@ -128,7 +128,7 @@ int Renderable2DComponent_BindLua::AddFont(lua_State* L) } return 0; } -int Renderable2DComponent_BindLua::RemoveSprite(lua_State *L) +int RenderPath2D_BindLua::RemoveSprite(lua_State *L) { if (component == nullptr) { @@ -141,14 +141,14 @@ int Renderable2DComponent_BindLua::RemoveSprite(lua_State *L) wiSprite_BindLua* sprite = Luna::lightcheck(L, 1); if (sprite != nullptr) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { ccomp->removeSprite(sprite->sprite); } else { - wiLua::SError(L, "RemoveSprite(Sprite sprite) not a Renderable2DComponent!"); + wiLua::SError(L, "RemoveSprite(Sprite sprite) not a RenderPath2D!"); } } else @@ -160,7 +160,7 @@ int Renderable2DComponent_BindLua::RemoveSprite(lua_State *L) } return 0; } -int Renderable2DComponent_BindLua::RemoveFont(lua_State* L) +int RenderPath2D_BindLua::RemoveFont(lua_State* L) { if (component == nullptr) { @@ -173,14 +173,14 @@ int Renderable2DComponent_BindLua::RemoveFont(lua_State* L) wiFont_BindLua* font = Luna::lightcheck(L, 1); if (font != nullptr) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { ccomp->removeFont(font->font); } else { - wiLua::SError(L, "RemoveFont(Font font) not a Renderable2DComponent!"); + wiLua::SError(L, "RemoveFont(Font font) not a RenderPath2D!"); } } else @@ -192,43 +192,43 @@ int Renderable2DComponent_BindLua::RemoveFont(lua_State* L) } return 0; } -int Renderable2DComponent_BindLua::ClearSprites(lua_State *L) +int RenderPath2D_BindLua::ClearSprites(lua_State *L) { if (component == nullptr) { wiLua::SError(L, "ClearSprites() component is empty!"); return 0; } - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { ccomp->clearSprites(); } else { - wiLua::SError(L, "ClearSprites() not a Renderable2DComponent!"); + wiLua::SError(L, "ClearSprites() not a RenderPath2D!"); } return 0; } -int Renderable2DComponent_BindLua::ClearFonts(lua_State* L) +int RenderPath2D_BindLua::ClearFonts(lua_State* L) { if (component == nullptr) { wiLua::SError(L, "ClearFonts() component is empty!"); return 0; } - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { ccomp->clearFonts(); } else { - wiLua::SError(L, "ClearFonts() not a Renderable2DComponent!"); + wiLua::SError(L, "ClearFonts() not a RenderPath2D!"); } return 0; } -int Renderable2DComponent_BindLua::GetSpriteOrder(lua_State* L) +int RenderPath2D_BindLua::GetSpriteOrder(lua_State* L) { if (component == nullptr) { @@ -241,7 +241,7 @@ int Renderable2DComponent_BindLua::GetSpriteOrder(lua_State* L) wiSprite_BindLua* sprite = Luna::lightcheck(L, 1); if (sprite != nullptr) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { wiLua::SSetInt(L, ccomp->getSpriteOrder(sprite->sprite)); @@ -249,7 +249,7 @@ int Renderable2DComponent_BindLua::GetSpriteOrder(lua_State* L) } else { - wiLua::SError(L, "GetSpriteOrder(Sprite sprite) not a Renderable2DComponent!"); + wiLua::SError(L, "GetSpriteOrder(Sprite sprite) not a RenderPath2D!"); } } else @@ -261,7 +261,7 @@ int Renderable2DComponent_BindLua::GetSpriteOrder(lua_State* L) } return 0; } -int Renderable2DComponent_BindLua::GetFontOrder(lua_State* L) +int RenderPath2D_BindLua::GetFontOrder(lua_State* L) { if (component == nullptr) { @@ -274,7 +274,7 @@ int Renderable2DComponent_BindLua::GetFontOrder(lua_State* L) wiFont_BindLua* font = Luna::lightcheck(L, 1); if (font != nullptr) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { wiLua::SSetInt(L, ccomp->getFontOrder(font->font)); @@ -282,7 +282,7 @@ int Renderable2DComponent_BindLua::GetFontOrder(lua_State* L) } else { - wiLua::SError(L, "GetFontOrder(Font font) not a Renderable2DComponent!"); + wiLua::SError(L, "GetFontOrder(Font font) not a RenderPath2D!"); } } else @@ -295,7 +295,7 @@ int Renderable2DComponent_BindLua::GetFontOrder(lua_State* L) return 0; } -int Renderable2DComponent_BindLua::AddLayer(lua_State* L) +int RenderPath2D_BindLua::AddLayer(lua_State* L) { if (component == nullptr) { @@ -305,14 +305,14 @@ int Renderable2DComponent_BindLua::AddLayer(lua_State* L) int argc = wiLua::SGetArgCount(L); if (argc > 0) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { ccomp->addLayer(wiLua::SGetString(L, 1)); } else { - wiLua::SError(L, "AddLayer(string name) not a Renderable2DComponent!"); + wiLua::SError(L, "AddLayer(string name) not a RenderPath2D!"); } } else @@ -321,7 +321,7 @@ int Renderable2DComponent_BindLua::AddLayer(lua_State* L) } return 0; } -int Renderable2DComponent_BindLua::GetLayers(lua_State* L) +int RenderPath2D_BindLua::GetLayers(lua_State* L) { if (component == nullptr) { @@ -329,7 +329,7 @@ int Renderable2DComponent_BindLua::GetLayers(lua_State* L) return 0; } - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { stringstream ss(""); @@ -342,12 +342,12 @@ int Renderable2DComponent_BindLua::GetLayers(lua_State* L) } else { - wiLua::SError(L, "GetLayers() not a Renderable2DComponent!"); + wiLua::SError(L, "GetLayers() not a RenderPath2D!"); } return 0; } -int Renderable2DComponent_BindLua::SetLayerOrder(lua_State* L) +int RenderPath2D_BindLua::SetLayerOrder(lua_State* L) { if (component == nullptr) { @@ -357,14 +357,14 @@ int Renderable2DComponent_BindLua::SetLayerOrder(lua_State* L) int argc = wiLua::SGetArgCount(L); if (argc > 1) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { ccomp->setLayerOrder(wiLua::SGetString(L, 1),wiLua::SGetInt(L,2)); } else { - wiLua::SError(L, "SetLayerOrder(string name, int order) not a Renderable2DComponent!"); + wiLua::SError(L, "SetLayerOrder(string name, int order) not a RenderPath2D!"); } } else @@ -373,7 +373,7 @@ int Renderable2DComponent_BindLua::SetLayerOrder(lua_State* L) } return 0; } -int Renderable2DComponent_BindLua::SetSpriteOrder(lua_State* L) +int RenderPath2D_BindLua::SetSpriteOrder(lua_State* L) { if (component == nullptr) { @@ -383,7 +383,7 @@ int Renderable2DComponent_BindLua::SetSpriteOrder(lua_State* L) int argc = wiLua::SGetArgCount(L); if (argc > 1) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { wiSprite_BindLua* sprite = Luna::lightcheck(L, 1); @@ -398,7 +398,7 @@ int Renderable2DComponent_BindLua::SetSpriteOrder(lua_State* L) } else { - wiLua::SError(L, "SetSpriteOrder(Sprite sprite, int order) not a Renderable2DComponent!"); + wiLua::SError(L, "SetSpriteOrder(Sprite sprite, int order) not a RenderPath2D!"); } } else @@ -407,7 +407,7 @@ int Renderable2DComponent_BindLua::SetSpriteOrder(lua_State* L) } return 0; } -int Renderable2DComponent_BindLua::SetFontOrder(lua_State* L) +int RenderPath2D_BindLua::SetFontOrder(lua_State* L) { if (component == nullptr) { @@ -417,7 +417,7 @@ int Renderable2DComponent_BindLua::SetFontOrder(lua_State* L) int argc = wiLua::SGetArgCount(L); if (argc > 1) { - Renderable2DComponent* ccomp = dynamic_cast(component); + RenderPath2D* ccomp = dynamic_cast(component); if (ccomp != nullptr) { wiFont_BindLua* font = Luna::lightcheck(L, 1); @@ -432,7 +432,7 @@ int Renderable2DComponent_BindLua::SetFontOrder(lua_State* L) } else { - wiLua::SError(L, "SetFontOrder(Font font, int order) not a Renderable2DComponent!"); + wiLua::SError(L, "SetFontOrder(Font font, int order) not a RenderPath2D!"); } } else @@ -442,12 +442,12 @@ int Renderable2DComponent_BindLua::SetFontOrder(lua_State* L) return 0; } -void Renderable2DComponent_BindLua::Bind() +void RenderPath2D_BindLua::Bind() { static bool initialized = false; if (!initialized) { initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); + Luna::Register(wiLua::GetGlobal()->GetLuaState()); } } \ No newline at end of file diff --git a/WickedEngine/Renderable2DComponent_BindLua.h b/WickedEngine/RenderPath2D_BindLua.h similarity index 54% rename from WickedEngine/Renderable2DComponent_BindLua.h rename to WickedEngine/RenderPath2D_BindLua.h index 1bf5de88d..07845da35 100644 --- a/WickedEngine/Renderable2DComponent_BindLua.h +++ b/WickedEngine/RenderPath2D_BindLua.h @@ -1,19 +1,19 @@ #pragma once #include "wiLua.h" #include "wiLuna.h" -#include "Renderable2DComponent.h" -#include "RenderableComponent_BindLua.h" +#include "RenderPath2D.h" +#include "RenderPath_BindLua.h" -class Renderable2DComponent_BindLua : public RenderableComponent_BindLua +class RenderPath2D_BindLua : public RenderPath_BindLua { public: static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; - Renderable2DComponent_BindLua(Renderable2DComponent* component = nullptr); - Renderable2DComponent_BindLua(lua_State *L); - ~Renderable2DComponent_BindLua(); + RenderPath2D_BindLua(RenderPath2D* component = nullptr); + RenderPath2D_BindLua(lua_State *L); + ~RenderPath2D_BindLua(); int AddSprite(lua_State *L); int AddFont(lua_State* L); diff --git a/WickedEngine/Renderable3DComponent.cpp b/WickedEngine/RenderPath3D.cpp similarity index 91% rename from WickedEngine/Renderable3DComponent.cpp rename to WickedEngine/RenderPath3D.cpp index 10ab8d4a3..819313f7e 100644 --- a/WickedEngine/Renderable3DComponent.cpp +++ b/WickedEngine/RenderPath3D.cpp @@ -1,4 +1,4 @@ -#include "Renderable3DComponent.h" +#include "RenderPath3D.h" #include "wiRenderer.h" #include "wiImage.h" #include "wiImageEffects.h" @@ -10,32 +10,32 @@ using namespace wiGraphicsTypes; -Renderable3DComponent::Renderable3DComponent() : Renderable2DComponent() +RenderPath3D::RenderPath3D() : RenderPath2D() { } -Renderable3DComponent::~Renderable3DComponent() +RenderPath3D::~RenderPath3D() { } wiRenderTarget - Renderable3DComponent::rtReflection - , Renderable3DComponent::rtSSR - , Renderable3DComponent::rtMotionBlur - , Renderable3DComponent::rtSceneCopy - , Renderable3DComponent::rtWaterRipple - , Renderable3DComponent::rtLinearDepth - , Renderable3DComponent::rtParticle - , Renderable3DComponent::rtVolumetricLights - , Renderable3DComponent::rtFinal[2] - , Renderable3DComponent::rtDof[3] - , Renderable3DComponent::rtTemporalAA[2] + RenderPath3D::rtReflection + , RenderPath3D::rtSSR + , RenderPath3D::rtMotionBlur + , RenderPath3D::rtSceneCopy + , RenderPath3D::rtWaterRipple + , RenderPath3D::rtLinearDepth + , RenderPath3D::rtParticle + , RenderPath3D::rtVolumetricLights + , RenderPath3D::rtFinal[2] + , RenderPath3D::rtDof[3] + , RenderPath3D::rtTemporalAA[2] ; -std::vector Renderable3DComponent::rtSun, Renderable3DComponent::rtBloom, Renderable3DComponent::rtSSAO; -wiDepthTarget Renderable3DComponent::dtDepthCopy; -Texture2D* Renderable3DComponent::smallDepth = nullptr; -void Renderable3DComponent::ResizeBuffers() +std::vector RenderPath3D::rtSun, RenderPath3D::rtBloom, RenderPath3D::rtSSAO; +wiDepthTarget RenderPath3D::dtDepthCopy; +Texture2D* RenderPath3D::smallDepth = nullptr; +void RenderPath3D::ResizeBuffers() { - Renderable2DComponent::ResizeBuffers(); + RenderPath2D::ResizeBuffers(); wiRenderer::GetDevice()->WaitForGPU(); @@ -156,7 +156,7 @@ void Renderable3DComponent::ResizeBuffers() wiRenderer::GetDevice()->CreateTexture2D(&desc, nullptr, &smallDepth); } -void Renderable3DComponent::setProperties() +void RenderPath3D::setProperties() { setLightShaftQuality(0.4f); setBloomDownSample(4.0f); @@ -195,34 +195,34 @@ void Renderable3DComponent::setProperties() setMSAASampleCount(1); } -void Renderable3DComponent::Initialize() +void RenderPath3D::Initialize() { - Renderable2DComponent::Initialize(); + RenderPath2D::Initialize(); } -void Renderable3DComponent::Load() +void RenderPath3D::Load() { - Renderable2DComponent::Load(); + RenderPath2D::Load(); } -void Renderable3DComponent::Start() +void RenderPath3D::Start() { - Renderable2DComponent::Start(); + RenderPath2D::Start(); } -void Renderable3DComponent::FixedUpdate() +void RenderPath3D::FixedUpdate() { - Renderable2DComponent::FixedUpdate(); + RenderPath2D::FixedUpdate(); } -void Renderable3DComponent::Update(float dt) +void RenderPath3D::Update(float dt) { wiRenderer::UpdatePerFrameData(dt); - Renderable2DComponent::Update(dt); + RenderPath2D::Update(dt); } -void Renderable3DComponent::Compose() +void RenderPath3D::Compose() { RenderColorGradedComposition(); @@ -231,10 +231,10 @@ void Renderable3DComponent::Compose() wiImage::Draw((Texture2D*)wiRenderer::GetTexture(TEXTYPE_2D_DEBUGUAV), wiImageEffects((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()), GRAPHICSTHREAD_IMMEDIATE); } - Renderable2DComponent::Compose(); + RenderPath2D::Compose(); } -void Renderable3DComponent::RenderFrameSetUp(GRAPHICSTHREAD threadID) +void RenderPath3D::RenderFrameSetUp(GRAPHICSTHREAD threadID) { wiRenderer::GetDevice()->BindResource(CS, dtDepthCopy.GetTexture(), TEXSLOT_DEPTH, threadID); wiRenderer::UpdateRenderData(threadID); @@ -254,7 +254,7 @@ void Renderable3DComponent::RenderFrameSetUp(GRAPHICSTHREAD threadID) wiRenderer::OcclusionCulling_Render(threadID); } -void Renderable3DComponent::RenderReflections(GRAPHICSTHREAD threadID) +void RenderPath3D::RenderReflections(GRAPHICSTHREAD threadID) { if (getStereogramEnabled()) { @@ -294,7 +294,7 @@ void Renderable3DComponent::RenderReflections(GRAPHICSTHREAD threadID) wiProfiler::EndRange(); // Reflection Rendering } -void Renderable3DComponent::RenderShadows(GRAPHICSTHREAD threadID) +void RenderPath3D::RenderShadows(GRAPHICSTHREAD threadID) { if (getStereogramEnabled()) { @@ -309,7 +309,7 @@ void Renderable3DComponent::RenderShadows(GRAPHICSTHREAD threadID) wiRenderer::VoxelRadiance(threadID); } -void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, GRAPHICSTHREAD threadID) +void RenderPath3D::RenderSecondaryScene(wiRenderTarget& mainRT, wiRenderTarget& shadedSceneRT, GRAPHICSTHREAD threadID) { wiImageEffects fx((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y); fx.hdr = true; @@ -446,7 +446,7 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende wiProfiler::EndRange(threadID); // Secondary Scene } -void Renderable3DComponent::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) +void RenderPath3D::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Transparent Scene", wiProfiler::DOMAIN_GPU, threadID); @@ -457,7 +457,7 @@ void Renderable3DComponent::RenderTransparentScene(wiRenderTarget& refractionRT, wiProfiler::EndRange(threadID); // Transparent Scene } -void Renderable3DComponent::RenderComposition(wiRenderTarget& shadedSceneRT, wiRenderTarget& mainRT, GRAPHICSTHREAD threadID) +void RenderPath3D::RenderComposition(wiRenderTarget& shadedSceneRT, wiRenderTarget& mainRT, GRAPHICSTHREAD threadID) { if (getStereogramEnabled()) { @@ -643,7 +643,7 @@ void Renderable3DComponent::RenderComposition(wiRenderTarget& shadedSceneRT, wiR wiProfiler::EndRange(threadID); // Post Processing 1 } -void Renderable3DComponent::RenderColorGradedComposition() +void RenderPath3D::RenderColorGradedComposition() { wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); fx.blendFlag = BLENDMODE_PREMULTIPLIED; diff --git a/WickedEngine/Renderable3DComponent.h b/WickedEngine/RenderPath3D.h similarity index 94% rename from WickedEngine/Renderable3DComponent.h rename to WickedEngine/RenderPath3D.h index abaf52e52..e0897f865 100644 --- a/WickedEngine/Renderable3DComponent.h +++ b/WickedEngine/RenderPath3D.h @@ -1,10 +1,10 @@ #pragma once -#include "Renderable2DComponent.h" +#include "RenderPath2D.h" #include "wiRenderer.h" #include "wiGraphicsDevice.h" -class Renderable3DComponent : - public Renderable2DComponent +class RenderPath3D : + public RenderPath2D { private: float lightShaftQuality; @@ -154,14 +154,14 @@ public: void setProperties(); - Renderable3DComponent(); - virtual ~Renderable3DComponent(); + RenderPath3D(); + virtual ~RenderPath3D(); - virtual void Initialize() override; - virtual void Load() override; - virtual void Start() override; - virtual void FixedUpdate() override; - virtual void Update(float dt) override; - virtual void Compose() override; + void Initialize() override; + void Load() override; + void Start() override; + void FixedUpdate() override; + void Update(float dt) override; + void Compose() override; }; diff --git a/WickedEngine/RenderPath3D_BindLua.cpp b/WickedEngine/RenderPath3D_BindLua.cpp new file mode 100644 index 000000000..800e7076b --- /dev/null +++ b/WickedEngine/RenderPath3D_BindLua.cpp @@ -0,0 +1,444 @@ +#include "RenderPath3D_BindLua.h" +#include "wiResourceManager_BindLua.h" +#include "Texture_BindLua.h" + +const char RenderPath3D_BindLua::className[] = "RenderPath3D"; + +Luna::FunctionType RenderPath3D_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + + lunamethod(RenderPath3D_BindLua, GetContent), + lunamethod(RenderPath3D_BindLua, Initialize), + lunamethod(RenderPath3D_BindLua, Load), + lunamethod(RenderPath3D_BindLua, Unload), + lunamethod(RenderPath3D_BindLua, Start), + lunamethod(RenderPath3D_BindLua, Stop), + lunamethod(RenderPath3D_BindLua, FixedUpdate), + lunamethod(RenderPath3D_BindLua, Update), + lunamethod(RenderPath3D_BindLua, Render), + lunamethod(RenderPath3D_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), + + lunamethod(RenderPath3D_BindLua, SetSSAOEnabled), + lunamethod(RenderPath3D_BindLua, SetSSREnabled), + lunamethod(RenderPath3D_BindLua, SetShadowsEnabled), + lunamethod(RenderPath3D_BindLua, SetReflectionsEnabled), + lunamethod(RenderPath3D_BindLua, SetFXAAEnabled), + lunamethod(RenderPath3D_BindLua, SetBloomEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingTexture), + lunamethod(RenderPath3D_BindLua, SetEmitterParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesReflectionEnabled), + lunamethod(RenderPath3D_BindLua, SetVolumeLightsEnabled), + lunamethod(RenderPath3D_BindLua, SetLightShaftsEnabled), + lunamethod(RenderPath3D_BindLua, SetLensFlareEnabled), + lunamethod(RenderPath3D_BindLua, SetMotionBlurEnabled), + lunamethod(RenderPath3D_BindLua, SetSSSEnabled), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldEnabled), + lunamethod(RenderPath3D_BindLua, SetStereogramEnabled), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionEnabled), + lunamethod(RenderPath3D_BindLua, SetTessellationEnabled), + lunamethod(RenderPath3D_BindLua, SetMSAASampleCount), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterAmount), + + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldFocus), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldStrength), + { NULL, NULL } +}; +Luna::PropertyType RenderPath3D_BindLua::properties[] = { + { NULL, NULL } +}; + +RenderPath3D_BindLua::RenderPath3D_BindLua(RenderPath3D* component) +{ + this->component = component; +} + +RenderPath3D_BindLua::RenderPath3D_BindLua(lua_State* L) +{ + component = nullptr; +} + +RenderPath3D_BindLua::~RenderPath3D_BindLua() +{ +} + + +int RenderPath3D_BindLua::SetSSAOEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetSSAOEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setSSAOEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetSSAOEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetSSREnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetSSREnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setSSREnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetSSREnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetShadowsEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetShadowsEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setShadowsEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetShadowsEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetReflectionsEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetShadowsEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setReflectionsEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetShadowsEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetFXAAEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetFXAAEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setFXAAEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetFXAAEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetBloomEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetBloomEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setBloomEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetBloomEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetColorGradingEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetColorGradingEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setColorGradingEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetColorGradingEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetColorGradingTexture(lua_State* L) +{ + int argc = wiLua::SGetArgCount(L); + if (argc > 0) + { + Texture_BindLua* tex = Luna::lightcheck(L, 1); + if (tex != nullptr) + { + ((RenderPath3D*)component)->setColorGradingTexture(tex->texture); + } + else + wiLua::SError(L, "SetColorGradingTexture(Texture texture2D) argument is not a texture!"); + } + else + wiLua::SError(L, "SetColorGradingTexture(Texture texture2D) not enough arguments!"); + + return 0; +} +int RenderPath3D_BindLua::SetEmitterParticlesEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetEmitterParticlesEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setEmitterParticlesEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetEmitterParticlesEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetHairParticlesEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetHairParticlesEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setHairParticlesEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetHairParticlesEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetHairParticlesReflectionEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetHairParticlesReflectionEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setHairParticlesReflectionEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetHairParticlesReflectionEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetVolumeLightsEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetVolumeLightsEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setVolumeLightsEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetVolumeLightsEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetLightShaftsEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetLightShaftsEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setLightShaftsEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetLightShaftsEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetLensFlareEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetLensFlareEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setLensFlareEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetLensFlareEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetMotionBlurEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetMotionBlurEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setMotionBlurEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetMotionBlurEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetSSSEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetSSSEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((RenderPath3D*)component)->setSSSEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetSSSEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetDepthOfFieldEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetDepthOfFieldEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setDepthOfFieldEnabled(wiLua::SGetBool(L, 1)); + } + else + wiLua::SError(L, "SetDepthOfFieldEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetStereogramEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetStereogramEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setStereogramEnabled(wiLua::SGetBool(L, 1)); + } + else + wiLua::SError(L, "SetStereogramEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetEyeAdaptionEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetEyeAdaptionEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setEyeAdaptionEnabled(wiLua::SGetBool(L, 1)); + } + else + wiLua::SError(L, "SetEyeAdaptionEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetTessellationEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetTessellationEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setTessellationEnabled(wiLua::SGetBool(L, 1)); + } + else + wiLua::SError(L, "SetTessellationEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetMSAASampleCount(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetMSAASampleCount(int value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setMSAASampleCount((UINT)wiLua::SGetInt(L, 1)); + } + else + wiLua::SError(L, "SetMSAASampleCount(int value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetSharpenFilterEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetSharpenFilterEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setSharpenFilterEnabled(wiLua::SGetBool(L, 1)); + } + else + wiLua::SError(L, "SetSharpenFilterEnabled(bool value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetSharpenFilterAmount(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetSharpenFilterAmount(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setSharpenFilterAmount(wiLua::SGetFloat(L, 1)); + } + else + wiLua::SError(L, "SetSharpenFilterAmount(bool value) not enough arguments!"); + return 0; +} + + +int RenderPath3D_BindLua::SetDepthOfFieldFocus(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetDepthOfFieldFocus(float value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setDepthOfFieldFocus(wiLua::SGetFloat(L, 1)); + } + else + wiLua::SError(L, "SetDepthOfFieldFocus(float value) not enough arguments!"); + return 0; +} +int RenderPath3D_BindLua::SetDepthOfFieldStrength(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetDepthOfFieldStrength(float value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setDepthOfFieldStrength(wiLua::SGetFloat(L, 1)); + } + else + wiLua::SError(L, "SetDepthOfFieldStrength(float value) not enough arguments!"); + return 0; +} + +void RenderPath3D_BindLua::Bind() +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + Luna::Register(wiLua::GetGlobal()->GetLuaState()); + } +} diff --git a/WickedEngine/Renderable3DComponent_BindLua.h b/WickedEngine/RenderPath3D_BindLua.h similarity index 71% rename from WickedEngine/Renderable3DComponent_BindLua.h rename to WickedEngine/RenderPath3D_BindLua.h index 5a7b53b5a..491f2473b 100644 --- a/WickedEngine/Renderable3DComponent_BindLua.h +++ b/WickedEngine/RenderPath3D_BindLua.h @@ -1,19 +1,19 @@ #pragma once #include "wiLua.h" #include "wiLuna.h" -#include "Renderable3DComponent.h" -#include "Renderable2DComponent_BindLua.h" +#include "RenderPath3D.h" +#include "RenderPath2D_BindLua.h" -class Renderable3DComponent_BindLua : public Renderable2DComponent_BindLua +class RenderPath3D_BindLua : public RenderPath2D_BindLua { public: static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; - Renderable3DComponent_BindLua(Renderable3DComponent* component = nullptr); - Renderable3DComponent_BindLua(lua_State* L); - ~Renderable3DComponent_BindLua(); + RenderPath3D_BindLua(RenderPath3D* component = nullptr); + RenderPath3D_BindLua(lua_State* L); + ~RenderPath3D_BindLua(); int SetSSAOEnabled(lua_State* L); int SetSSREnabled(lua_State* L); diff --git a/WickedEngine/DeferredRenderableComponent.cpp b/WickedEngine/RenderPath3D_Deferred.cpp similarity index 89% rename from WickedEngine/DeferredRenderableComponent.cpp rename to WickedEngine/RenderPath3D_Deferred.cpp index 1f6619880..03885b804 100644 --- a/WickedEngine/DeferredRenderableComponent.cpp +++ b/WickedEngine/RenderPath3D_Deferred.cpp @@ -1,4 +1,4 @@ -#include "DeferredRenderableComponent.h" +#include "RenderPath3D_Deferred.h" #include "wiRenderer.h" #include "wiImage.h" #include "wiImageEffects.h" @@ -10,20 +10,20 @@ using namespace wiGraphicsTypes; -wiRenderTarget DeferredRenderableComponent::rtGBuffer, DeferredRenderableComponent::rtDeferred, DeferredRenderableComponent::rtLight, DeferredRenderableComponent::rtSSS[2]; +wiRenderTarget RenderPath3D_Deferred::rtGBuffer, RenderPath3D_Deferred::rtDeferred, RenderPath3D_Deferred::rtLight, RenderPath3D_Deferred::rtSSS[2]; -DeferredRenderableComponent::DeferredRenderableComponent() +RenderPath3D_Deferred::RenderPath3D_Deferred() { - Renderable3DComponent::setProperties(); + RenderPath3D::setProperties(); } -DeferredRenderableComponent::~DeferredRenderableComponent() +RenderPath3D_Deferred::~RenderPath3D_Deferred() { } -void DeferredRenderableComponent::ResizeBuffers() +void RenderPath3D_Deferred::ResizeBuffers() { - Renderable3DComponent::ResizeBuffers(); + RenderPath3D::ResizeBuffers(); FORMAT defaultTextureFormat = wiRenderer::GetDevice()->GetBackBufferFormat(); @@ -68,21 +68,21 @@ void DeferredRenderableComponent::ResizeBuffers() , false, wiRenderer::RTFormat_hdr); } -void DeferredRenderableComponent::Initialize() +void RenderPath3D_Deferred::Initialize() { ResizeBuffers(); - Renderable3DComponent::Initialize(); + RenderPath3D::Initialize(); } -void DeferredRenderableComponent::Load() +void RenderPath3D_Deferred::Load() { - Renderable3DComponent::Load(); + RenderPath3D::Load(); } -void DeferredRenderableComponent::Start() +void RenderPath3D_Deferred::Start() { - Renderable3DComponent::Start(); + RenderPath3D::Start(); } -void DeferredRenderableComponent::Render() +void RenderPath3D_Deferred::Render() { RenderFrameSetUp(GRAPHICSTHREAD_IMMEDIATE); RenderShadows(GRAPHICSTHREAD_IMMEDIATE); @@ -91,11 +91,11 @@ void DeferredRenderableComponent::Render() RenderSecondaryScene(rtGBuffer, GetFinalRT(), GRAPHICSTHREAD_IMMEDIATE); RenderComposition(GetFinalRT(), rtGBuffer, GRAPHICSTHREAD_IMMEDIATE); - Renderable2DComponent::Render(); + RenderPath2D::Render(); } -void DeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) +void RenderPath3D_Deferred::RenderScene(GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Opaque Scene", wiProfiler::DOMAIN_GPU, threadID); @@ -265,7 +265,7 @@ void DeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) wiProfiler::EndRange(threadID); // Opaque Scene } -wiRenderTarget& DeferredRenderableComponent::GetFinalRT() +wiRenderTarget& RenderPath3D_Deferred::GetFinalRT() { //if (getSSREnabled()) // return rtSSR; @@ -273,7 +273,7 @@ wiRenderTarget& DeferredRenderableComponent::GetFinalRT() return rtDeferred; } -wiDepthTarget* DeferredRenderableComponent::GetDepthBuffer() +wiDepthTarget* RenderPath3D_Deferred::GetDepthBuffer() { return rtGBuffer.depth; } diff --git a/WickedEngine/RenderPath3D_Deferred.h b/WickedEngine/RenderPath3D_Deferred.h new file mode 100644 index 000000000..1de3cfa65 --- /dev/null +++ b/WickedEngine/RenderPath3D_Deferred.h @@ -0,0 +1,27 @@ +#pragma once +#include "RenderPath3D.h" + + +class RenderPath3D_Deferred : + public RenderPath3D +{ +protected: + static wiRenderTarget rtGBuffer, rtDeferred, rtLight, rtSSS[2]; + + void ResizeBuffers() override; + + void RenderScene(GRAPHICSTHREAD threadID) override; + wiRenderTarget& GetFinalRT(); + +public: + RenderPath3D_Deferred(); + virtual ~RenderPath3D_Deferred(); + + wiDepthTarget* GetDepthBuffer() override; + + void Initialize() override; + void Load() override; + void Start() override; + void Render() override; +}; + diff --git a/WickedEngine/RenderPath3D_Deferred_BindLua.cpp b/WickedEngine/RenderPath3D_Deferred_BindLua.cpp new file mode 100644 index 000000000..2db10235d --- /dev/null +++ b/WickedEngine/RenderPath3D_Deferred_BindLua.cpp @@ -0,0 +1,91 @@ +#include "RenderPath3D_Deferred_BindLua.h" + +const char RenderPath3D_Deferred_BindLua::className[] = "RenderPath3D_Deferred"; + +Luna::FunctionType RenderPath3D_Deferred_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + + lunamethod(RenderPath_BindLua, GetContent), + lunamethod(RenderPath_BindLua, Initialize), + lunamethod(RenderPath_BindLua, Load), + lunamethod(RenderPath_BindLua, Unload), + lunamethod(RenderPath_BindLua, Start), + lunamethod(RenderPath_BindLua, Stop), + lunamethod(RenderPath_BindLua, FixedUpdate), + lunamethod(RenderPath_BindLua, Update), + lunamethod(RenderPath_BindLua, Render), + lunamethod(RenderPath_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), + + lunamethod(RenderPath3D_BindLua, SetSSAOEnabled), + lunamethod(RenderPath3D_BindLua, SetSSREnabled), + lunamethod(RenderPath3D_BindLua, SetShadowsEnabled), + lunamethod(RenderPath3D_BindLua, SetReflectionsEnabled), + lunamethod(RenderPath3D_BindLua, SetFXAAEnabled), + lunamethod(RenderPath3D_BindLua, SetBloomEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingTexture), + lunamethod(RenderPath3D_BindLua, SetEmitterParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesReflectionEnabled), + lunamethod(RenderPath3D_BindLua, SetVolumeLightsEnabled), + lunamethod(RenderPath3D_BindLua, SetLightShaftsEnabled), + lunamethod(RenderPath3D_BindLua, SetLensFlareEnabled), + lunamethod(RenderPath3D_BindLua, SetMotionBlurEnabled), + lunamethod(RenderPath3D_BindLua, SetSSSEnabled), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldEnabled), + lunamethod(RenderPath3D_BindLua, SetStereogramEnabled), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionEnabled), + lunamethod(RenderPath3D_BindLua, SetTessellationEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterAmount), + + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldFocus), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldStrength), + + { NULL, NULL } +}; +Luna::PropertyType RenderPath3D_Deferred_BindLua::properties[] = { + { NULL, NULL } +}; + +RenderPath3D_Deferred_BindLua::RenderPath3D_Deferred_BindLua(RenderPath3D_Deferred* component) +{ + this->component = component; +} + +RenderPath3D_Deferred_BindLua::RenderPath3D_Deferred_BindLua(lua_State *L) +{ + component = new RenderPath3D_Deferred(); +} + + +RenderPath3D_Deferred_BindLua::~RenderPath3D_Deferred_BindLua() +{ +} + +void RenderPath3D_Deferred_BindLua::Bind() +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + Luna::Register(wiLua::GetGlobal()->GetLuaState()); + } +} diff --git a/WickedEngine/RenderPath3D_Deferred_BindLua.h b/WickedEngine/RenderPath3D_Deferred_BindLua.h new file mode 100644 index 000000000..95155a2eb --- /dev/null +++ b/WickedEngine/RenderPath3D_Deferred_BindLua.h @@ -0,0 +1,19 @@ +#pragma once +#include "wiLua.h" +#include "wiLuna.h" +#include "RenderPath3D_Deferred.h" +#include "RenderPath3D_BindLua.h" + +class RenderPath3D_Deferred_BindLua : public RenderPath3D_BindLua +{ +public: + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + RenderPath3D_Deferred_BindLua(RenderPath3D_Deferred* component = nullptr); + RenderPath3D_Deferred_BindLua(lua_State *L); + ~RenderPath3D_Deferred_BindLua(); + + static void Bind(); +}; diff --git a/WickedEngine/ForwardRenderableComponent.cpp b/WickedEngine/RenderPath3D_Forward.cpp similarity index 87% rename from WickedEngine/ForwardRenderableComponent.cpp rename to WickedEngine/RenderPath3D_Forward.cpp index f4f63fdb0..4161cc080 100644 --- a/WickedEngine/ForwardRenderableComponent.cpp +++ b/WickedEngine/RenderPath3D_Forward.cpp @@ -1,4 +1,4 @@ -#include "ForwardRenderableComponent.h" +#include "RenderPath3D_Forward.h" #include "wiRenderer.h" #include "wiImage.h" #include "wiImageEffects.h" @@ -8,22 +8,22 @@ using namespace wiGraphicsTypes; -ForwardRenderableComponent::ForwardRenderableComponent() +RenderPath3D_Forward::RenderPath3D_Forward() { - Renderable3DComponent::setProperties(); + RenderPath3D::setProperties(); setSSREnabled(false); setSSAOEnabled(false); setShadowsEnabled(false); } -ForwardRenderableComponent::~ForwardRenderableComponent() +RenderPath3D_Forward::~RenderPath3D_Forward() { } -wiRenderTarget ForwardRenderableComponent::rtMain; -void ForwardRenderableComponent::ResizeBuffers() +wiRenderTarget RenderPath3D_Forward::rtMain; +void RenderPath3D_Forward::ResizeBuffers() { - Renderable3DComponent::ResizeBuffers(); + RenderPath3D::ResizeBuffers(); FORMAT defaultTextureFormat = wiRenderer::GetDevice()->GetBackBufferFormat(); @@ -49,22 +49,22 @@ void ForwardRenderableComponent::ResizeBuffers() rtMain.Add(wiRenderer::RTFormat_gbuffer_1); // thin gbuffer } -void ForwardRenderableComponent::Initialize() +void RenderPath3D_Forward::Initialize() { ResizeBuffers(); - Renderable3DComponent::Initialize(); + RenderPath3D::Initialize(); } -void ForwardRenderableComponent::Load() +void RenderPath3D_Forward::Load() { - Renderable3DComponent::Load(); + RenderPath3D::Load(); } -void ForwardRenderableComponent::Start() +void RenderPath3D_Forward::Start() { - Renderable3DComponent::Start(); + RenderPath3D::Start(); } -void ForwardRenderableComponent::Render() +void RenderPath3D_Forward::Render() { RenderFrameSetUp(GRAPHICSTHREAD_IMMEDIATE); RenderShadows(GRAPHICSTHREAD_IMMEDIATE); @@ -73,11 +73,11 @@ void ForwardRenderableComponent::Render() RenderSecondaryScene(rtMain, rtMain, GRAPHICSTHREAD_IMMEDIATE); RenderComposition(rtMain, rtMain, GRAPHICSTHREAD_IMMEDIATE); - Renderable2DComponent::Render(); + RenderPath2D::Render(); } -void ForwardRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) +void RenderPath3D_Forward::RenderScene(GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Opaque Scene", wiProfiler::DOMAIN_GPU, threadID); @@ -166,7 +166,7 @@ void ForwardRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) wiProfiler::EndRange(threadID); // Opaque Scene } -wiDepthTarget* ForwardRenderableComponent::GetDepthBuffer() +wiDepthTarget* RenderPath3D_Forward::GetDepthBuffer() { return rtMain.depth; } diff --git a/WickedEngine/RenderPath3D_Forward.h b/WickedEngine/RenderPath3D_Forward.h new file mode 100644 index 000000000..0d2a60841 --- /dev/null +++ b/WickedEngine/RenderPath3D_Forward.h @@ -0,0 +1,26 @@ +#pragma once +#include "RenderPath3D.h" + + +class RenderPath3D_Forward : + public RenderPath3D +{ +protected: + + static wiRenderTarget rtMain; + + void ResizeBuffers() override; + + void RenderScene(GRAPHICSTHREAD threadID) override; +public: + RenderPath3D_Forward(); + virtual ~RenderPath3D_Forward(); + + wiDepthTarget* GetDepthBuffer() override; + + void Initialize() override; + void Load() override; + void Start() override; + void Render() override; +}; + diff --git a/WickedEngine/RenderPath3D_Forward_BindLua.cpp b/WickedEngine/RenderPath3D_Forward_BindLua.cpp new file mode 100644 index 000000000..5d85ba661 --- /dev/null +++ b/WickedEngine/RenderPath3D_Forward_BindLua.cpp @@ -0,0 +1,91 @@ +#include "RenderPath3D_Forward_BindLua.h" + +const char RenderPath3D_Forward_BindLua::className[] = "RenderPath3D_Forward"; + +Luna::FunctionType RenderPath3D_Forward_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + + lunamethod(RenderPath_BindLua, GetContent), + lunamethod(RenderPath_BindLua, Initialize), + lunamethod(RenderPath_BindLua, Load), + lunamethod(RenderPath_BindLua, Unload), + lunamethod(RenderPath_BindLua, Start), + lunamethod(RenderPath_BindLua, Stop), + lunamethod(RenderPath_BindLua, FixedUpdate), + lunamethod(RenderPath_BindLua, Update), + lunamethod(RenderPath_BindLua, Render), + lunamethod(RenderPath_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), + + lunamethod(RenderPath3D_BindLua, SetSSAOEnabled), + lunamethod(RenderPath3D_BindLua, SetSSREnabled), + lunamethod(RenderPath3D_BindLua, SetShadowsEnabled), + lunamethod(RenderPath3D_BindLua, SetReflectionsEnabled), + lunamethod(RenderPath3D_BindLua, SetFXAAEnabled), + lunamethod(RenderPath3D_BindLua, SetBloomEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingTexture), + lunamethod(RenderPath3D_BindLua, SetEmitterParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesReflectionEnabled), + lunamethod(RenderPath3D_BindLua, SetVolumeLightsEnabled), + lunamethod(RenderPath3D_BindLua, SetLightShaftsEnabled), + lunamethod(RenderPath3D_BindLua, SetLensFlareEnabled), + lunamethod(RenderPath3D_BindLua, SetMotionBlurEnabled), + lunamethod(RenderPath3D_BindLua, SetSSSEnabled), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldEnabled), + lunamethod(RenderPath3D_BindLua, SetStereogramEnabled), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionEnabled), + lunamethod(RenderPath3D_BindLua, SetTessellationEnabled), + lunamethod(RenderPath3D_BindLua, SetMSAASampleCount), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterAmount), + + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldFocus), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldStrength), + { NULL, NULL } +}; +Luna::PropertyType RenderPath3D_Forward_BindLua::properties[] = { + { NULL, NULL } +}; + +RenderPath3D_Forward_BindLua::RenderPath3D_Forward_BindLua(RenderPath3D_Forward* component) +{ + this->component = component; +} + +RenderPath3D_Forward_BindLua::RenderPath3D_Forward_BindLua(lua_State *L) +{ + component = new RenderPath3D_Forward(); +} + + +RenderPath3D_Forward_BindLua::~RenderPath3D_Forward_BindLua() +{ +} + +void RenderPath3D_Forward_BindLua::Bind() +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + //Luna::Register(wiLua::GetGlobal()->GetLuaState()); + } +} diff --git a/WickedEngine/RenderPath3D_Forward_BindLua.h b/WickedEngine/RenderPath3D_Forward_BindLua.h new file mode 100644 index 000000000..9f809b636 --- /dev/null +++ b/WickedEngine/RenderPath3D_Forward_BindLua.h @@ -0,0 +1,20 @@ +#pragma once +#include "wiLua.h" +#include "wiLuna.h" +#include "RenderPath3D_Forward.h" +#include "RenderPath3D_BindLua.h" + +class RenderPath3D_Forward_BindLua : public RenderPath3D_BindLua +{ +public: + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + RenderPath3D_Forward_BindLua(RenderPath3D_Forward* component = nullptr); + RenderPath3D_Forward_BindLua(lua_State *L); + ~RenderPath3D_Forward_BindLua(); + + static void Bind(); +}; + diff --git a/WickedEngine/PathTracingRenderableComponent.cpp b/WickedEngine/RenderPath3D_PathTracing.cpp similarity index 74% rename from WickedEngine/PathTracingRenderableComponent.cpp rename to WickedEngine/RenderPath3D_PathTracing.cpp index 81d230f7e..57319324d 100644 --- a/WickedEngine/PathTracingRenderableComponent.cpp +++ b/WickedEngine/RenderPath3D_PathTracing.cpp @@ -1,4 +1,4 @@ -#include "PathTracingRenderableComponent.h" +#include "RenderPath3D_PathTracing.h" #include "wiRenderer.h" #include "wiImage.h" #include "wiImageEffects.h" @@ -12,20 +12,20 @@ using namespace wiGraphicsTypes; using namespace wiSceneSystem; -PathTracingRenderableComponent::PathTracingRenderableComponent() +RenderPath3D_PathTracing::RenderPath3D_PathTracing() { - Renderable3DComponent::setProperties(); + RenderPath3D::setProperties(); } -PathTracingRenderableComponent::~PathTracingRenderableComponent() +RenderPath3D_PathTracing::~RenderPath3D_PathTracing() { } -wiGraphicsTypes::Texture2D* PathTracingRenderableComponent::traceResult = nullptr; -wiRenderTarget PathTracingRenderableComponent::rtAccumulation; -void PathTracingRenderableComponent::ResizeBuffers() +wiGraphicsTypes::Texture2D* RenderPath3D_PathTracing::traceResult = nullptr; +wiRenderTarget RenderPath3D_PathTracing::rtAccumulation; +void RenderPath3D_PathTracing::ResizeBuffers() { - Renderable3DComponent::ResizeBuffers(); + RenderPath3D::ResizeBuffers(); FORMAT defaultTextureFormat = wiRenderer::GetDevice()->GetBackBufferFormat(); @@ -75,30 +75,30 @@ void PathTracingRenderableComponent::ResizeBuffers() sam = -1; } -void PathTracingRenderableComponent::Initialize() +void RenderPath3D_PathTracing::Initialize() { ResizeBuffers(); - Renderable3DComponent::Initialize(); + RenderPath3D::Initialize(); } -void PathTracingRenderableComponent::Load() +void RenderPath3D_PathTracing::Load() { - Renderable3DComponent::Load(); + RenderPath3D::Load(); } -void PathTracingRenderableComponent::Start() +void RenderPath3D_PathTracing::Start() { - Renderable3DComponent::Start(); + RenderPath3D::Start(); } -void PathTracingRenderableComponent::Render() +void RenderPath3D_PathTracing::Render() { RenderFrameSetUp(GRAPHICSTHREAD_IMMEDIATE); RenderScene(GRAPHICSTHREAD_IMMEDIATE); - Renderable2DComponent::Render(); + RenderPath2D::Render(); } -void PathTracingRenderableComponent::Update(float dt) +void RenderPath3D_PathTracing::Update(float dt) { const Scene& scene = wiRenderer::GetScene(); @@ -121,11 +121,11 @@ void PathTracingRenderableComponent::Update(float dt) } sam++; - Renderable3DComponent::Update(dt); + RenderPath3D::Update(dt); } -void PathTracingRenderableComponent::RenderFrameSetUp(GRAPHICSTHREAD threadID) +void RenderPath3D_PathTracing::RenderFrameSetUp(GRAPHICSTHREAD threadID) { wiRenderer::UpdateRenderData(threadID); @@ -135,7 +135,7 @@ void PathTracingRenderableComponent::RenderFrameSetUp(GRAPHICSTHREAD threadID) } } -void PathTracingRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) +void RenderPath3D_PathTracing::RenderScene(GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Traced Scene", wiProfiler::DOMAIN_GPU, threadID); @@ -161,9 +161,9 @@ void PathTracingRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) wiProfiler::EndRange(threadID); // Traced Scene } -void PathTracingRenderableComponent::Compose() +void RenderPath3D_PathTracing::Compose() { - wiRenderer::GetDevice()->EventBegin("PathTracingRenderableComponent::Compose", GRAPHICSTHREAD_IMMEDIATE); + wiRenderer::GetDevice()->EventBegin("RenderPath3D_PathTracing::Compose", GRAPHICSTHREAD_IMMEDIATE); wiImageEffects fx((float)wiRenderer::GetDevice()->GetScreenWidth(), (float)wiRenderer::GetDevice()->GetScreenHeight()); @@ -178,7 +178,7 @@ void PathTracingRenderableComponent::Compose() wiRenderer::GetDevice()->EventEnd(GRAPHICSTHREAD_IMMEDIATE); - Renderable2DComponent::Compose(); + RenderPath2D::Compose(); } diff --git a/WickedEngine/RenderPath3D_PathTracing.h b/WickedEngine/RenderPath3D_PathTracing.h new file mode 100644 index 000000000..8db0810c9 --- /dev/null +++ b/WickedEngine/RenderPath3D_PathTracing.h @@ -0,0 +1,32 @@ +#pragma once +#include "RenderPath3D.h" + + +class RenderPath3D_PathTracing : + public RenderPath3D +{ +private: + int sam = -1; + +protected: + static wiGraphicsTypes::Texture2D* traceResult; + static wiRenderTarget rtAccumulation; + + void ResizeBuffers() override; + + void RenderFrameSetUp(GRAPHICSTHREAD threadID) override; + void RenderScene(GRAPHICSTHREAD threadID) override; + +public: + RenderPath3D_PathTracing(); + virtual ~RenderPath3D_PathTracing(); + + wiDepthTarget* GetDepthBuffer() override { return nullptr; }; + + void Initialize() override; + void Load() override; + void Start() override; + void Update(float dt) override; + void Render() override; + void Compose() override; +}; diff --git a/WickedEngine/TiledDeferredRenderableComponent.cpp b/WickedEngine/RenderPath3D_TiledDeferred.cpp similarity index 94% rename from WickedEngine/TiledDeferredRenderableComponent.cpp rename to WickedEngine/RenderPath3D_TiledDeferred.cpp index 32b944794..e46aac564 100644 --- a/WickedEngine/TiledDeferredRenderableComponent.cpp +++ b/WickedEngine/RenderPath3D_TiledDeferred.cpp @@ -1,4 +1,4 @@ -#include "TiledDeferredRenderableComponent.h" +#include "RenderPath3D_TiledDeferred.h" #include "wiRenderer.h" #include "wiImage.h" #include "wiImageEffects.h" @@ -11,19 +11,19 @@ using namespace wiGraphicsTypes; -TiledDeferredRenderableComponent::TiledDeferredRenderableComponent() +RenderPath3D_TiledDeferred::RenderPath3D_TiledDeferred() { - DeferredRenderableComponent::setProperties(); + RenderPath3D_Deferred::setProperties(); } -TiledDeferredRenderableComponent::~TiledDeferredRenderableComponent() +RenderPath3D_TiledDeferred::~RenderPath3D_TiledDeferred() { } -void TiledDeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) +void RenderPath3D_TiledDeferred::RenderScene(GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Opaque Scene", wiProfiler::DOMAIN_GPU, threadID); @@ -193,7 +193,7 @@ void TiledDeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) wiProfiler::EndRange(threadID); // Opaque Scene } -void TiledDeferredRenderableComponent::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) +void RenderPath3D_TiledDeferred::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Transparent Scene", wiProfiler::DOMAIN_GPU, threadID); diff --git a/WickedEngine/RenderPath3D_TiledDeferred.h b/WickedEngine/RenderPath3D_TiledDeferred.h new file mode 100644 index 000000000..1a203425d --- /dev/null +++ b/WickedEngine/RenderPath3D_TiledDeferred.h @@ -0,0 +1,14 @@ +#pragma once +#include "RenderPath3D_Deferred.h" + +class RenderPath3D_TiledDeferred : + public RenderPath3D_Deferred +{ +private: + void RenderScene(GRAPHICSTHREAD threadID) override; + void RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) override; +public: + RenderPath3D_TiledDeferred(); + virtual ~RenderPath3D_TiledDeferred(); +}; + diff --git a/WickedEngine/RenderPath3D_TiledDeferred_BindLua.cpp b/WickedEngine/RenderPath3D_TiledDeferred_BindLua.cpp new file mode 100644 index 000000000..06e3a8f1a --- /dev/null +++ b/WickedEngine/RenderPath3D_TiledDeferred_BindLua.cpp @@ -0,0 +1,91 @@ +#include "RenderPath3D_TiledDeferred_BindLua.h" + +const char RenderPath3D_TiledDeferred_BindLua::className[] = "RenderPath3D_TiledDeferred"; + +Luna::FunctionType RenderPath3D_TiledDeferred_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + + lunamethod(RenderPath_BindLua, GetContent), + lunamethod(RenderPath_BindLua, Initialize), + lunamethod(RenderPath_BindLua, Load), + lunamethod(RenderPath_BindLua, Unload), + lunamethod(RenderPath_BindLua, Start), + lunamethod(RenderPath_BindLua, Stop), + lunamethod(RenderPath_BindLua, FixedUpdate), + lunamethod(RenderPath_BindLua, Update), + lunamethod(RenderPath_BindLua, Render), + lunamethod(RenderPath_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), + + lunamethod(RenderPath3D_BindLua, SetSSAOEnabled), + lunamethod(RenderPath3D_BindLua, SetSSREnabled), + lunamethod(RenderPath3D_BindLua, SetShadowsEnabled), + lunamethod(RenderPath3D_BindLua, SetReflectionsEnabled), + lunamethod(RenderPath3D_BindLua, SetFXAAEnabled), + lunamethod(RenderPath3D_BindLua, SetBloomEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingTexture), + lunamethod(RenderPath3D_BindLua, SetEmitterParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesReflectionEnabled), + lunamethod(RenderPath3D_BindLua, SetVolumeLightsEnabled), + lunamethod(RenderPath3D_BindLua, SetLightShaftsEnabled), + lunamethod(RenderPath3D_BindLua, SetLensFlareEnabled), + lunamethod(RenderPath3D_BindLua, SetMotionBlurEnabled), + lunamethod(RenderPath3D_BindLua, SetSSSEnabled), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldEnabled), + lunamethod(RenderPath3D_BindLua, SetStereogramEnabled), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionEnabled), + lunamethod(RenderPath3D_BindLua, SetTessellationEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterAmount), + + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldFocus), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldStrength), + + { NULL, NULL } +}; +Luna::PropertyType RenderPath3D_TiledDeferred_BindLua::properties[] = { + { NULL, NULL } +}; + +RenderPath3D_TiledDeferred_BindLua::RenderPath3D_TiledDeferred_BindLua(RenderPath3D_TiledDeferred* component) +{ + this->component = component; +} + +RenderPath3D_TiledDeferred_BindLua::RenderPath3D_TiledDeferred_BindLua(lua_State *L) +{ + component = new RenderPath3D_TiledDeferred(); +} + + +RenderPath3D_TiledDeferred_BindLua::~RenderPath3D_TiledDeferred_BindLua() +{ +} + +void RenderPath3D_TiledDeferred_BindLua::Bind() +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + //Luna::Register(wiLua::GetGlobal()->GetLuaState()); + } +} diff --git a/WickedEngine/RenderPath3D_TiledDeferred_BindLua.h b/WickedEngine/RenderPath3D_TiledDeferred_BindLua.h new file mode 100644 index 000000000..fbcaf69d8 --- /dev/null +++ b/WickedEngine/RenderPath3D_TiledDeferred_BindLua.h @@ -0,0 +1,20 @@ +#pragma once +#include "wiLua.h" +#include "wiLuna.h" +#include "RenderPath3D_TiledDeferred.h" +#include "RenderPath3D_BindLua.h" + +class RenderPath3D_TiledDeferred_BindLua : public RenderPath3D_BindLua +{ +public: + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + RenderPath3D_TiledDeferred_BindLua(RenderPath3D_TiledDeferred* component = nullptr); + RenderPath3D_TiledDeferred_BindLua(lua_State *L); + ~RenderPath3D_TiledDeferred_BindLua(); + + static void Bind(); +}; + diff --git a/WickedEngine/TiledForwardRenderableComponent.cpp b/WickedEngine/RenderPath3D_TiledForward.cpp similarity index 92% rename from WickedEngine/TiledForwardRenderableComponent.cpp rename to WickedEngine/RenderPath3D_TiledForward.cpp index 6868daf6b..152f015be 100644 --- a/WickedEngine/TiledForwardRenderableComponent.cpp +++ b/WickedEngine/RenderPath3D_TiledForward.cpp @@ -1,4 +1,4 @@ -#include "TiledForwardRenderableComponent.h" +#include "RenderPath3D_TiledForward.h" #include "wiRenderer.h" #include "wiImage.h" #include "wiImageEffects.h" @@ -8,15 +8,15 @@ using namespace wiGraphicsTypes; -TiledForwardRenderableComponent::TiledForwardRenderableComponent() +RenderPath3D_TiledForward::RenderPath3D_TiledForward() { - ForwardRenderableComponent::setProperties(); + RenderPath3D_Forward::setProperties(); } -TiledForwardRenderableComponent::~TiledForwardRenderableComponent() +RenderPath3D_TiledForward::~RenderPath3D_TiledForward() { } -void TiledForwardRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) +void RenderPath3D_TiledForward::RenderScene(GRAPHICSTHREAD threadID) { wiRenderer::UpdateCameraCB(wiRenderer::GetCamera(), threadID); @@ -115,7 +115,7 @@ void TiledForwardRenderableComponent::RenderScene(GRAPHICSTHREAD threadID) wiProfiler::EndRange(threadID); // Opaque Scene } -void TiledForwardRenderableComponent::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) +void RenderPath3D_TiledForward::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) { wiProfiler::BeginRange("Transparent Scene", wiProfiler::DOMAIN_GPU, threadID); diff --git a/WickedEngine/RenderPath3D_TiledForward.h b/WickedEngine/RenderPath3D_TiledForward.h new file mode 100644 index 000000000..d42573921 --- /dev/null +++ b/WickedEngine/RenderPath3D_TiledForward.h @@ -0,0 +1,14 @@ +#pragma once +#include "RenderPath3D_Forward.h" + +class RenderPath3D_TiledForward : + public RenderPath3D_Forward +{ +private: + void RenderScene(GRAPHICSTHREAD threadID) override; + void RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) override; +public: + RenderPath3D_TiledForward(); + virtual ~RenderPath3D_TiledForward(); +}; + diff --git a/WickedEngine/RenderPath3D_TiledForward_BindLua.cpp b/WickedEngine/RenderPath3D_TiledForward_BindLua.cpp new file mode 100644 index 000000000..58c996d1b --- /dev/null +++ b/WickedEngine/RenderPath3D_TiledForward_BindLua.cpp @@ -0,0 +1,91 @@ +#include "RenderPath3D_TiledForward_BindLua.h" + +const char RenderPath3D_TiledForward_BindLua::className[] = "RenderPath3D_TiledForward"; + +Luna::FunctionType RenderPath3D_TiledForward_BindLua::methods[] = { + lunamethod(RenderPath2D_BindLua, AddSprite), + lunamethod(RenderPath2D_BindLua, AddFont), + lunamethod(RenderPath2D_BindLua, RemoveSprite), + lunamethod(RenderPath2D_BindLua, RemoveFont), + lunamethod(RenderPath2D_BindLua, ClearSprites), + lunamethod(RenderPath2D_BindLua, ClearFonts), + lunamethod(RenderPath2D_BindLua, GetSpriteOrder), + lunamethod(RenderPath2D_BindLua, GetFontOrder), + + lunamethod(RenderPath2D_BindLua, AddLayer), + lunamethod(RenderPath2D_BindLua, GetLayers), + lunamethod(RenderPath2D_BindLua, SetLayerOrder), + lunamethod(RenderPath2D_BindLua, SetSpriteOrder), + lunamethod(RenderPath2D_BindLua, SetFontOrder), + + lunamethod(RenderPath_BindLua, GetContent), + lunamethod(RenderPath_BindLua, Initialize), + lunamethod(RenderPath_BindLua, Load), + lunamethod(RenderPath_BindLua, Unload), + lunamethod(RenderPath_BindLua, Start), + lunamethod(RenderPath_BindLua, Stop), + lunamethod(RenderPath_BindLua, FixedUpdate), + lunamethod(RenderPath_BindLua, Update), + lunamethod(RenderPath_BindLua, Render), + lunamethod(RenderPath_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), + + lunamethod(RenderPath3D_BindLua, SetSSAOEnabled), + lunamethod(RenderPath3D_BindLua, SetSSREnabled), + lunamethod(RenderPath3D_BindLua, SetShadowsEnabled), + lunamethod(RenderPath3D_BindLua, SetReflectionsEnabled), + lunamethod(RenderPath3D_BindLua, SetFXAAEnabled), + lunamethod(RenderPath3D_BindLua, SetBloomEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingEnabled), + lunamethod(RenderPath3D_BindLua, SetColorGradingTexture), + lunamethod(RenderPath3D_BindLua, SetEmitterParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesEnabled), + lunamethod(RenderPath3D_BindLua, SetHairParticlesReflectionEnabled), + lunamethod(RenderPath3D_BindLua, SetVolumeLightsEnabled), + lunamethod(RenderPath3D_BindLua, SetLightShaftsEnabled), + lunamethod(RenderPath3D_BindLua, SetLensFlareEnabled), + lunamethod(RenderPath3D_BindLua, SetMotionBlurEnabled), + lunamethod(RenderPath3D_BindLua, SetSSSEnabled), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldEnabled), + lunamethod(RenderPath3D_BindLua, SetStereogramEnabled), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionEnabled), + lunamethod(RenderPath3D_BindLua, SetTessellationEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterEnabled), + lunamethod(RenderPath3D_BindLua, SetSharpenFilterAmount), + + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldFocus), + lunamethod(RenderPath3D_BindLua, SetDepthOfFieldStrength), + + { NULL, NULL } +}; +Luna::PropertyType RenderPath3D_TiledForward_BindLua::properties[] = { + { NULL, NULL } +}; + +RenderPath3D_TiledForward_BindLua::RenderPath3D_TiledForward_BindLua(RenderPath3D_TiledForward* component) +{ + this->component = component; +} + +RenderPath3D_TiledForward_BindLua::RenderPath3D_TiledForward_BindLua(lua_State *L) +{ + component = new RenderPath3D_TiledForward(); +} + + +RenderPath3D_TiledForward_BindLua::~RenderPath3D_TiledForward_BindLua() +{ +} + +void RenderPath3D_TiledForward_BindLua::Bind() +{ + static bool initialized = false; + if (!initialized) + { + initialized = true; + Luna::Register(wiLua::GetGlobal()->GetLuaState()); + } +} diff --git a/WickedEngine/RenderPath3D_TiledForward_BindLua.h b/WickedEngine/RenderPath3D_TiledForward_BindLua.h new file mode 100644 index 000000000..be47d0612 --- /dev/null +++ b/WickedEngine/RenderPath3D_TiledForward_BindLua.h @@ -0,0 +1,20 @@ +#pragma once +#include "wiLua.h" +#include "wiLuna.h" +#include "RenderPath3D_TiledForward.h" +#include "RenderPath3D_BindLua.h" + +class RenderPath3D_TiledForward_BindLua : public RenderPath3D_BindLua +{ +public: + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + RenderPath3D_TiledForward_BindLua(RenderPath3D_TiledForward* component = nullptr); + RenderPath3D_TiledForward_BindLua(lua_State *L); + ~RenderPath3D_TiledForward_BindLua(); + + static void Bind(); +}; + diff --git a/WickedEngine/RenderableComponent_BindLua.cpp b/WickedEngine/RenderPath_BindLua.cpp similarity index 55% rename from WickedEngine/RenderableComponent_BindLua.cpp rename to WickedEngine/RenderPath_BindLua.cpp index 252d508dc..4e4b0b7b5 100644 --- a/WickedEngine/RenderableComponent_BindLua.cpp +++ b/WickedEngine/RenderPath_BindLua.cpp @@ -1,46 +1,46 @@ -#include "RenderableComponent_BindLua.h" +#include "RenderPath_BindLua.h" #include "wiResourceManager_BindLua.h" using namespace std; -const char RenderableComponent_BindLua::className[] = "RenderableComponent"; +const char RenderPath_BindLua::className[] = "RenderPath"; -Luna::FunctionType RenderableComponent_BindLua::methods[] = { - lunamethod(RenderableComponent_BindLua, GetContent), - lunamethod(RenderableComponent_BindLua, Initialize), - lunamethod(RenderableComponent_BindLua, Load), - lunamethod(RenderableComponent_BindLua, Unload), - lunamethod(RenderableComponent_BindLua, Start), - lunamethod(RenderableComponent_BindLua, Stop), - lunamethod(RenderableComponent_BindLua, FixedUpdate), - lunamethod(RenderableComponent_BindLua, Update), - lunamethod(RenderableComponent_BindLua, Render), - lunamethod(RenderableComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), +Luna::FunctionType RenderPath_BindLua::methods[] = { + lunamethod(RenderPath_BindLua, GetContent), + lunamethod(RenderPath_BindLua, Initialize), + lunamethod(RenderPath_BindLua, Load), + lunamethod(RenderPath_BindLua, Unload), + lunamethod(RenderPath_BindLua, Start), + lunamethod(RenderPath_BindLua, Stop), + lunamethod(RenderPath_BindLua, FixedUpdate), + lunamethod(RenderPath_BindLua, Update), + lunamethod(RenderPath_BindLua, Render), + lunamethod(RenderPath_BindLua, Compose), + lunamethod(RenderPath_BindLua, OnStart), + lunamethod(RenderPath_BindLua, OnStop), + lunamethod(RenderPath_BindLua, GetLayerMask), + lunamethod(RenderPath_BindLua, SetLayerMask), { NULL, NULL } }; -Luna::PropertyType RenderableComponent_BindLua::properties[] = { +Luna::PropertyType RenderPath_BindLua::properties[] = { { NULL, NULL } }; -RenderableComponent_BindLua::RenderableComponent_BindLua(RenderableComponent* component) :component(component) +RenderPath_BindLua::RenderPath_BindLua(RenderPath* component) :component(component) { } -RenderableComponent_BindLua::RenderableComponent_BindLua(lua_State *L) +RenderPath_BindLua::RenderPath_BindLua(lua_State *L) { - component = new RenderableComponent(); + component = new RenderPath(); } -RenderableComponent_BindLua::~RenderableComponent_BindLua() +RenderPath_BindLua::~RenderPath_BindLua() { } -int RenderableComponent_BindLua::GetContent(lua_State *L) +int RenderPath_BindLua::GetContent(lua_State *L) { if (component == nullptr) { @@ -51,7 +51,7 @@ int RenderableComponent_BindLua::GetContent(lua_State *L) return 1; } -int RenderableComponent_BindLua::Initialize(lua_State* L) +int RenderPath_BindLua::Initialize(lua_State* L) { if (component == nullptr) { @@ -62,7 +62,7 @@ int RenderableComponent_BindLua::Initialize(lua_State* L) return 0; } -int RenderableComponent_BindLua::Load(lua_State* L) +int RenderPath_BindLua::Load(lua_State* L) { if (component == nullptr) { @@ -73,7 +73,7 @@ int RenderableComponent_BindLua::Load(lua_State* L) return 0; } -int RenderableComponent_BindLua::Unload(lua_State* L) +int RenderPath_BindLua::Unload(lua_State* L) { if (component == nullptr) { @@ -84,7 +84,7 @@ int RenderableComponent_BindLua::Unload(lua_State* L) return 0; } -int RenderableComponent_BindLua::Start(lua_State* L) +int RenderPath_BindLua::Start(lua_State* L) { if (component == nullptr) { @@ -95,7 +95,7 @@ int RenderableComponent_BindLua::Start(lua_State* L) return 0; } -int RenderableComponent_BindLua::Stop(lua_State* L) +int RenderPath_BindLua::Stop(lua_State* L) { if (component == nullptr) { @@ -106,7 +106,7 @@ int RenderableComponent_BindLua::Stop(lua_State* L) return 0; } -int RenderableComponent_BindLua::FixedUpdate(lua_State* L) +int RenderPath_BindLua::FixedUpdate(lua_State* L) { if (component == nullptr) { @@ -117,7 +117,7 @@ int RenderableComponent_BindLua::FixedUpdate(lua_State* L) return 0; } -int RenderableComponent_BindLua::Update(lua_State* L) +int RenderPath_BindLua::Update(lua_State* L) { if (component == nullptr) { @@ -133,7 +133,7 @@ int RenderableComponent_BindLua::Update(lua_State* L) return 0; } -int RenderableComponent_BindLua::Render(lua_State* L) +int RenderPath_BindLua::Render(lua_State* L) { if (component == nullptr) { @@ -144,7 +144,7 @@ int RenderableComponent_BindLua::Render(lua_State* L) return 0; } -int RenderableComponent_BindLua::Compose(lua_State* L) +int RenderPath_BindLua::Compose(lua_State* L) { if (component == nullptr) { @@ -156,7 +156,7 @@ int RenderableComponent_BindLua::Compose(lua_State* L) } -int RenderableComponent_BindLua::OnStart(lua_State* L) +int RenderPath_BindLua::OnStart(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -168,7 +168,7 @@ int RenderableComponent_BindLua::OnStart(lua_State* L) wiLua::SError(L, "OnStart(string taskScript) not enough arguments!"); return 0; } -int RenderableComponent_BindLua::OnStop(lua_State* L) +int RenderPath_BindLua::OnStop(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -182,13 +182,13 @@ int RenderableComponent_BindLua::OnStop(lua_State* L) } -int RenderableComponent_BindLua::GetLayerMask(lua_State* L) +int RenderPath_BindLua::GetLayerMask(lua_State* L) { uint32_t mask = component->getLayerMask(); wiLua::SSetInt(L, *reinterpret_cast(&mask)); return 1; } -int RenderableComponent_BindLua::SetLayerMask(lua_State* L) +int RenderPath_BindLua::SetLayerMask(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) @@ -201,14 +201,14 @@ int RenderableComponent_BindLua::SetLayerMask(lua_State* L) return 0; } -void RenderableComponent_BindLua::Bind() +void RenderPath_BindLua::Bind() { static bool initialized = false; if (!initialized) { initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); + Luna::Register(wiLua::GetGlobal()->GetLuaState()); } } diff --git a/WickedEngine/RenderableComponent_BindLua.h b/WickedEngine/RenderPath_BindLua.h similarity index 62% rename from WickedEngine/RenderableComponent_BindLua.h rename to WickedEngine/RenderPath_BindLua.h index 60b9d9ef7..d145b67eb 100644 --- a/WickedEngine/RenderableComponent_BindLua.h +++ b/WickedEngine/RenderPath_BindLua.h @@ -1,19 +1,19 @@ #pragma once #include "wiLua.h" #include "wiLuna.h" -#include "RenderableComponent.h" +#include "RenderPath.h" -class RenderableComponent_BindLua +class RenderPath_BindLua { public: - RenderableComponent* component; + RenderPath* component; static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; - RenderableComponent_BindLua(RenderableComponent* component = nullptr); - RenderableComponent_BindLua(lua_State *L); - ~RenderableComponent_BindLua(); + RenderPath_BindLua(RenderPath* component = nullptr); + RenderPath_BindLua(lua_State *L); + ~RenderPath_BindLua(); virtual int GetContent(lua_State* L); diff --git a/WickedEngine/Renderable3DComponent_BindLua.cpp b/WickedEngine/Renderable3DComponent_BindLua.cpp deleted file mode 100644 index 7356e216a..000000000 --- a/WickedEngine/Renderable3DComponent_BindLua.cpp +++ /dev/null @@ -1,444 +0,0 @@ -#include "Renderable3DComponent_BindLua.h" -#include "wiResourceManager_BindLua.h" -#include "Texture_BindLua.h" - -const char Renderable3DComponent_BindLua::className[] = "Renderable3DComponent"; - -Luna::FunctionType Renderable3DComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - - lunamethod(Renderable3DComponent_BindLua, GetContent), - lunamethod(Renderable3DComponent_BindLua, Initialize), - lunamethod(Renderable3DComponent_BindLua, Load), - lunamethod(Renderable3DComponent_BindLua, Unload), - lunamethod(Renderable3DComponent_BindLua, Start), - lunamethod(Renderable3DComponent_BindLua, Stop), - lunamethod(Renderable3DComponent_BindLua, FixedUpdate), - lunamethod(Renderable3DComponent_BindLua, Update), - lunamethod(Renderable3DComponent_BindLua, Render), - lunamethod(Renderable3DComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), - - lunamethod(Renderable3DComponent_BindLua, SetSSAOEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSREnabled), - lunamethod(Renderable3DComponent_BindLua, SetShadowsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetReflectionsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetFXAAEnabled), - lunamethod(Renderable3DComponent_BindLua, SetBloomEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingTexture), - lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldEnabled), - lunamethod(Renderable3DComponent_BindLua, SetStereogramEnabled), - lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMSAASampleCount), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount), - - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldFocus), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldStrength), - { NULL, NULL } -}; -Luna::PropertyType Renderable3DComponent_BindLua::properties[] = { - { NULL, NULL } -}; - -Renderable3DComponent_BindLua::Renderable3DComponent_BindLua(Renderable3DComponent* component) -{ - this->component = component; -} - -Renderable3DComponent_BindLua::Renderable3DComponent_BindLua(lua_State* L) -{ - component = nullptr; -} - -Renderable3DComponent_BindLua::~Renderable3DComponent_BindLua() -{ -} - - -int Renderable3DComponent_BindLua::SetSSAOEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetSSAOEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setSSAOEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetSSAOEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetSSREnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetSSREnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setSSREnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetSSREnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetShadowsEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetShadowsEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setShadowsEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetShadowsEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetReflectionsEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetShadowsEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setReflectionsEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetShadowsEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetFXAAEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetFXAAEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setFXAAEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetFXAAEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetBloomEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetBloomEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setBloomEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetBloomEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetColorGradingEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetColorGradingEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setColorGradingEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetColorGradingEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetColorGradingTexture(lua_State* L) -{ - int argc = wiLua::SGetArgCount(L); - if (argc > 0) - { - Texture_BindLua* tex = Luna::lightcheck(L, 1); - if (tex != nullptr) - { - ((Renderable3DComponent*)component)->setColorGradingTexture(tex->texture); - } - else - wiLua::SError(L, "SetColorGradingTexture(Texture texture2D) argument is not a texture!"); - } - else - wiLua::SError(L, "SetColorGradingTexture(Texture texture2D) not enough arguments!"); - - return 0; -} -int Renderable3DComponent_BindLua::SetEmitterParticlesEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetEmitterParticlesEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setEmitterParticlesEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetEmitterParticlesEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetHairParticlesEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetHairParticlesEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setHairParticlesEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetHairParticlesEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetHairParticlesReflectionEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetHairParticlesReflectionEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setHairParticlesReflectionEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetHairParticlesReflectionEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetVolumeLightsEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetVolumeLightsEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setVolumeLightsEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetVolumeLightsEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetLightShaftsEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetLightShaftsEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setLightShaftsEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetLightShaftsEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetLensFlareEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetLensFlareEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setLensFlareEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetLensFlareEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetMotionBlurEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetMotionBlurEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setMotionBlurEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetMotionBlurEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetSSSEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetSSSEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - ((Renderable3DComponent*)component)->setSSSEnabled(wiLua::SGetBool(L, 1)); - else - wiLua::SError(L, "SetSSSEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetDepthOfFieldEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetDepthOfFieldEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setDepthOfFieldEnabled(wiLua::SGetBool(L, 1)); - } - else - wiLua::SError(L, "SetDepthOfFieldEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetStereogramEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetStereogramEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setStereogramEnabled(wiLua::SGetBool(L, 1)); - } - else - wiLua::SError(L, "SetStereogramEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetEyeAdaptionEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetEyeAdaptionEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setEyeAdaptionEnabled(wiLua::SGetBool(L, 1)); - } - else - wiLua::SError(L, "SetEyeAdaptionEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetTessellationEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetTessellationEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setTessellationEnabled(wiLua::SGetBool(L, 1)); - } - else - wiLua::SError(L, "SetTessellationEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetMSAASampleCount(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetMSAASampleCount(int value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setMSAASampleCount((UINT)wiLua::SGetInt(L, 1)); - } - else - wiLua::SError(L, "SetMSAASampleCount(int value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetSharpenFilterEnabled(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetSharpenFilterEnabled(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setSharpenFilterEnabled(wiLua::SGetBool(L, 1)); - } - else - wiLua::SError(L, "SetSharpenFilterEnabled(bool value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetSharpenFilterAmount(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetSharpenFilterAmount(bool value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setSharpenFilterAmount(wiLua::SGetFloat(L, 1)); - } - else - wiLua::SError(L, "SetSharpenFilterAmount(bool value) not enough arguments!"); - return 0; -} - - -int Renderable3DComponent_BindLua::SetDepthOfFieldFocus(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetDepthOfFieldFocus(float value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setDepthOfFieldFocus(wiLua::SGetFloat(L, 1)); - } - else - wiLua::SError(L, "SetDepthOfFieldFocus(float value) not enough arguments!"); - return 0; -} -int Renderable3DComponent_BindLua::SetDepthOfFieldStrength(lua_State* L) -{ - if (component == nullptr) - { - wiLua::SError(L, "SetDepthOfFieldStrength(float value) component is null!"); - return 0; - } - if (wiLua::SGetArgCount(L) > 0) - { - ((Renderable3DComponent*)component)->setDepthOfFieldStrength(wiLua::SGetFloat(L, 1)); - } - else - wiLua::SError(L, "SetDepthOfFieldStrength(float value) not enough arguments!"); - return 0; -} - -void Renderable3DComponent_BindLua::Bind() -{ - static bool initialized = false; - if (!initialized) - { - initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); - } -} diff --git a/WickedEngine/ResourceMapping.h b/WickedEngine/ResourceMapping.h index 264e0af7e..46ee2dd25 100644 --- a/WickedEngine/ResourceMapping.h +++ b/WickedEngine/ResourceMapping.h @@ -70,7 +70,7 @@ -// RenderableComponent texture mappings: +// RenderPath texture mappings: #define TEXSLOT_RENDERABLECOMPONENT_REFLECTION TEXSLOT_ONDEMAND6 #define TEXSLOT_RENDERABLECOMPONENT_REFRACTION TEXSLOT_ONDEMAND7 #define TEXSLOT_RENDERABLECOMPONENT_WATERRIPPLES TEXSLOT_ONDEMAND8 diff --git a/WickedEngine/TiledDeferredRenderableComponent.h b/WickedEngine/TiledDeferredRenderableComponent.h deleted file mode 100644 index 2439429cf..000000000 --- a/WickedEngine/TiledDeferredRenderableComponent.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#include "DeferredRenderableComponent.h" - -class TiledDeferredRenderableComponent : - public DeferredRenderableComponent -{ -private: - virtual void RenderScene(GRAPHICSTHREAD threadID) override; - virtual void RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) override; -public: - TiledDeferredRenderableComponent(); - virtual ~TiledDeferredRenderableComponent(); -}; - diff --git a/WickedEngine/TiledDeferredRenderableComponent_BindLua.cpp b/WickedEngine/TiledDeferredRenderableComponent_BindLua.cpp deleted file mode 100644 index b82c248a5..000000000 --- a/WickedEngine/TiledDeferredRenderableComponent_BindLua.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "TiledDeferredRenderableComponent_BindLua.h" - -const char TiledDeferredRenderableComponent_BindLua::className[] = "TiledDeferredRenderableComponent"; - -Luna::FunctionType TiledDeferredRenderableComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - - lunamethod(RenderableComponent_BindLua, GetContent), - lunamethod(RenderableComponent_BindLua, Initialize), - lunamethod(RenderableComponent_BindLua, Load), - lunamethod(RenderableComponent_BindLua, Unload), - lunamethod(RenderableComponent_BindLua, Start), - lunamethod(RenderableComponent_BindLua, Stop), - lunamethod(RenderableComponent_BindLua, FixedUpdate), - lunamethod(RenderableComponent_BindLua, Update), - lunamethod(RenderableComponent_BindLua, Render), - lunamethod(RenderableComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), - - lunamethod(Renderable3DComponent_BindLua, SetSSAOEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSREnabled), - lunamethod(Renderable3DComponent_BindLua, SetShadowsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetReflectionsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetFXAAEnabled), - lunamethod(Renderable3DComponent_BindLua, SetBloomEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingTexture), - lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldEnabled), - lunamethod(Renderable3DComponent_BindLua, SetStereogramEnabled), - lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount), - - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldFocus), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldStrength), - - { NULL, NULL } -}; -Luna::PropertyType TiledDeferredRenderableComponent_BindLua::properties[] = { - { NULL, NULL } -}; - -TiledDeferredRenderableComponent_BindLua::TiledDeferredRenderableComponent_BindLua(TiledDeferredRenderableComponent* component) -{ - this->component = component; -} - -TiledDeferredRenderableComponent_BindLua::TiledDeferredRenderableComponent_BindLua(lua_State *L) -{ - component = new TiledDeferredRenderableComponent(); -} - - -TiledDeferredRenderableComponent_BindLua::~TiledDeferredRenderableComponent_BindLua() -{ -} - -void TiledDeferredRenderableComponent_BindLua::Bind() -{ - static bool initialized = false; - if (!initialized) - { - initialized = true; - //Luna::Register(wiLua::GetGlobal()->GetLuaState()); - } -} diff --git a/WickedEngine/TiledDeferredRenderableComponent_BindLua.h b/WickedEngine/TiledDeferredRenderableComponent_BindLua.h deleted file mode 100644 index 21415858e..000000000 --- a/WickedEngine/TiledDeferredRenderableComponent_BindLua.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "wiLua.h" -#include "wiLuna.h" -#include "TiledDeferredRenderableComponent.h" -#include "Renderable3DComponent_BindLua.h" - -class TiledDeferredRenderableComponent_BindLua : public Renderable3DComponent_BindLua -{ -public: - static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; - - TiledDeferredRenderableComponent_BindLua(TiledDeferredRenderableComponent* component = nullptr); - TiledDeferredRenderableComponent_BindLua(lua_State *L); - ~TiledDeferredRenderableComponent_BindLua(); - - static void Bind(); -}; - diff --git a/WickedEngine/TiledForwardRenderableComponent.h b/WickedEngine/TiledForwardRenderableComponent.h deleted file mode 100644 index 75c4a5ba3..000000000 --- a/WickedEngine/TiledForwardRenderableComponent.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#include "ForwardRenderableComponent.h" - -class TiledForwardRenderableComponent : - public ForwardRenderableComponent -{ -private: - virtual void RenderScene(GRAPHICSTHREAD threadID) override; - virtual void RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID) override; -public: - TiledForwardRenderableComponent(); - virtual ~TiledForwardRenderableComponent(); -}; - diff --git a/WickedEngine/TiledForwardRenderableComponent_BindLua.cpp b/WickedEngine/TiledForwardRenderableComponent_BindLua.cpp deleted file mode 100644 index e406f26ae..000000000 --- a/WickedEngine/TiledForwardRenderableComponent_BindLua.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "TiledForwardRenderableComponent_BindLua.h" - -const char TiledForwardRenderableComponent_BindLua::className[] = "TiledForwardRenderableComponent"; - -Luna::FunctionType TiledForwardRenderableComponent_BindLua::methods[] = { - lunamethod(Renderable2DComponent_BindLua, AddSprite), - lunamethod(Renderable2DComponent_BindLua, AddFont), - lunamethod(Renderable2DComponent_BindLua, RemoveSprite), - lunamethod(Renderable2DComponent_BindLua, RemoveFont), - lunamethod(Renderable2DComponent_BindLua, ClearSprites), - lunamethod(Renderable2DComponent_BindLua, ClearFonts), - lunamethod(Renderable2DComponent_BindLua, GetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, GetFontOrder), - - lunamethod(Renderable2DComponent_BindLua, AddLayer), - lunamethod(Renderable2DComponent_BindLua, GetLayers), - lunamethod(Renderable2DComponent_BindLua, SetLayerOrder), - lunamethod(Renderable2DComponent_BindLua, SetSpriteOrder), - lunamethod(Renderable2DComponent_BindLua, SetFontOrder), - - lunamethod(RenderableComponent_BindLua, GetContent), - lunamethod(RenderableComponent_BindLua, Initialize), - lunamethod(RenderableComponent_BindLua, Load), - lunamethod(RenderableComponent_BindLua, Unload), - lunamethod(RenderableComponent_BindLua, Start), - lunamethod(RenderableComponent_BindLua, Stop), - lunamethod(RenderableComponent_BindLua, FixedUpdate), - lunamethod(RenderableComponent_BindLua, Update), - lunamethod(RenderableComponent_BindLua, Render), - lunamethod(RenderableComponent_BindLua, Compose), - lunamethod(RenderableComponent_BindLua, OnStart), - lunamethod(RenderableComponent_BindLua, OnStop), - lunamethod(RenderableComponent_BindLua, GetLayerMask), - lunamethod(RenderableComponent_BindLua, SetLayerMask), - - lunamethod(Renderable3DComponent_BindLua, SetSSAOEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSREnabled), - lunamethod(Renderable3DComponent_BindLua, SetShadowsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetReflectionsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetFXAAEnabled), - lunamethod(Renderable3DComponent_BindLua, SetBloomEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), - lunamethod(Renderable3DComponent_BindLua, SetColorGradingTexture), - lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), - lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), - lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), - lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldEnabled), - lunamethod(Renderable3DComponent_BindLua, SetStereogramEnabled), - lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled), - lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled), - lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount), - - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldFocus), - lunamethod(Renderable3DComponent_BindLua, SetDepthOfFieldStrength), - - { NULL, NULL } -}; -Luna::PropertyType TiledForwardRenderableComponent_BindLua::properties[] = { - { NULL, NULL } -}; - -TiledForwardRenderableComponent_BindLua::TiledForwardRenderableComponent_BindLua(TiledForwardRenderableComponent* component) -{ - this->component = component; -} - -TiledForwardRenderableComponent_BindLua::TiledForwardRenderableComponent_BindLua(lua_State *L) -{ - component = new TiledForwardRenderableComponent(); -} - - -TiledForwardRenderableComponent_BindLua::~TiledForwardRenderableComponent_BindLua() -{ -} - -void TiledForwardRenderableComponent_BindLua::Bind() -{ - static bool initialized = false; - if (!initialized) - { - initialized = true; - Luna::Register(wiLua::GetGlobal()->GetLuaState()); - } -} diff --git a/WickedEngine/TiledForwardRenderableComponent_BindLua.h b/WickedEngine/TiledForwardRenderableComponent_BindLua.h deleted file mode 100644 index d2dd3fc59..000000000 --- a/WickedEngine/TiledForwardRenderableComponent_BindLua.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "wiLua.h" -#include "wiLuna.h" -#include "TiledForwardRenderableComponent.h" -#include "Renderable3DComponent_BindLua.h" - -class TiledForwardRenderableComponent_BindLua : public Renderable3DComponent_BindLua -{ -public: - static const char className[]; - static Luna::FunctionType methods[]; - static Luna::PropertyType properties[]; - - TiledForwardRenderableComponent_BindLua(TiledForwardRenderableComponent* component = nullptr); - TiledForwardRenderableComponent_BindLua(lua_State *L); - ~TiledForwardRenderableComponent_BindLua(); - - static void Bind(); -}; - diff --git a/WickedEngine/WickedEngine.h b/WickedEngine/WickedEngine.h index e3d22c010..91ebf5b20 100644 --- a/WickedEngine/WickedEngine.h +++ b/WickedEngine/WickedEngine.h @@ -56,15 +56,15 @@ #include "wiGPUBVH.h" #include "wiGPUSortLib.h" -#include "RenderableComponent.h" -#include "Renderable2DComponent.h" -#include "Renderable3DComponent.h" -#include "ForwardRenderableComponent.h" -#include "DeferredRenderableComponent.h" -#include "TiledForwardRenderableComponent.h" -#include "TiledDeferredRenderableComponent.h" -#include "PathTracingRenderableComponent.h" -#include "LoadingScreenComponent.h" +#include "RenderPath.h" +#include "RenderPath2D.h" +#include "RenderPath3D.h" +#include "RenderPath3D_Forward.h" +#include "RenderPath3D_Deferred.h" +#include "RenderPath3D_TiledForward.h" +#include "RenderPath3D_TiledDeferred.h" +#include "RenderPath3D_PathTracing.h" +#include "LoadingScreen.h" #include "MainComponent.h" #ifdef _WIN32 diff --git a/WickedEngine/WickedEngine_SHARED.vcxitems b/WickedEngine/WickedEngine_SHARED.vcxitems index fb61581b0..0756021cd 100644 --- a/WickedEngine/WickedEngine_SHARED.vcxitems +++ b/WickedEngine/WickedEngine_SHARED.vcxitems @@ -229,17 +229,17 @@ - - - - + + + + - + @@ -249,10 +249,10 @@ - - - - + + + + @@ -269,8 +269,8 @@ - - + + @@ -300,12 +300,12 @@ - - - - - - + + + + + + @@ -517,15 +517,15 @@ - - - - - - - - - + + + + + + + + + @@ -536,8 +536,8 @@ - - + + false @@ -646,12 +646,12 @@ - - - - - - + + + + + + diff --git a/WickedEngine/WickedEngine_SHARED.vcxitems.filters b/WickedEngine/WickedEngine_SHARED.vcxitems.filters index e100516c0..c6f6c06b6 100644 --- a/WickedEngine/WickedEngine_SHARED.vcxitems.filters +++ b/WickedEngine/WickedEngine_SHARED.vcxitems.filters @@ -13,9 +13,6 @@ {2d30408b-f788-42a8-9648-41561036e10a} - - {a25b4076-72bb-4c78-8bc1-84c59a8984fd} - {3c39405f-ec30-4b72-9c32-68aefb4fb7a5} @@ -64,6 +61,9 @@ {f9156b5b-9cc8-436c-9faa-536f7dce4f27} + + {a25b4076-72bb-4c78-8bc1-84c59a8984fd} + @@ -156,48 +156,15 @@ ENGINE\Graphics\GPUMapping - - ENGINE\Components - - - ENGINE\Components - - ENGINE\Components - - - ENGINE\Components - - - ENGINE\Components - - - ENGINE\Components + ENGINE\High level interface ENGINE\Scripting\LuaBindings - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - ENGINE\Scripting\LuaBindings - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - ENGINE\Scripting\LuaBindings @@ -1005,15 +972,9 @@ ENGINE\Helpers - - ENGINE\Components - ENGINE\Helpers - - ENGINE\Scripting\LuaBindings - ENGINE\Helpers @@ -1038,9 +999,6 @@ ENGINE\Graphics\API - - ENGINE\Components - ENGINE\Graphics\GPUMapping @@ -1092,21 +1050,12 @@ ENGINE\Graphics\GPUMapping - - ENGINE\Scripting\LuaBindings - ENGINE\Graphics\GPUMapping - - ENGINE\Components - ENGINE\Graphics\GPUMapping - - ENGINE\Components - ENGINE\Graphics\GPUMapping @@ -1149,6 +1098,57 @@ UTILITY + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + @@ -1259,48 +1259,15 @@ ENGINE - - ENGINE\Components - - - ENGINE\Components - - ENGINE\Components - - - ENGINE\Components - - - ENGINE\Components - - - ENGINE\Components + ENGINE\High level interface ENGINE\Scripting\LuaBindings - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - ENGINE\Scripting\LuaBindings - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - - - ENGINE\Scripting\LuaBindings - ENGINE\Scripting\LuaBindings @@ -1868,15 +1835,9 @@ ENGINE\Helpers - - ENGINE\Components - ENGINE\Helpers - - ENGINE\Scripting\LuaBindings - ENGINE\Helpers @@ -1892,9 +1853,6 @@ ENGINE\Graphics\API - - ENGINE\Components - ENGINE\Graphics @@ -1916,15 +1874,6 @@ ENGINE\Graphics - - ENGINE\Scripting\LuaBindings - - - ENGINE\Components - - - ENGINE\Components - UTILITY @@ -1946,6 +1895,57 @@ ENGINE\Helpers + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\Scripting\LuaBindings + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + + + ENGINE\High level interface + diff --git a/WickedEngine/objectHF.hlsli b/WickedEngine/objectHF.hlsli index ac373f6e2..2e6ae1e3e 100644 --- a/WickedEngine/objectHF.hlsli +++ b/WickedEngine/objectHF.hlsli @@ -35,7 +35,7 @@ #define xSurfaceMap texture_2 // r: reflectance, g: metalness, b: emissive, a: subsurface scattering #define xDisplacementMap texture_3 // r: heightmap -// These are bound by RenderableComponent (based on Render Path): +// These are bound by RenderPath (based on Render Path): #define xReflection texture_6 // rgba: scene color from reflected camera angle #define xRefraction texture_7 // rgba: scene color from primary camera angle #define xWaterRipples texture_8 // rgb: snorm8 water ripple normal map diff --git a/WickedEngine/wiBackLog.cpp b/WickedEngine/wiBackLog.cpp index abe8fa270..f1663052a 100644 --- a/WickedEngine/wiBackLog.cpp +++ b/WickedEngine/wiBackLog.cpp @@ -16,8 +16,6 @@ using namespace std; using namespace wiGraphicsTypes; -wiSpinLock logLock; - namespace wiBackLog { @@ -39,6 +37,7 @@ namespace wiBackLog stringstream inputArea; int historyPos = 0; wiFont font; + wiSpinLock logLock; Texture2D* backgroundTex = nullptr; diff --git a/WickedEngine/wiLua.cpp b/WickedEngine/wiLua.cpp index 636963bd4..b1f3c43aa 100644 --- a/WickedEngine/wiLua.cpp +++ b/WickedEngine/wiLua.cpp @@ -2,14 +2,14 @@ #include "wiLua_Globals.h" #include "wiBackLog.h" #include "MainComponent_BindLua.h" -#include "RenderableComponent_BindLua.h" -#include "Renderable2DComponent_BindLua.h" -#include "LoadingScreenComponent_BindLua.h" -#include "Renderable3DComponent_BindLua.h" -#include "DeferredRenderableComponent_BindLua.h" -#include "ForwardRenderableComponent_BindLua.h" -#include "TiledForwardRenderableComponent_BindLua.h" -#include "TiledDeferredRenderableComponent_BindLua.h" +#include "RenderPath_BindLua.h" +#include "RenderPath2D_BindLua.h" +#include "LoadingScreen_BindLua.h" +#include "RenderPath3D_BindLua.h" +#include "RenderPath3D_Deferred_BindLua.h" +#include "RenderPath3D_Forward_BindLua.h" +#include "RenderPath3D_TiledForward_BindLua.h" +#include "RenderPath3D_TiledDeferred_BindLua.h" #include "Texture_BindLua.h" #include "wiRenderer_BindLua.h" #include "wiSound_BindLua.h" @@ -56,14 +56,14 @@ wiLua* wiLua::GetGlobal() UNLOCK_STATIC(); MainComponent_BindLua::Bind(); - RenderableComponent_BindLua::Bind(); - Renderable2DComponent_BindLua::Bind(); - LoadingScreenComponent_BindLua::Bind(); - Renderable3DComponent_BindLua::Bind(); - DeferredRenderableComponent_BindLua::Bind(); - ForwardRenderableComponent_BindLua::Bind(); - TiledForwardRenderableComponent_BindLua::Bind(); - TiledDeferredRenderableComponent_BindLua::Bind(); + RenderPath_BindLua::Bind(); + RenderPath2D_BindLua::Bind(); + LoadingScreen_BindLua::Bind(); + RenderPath3D_BindLua::Bind(); + RenderPath3D_Deferred_BindLua::Bind(); + RenderPath3D_Forward_BindLua::Bind(); + RenderPath3D_TiledForward_BindLua::Bind(); + RenderPath3D_TiledDeferred_BindLua::Bind(); Texture_BindLua::Bind(); wiRenderer_BindLua::Bind(); wiSound_BindLua::Bind(); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 411ec6b0f..26498fddd 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 = 21; + const int minor = 22; // minor bug fixes, alterations, refactors, updates - const int revision = 38; + const int revision = 0; long GetVersion()