diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md
index cbd927e9f..92e04a15a 100644
--- a/Content/Documentation/ScriptingAPI-Documentation.md
+++ b/Content/Documentation/ScriptingAPI-Documentation.md
@@ -43,6 +43,11 @@ This is a reference and explanation of Lua scripting features in Wicked Engine.
1. [RenderPath2D](#renderpath2d)
2. [RenderPath3D](#renderpath3d)
3. [LoadingScreen](#loadingscreen)
+ 12. [Primitives](#primitives)
+ 1. [Ray](#ray)
+ 2. [AABB](#aabb)
+ 3. [Sphere](#sphere)
+ 4. [Capsule](#capsule)
12. [Input](#input)
## Introduction and usage
@@ -682,7 +687,7 @@ It inherits functions from RenderPath2D.
- AddLoadingTask(string taskScript)
- OnFinished(string taskScript)
-### Intersects
+### Primitives
#### Ray
A ray is defined by an origin Vector and a normalized direction Vector. It can be used to intersect with other primitives or the scene
diff --git a/Content/Documentation/WickedEngine-Documentation.md b/Content/Documentation/WickedEngine-Documentation.md
index 0709c76dc..63255be94 100644
--- a/Content/Documentation/WickedEngine-Documentation.md
+++ b/Content/Documentation/WickedEngine-Documentation.md
@@ -5,7 +5,7 @@ This is a reference for the C++ features of Wicked Engine
## Contents
1. [High Level Interface](#high-level-interface)
- 1. [MainComponent](#maincomponent)
+ 1. [Application](#application)
2. [RenderPath](#renderpath)
3. [RenderPath2D](#renderpath2d)
4. [RenderPath3D](#renderpath3d)
@@ -13,8 +13,8 @@ This is a reference for the C++ features of Wicked Engine
1.[Denoiser](#denoiser)
10. [LoadingScreen](#loadingscreen)
2. [System](#system)
- 1. [wiECS (Entity-Component System)](#wiecs)
- 2. [wiScene](#wiscene)
+ 1. [Entity-Component System](#entity-component-system)
+ 2. [Scene System](#scene-system)
1. [NameComponent](#namecomponent)
2. [LayerComponent](#layercomponent)
3. [TransformComponent](#transformcomponent)
@@ -38,13 +38,13 @@ This is a reference for the C++ features of Wicked Engine
21. [InverseKinematicsComponent](#inversekinematicscomponent)
22. [SpringComponent](#springcomponent)
23. [Scene](#scene)
- 3. [wiJobSystem](#wijobsystem)
- 4. [wiInitializer](#wiinitializer)
- 5. [wiPlatform](#wiplatform)
- 6. [wiEvent](#wievent)
- 7. [wiCanvas](#wicanvas)
+ 3. [Job System](#job-system)
+ 4. [Initializer](#initializer)
+ 5. [Platform](#platform)
+ 6. [EventHandler](#event-handler)
+ 7. [Canvas](#canvas)
3. [Graphics](#graphics)
- 1. [wiGraphics](#wigraphics)
+ 1. [Graphics API](#graphics-api)
1. [GraphicsDevice](#wigraphicsdevice)
1. [Debug device](#debug-device)
2. [Creating resources](#creating-resources)
@@ -69,7 +69,7 @@ This is a reference for the C++ features of Wicked Engine
2. [GraphicsDevice_DX11](#wigraphicsdevice_dx11)
3. [GraphicsDevice_DX12](#wigraphicsdevice_dx12)
4. [GraphicsDevice_Vulkan](#wigraphicsdevice_vulkan)
- 2. [wiRenderer](#wirenderer)
+ 2. [Renderer](#renderer)
1. [DrawScene](#drawscene)
2. [DrawScene_Transparent](#drawscene_transparent)
3. [Tessellation](#tessellation)
@@ -89,40 +89,38 @@ This is a reference for the C++ features of Wicked Engine
16. [Debug Draw](#debug-draw)
17. [Animation Skinning](#animation-skinning)
18. [Custom Shaders](#custom-shaders)
- 3. [wiEnums](#wienums)
- 4. [wiImage](#wiimage)
- 5. [wiFont](#wifont)
- 6. [wiEmittedParticle](#wiemittedparticle)
- 7. [wiHairParticle](#wihairparticle)
- 8. [wiOcean](#wiocean)
- 9. [wiSprite](#wisprite)
- 10. [wiSpriteFont](#wispritefont)
- 11. [wiGPUSortLib](#wigpusortlib)
- 12. [wiGPUBVH](#wigpubvh)
+ 3. [Enums](#enums)
+ 4. [Image Renderer](#image-renderer)
+ 5. [Font Renderer](#font-renderer)
+ 6. [Emitted Particle System](#emitted-particle-system)
+ 7. [Hair Particle System](#hair-particle-system)
+ 8. [Ocean](#ocean)
+ 9. [Sprite](#sprite)
+ 10. [SpriteFont](#spritefont)
+ 11. [GPUSortLib](#gpusortlib)
+ 12. [GPUBVH](#gpubvh)
4. [GUI](#gui)
- 1. [wiGUI](#wigui)
- 2. [wiWidget](#wiwidget)
- 3. [wiButton](#wibutton)
- 4. [wiLabel](#wilabel)
- 5. [wiTextInputField](#witextinputfield)
- 6. [wiSlider](#wislider)
- 7. [wiCheckBox](#wicheckbox)
- 8. [wiComboBox](#wicombobox)
- 9. [wiWindow](#wiwindow)
- 10. [wiColorPicker](#wicolorpicker)
+ 1. [GUI](#gui)
+ 2. [Widget](#widget)
+ 3. [Button](#button)
+ 4. [Label](#label)
+ 5. [TextInputField](#textinputfield)
+ 6. [Slider](#slider)
+ 7. [CheckBox](#checkbox)
+ 8. [ComboBox](#combobox)
+ 9. [Window](#window)
+ 10. [ColorPicker](#colorpicker)
+ 11. [TreeList](#treelist)
5. [Helpers](#helpers)
- 1. [wiAllocators](#wiallocators)
- 1. [LinearAllocator](#linearallocator)
- 1. [ThreadSafeRingBuffer](#threadsaferingbuffer)
- 2. [wiArchive](#wiarchive)
- 3. [wiColor](#wicolor)
- 5. [wiFadeManager](#wifademanager)
- 6. [wiHelper](#wihelper)
- 7. [wiIntersect](#wiintersect)
+ 2. [Archive](#archive)
+ 3. [Color](#color)
+ 5. [FadeManager](#fademanager)
+ 6. [Helper](#helper)
+ 7. [Primitive](#primitive)
1. [AABB](#aabb)
- 2. [SPHERE](#sphere)
- 2. [CAPSULE](#capsule)
- 3. [RAY](#ray)
+ 2. [Sphere](#sphere)
+ 2. [Capsule](#capsule)
+ 3. [Ray](#ray)
4. [Frustum](#frustum)
5. [Hitbox2D](#hitbox2d)
8. [wiMath](#wimath)
@@ -130,32 +128,28 @@ This is a reference for the C++ features of Wicked Engine
10. [wiRectPacker](#wirectpacker)
11. [wiResourceManager](#wiresourcemanager)
12. [wiSpinLock](#wispinlock)
- 13. [wiStartupArguments](#wistartuparguments)
+ 13. [wiArguments](#wiarguments)
14. [wiTimer](#witimer)
6. [Input](#input)
7. [Audio](#audio)
- 1. [wiAudio](#wiaudio)
- 2. [Sound](#sound)
- 3. [SoundInstance](#soundinstance)
- 4. [SoundInstance3D](#soundinstance3d)
- 5. [SUBMIX_TYPE](#submix_type)
- 6. [REVERB_PRESET](#reverb_preset)
+ 1. [Sound](#sound)
+ 2. [SoundInstance](#soundinstance)
+ 3. [SoundInstance3D](#soundinstance3d)
+ 4. [SUBMIX_TYPE](#submix_type)
+ 5. [REVERB_PRESET](#reverb_preset)
8. [Physics](#physics)
- 1. [wiPhysicsEngine](#wiphysicsengine)
- 1. [Rigid Body Physics](#rigid-body-physics)
- 2. [Soft Body Physics](#soft-body-physics)
- 2. [wiPhysicsEngine_BULLET](#wiphysicsengine_bullet)
+ 1. [Rigid Body Physics](#rigid-body-physics)
+ 2. [Soft Body Physics](#soft-body-physics)
9. [Network](#network)
- 1. [wiNetwork](#winetwork)
2. [Socket](#socket)
3. [Connection](#connection)
10. [Scripting](#scripting)
- 1. [wiLua](#wilua)
- 2. [wiLua_Globals](#wilua_globals)
- 3. [wiLuna](#wiluna)
+ 1. [Lua](#lua)
+ 2. [Lua_Globals](#lua_globals)
+ 3. [Luna](#luna)
11. [Tools](#tools)
- 1. [wiBacklog](#wibacklog)
- 2. [wiProfiler](#wiprofiler)
+ 1. [Backlog](#backlog)
+ 2. [Profiler](#profiler)
12. [Shaders](#shaders)
1. [Interop](#interop)
1. [ConstantBufferMapping](#constantbuffermapping)
@@ -168,14 +162,14 @@ This is a reference for the C++ features of Wicked Engine
## 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.
-### MainComponent
-[[Header]](../../WickedEngine/MainComponent.h) [[Cpp]](../../WickedEngine/MainComponent.cpp)
+### Application
+[[Header]](../../WickedEngine/wiApplication.h) [[Cpp]](../../WickedEngine/wiApplication.cpp)
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.
The user should call the SetWindow() function to associate it with a window of the operating system. This window will be used to render to.
-The MainComponent has many uses that the user is not necessarily interested in. The most important part is that it manages the RenderPaths. There can be one active RenderPath at a time, which will be updated and rendered to the screen every frame. However, because a RenderPath is a highly customizable class, there is no limitation what can be done within the RenderPath, for example supporting multiple concurrent RenderPaths if required. RenderPaths can be switched wit ha Fade out screen easily. Loading Screen can be activated as an active Renderpath and it will load and switch to an other RenderPath if desired. A RenderPath can be simply activated with the MainComponent::ActivatePath() function.
-The MainComponent does the following every frame while it is running:
+The `Application` has many uses that the user is not necessarily interested in. The most important part is that it manages the RenderPaths. There can be one active RenderPath at a time, which will be updated and rendered to the screen every frame. However, because a RenderPath is a highly customizable class, there is no limitation what can be done within the RenderPath, for example supporting multiple concurrent RenderPaths if required. RenderPaths can be switched wit ha Fade out screen easily. Loading Screen can be activated as an active Renderpath and it will load and switch to an other RenderPath if desired. A RenderPath can be simply activated with the `Application::ActivatePath()` function.
+The `Application` does the following every frame while it is running:
1. FixedUpdate()
-Calls FixedUpdate for the active RenderPath and wakes up scripts that are waiting for fixedupdate(). The frequency off calls will be determined by MainComponent::setTargetFrameRate(float framespersecond). By default (parameter = 60), FixedUpdate will be called 60 times per second.
+Calls FixedUpdate for the active RenderPath and wakes up scripts that are waiting for fixedupdate(). The frequency off calls will be determined by `Application::setTargetFrameRate(float framespersecond)`. By default (parameter = 60), FixedUpdate will be called 60 times per second.
2. Update(float deltatime)
Calls Update for the active RenderPath and wakes up scripts that are waiting for update()
3. Render()
@@ -184,13 +178,13 @@ Calls Render for the active RenderPath and wakes up scripts that are waiting for
Calls Compose for the active RenderPath
### RenderPath
-[[Header]](../../WickedEngine/RenderPath.h)
-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. The RenderPath inherits from [wiCanvas](#wicanvas), and the canvas properties will be set by the [MainComponent](#maincomponent) when the RenderPath was activated, and while the RenderPath is active.
+[[Header]](../../WickedEngine/wiRenderPath.h)
+This is an empty base class that can be activated with a `Application`. It calls its Start(), Update(), FixedUpdate(), Render(), Compose(), Stop() functions as needed. Override this to perform custom gameplay or rendering logic. The RenderPath inherits from [wiCanvas](#wicanvas), and the canvas properties will be set by the [Application](#application) when the RenderPath was activated, and while the RenderPath is active.
The order in which the functions are executed every frame:
1. PreUpdate()
This will be called once per frame before any script that calls Update().
2. FixedUpdate()
-This will be called in a manner that is deterministic, so logic will be running in the frequency that is specified with MainComponent::setTargetFrameRate(float framespersecond)
+This will be called in a manner that is deterministic, so logic will be running in the frequency that is specified with `Application::setTargetFrameRate(float framespersecond)`
3. Update(float deltatime)
This will be called once per frame, and the elapsed time in seconds since the last Update() is provided as parameter
4. PostUpdate()
@@ -204,19 +198,19 @@ Apart from the functions that will be run every frame, the RenderPath has the fo
1. Load()
Intended for loading resources before the first time the RenderPath will be used. It will be callsed by [LoadingScreen](#loadingscreen) to load resources in the background.
2. Start()
-Start will always be called when a RenderPath is activated by the MainComponent
+Start will always be called when a RenderPath is activated by the `Application`
3. Stop()
-Stop will be always called when the current RenderPath was the active one in MainComponent, but an other one was activated.
+Stop will be always called when the current RenderPath was the active one in `Application`, but an other one was activated.
### RenderPath2D
-[[Header]](../../WickedEngine/RenderPath2D.h) [[Cpp]](../../WickedEngine/RenderPath2D.cpp)
+[[Header]](../../WickedEngine/wiRenderPath2D.h) [[Cpp]](../../WickedEngine/wiRenderPath2D.cpp)
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 wiSpriteFont onto rendering layers and stenciling with 3D rendered scene. It has a [GUI](#gui) that is automatically updated and rendered if any elements have been added to it.
### RenderPath3D
-[[Header]](../../WickedEngine/RenderPath3D.h) [[Cpp]](../../WickedEngine/RenderPath3D.cpp)
+[[Header]](../../WickedEngine/wiRenderPath3D.h) [[Cpp]](../../WickedEngine/wiRenderPath3D.cpp)
Base class for implementing 3D rendering paths. It also supports everything that the Renderpath2D does.
-The post process chain is also implemented here. This means that the order of the post processes and the resources that they use are defined here, but the individual post process rendering on a lower level is implemented in the `wiRenderer` as core engine features. Read more about post process implementation in the [wiRenderer section](#post-processing).
+The post process chain is also implemented here. This means that the order of the post processes and the resources that they use are defined here, but the individual post process rendering on a lower level is implemented in the `wi::renderer` as core engine features. Read more about post process implementation in the [wi::renderer section](#post-processing).
The post process chain is implemented in `RenderPath3D::RenderPostprocessChain()` function and divided into multiple parts:
- HDR
@@ -229,19 +223,19 @@ These are running in more specific locations, depending on the render path. For
The HDR and LDR post process chain are using the "ping-ponging" technique, which means when the first post process consumes texture1 and produces texture2, then the following post process will consume texture2 and produce texture1, until all post processes are rendered.
### RenderPath3D_PathTracing
-[[Header]](../../WickedEngine/RenderPath3D_PathTracing.h) [[Cpp]](../../WickedEngine/RenderPath3D_PathTracing.cpp)
-Implements a compute shader based path tracing solution. In a static scene, the rendering will converge to ground truth. When something changes in the scene (something moves, ot material changes, etc...), the convergence will be restarted from the beginning. The raytracing is implemented in [wiRenderer](#wirenderer) and multiple [shaders](#shaders). The ray tracing is available on any GPU that supports compute shaders.
+[[Header]](../../WickedEngine/wiRenderPath3D_PathTracing.h) [[Cpp]](../../WickedEngine/wiRenderPath3D_PathTracing.cpp)
+Implements a compute shader based path tracing solution. In a static scene, the rendering will converge to ground truth. When something changes in the scene (something moves, ot material changes, etc...), the convergence will be restarted from the beginning. The raytracing is implemented in [wi::renderer](#wi::renderer) and multiple [shaders](#shaders). The ray tracing is available on any GPU that supports compute shaders.
#### Denoiser
To enable denoising for path traced images, you can use the [Open Image Denoise library](https://github.com/OpenImageDenoise/oidn). To enable this functionality, the engine will try to include the "OpenImageDenoise/oidn.hpp" file. If this file could be included, it will attampt to link with OpenImageDenoise.lib and tbb.lib. It is also required to provide the OpenImageDenoise.dll and tbb.dll near the exe to correctly launch the application after this. If you satisfy these steps, the denoiser will work automatically after the path tracer reached the target sample count. The final path traced image will be denoised and presented to the screen.
### LoadingScreen
-[[Header]](../../WickedEngine/LoadingScreen.h) [[Cpp]](../../WickedEngine/LoadingScreen.cpp)
+[[Header]](../../WickedEngine/wiLoadingScreen.h) [[Cpp]](../../WickedEngine/wiLoadingScreen.cpp)
Render path that can be easily used for loading screen. It is able to load content or RenderPath in the background and switch to an other RenderPath onceit finished.
## System
You can find out more about the Entity-Component system and other engine-level systems under ENGINE/System filter in the solution.
-### wiECS
+### Entity-Component System
[[Header]](../../WickedEngine/wiECS.h)
#### ComponentManager
@@ -250,11 +244,11 @@ This is the core entity-component relationship handler class. The purpose of thi
#### Entity
Entity is a number, it can reference components through ComponentManager containers. An entity is always valid if it exists. It's not required that an entity has any components. An entity has a component, if there is a ComponentManager that has a component which is associated with the same entity.
-### wiScene
+### Scene System
[[Header]](../../WickedEngine/wiScene.h) [[Cpp]](../../WickedEngine/wiScene.cpp)
The logical scene representation using the Entity-Component System
- GetScene
-Returns a global scene instance. The wiRenderer will use this scene instance to render the scene. The user can create multiple scenes as well, and merge those into the global scene so that those will be rendered as well.
+Returns a global scene instance. The wi::renderer will use this scene instance to render the scene. The user can create multiple scenes as well, and merge those into the global scene so that those will be rendered as well.
- LoadModel()
There are two flavours to this. One of them immediately loads into the global scene. The other loads into a custom scene, which is usefult to manage the contents separately. This function will return an Entity that represents the root transform of the scene - if the attached parameter was true, otherwise it will return INVALID_ENTITY and no root transform will be created.
- Pick
@@ -376,11 +370,11 @@ An entity can have a `SpringComponent` to achieve a "jiggle" or "soft" animation
#### Scene
[[Header]](../../WickedEngine/wiScene.h) [[Cpp]](../../WickedEngine/wiScene.cpp)
-A scene is a collection of component arrays. The scene is updating all the components in an efficient manner using the [job system](#wijobsystem). It can be serialized and saved/loaded from disk efficiently.
+A scene is a collection of component arrays. The scene is updating all the components in an efficient manner using the [job system](#job-system). It can be serialized and saved/loaded from disk efficiently.
- Update(float deltatime)
This function runs all the requied systems to update all components contained within the Scene.
-### wiJobSystem
+### Job System
[[Header]](../../WickedEngine/wiJobSystem.h) [[Cpp]](../../WickedEngine/wiJobSystem.cpp)
Manages the execution of concurrent tasks
- context
@@ -392,11 +386,11 @@ This will schedule a task for execution on multiple parallel threads for a given
- Wait
This function will block until all jobs have finished for a given workload. The current thread starts working on any work left to be finished.
-### wiInitializer
+### Initializer
[[Header]](../../WickedEngine/wiInitializer.h) [[Cpp]](../../WickedEngine/wiInitializer.cpp)
Initializes all engine systems either in a blocking or an asynchronous way.
-### wiPlatform
+### Platform
[[Header]](../../WickedEngine/wiPlatform.h)
You can get native platform specific handles here, such as window handle.
- GetWindow
@@ -404,20 +398,20 @@ Returns the platform specific window handle
- IsWindowActive
Returns true if the current window is the topmost one, false if it is not in focus
-### wiEvent
-[[Header]](../../WickedEngine/wiEvent.h)
+### Event Handler
+[[Header]](../../WickedEngine/wiEventHandler.h)
The event system can be used to execute system-wide tasks. Any system can "subscribe" to events and any system can "fire" events.
- Subscribe
The first parameter is the event ID. Core system events are negative numbers. The user can choose any positive number to create custom events.
The second parameter is a function to be executed, with a userdata argument. The userdata argument can hold any custom data that the user desires.
-The return value is a wiEvent::Handle type. When this is object is destroyed, the event is subscription for the function will be removed.
+The return value is a `wi::eventhandler::Handle` type. When this is object is destroyed, the event is subscription for the function will be removed.
Multiple functions can be subscribed to a single event ID.
- FireEvent
The first argument is the event id, that says which events to invoke.
The second argument will be passed to the subscribed event's userdata parameter.
All events that are subsribed to the specified event id will run immediately at the time of the call of FireEvent. The order of execution among events is the order of which they were subscribed.
-### wiCanvas
+### Canvas
[[Header]](../../WickedEngine/wiCanvas.h)
The canvas specifies a DPI-aware drawing area. Use the GetLogical... functions to get parameters with DPI aware scale factors applied. Use the GetPhysical... functions to get the real pixel counts.
@@ -425,7 +419,7 @@ The canvas specifies a DPI-aware drawing area. Use the GetLogical... functions t
## Graphics
Everything related to rendering graphics will be discussed below
-### wiGraphics
+### Graphics API
[[Header]](../../WickedEngine/wiGraphics.h)
The graphics API wrappers
@@ -705,12 +699,12 @@ The DirectX11 interface has been removed after version 0.56
[[Header]](../../WickedEngine/wiGraphicsDevice_DX12.h) [[Cpp]](../../WickedEngine/wiGraphicsDevice_DX12.cpp)
DirectX12 implementation for rendering interface
-#### wiGraphicsDevice_Vulkan
+#### GraphicsDevice_Vulkan
[[Header]](../../WickedEngine/wiGraphicsDevice_Vulkan.h) [[Cpp]](../../WickedEngine/wiGraphicsDevice_Vulkan.cpp)
Vulkan implementation for rendering interface
-### wiRenderer
+### Renderer
[[Header]](../../WickedEngine/wiRenderer.h) [[Cpp]](../../WickedEngine/wiRenderer.cpp)
This is a collection of graphics technique implentations and functions to draw a scene, shadows, post processes and other things. It is also the manager of the GraphicsDevice instance, and provides other helper functions to load shaders from files on disk.
@@ -731,15 +725,15 @@ The `flags` argument can contain various modifiers that determine what kind of o
- `DRAWSCENE_OPAQUE`: Opaque object will be rendered
- `DRAWSCENE_TRANSPARENT`: Transparent objects will be rendered. Objects will be sorted back-to front, for blending purposes
-- `DRAWSCENE_OCCLUSIONCULLING`: Occluded objects won't be rendered. [Occlusion culling](#occlusion-culling) can be globally switched on/off using `wiRenderer::SetOcclusionCullingEnabled()`
-- `DRAWSCENE_TESSELLATION`: Enable [tessellation](#tessellation) (if hardware supports it). [Tessellation](#tessellation) can be globally switched on/off using `wiRenderer::SetTessellationEnabled()`
+- `DRAWSCENE_OCCLUSIONCULLING`: Occluded objects won't be rendered. [Occlusion culling](#occlusion-culling) can be globally switched on/off using `wi::renderer::SetOcclusionCullingEnabled()`
+- `DRAWSCENE_TESSELLATION`: Enable [tessellation](#tessellation) (if hardware supports it). [Tessellation](#tessellation) can be globally switched on/off using `wi::renderer::SetTessellationEnabled()`
- `DRAWSCENE_HAIRPARTICLE`: Draw hair particles
#### Tessellation
Tessellation can be used when rendering objects. Tessellation requires a GPU hardware feature and can enable displacement mapping on vertices or smoothing mesh silhouettes dynamically while rendering objects. Tessellation will be used when `tessellation` parameter to the [DrawScene](#drawscene) was set to `true` and the GPU supports the tessellation feature. Tessellation level can be specified per [MeshComponent](#meshcomponent)'s `tessellationFactor` parameter. Tessellation level will be modulated by distance from camera, so that tessellation factor will fade out on more distant objects. Greater tessellation factor means more detailed geometry will be generated.
#### Occlusion Culling
-Occlusion culling is a technique to determine which objects are within the camera, but are completely behind an other objects, such that they wouldn't be rendered. The depth buffer already does occlusion culling on the GPU, however, we would like to perform this earlier than submitting the mesh to the GPU for drawing, so essentially do the occlusion culling on CPU. A hybrid approach is used here, which uses the results from a previously rendered frame (that was rendered by GPU) to determine if an object will be visible in the current frame. For this, we first render the object into the previous frame's depth buffer, and use the previous frame's camera matrices, however, the current position of the object. In fact, we only render bounding boxes instead of objects, for performance reasons. Occlusion queries are used while rendering, and the CPU can read the results of the queries in a later frame. We keep track of how many frames the object was not visible, and if it was not visible for a certain amount, we omit it from rendering. If it suddenly becomes visible later, we immediately enable rendering it again. This technique means that results will lag behind for a few frames (latency between cpu and gpu and latency of using previous frame's depth buffer). These are implemented in the functions `wiRenderer::OcclusionCulling_Render()` and `wiRenderer::OcclusionCulling_Read()`.
+Occlusion culling is a technique to determine which objects are within the camera, but are completely behind an other objects, such that they wouldn't be rendered. The depth buffer already does occlusion culling on the GPU, however, we would like to perform this earlier than submitting the mesh to the GPU for drawing, so essentially do the occlusion culling on CPU. A hybrid approach is used here, which uses the results from a previously rendered frame (that was rendered by GPU) to determine if an object will be visible in the current frame. For this, we first render the object into the previous frame's depth buffer, and use the previous frame's camera matrices, however, the current position of the object. In fact, we only render bounding boxes instead of objects, for performance reasons. Occlusion queries are used while rendering, and the CPU can read the results of the queries in a later frame. We keep track of how many frames the object was not visible, and if it was not visible for a certain amount, we omit it from rendering. If it suddenly becomes visible later, we immediately enable rendering it again. This technique means that results will lag behind for a few frames (latency between cpu and gpu and latency of using previous frame's depth buffer). These are implemented in the functions `wi::renderer::OcclusionCulling_Render()` and `wi::renderer::OcclusionCulling_Read()`.
#### Shadow Maps
The `DrawShadowmaps()` function will render shadow maps for each active dynamic light that are within the camera [frustum](#frustum). There are two types of shadow maps, 2D and Cube shadow maps. The maximum number of usable shadow maps are set up with calling `SetShadowProps2D()` or `SetShadowPropsCube()` functions, where the parameters will specify the maximum number of shadow maps and resolution. The shadow slots for each light must be already assigned, because this is a rendering function and is not allowed to modify the state of the [Scene](#scene) and [lights](#lightcomponent). The shadow slots will be set up in the [UpdatePerFrameData()](#updateperframedata) function that is called every frame by the `RenderPath3D`.
@@ -752,26 +746,26 @@ Begin rendering the frame on GPU. This means that GPU compute jobs are kicked, s
#### Ray tracing (hardware accelerated)
-Hardware accelerated ray tracing API is now available, so a variety of renderer features are available using that. If the hardware support is available, the `Scene` will allocate a top level acceleration structure, and the meshes will allocate bottom level acceleration structures for themselves. Updating these is done by simply calling `wiRenderer::UpdateRaytracingAccelerationStructures(cmd)`. The updates will happen on the GPU timeline, so provide a [CommandList](#work-submission) as argument. The top level acceleration structure will be rebuilt from scratch. The bottom level acceleration structures will be rebuilt from scratch once, and then they will be updated (refitted).
+Hardware accelerated ray tracing API is now available, so a variety of renderer features are available using that. If the hardware support is available, the `Scene` will allocate a top level acceleration structure, and the meshes will allocate bottom level acceleration structures for themselves. Updating these is done by simply calling `wi::renderer::UpdateRaytracingAccelerationStructures(cmd)`. The updates will happen on the GPU timeline, so provide a [CommandList](#work-submission) as argument. The top level acceleration structure will be rebuilt from scratch. The bottom level acceleration structures will be rebuilt from scratch once, and then they will be updated (refitted).
After the acceleration structures are updated, ray tracing shaders can use it after binding to a shader resource slot.
#### Ray tracing (legacy)
-Ray tracing can be used in multiple ways to render the scene. The `RayTraceScene()` function will render the scene with the rays that are provided as the `RayBuffers` type argument. For example, to render the scene from the camera perspective, first create rays that originate from the camera and shoot towards the caera far plane for every pixel. The `GenerateScreenRayBuffers()` helper function implements this functionality, by expecting a [CameraComponent](#cameracomponent) argument and returns a `RayBuffers` structure. The result will be written to a texture that is provided as parameter. The texture must have been created with `UNORDERED_ACCESS` bind flags, because it will be written in compute shaders. The scene BVH structure must have been already built to use this, it can be accomplished by calling [wiRenderer::BuildSceneBVH()](#build-scene-bvh). The [RenderPath3D_Pathracing](#renderpath3d_pathtracing) uses this ray tracing functionality to render a path traced scene.
+Ray tracing can be used in multiple ways to render the scene. The `RayTraceScene()` function will render the scene with the rays that are provided as the `RayBuffers` type argument. For example, to render the scene from the camera perspective, first create rays that originate from the camera and shoot towards the caera far plane for every pixel. The `GenerateScreenRayBuffers()` helper function implements this functionality, by expecting a [CameraComponent](#cameracomponent) argument and returns a `RayBuffers` structure. The result will be written to a texture that is provided as parameter. The texture must have been created with `UNORDERED_ACCESS` bind flags, because it will be written in compute shaders. The scene BVH structure must have been already built to use this, it can be accomplished by calling [wi::renderer::BuildSceneBVH()](#build-scene-bvh). The [RenderPath3D_Pathracing](#renderpath3d_pathtracing) uses this ray tracing functionality to render a path traced scene.
Other than path tracing, the scene BVH can be rendered by using the `RayTraceSceneBVH` function. This will render the bounding box hierarchy to the screen as a heatmap. Blue colors mean that few boxes were hit per pixel, and with more bounding box hits the colors go to green, yellow, red, and finaly white. This is useful to determine how expensive a the scene is with regards to ray tracing performance.
-The lightmap baking is also using ray tracing on the GPU to precompute static lighting for objects in the scene. [Objects](#objectcomponent) that contain lightmap atlas texture coordinate set can start lightmap rendering by setting `ObjectComponent::SetLightmapRenderRequest(true)`. Every object that have this flag set will have their lightmaps updated by performing ray traced rendering by the [wiRenderer](#wirenderer) internally. Lightmap texture coordinates can be generated by a separate tool, such as the Wicked Engine Editor application. Lightmaps will be rendered to a global lightmap atlas that can be used by all shaders to read static lighting data. The global lightmap atlas texture contains lightmaps from all objects inside the scene in a compact format for performance. Apart from that, each object contains its own lightmap in a full precision texture format that can be post-processed and saved to disc for later use. To denoise lightmaps, follow the same steps as the path tracer denoiser setup described in the [Denoiser](#denoiser) section.
+The lightmap baking is also using ray tracing on the GPU to precompute static lighting for objects in the scene. [Objects](#objectcomponent) that contain lightmap atlas texture coordinate set can start lightmap rendering by setting `ObjectComponent::SetLightmapRenderRequest(true)`. Every object that have this flag set will have their lightmaps updated by performing ray traced rendering by the [wi::renderer](#wi::renderer) internally. Lightmap texture coordinates can be generated by a separate tool, such as the Wicked Engine Editor application. Lightmaps will be rendered to a global lightmap atlas that can be used by all shaders to read static lighting data. The global lightmap atlas texture contains lightmaps from all objects inside the scene in a compact format for performance. Apart from that, each object contains its own lightmap in a full precision texture format that can be post-processed and saved to disc for later use. To denoise lightmaps, follow the same steps as the path tracer denoiser setup described in the [Denoiser](#denoiser) section.
#### Scene BVH
-The scene BVH can be rebuilt from scratch using the `wiRenderer::BuildSceneBVH()` function. This will use the global scene to build the BVH hierarchy and global material atlases. The [ray tracing](#ray-tracing) features require the scene BVH to be built before using them. This is using the [wiGPUBVH](#wigpubvh) facility to build the BVH using compute shaders running on the GPU.
+The scene BVH can be rebuilt from scratch using the `wi::renderer::BuildSceneBVH()` function. This will use the global scene to build the BVH hierarchy and global material atlases. The [ray tracing](#ray-tracing) features require the scene BVH to be built before using them. This is using the [wiGPUBVH](#wigpubvh) facility to build the BVH using compute shaders running on the GPU.
#### Decals
The [DecalComponents](#decalcomponent) in the scene can be rendered differently based on the rendering technique that is being used. The two main rendering techinques are forward and deferred rendering.
Forward rendering is aimed at low bandwidth consumption, so the scene lighting is computed in one rendering pass, right when rendering the scene objects to the screen. In this case, all of the decals are also processed in the object rendering shaders automatically. In this case a decal atlas will need to be generated, because all decal textures must be available to sample in a single shader, but this is handled automatically inside the [UpdateRenderData](#updaterenderdata) function.
-Deferred rendering techniques are outputting G-buffers, and compute lighting in a separate pass that is decoupled from the object rendering pass. Decals are rendered one by one on top of the albedo buffer using the function `wiRenderer::DrawDeferredDecals()`. All the lighting will be computed on top after the decals were rendered to the albedo in a separate render pass to complete the final scene.
+Deferred rendering techniques are outputting G-buffers, and compute lighting in a separate pass that is decoupled from the object rendering pass. Decals are rendered one by one on top of the albedo buffer using the function `wi::renderer::DrawDeferredDecals()`. All the lighting will be computed on top after the decals were rendered to the albedo in a separate render pass to complete the final scene.
#### Environment probes
[EnvironmentProbeComponents](#environmentprobecomponent) can be placed into the scene and if they are tagged as invalid using the `EnvironmentProbeComponent::SetDirty(true)` flag, they will be rendered to a cubemap array that is accessible in all shaders. They will also be rendered in real time every frame if the `EnvironmentProbeComponent::SetRealTime(true)` flag is set. The cubemaps of these contain indirect specular information from a point source that can be used as approximate reflections for close by objects.
@@ -779,7 +773,7 @@ The [DecalComponents](#decalcomponent) in the scene can be rendered differently
The probes also must have [TransformComponent](#transformcomponent) associated to the same entity. This will be used to position the probes in the scene, but also to scale and rotate them. The scale/position/rotation defines an oriented bounding box (OBB) that will be used to perform parallax corrected environment mapping. This means that reflections inside the box volume will not appear as infinitely distant, but constrained inside the volume, to achieve more believable illusion.
#### Post processing
-There are several post processing effects implemented in the `wiRenderer`. They are all implemented in a single function with their name starting with Postprocess_, like for example: `wiRenderer::Postprocess_SSAO()`. They are aimed to be stateless functions, with their function signature clearly indicating input-output parameters and resources.
+There are several post processing effects implemented in the `wi::renderer`. They are all implemented in a single function with their name starting with Postprocess_, like for example: `wi::renderer::Postprocess_SSAO()`. They are aimed to be stateless functions, with their function signature clearly indicating input-output parameters and resources.
The chain/order of post processes is not implemented here, only the single effects themselves. The order of post proceses is more of a user responsibility, so it should be implemented in the [High Ievel Interface](#high-level-interface). For reference, a default post processchain is implemented in [RenderPath3D::RenderPostProcessChain()](#renderpath3d) function.
@@ -788,22 +782,22 @@ Instanced rendering will be always used automatically when rendering objects. Th
[ObjectComponents](#objectcomponent) can override [stencil](#stencil) settings for the [material](#materialcomponent). In case multiple [ObjectComponents](#objectcomponent) share the same mesh, but some are using different stencil overrides, those could be removed from the instanced batch, so there is some overhead to modifying stencil overrides for objects.
-Tip: to find out more about how instancing is used to batch objects together, take a look at the `RenderMeshes()` function inside [wiRenderer.cpp](../WickedEngine/wiRenderer.cpp)
+Tip: to find out more about how instancing is used to batch objects together, take a look at the `RenderMeshes()` function inside [wi::renderer.cpp](../WickedEngine/wi::renderer.cpp)
#### Stencil
If a depth stencil buffer is bound when using [DrawScene()](#drawscene), or [DrawScene_Transparent()](#drawscene_transparent), the stencil buffer will be written. The stencil is a 8-bit mask that can be used to achieve different kinds of screen space effects for different objects. [MaterialComponents](#materialcomponent) and [ObjectComponents](#objectcomponent) have the ability to set the stencil value that will be rendered. The 8-bit stencil value is separated into two parts:
- The first 4 bits are reseved for engine-specific values, such as to separate skin, sky, common materials from each other. these values are contained in [wiEnums](#wienums) in the `STENCILREF` enum.
- The last 4 bits are reserved for user stencil values. The application can decide what it wants to use these for.
-Please use the `wiRenderer::CombineStencilrefs()` function to specify stencil masks in a future-proof way.
+Please use the `wi::renderer::CombineStencilrefs()` function to specify stencil masks in a future-proof way.
The [Pipeline States](#pipeline-states) have a `DepthStencilState` type member which will control how the stencil mask is used in the graphics pipeline for any custom rendering effect. The functionality is supposed to be equivalent and closely matching of what DirectX 11 provides, so for further information, refer to the [DirectX 11 documentation of Depth Stencil States](https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-depth-stencil).
#### Loading Shaders
-While the [GraphicsDevice is responsible of creating shaders and pipeline states](#pipeline-states-and-shaders), loading the shader files themselves are not handled by the graphics device. The `wiRenderer::LoadShader(ShaderStage::)` is a helper function that provides this feature. This is internally loading shaders from a common shader path, that is by default the "../WickedEngine/shaders" directory (relative to the application working directory), so the filename provided to this function must be relative to that path. Every system in the engine that loads shaders uses this function to load shaders from the same folder, which makes it very easy to reload shaders on demand with the `wiRenderer::ReloadShaders()` function. This is useful for when the developer modifies a shader and recompiles it, the engine can reload it while the application is running. The developer can modify the common shader path with the `wiRenderer::SetShaderPath()` to any path of preference. The developer is free to load shaders with a custom loader, from any path too, but the `wiRenderer::ReloadShaders()` functionality might not work in that case for those shaders.
+While the [GraphicsDevice is responsible of creating shaders and pipeline states](#pipeline-states-and-shaders), loading the shader files themselves are not handled by the graphics device. The `wi::renderer::LoadShader(ShaderStage::)` is a helper function that provides this feature. This is internally loading shaders from a common shader path, that is by default the "../WickedEngine/shaders" directory (relative to the application working directory), so the filename provided to this function must be relative to that path. Every system in the engine that loads shaders uses this function to load shaders from the same folder, which makes it very easy to reload shaders on demand with the `wi::renderer::ReloadShaders()` function. This is useful for when the developer modifies a shader and recompiles it, the engine can reload it while the application is running. The developer can modify the common shader path with the `wi::renderer::SetShaderPath()` to any path of preference. The developer is free to load shaders with a custom loader, from any path too, but the `wi::renderer::ReloadShaders()` functionality might not work in that case for those shaders.
#### Debug Draw
-Debug geometry can be rendered by calling the `wiRenderer::DrawDebugWorld()` function and setting up debug geometries, or enabling debug features. The `DrawDebugWorld()` is already called by [RenderPath3D](#renderpath3d), so the developer can simply just worry about configure debug drawing features and add debug geometries and drawing will happen at the right place (if the developer decided to use [RenderPath3D](#renderpath3d) in their application).
+Debug geometry can be rendered by calling the `wi::renderer::DrawDebugWorld()` function and setting up debug geometries, or enabling debug features. The `DrawDebugWorld()` is already called by [RenderPath3D](#renderpath3d), so the developer can simply just worry about configure debug drawing features and add debug geometries and drawing will happen at the right place (if the developer decided to use [RenderPath3D](#renderpath3d) in their application).
The user provided debug geometry features at present are:
- `DrawBox()`: provide a transformation matrix and color to render a wireframe box mesh with the desired transformation and color. The box will be only rendered for a single frame.
@@ -822,19 +816,18 @@ Configuring other debug rendering functionality:
- `SetToDrawDebugCameras()`: Cameras will be rendered as oriented boxes.
#### Animation Skinning
-[MeshComponents](#meshcomponent) that have their `armatureID` associated with an [ArmatureComponent](#armaturecomponent) will be skinned inside the `wiRenderer::UpdateRenderData()` function. This means that their vertex buffer will be animated with compute shaders, and the animated vertex buffer will be used throughout the rest of the frame.
+[MeshComponents](#meshcomponent) that have their `armatureID` associated with an [ArmatureComponent](#armaturecomponent) will be skinned inside the `wi::renderer::UpdateRenderData()` function. This means that their vertex buffer will be animated with compute shaders, and the animated vertex buffer will be used throughout the rest of the frame.
-If the [ArmatureComponent](#armaturecomponent) has less than `SKINNING_COMPUTE_THREADCOUNT` amount of bones, an optimized version of the skinning will be performed that uses shared memory. The user can disable this with the `wiRenderer::SetLDSSkinningEnabled()` function if the optimization proves to be worse on the target platform.
#### Custom Shaders
-Apart from the built in material shaders, the developer can create a library of custom shaders from the application side and assign them to materials. The `wiRenderer::RegisterCustomShader()` function is used to register a custom shader from the application. The function returns the ID of the custom shader that can be input to the `MaterialComponent::SetCustomShaderID()` function.
+Apart from the built in material shaders, the developer can create a library of custom shaders from the application side and assign them to materials. The `wi::renderer::RegisterCustomShader()` function is used to register a custom shader from the application. The function returns the ID of the custom shader that can be input to the `MaterialComponent::SetCustomShaderID()` function.
The custom shader is essentially the combination of a [Pipeline State Object](#pipeline-states-and-shaders) for each `RENDERPASS` and a `RENDERTYPE` flag that specifies whether it is to be drawn in a transparent or opaque, or other kind of pass within a `RENDERPASS`. The developer is responsible of creating a fully valid pipeline state to render a mesh. If a pipeline state is left as empty for a combination of `RENDERPASS` and `RENDERTYPE`, then the material will simply be skipped and not rendered.
-### wiEnums
+### Enums
[[Header]](../../WickedEngine/wiEnums.h)
-This is a collection of enum values used by the wiRenderer to identify graphics resources. Usually arrays of the same resource type are declared and the XYZENUM_COUNT values tell the length of the array. The other XYZENUM_VALUE represents a single element within that array. This makes the code easy to manage, for example:
+This is a collection of enum values used by the wi::renderer to identify graphics resources. Usually arrays of the same resource type are declared and the XYZENUM_COUNT values tell the length of the array. The other XYZENUM_VALUE represents a single element within that array. This makes the code easy to manage, for example:
```cpp
enum CBTYPE
@@ -851,23 +844,23 @@ device->BindConstantBuffer(&buffers[CBTYPE_MESH], 0, cmd); // makes it easy to r
This is widely used to make code straight forward and easy to add new objects, without needing to create additional declarations, except for the enum values.
-### wiImage
+### Image Renderer
[[Header]](../../WickedEngine/wiImage.h) [[Cpp]](../../WickedEngine/wiImage.cpp)
This can render images to the screen in a simple manner. You can draw an image like this:
```cpp
-wiImage::SetCanvas(canvas, cmd); // setting the canvas area is required to set the drawing area and perform DPI scaling (the canvas will remain for the duration of the command list)
-wiImage::Draw(myTexture, wiImageParams(10, 20, 256, 128), cmd);
+wi::image::SetCanvas(canvas, cmd); // setting the canvas area is required to set the drawing area and perform DPI scaling (the canvas will remain for the duration of the command list)
+wi::image::Draw(myTexture, wiImageParams(10, 20, 256, 128), cmd);
```
The example will draw a 2D texture image to the position (10, 20), with a size of 256 x 128 pixels to the current render pass. There are a lot of other parameters to customize the rendered image, for more information see wiImageParams structure.
-- wiImageParams
+- wi::image::Params
Describe all parameters of how and where to draw the image on the screen.
-### wiFont
+### Font Renderer
[[Header]](../../WickedEngine/wiFont.h) [[Cpp]](../../WickedEngine/wiFont.cpp)
This can render fonts to the screen in a simple manner. You can render a font as simple as this:
```cpp
-wiFont::SetCanvas(canvas, cmd); // setting the canvas area is required to set the drawing area and perform DPI scaling (the canvas will remain for the duration of the command list)
-wiFont::Draw("write this!", wiFontParams(10, 20), cmd);
+wi::font::SetCanvas(canvas, cmd); // setting the canvas area is required to set the drawing area and perform DPI scaling (the canvas will remain for the duration of the command list)
+wi::font::Draw("write this!", wiFontParams(10, 20), cmd);
```
Which will write the text write this! to 10, 20 pixel position onto the screen. There are many other parameters to describe the font's position, size, color, etc. See the wiFontParams structure for more details.
- wiFontParams
@@ -875,37 +868,37 @@ Describe all parameters of how and where to draw the font on the screen.
The wiFont can load and render .ttf (TrueType) fonts. The default arial font style is embedded into the engine ([[arial.h]](../WickedEngine/Utility/arial.h) file). The developer can load additional fonts from files by using `wiFont::AddFontStyle()` functions. These can either load from a file, or take a provided byte data for the font. The `AddFontStyle()` will return an `int` that will indicate the font ID within the loaded font library. The `wiFontParams::style` can be set to the font ID to use a specific font that was previously loaded. If the developer added a font before wiFont::Initialize was called, then that will be the default font and the arial font will not be created.
-### wiEmittedParticle
+### Emitted Particle System
[[Header]](../../WickedEngine/wiEmittedParticle.h) [[Cpp]](../../WickedEngine/wiEmittedParticle.cpp)
GPU driven emitter particle system, used to draw large amount of camera facing quad billboards. Supports simulation with force fields and fluid simulation based on Smooth Particle Hydrodynamics computation.
-### wiHairParticle
+### Hair Particle System
[[Header]](../../WickedEngine/wiHairParticle.h) [[Cpp]](../../WickedEngine/wiHairParticle.cpp)
GPU driven particles that are attached to a mesh surface. It can be used to render vegetation. It participates in force fields simulation.
-### wiOcean
+### Ocean
[[Header]](../../WickedEngine/wiOcean.h) [[Cpp]](../../WickedEngine/wiOcean.cpp)
Ocean renderer using Fast Fourier Transforms simulation. The ocean surface is always rendered relative to the camera, like an infinitely large water body.
-### wiSprite
+### Sprite
[[Header]](../../WickedEngine/wiSprite.h) [[Cpp]](../../WickedEngine/wiSprite.cpp)
A helper facility to render and animate images. It uses the [wiImage](#wiimage) renderer internally
- Anim
Several different simple animation utilities, like animated textures, wobbling, rotation, fade out, etc...
-### wiSpriteFont
+### SpriteFont
[[Header]](../../WickedEngine/wiSprite.h) [[Cpp]](../../WickedEngine/wiSprite.cpp)
A helper facility to render fonts. It uses the [wiFont](#wifont) renderer internally. It performs string conversion
-### wiTextureHelper
+### TextureHelper
[[Header]](../../WickedEngine/wiTextureHelper.h) [[Cpp]](../../WickedEngine/wiTextureHelper.cpp)
This is used to generate procedural textures, such as uniform colors, noise, etc...
-### wiGPUSortLib
+### GPUSortLib
[[Header]](../../WickedEngine/wiGPUSortLib.h) [[Cpp]](../../WickedEngine/wiGPUSortLib.cpp)
This is a GPU sorting facility using the Bitonic Sort algorithm. It can be used to sort an index list based on a list of floats as comparison keys entirely on the GPU.
-### wiGPUBVH
+### GPUBVH
[[Header]](../../WickedEngine/wiGPUBVH.h) [[Cpp]](../../WickedEngine/wiGPUBVH.cpp)
This facility can generate a BVH (Bounding Volume Hierarcy) on the GPU for a [Scene](#scene). The BVH structure can be used to perform efficient RAY-triangle intersections on the GPU, for example in ray tracing. This is not using the ray tracing API hardware acceleration, but implemented in compute, so it has wide hardware support.
@@ -913,124 +906,103 @@ This facility can generate a BVH (Bounding Volume Hierarcy) on the GPU for a [Sc
## GUI
The custom GUI, implemented with engine features
-### wiGUI
+### GUI
[[Header]](../../WickedEngine/wiGUI.h) [[Cpp]](../../WickedEngine/wiGUI.cpp)
The wiGUI is responsible to run a GUI interface and manage widgets.
GUI Scaling: To ensure correct GUI scaling, GUI elements should be designed for the current window size. If they are placed inside `RenderPath2D::ResizeLayout()` function according to current screen size, it will ensure that GUI will be scaled on a Resolution or DPI change event, which is recommended.
-### wiEventArgs
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+### EventArgs
This will be sent to widget callbacks to provide event arguments in different formats
### wiWidget
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
The base widget interface can be extended with specific functionality. The GUI will store and process widgets by this interface.
-#### wiButton
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### Button
A simple clickable button. Supports the OnClick event callback.
-#### wiLabel
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### Label
A simple static text field.
-#### wiTextInputField
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### TextInputField
Supports text input when activated. Pressing Enter will accept the input and fire the OnInputAccepted callback. Pressing the Escape key while active will cancel the text input and restoe the previous state. There can be only one active text input field at a time.
-#### wiSlider
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### Slider
A slider, that can represent float or integer values. The slider also accepts text input to input number values. If the number input is outside of the slider's range, it will expand its range to support the newly assigned value. Upon changing the slider value, whether by text input or sliding, the OnSlide event callback will be fired.
-#### wiCheckBox
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### CheckBox
The checkbox is a two state item which can represent true/false state. The OnClick event callback will be fired upon changing the value (by clicking on it)
-#### wiComboBox
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### ComboBox
Supports item selection from a list of text. Can set the maximum number of visible items. If the list of items is greater than the max allowed visible items, then a vertical scrollbar will be presented to allow showing hidden items. Upon selection, the OnSelect event callback will be triggered.
-#### wiWindow
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### Window
A window widget is able to hold any number of other widgets. It can be moved across the screen, minimized and resized by the user. The window does not manage lifetime of attached widgets since 0.49.0!
-#### wiColorPicker
-[[Header]](../../WickedEngine/wiWidget.h) [[Cpp]](../../WickedEngine/wiWidget.cpp)
+#### ColorPicker
Supports picking a HSV (or HSL) color, displaying its RGB values. On selection, the OnColorChanged event callback will be fired and the user can read the new RGB value from the event argument.
## Helpers
A collection of engine-level helper classes
-### wiAllocators
-[[Header]](../../WickedEngine/wiAllocators.h)
-
-#### LinearAllocator
-[[Header]](../../WickedEngine/wiAllocators.h)
-The linear allocator is used to allocate contiguous blocks of memory. The amount of maximum allocations is defined at creation time. Blocks then can be allocated from beginning to end until there is free space left. Blocks can be freed from the end until the allocator is not empty. This is not thread safe.
-
-#### ThreadSafeRingBuffer
-[[Header]](../../WickedEngine/wiContainers.h)
-This is a thread safe container that can hold elements of one certain data type at once. Elements are added to the end of container, and they are removed from the beginning. The container wraps around, so if the last element would be put after the last valid array index, then it will be put to the first instead (if the first array index is not occupied).
-
-### wiArchive
+### Archive
[[Header]](../../WickedEngine/wiArchive.h) [[Cpp]](../../WickedEngine/wiArchive.cpp)
This is used for serializing binary data to disk or memory. An archive file always starts with the 64-bit version number that it was serialized with. An archive of greater version number than the current archive version of the engine can't be opened safely, so an error message will be shown if this happens. A certain archive version will not be forward compatible with the current engine version if the current archive version barrier number is greater than the archive's own version number.
-### wiColor
+### Color
[[Header]](../../WickedEngine/wiColor.h)
Utility to convert to/from float color data to 32-bit RGBA data (stored in a uint32_t as RGBA, where each channel is 8 bits)
-### wiFadeManager
+### FadeManager
[[Header]](../../WickedEngine/wiFadeManager.h) [[Cpp]](../../WickedEngine/wiFadeManager.cpp)
-Simple helper to manage a fadeout screen. Fadeout starts at transparent, then fades smoothly to an opaque color (such as black, in most cases), then a callback occurs which the user can handle with their own event. After that, the color will fade back to transperent. This is used by the [MainComponent](#maincomponent) to fade from one RenderPath to an other.
+Simple helper to manage a fadeout screen. Fadeout starts at transparent, then fades smoothly to an opaque color (such as black, in most cases), then a callback occurs which the user can handle with their own event. After that, the color will fade back to transperent. This is used by the [Application](#application) to fade from one RenderPath to an other.
-### wiHelper
+### Helper
[[Header]](../../WickedEngine/wiHelper.h) [[Cpp]](../../WickedEngine/wiHelper.cpp)
Many helper utility functions, like screenshot, readfile, messagebox, splitpath, sleep, etc...
-### wiIntersect
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+### Primitive
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
Primitives that can be intersected with each other
#### AABB
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
Axis aligned bounding box. There are multiple ways to construct it, for example from min-max corners, or center and halfextent.
-#### SPHERE
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+#### Sphere
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
Sphere with a center and radius.
-#### CAPSULE
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+#### Capsule
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
It's like two spheres connected by a cylinder. Base and Tip are the two endpoints, radius is the cylinder's radius.
-#### RAY
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+#### Ray
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
Line with a starting point (origin) and direction. The direction's reciprocal is precomputed to perform fast intersection of many primitives with one ray.
#### Frustum
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
Six planes, most commonly used for checking if an intersectable primitive is inside a camera.
#### Hitbox2D
-[[Header]](../../WickedEngine/wiIntersect.h) [[Cpp]](../../WickedEngine/wiIntersect.cpp)
+[[Header]](../../WickedEngine/wiPrimitive.h) [[Cpp]](../../WickedEngine/wiPrimitive.cpp)
A rectangle, essentially an 2D AABB.
-### wiMath
+### Math
[[Header]](../../WickedEngine/wiMath.h) [[Cpp]](../../WickedEngine/wiMath.cpp)
Math related helper functions, like lerp, triangleArea, HueToRGB, etc...
-### wiRandom
+### Random
[[Header]](../../WickedEngine/wiRandom.h) [[Cpp]](../../WickedEngine/wiRandom.cpp)
Uniform random number generator with a good distribution.
-### wiRectPacker
+### RectPacker
[[Header]](../../WickedEngine/wiRectPacker.h) [[Cpp]](../../WickedEngine/wiRectPacker.cpp)
Provides the ability to pack multiple rectangles into a bigger rectangle, while taking up the least amount of space from the containing rectangle.
-### wiResourceManager
+### ResourceManager
[[Header]](../../WickedEngine/wiResourceManager.h) [[Cpp]](../../WickedEngine/wiResourceManager.cpp)
This can load images and sounds. It will hold on to resources until there is at least something that is referencing them, otherwise deletes them. One resource can have multiple owners, too. This is thread safe.
@@ -1039,35 +1011,32 @@ This can load images and sounds. It will hold on to resources until there is at
- `Clear()` : Clear all resources. This will clear the resource library, but resources that are still used somewhere will remain usable.
The resource manager can support different modes that can be set with `SetMode(MODE param)` function:
-- `MODE_DISCARD_FILEDATA_AFTER_LOAD` : this is the default behaviour. The resource will not hold on to file data, even if the user specified `IMPORT_RETAIN_FILEDATA` flag when loading the resource. This will result in the resource manager unable to serialize (save) itself.
-- `MODE_ALLOW_RETAIN_FILEDATA` : this mode can be used to keep the file data buffers alive inside resources. This way the resource manager can be serialized (saved). Only the resources that still hold onto their file data will be serialized (saved). When loading a resource, the user can specify `IMPORT_RETAIN_FILEDATA` flag to keep the file data for a specific resource instead of discarding it.
-- `MODE_ALLOW_RETAIN_FILEDATA_BUT_DISABLE_EMBEDDING` : Keep all file data, but don't write them while serializing. This is useful to disable resource embedding temporarily without destroying file data buffers.
+- `DISCARD_FILEDATA_AFTER_LOAD` : this is the default behaviour. The resource will not hold on to file data, even if the user specified `IMPORT_RETAIN_FILEDATA` flag when loading the resource. This will result in the resource manager unable to serialize (save) itself.
+- `ALLOW_RETAIN_FILEDATA` : this mode can be used to keep the file data buffers alive inside resources. This way the resource manager can be serialized (saved). Only the resources that still hold onto their file data will be serialized (saved). When loading a resource, the user can specify `IMPORT_RETAIN_FILEDATA` flag to keep the file data for a specific resource instead of discarding it.
+- `ALLOW_RETAIN_FILEDATA_BUT_DISABLE_EMBEDDING` : Keep all file data, but don't write them while serializing. This is useful to disable resource embedding temporarily without destroying file data buffers.
The resource manager can always be serialized in read mode. File data retention will be based on existing file import flags and the global resource manager mode.
-### wiSpinLock
+### SpinLock
[[Header]](../../WickedEngine/wiSpinLock.h) [[Cpp]](../../WickedEngine/wiSpinLock.cpp)
This can be used to guarantee exclusive access to a block in multithreaded race condition scenario instead of a mutex. The difference to a mutex that this doesn't let the thread to yield, but instead spin on an atomic flag until the spinlock can be locked.
-### wiStartupArguments
-[[Header]](../../WickedEngine/wiStartupArguments.h) [[Cpp]](../../WickedEngine/wiStartupArguments.cpp)
+### Arguments
+[[Header]](../../WickedEngine/wiArguments.h) [[Cpp]](../../WickedEngine/wiArguments.cpp)
This is to store the startup parameters that were passed to the application from the operating system "command line". The user can query these arguments by name.
-### wiTimer
+### Timer
[[Header]](../../WickedEngine/wiTimer.h) [[Cpp]](../../WickedEngine/wiTimer.cpp)
High resolution stopwatch timer
## Input
-The input interface
-
-### wiInput
[[Header]](../../WickedEngine/wiInput.h) [[Cpp]](../../WickedEngine/wiInput.cpp)
This is the high level input interface. Use this to read input devices in a platform-independent way.
- Initialize
Creates all necessary resources, the engine initialization already does this via [wiInitializer](#wiinitializer), so the user probably doesn't have to worry about this.
- Update
-This is called once per frame and necessary to process inputs. This is automatically called in [MainComponent](#maincomponent), so the user doesn't need to worry about it, unless they are reimplementing the high level interface for themselves.
+This is called once per frame and necessary to process inputs. This is automatically called in [Application](#application), so the user doesn't need to worry about it, unless they are reimplementing the high level interface for themselves.
- Down
Checks whether a button is currently held down.
- Press
@@ -1109,21 +1078,19 @@ A touch contact point. Currently it is supported in UWP (Universal Windows Platf
- GetTouches
Get a vector containing current Touch contact points
-### wiXInput
+### XInput
[[Header]](../../WickedEngine/wiXInput.h) [[Cpp]](../../WickedEngine/wiXInput.cpp)
Low level wrapper for XInput API (capable of handling Xbox controllers). This functionality is used by the more generic wiInput interface, so the user probably doesn't need to use this.
-### wiRawInput
+### RawInput
[[Header]](../../WickedEngine/wiRawInput.h) [[Cpp]](../../WickedEngine/wiRawInput.cpp)
Low level wrapper for RAWInput API (capable of handling human interface devices, such as mouse, keyboard, controllers). This functionality is used by the more generic wiInput interface, so the user probably doesn't need to use this.
## Audio
-Handles audio playback and spatial audio.
-### wiAudio
[[Header]](../../WickedEngine/wiAudio.h) [[Cpp]](../../WickedEngine/wiAudio.cpp)
-The namespace that is a collection of audio related functionality. It is currently implemented with XAudio2
+The namespace that is a collection of audio related functionality.
- CreateSound
- CreateSoundInstance
- Play
@@ -1179,10 +1146,9 @@ Can make different sounding 3D reverb effect globally
## Physics
+[[Header]](../../WickedEngine/wiPhysics.h) [[Cpp]](../../WickedEngine/wiPhysics_Bullet.cpp)
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
-[[Header]](../../WickedEngine/wiPhysicsEngine.h) [[Cpp]](../../WickedEngine/wiPhysicsEngine.cpp)
- Initialize
This must be called before using the physics system, but it is automatically done by [wiInitializer](#wiinitializer)
- IsEnabled
@@ -1220,13 +1186,8 @@ The pinned vertices can also be manipulated via skinning animation. If th
Resetting a soft body can be accomplished by setting the `SoftBodyPhysicsComponent::FORCE_RESET` flag. This means that the next physics update will reset the soft body mesh to the initial pose.
-### wiPhysicsEngine_Bullet
-[[Header]](../../WickedEngine/wiPhysicsEngine_BULLET.h) [[Cpp]](../../WickedEngine/wiPhysicsEngine_BULLET.cpp)
-Bullet physics engine implementation of the physics update system
-
## Network
-### wiNetwork
[[Header]](../../WickedEngine/wiNetwork.h) [[Cpp]](../../WickedEngine/wiNetwork.cpp)
Simple interface that provides UDP networking features.
- Initialize
@@ -1245,24 +1206,24 @@ An IP address and a port number that identifies the target of communication
This is the place for the Lua scipt interface. For a complete reference about Lua scripting interface, please see the [ScriptingAPI-Documentation](ScriptingAPI-Documentation.md)
### LuaBindings
The systems that are bound to Lua have the name of the system as their filename, postfixed by _BindLua.
-### wiLua
+### Lua
[[Header]](../../WickedEngine/wiLua.h) [[Cpp]](../../WickedEngine/wiLua.cpp)
The Lua scripting interface on the C++ side. This allows to execute lua commands from the C++ side and manipulate the lua stack, such as pushing values to lua and getting values from lua, among other things.
-### wiLua_Globals
+### Lua_Globals
[[Header]](../../WickedEngine/wiLua_Globals.h)
Hardcoded lua script in text format. This will be always executed and provides some commonly used helper functionality for lua scripts.
-### wiLuna
+### Luna
[[Header]](../../WickedEngine/wiLuna.h)
Helper to allow bind engine classes from C++ to Lua
## Tools
This is the place for tools that use engine-level systems
-### wiBackLog
-[[Header]](../../WickedEngine/wiBacklog.h) [[Cpp]](../../WickedEngine/wiBackLog.cpp)
+### Backlog
+[[Header]](../../WickedEngine/wiBacklog.h) [[Cpp]](../../WickedEngine/wiBacklog.cpp)
Used to log any messages by any system, from any thread. It can draw itself to the screen. It can execute Lua scripts.
-If there was a `wiBackLog::LogLevel::Error` or higher severity message posted on the backlog, the contents of the log will be saved to the temporary user directory as wiBackLog.txt.
-### wiProfiler
+If there was a `wii:backlog::LogLevel::Error` or higher severity message posted on the backlog, the contents of the log will be saved to the temporary user directory as wiBacklog.txt.
+### Profiler
[[Header]](../../WickedEngine/wiProfiler.h) [[Cpp]](../../WickedEngine/wiProfiler.cpp)
Used to time specific ranges in execution. Support CPU and GPU timing. Can write the result to the screen as simple text at this time.
diff --git a/Content/scripts/character_controller_tps.lua b/Content/scripts/character_controller_tps.lua
index 456757bed..007f32448 100644
--- a/Content/scripts/character_controller_tps.lua
+++ b/Content/scripts/character_controller_tps.lua
@@ -405,10 +405,10 @@ runProcess(function()
-- We will override the render path so we can invoke the script from Editor and controls won't collide with editor scripts
-- Also save the active component that we can restore when ESCAPE is pressed
- local prevPath = main.GetActivePath()
+ local prevPath = application.GetActivePath()
local path = RenderPath3D()
path.SetLightShaftsEnabled(true)
- main.SetActivePath(path)
+ application.SetActivePath(path)
local font = SpriteFont("This script is showcasing how to perform scene collision with raycasts for character and camera.\nControls:\n#####################\n\nWASD/arrows/left analog stick: walk\nSHIFT/right shoulder button: movement speed\nSPACE/gamepad X/gamepad button 2: Jump\nRight Mouse Button/Right thumbstick: rotate camera\nScoll middle mouse/Left-Right triggers: adjust camera distance\nESCAPE key: quit\nR: reload script");
font.SetSize(14)
@@ -433,14 +433,14 @@ runProcess(function()
-- so if you loaded this script from the editor, you can go back to the editor with ESC
backlog_post("EXIT")
killProcesses()
- main.SetActivePath(prevPath)
+ application.SetActivePath(prevPath)
return
end
if(input.Press(string.byte('R'))) then
-- reload script
backlog_post("RELOAD")
killProcesses()
- main.SetActivePath(prevPath)
+ application.SetActivePath(prevPath)
dofile("character_controller_tps.lua")
return
end
diff --git a/Content/scripts/fighting_game.lua b/Content/scripts/fighting_game.lua
index 4f4e35be1..c0ca67e46 100644
--- a/Content/scripts/fighting_game.lua
+++ b/Content/scripts/fighting_game.lua
@@ -1305,7 +1305,7 @@ local function Character(face, skin_color, shirt_color, hair_color, shoe_color)
-- HP bar, etc. sprites:
- local renderPath = main.GetActivePath()
+ local renderPath = application.GetActivePath()
self.sprite_hpbar_background = Sprite("hp_bar.png")
local fx = self.sprite_hpbar_background.GetParams()
@@ -1903,14 +1903,14 @@ runProcess(function()
-- We lock the framerate to 60 FPS, so if frame rate goes below, game will play slower
--
-- There is also the possibility to implement game logic in fixed_update() instead, but that is not common for fighting games
- main.SetTargetFrameRate(60)
- main.SetFrameRateLock(true)
+ application.SetTargetFrameRate(60)
+ application.SetFrameRateLock(true)
-- We will override the render path so we can invoke the script from Editor and controls won't collide with editor scripts
-- Also save the active component that we can restore when ESCAPE is pressed
- local prevPath = main.GetActivePath()
+ local prevPath = application.GetActivePath()
local path = RenderPath3D()
- main.SetActivePath(path)
+ application.SetActivePath(path)
local help_text = ""
help_text = help_text .. "Wicked Engine Fighting game sample script\n"
@@ -2026,14 +2026,14 @@ runProcess(function()
-- so if you loaded this script from the editor, you can go back to the editor with ESC
backlog_post("EXIT")
killProcesses()
- main.SetActivePath(prevPath)
+ application.SetActivePath(prevPath)
return
end
if(input.Press(string.byte('R'))) then
-- reload script
backlog_post("RELOAD")
killProcesses()
- main.SetActivePath(prevPath)
+ application.SetActivePath(prevPath)
dofile("fighting_game.lua")
return
end
diff --git a/Editor/AnimationWindow.cpp b/Editor/AnimationWindow.cpp
index 27d0ad65b..eca464286 100644
--- a/Editor/AnimationWindow.cpp
+++ b/Editor/AnimationWindow.cpp
@@ -2,12 +2,12 @@
#include "AnimationWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void AnimationWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Animation Window");
+ wi::gui::Window::Create("Animation Window");
SetSize(XMFLOAT2(520, 140));
float x = 140;
@@ -20,8 +20,8 @@ void AnimationWindow::Create(EditorComponent* editor)
animationsComboBox.SetSize(XMFLOAT2(300, hei));
animationsComboBox.SetPos(XMFLOAT2(x, y += step));
animationsComboBox.SetEnabled(false);
- animationsComboBox.OnSelect([&](wiEventArgs args) {
- entity = wiScene::GetScene().animations.GetEntity(args.iValue);
+ animationsComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ entity = wi::scene::GetScene().animations.GetEntity(args.iValue);
});
animationsComboBox.SetTooltip("Choose an animation clip...");
AddWidget(&animationsComboBox);
@@ -30,8 +30,8 @@ void AnimationWindow::Create(EditorComponent* editor)
loopedCheckBox.SetTooltip("Toggle animation looping behaviour.");
loopedCheckBox.SetSize(XMFLOAT2(hei, hei));
loopedCheckBox.SetPos(XMFLOAT2(150, y += step));
- loopedCheckBox.OnClick([&](wiEventArgs args) {
- AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity);
+ loopedCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ AnimationComponent* animation = wi::scene::GetScene().animations.GetComponent(entity);
if (animation != nullptr)
{
animation->SetLooped(args.bValue);
@@ -43,8 +43,8 @@ void AnimationWindow::Create(EditorComponent* editor)
playButton.SetTooltip("Play/Pause animation.");
playButton.SetSize(XMFLOAT2(100, hei));
playButton.SetPos(XMFLOAT2(200, y));
- playButton.OnClick([&](wiEventArgs args) {
- AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity);
+ playButton.OnClick([&](wi::gui::EventArgs args) {
+ AnimationComponent* animation = wi::scene::GetScene().animations.GetComponent(entity);
if (animation != nullptr)
{
if (animation->IsPlaying())
@@ -64,8 +64,8 @@ void AnimationWindow::Create(EditorComponent* editor)
stopButton.SetTooltip("Stop animation.");
stopButton.SetSize(XMFLOAT2(100, hei));
stopButton.SetPos(XMFLOAT2(310, y));
- stopButton.OnClick([&](wiEventArgs args) {
- AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity);
+ stopButton.OnClick([&](wi::gui::EventArgs args) {
+ AnimationComponent* animation = wi::scene::GetScene().animations.GetComponent(entity);
if (animation != nullptr)
{
animation->Stop();
@@ -76,8 +76,8 @@ void AnimationWindow::Create(EditorComponent* editor)
timerSlider.Create(0, 1, 0, 100000, "Timer: ");
timerSlider.SetSize(XMFLOAT2(250, hei));
timerSlider.SetPos(XMFLOAT2(x, y += step));
- timerSlider.OnSlide([&](wiEventArgs args) {
- AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity);
+ timerSlider.OnSlide([&](wi::gui::EventArgs args) {
+ AnimationComponent* animation = wi::scene::GetScene().animations.GetComponent(entity);
if (animation != nullptr)
{
animation->timer = args.fValue;
@@ -90,8 +90,8 @@ void AnimationWindow::Create(EditorComponent* editor)
amountSlider.Create(0, 1, 0, 100000, "Amount: ");
amountSlider.SetSize(XMFLOAT2(250, hei));
amountSlider.SetPos(XMFLOAT2(x, y += step));
- amountSlider.OnSlide([&](wiEventArgs args) {
- AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity);
+ amountSlider.OnSlide([&](wi::gui::EventArgs args) {
+ AnimationComponent* animation = wi::scene::GetScene().animations.GetComponent(entity);
if (animation != nullptr)
{
animation->amount = args.fValue;
@@ -104,8 +104,8 @@ void AnimationWindow::Create(EditorComponent* editor)
speedSlider.Create(0, 4, 1, 100000, "Speed: ");
speedSlider.SetSize(XMFLOAT2(250, hei));
speedSlider.SetPos(XMFLOAT2(x, y += step));
- speedSlider.OnSlide([&](wiEventArgs args) {
- AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity);
+ speedSlider.OnSlide([&](wi::gui::EventArgs args) {
+ AnimationComponent* animation = wi::scene::GetScene().animations.GetComponent(entity);
if (animation != nullptr)
{
animation->speed = args.fValue;
@@ -126,7 +126,7 @@ void AnimationWindow::Update()
{
animationsComboBox.ClearItems();
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
if (!scene.animations.Contains(entity))
{
@@ -169,7 +169,7 @@ void AnimationWindow::Update()
if (animation.IsPlaying())
{
playButton.SetText("Pause");
- animation.amount = wiMath::Lerp(animation.amount, 1, 0.1f);
+ animation.amount = wi::math::Lerp(animation.amount, 1, 0.1f);
}
else
{
diff --git a/Editor/AnimationWindow.h b/Editor/AnimationWindow.h
index d431be363..e3425d59c 100644
--- a/Editor/AnimationWindow.h
+++ b/Editor/AnimationWindow.h
@@ -3,20 +3,20 @@
class EditorComponent;
-class AnimationWindow : public wiWindow
+class AnimationWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity = wiECS::INVALID_ENTITY;
+ wi::ecs::Entity entity = wi::ecs::INVALID_ENTITY;
- wiComboBox animationsComboBox;
- wiCheckBox loopedCheckBox;
- wiButton playButton;
- wiButton stopButton;
- wiSlider timerSlider;
- wiSlider amountSlider;
- wiSlider speedSlider;
+ wi::gui::ComboBox animationsComboBox;
+ wi::gui::CheckBox loopedCheckBox;
+ wi::gui::Button playButton;
+ wi::gui::Button stopButton;
+ wi::gui::Slider timerSlider;
+ wi::gui::Slider amountSlider;
+ wi::gui::Slider speedSlider;
void Update();
};
diff --git a/Editor/App_Windows.cpp b/Editor/App_Windows.cpp
index 43177b3c4..69aff6f99 100644
--- a/Editor/App_Windows.cpp
+++ b/Editor/App_Windows.cpp
@@ -167,15 +167,15 @@ protected:
if (c == '\b')
{
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
}
else
{
- if (wiBackLog::isActive())
- wiBackLog::input(c);
- wiTextInputField::AddInput(c);
+ if (wi::backlog::isActive())
+ wi::backlog::input(c);
+ wi::gui::TextInputField::AddInput(c);
}
}
diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp
index 1449cba5b..446d56478 100644
--- a/Editor/CameraWindow.cpp
+++ b/Editor/CameraWindow.cpp
@@ -2,16 +2,16 @@
#include "CameraWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void CameraWindow::ResetCam()
{
move = {};
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ CameraComponent& camera = wi::scene::GetCamera();
float width = camera.width;
float height = camera.height;
camera = CameraComponent();
@@ -30,8 +30,8 @@ void CameraWindow::ResetCam()
void CameraWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Camera Window");
- camera_transform.MatrixTransform(wiScene::GetCamera().GetInvView());
+ wi::gui::Window::Create("Camera Window");
+ camera_transform.MatrixTransform(wi::scene::GetCamera().GetInvView());
camera_transform.UpdateTransform();
SetSize(XMFLOAT2(380, 360));
@@ -45,10 +45,10 @@ void CameraWindow::Create(EditorComponent* editor)
farPlaneSlider.SetTooltip("Controls the camera's far clip plane, geometry farther than this will be clipped.");
farPlaneSlider.SetSize(XMFLOAT2(100, hei));
farPlaneSlider.SetPos(XMFLOAT2(x, y += step));
- farPlaneSlider.SetValue(wiScene::GetCamera().zFarP);
- farPlaneSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ farPlaneSlider.SetValue(wi::scene::GetCamera().zFarP);
+ farPlaneSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.zFarP = args.fValue;
camera.UpdateCamera();
camera.SetDirty();
@@ -59,10 +59,10 @@ void CameraWindow::Create(EditorComponent* editor)
nearPlaneSlider.SetTooltip("Controls the camera's near clip plane, geometry closer than this will be clipped.");
nearPlaneSlider.SetSize(XMFLOAT2(100, hei));
nearPlaneSlider.SetPos(XMFLOAT2(x, y += step));
- nearPlaneSlider.SetValue(wiScene::GetCamera().zNearP);
- nearPlaneSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ nearPlaneSlider.SetValue(wi::scene::GetCamera().zNearP);
+ nearPlaneSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.zNearP = args.fValue;
camera.UpdateCamera();
camera.SetDirty();
@@ -73,9 +73,9 @@ void CameraWindow::Create(EditorComponent* editor)
fovSlider.SetTooltip("Controls the camera's top-down field of view (in degrees)");
fovSlider.SetSize(XMFLOAT2(100, hei));
fovSlider.SetPos(XMFLOAT2(x, y += step));
- fovSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ fovSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.fov = args.fValue / 180.f * XM_PI;
camera.UpdateCamera();
camera.SetDirty();
@@ -86,9 +86,9 @@ void CameraWindow::Create(EditorComponent* editor)
focalLengthSlider.SetTooltip("Controls the depth of field effect's focus distance");
focalLengthSlider.SetSize(XMFLOAT2(100, hei));
focalLengthSlider.SetPos(XMFLOAT2(x, y += step));
- focalLengthSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ focalLengthSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.focal_length = args.fValue;
camera.UpdateCamera();
camera.SetDirty();
@@ -99,9 +99,9 @@ void CameraWindow::Create(EditorComponent* editor)
apertureSizeSlider.SetTooltip("Controls the depth of field effect's strength");
apertureSizeSlider.SetSize(XMFLOAT2(100, hei));
apertureSizeSlider.SetPos(XMFLOAT2(x, y += step));
- apertureSizeSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ apertureSizeSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.aperture_size = args.fValue;
camera.UpdateCamera();
camera.SetDirty();
@@ -112,9 +112,9 @@ void CameraWindow::Create(EditorComponent* editor)
apertureShapeXSlider.SetTooltip("Controls the depth of field effect's bokeh shape");
apertureShapeXSlider.SetSize(XMFLOAT2(100, hei));
apertureShapeXSlider.SetPos(XMFLOAT2(x, y += step));
- apertureShapeXSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ apertureShapeXSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.aperture_shape.x = args.fValue;
camera.UpdateCamera();
camera.SetDirty();
@@ -125,9 +125,9 @@ void CameraWindow::Create(EditorComponent* editor)
apertureShapeYSlider.SetTooltip("Controls the depth of field effect's bokeh shape");
apertureShapeYSlider.SetSize(XMFLOAT2(100, hei));
apertureShapeYSlider.SetPos(XMFLOAT2(x, y += step));
- apertureShapeYSlider.OnSlide([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ apertureShapeYSlider.OnSlide([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
camera.aperture_shape.y = args.fValue;
camera.UpdateCamera();
camera.SetDirty();
@@ -152,7 +152,7 @@ void CameraWindow::Create(EditorComponent* editor)
resetButton.Create("Reset Camera");
resetButton.SetSize(XMFLOAT2(140, hei));
resetButton.SetPos(XMFLOAT2(x, y += step));
- resetButton.OnClick([&](wiEventArgs args) {
+ resetButton.OnClick([&](wi::gui::EventArgs args) {
ResetCam();
});
AddWidget(&resetButton);
@@ -169,11 +169,11 @@ void CameraWindow::Create(EditorComponent* editor)
proxyButton.SetTooltip("Copy the current camera and place a proxy of it in the world.");
proxyButton.SetSize(XMFLOAT2(140, hei));
proxyButton.SetPos(XMFLOAT2(x, y += step * 2));
- proxyButton.OnClick([=](wiEventArgs args) {
+ proxyButton.OnClick([=](wi::gui::EventArgs args) {
- const CameraComponent& camera = wiScene::GetCamera();
+ const CameraComponent& camera = wi::scene::GetCamera();
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
static int camcounter = 0;
Entity entity = scene.Entity_CreateCamera("cam" + std::to_string(camcounter), camera.width, camera.height, camera.zNearP, camera.zFarP, camera.fov);
@@ -216,7 +216,7 @@ void CameraWindow::SetEntity(Entity entity)
{
proxy = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
if (scene.cameras.GetComponent(entity) != nullptr)
{
@@ -233,7 +233,7 @@ void CameraWindow::SetEntity(Entity entity)
void CameraWindow::Update()
{
- CameraComponent& camera = wiScene::GetCamera();
+ CameraComponent& camera = wi::scene::GetCamera();
farPlaneSlider.SetValue(camera.zFarP);
nearPlaneSlider.SetValue(camera.zNearP);
diff --git a/Editor/CameraWindow.h b/Editor/CameraWindow.h
index 2f30627b8..b80ef7f9f 100644
--- a/Editor/CameraWindow.h
+++ b/Editor/CameraWindow.h
@@ -3,38 +3,38 @@
class EditorComponent;
-class CameraWindow : public wiWindow
+class CameraWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
void ResetCam();
- wiECS::Entity proxy = wiECS::INVALID_ENTITY;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity proxy = wi::ecs::INVALID_ENTITY;
+ void SetEntity(wi::ecs::Entity entity);
void Update();
XMFLOAT3 move = {};
- wiScene::TransformComponent camera_transform;
- wiScene::TransformComponent camera_target;
+ wi::scene::TransformComponent camera_transform;
+ wi::scene::TransformComponent camera_target;
- wiSlider farPlaneSlider;
- wiSlider nearPlaneSlider;
- wiSlider fovSlider;
- wiSlider focalLengthSlider;
- wiSlider apertureSizeSlider;
- wiSlider apertureShapeXSlider;
- wiSlider apertureShapeYSlider;
- wiSlider movespeedSlider;
- wiSlider rotationspeedSlider;
- wiSlider accelerationSlider;
- wiButton resetButton;
- wiCheckBox fpsCheckBox;
+ wi::gui::Slider farPlaneSlider;
+ wi::gui::Slider nearPlaneSlider;
+ wi::gui::Slider fovSlider;
+ wi::gui::Slider focalLengthSlider;
+ wi::gui::Slider apertureSizeSlider;
+ wi::gui::Slider apertureShapeXSlider;
+ wi::gui::Slider apertureShapeYSlider;
+ wi::gui::Slider movespeedSlider;
+ wi::gui::Slider rotationspeedSlider;
+ wi::gui::Slider accelerationSlider;
+ wi::gui::Button resetButton;
+ wi::gui::CheckBox fpsCheckBox;
- wiButton proxyButton;
- wiCheckBox followCheckBox;
- wiSlider followSlider;
+ wi::gui::Button proxyButton;
+ wi::gui::CheckBox followCheckBox;
+ wi::gui::Slider followSlider;
};
diff --git a/Editor/DecalWindow.cpp b/Editor/DecalWindow.cpp
index 17b9a6eb0..2e691aa4a 100644
--- a/Editor/DecalWindow.cpp
+++ b/Editor/DecalWindow.cpp
@@ -2,13 +2,13 @@
#include "DecalWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void DecalWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Decal Window");
+ wi::gui::Window::Create("Decal Window");
SetSize(XMFLOAT2(400, 200));
float x = 200;
@@ -29,15 +29,15 @@ void DecalWindow::Create(EditorComponent* editor)
infoLabel.SetText("Selecting decals will select the according material. Set decal properties (texture, color, etc.) in the Material window.");
infoLabel.SetSize(XMFLOAT2(400 - 20, 100));
infoLabel.SetPos(XMFLOAT2(10, y));
- infoLabel.SetColor(wiColor::Transparent());
+ infoLabel.SetColor(wi::Color::Transparent());
AddWidget(&infoLabel);
y += infoLabel.GetScale().y - step + 5;
decalNameField.Create("Decal Name");
decalNameField.SetPos(XMFLOAT2(10, y+=step));
decalNameField.SetSize(XMFLOAT2(300, hei));
- decalNameField.OnInputAccepted([=](wiEventArgs args) {
- NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
+ decalNameField.OnInputAccepted([=](wi::gui::EventArgs args) {
+ NameComponent* name = wi::scene::GetScene().names.GetComponent(entity);
if (name != nullptr)
{
*name = args.sValue;
@@ -57,7 +57,7 @@ void DecalWindow::SetEntity(Entity entity)
{
this->entity = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
const DecalComponent* decal = scene.decals.GetComponent(entity);
if (decal != nullptr)
diff --git a/Editor/DecalWindow.h b/Editor/DecalWindow.h
index 6b421b971..97d42a803 100644
--- a/Editor/DecalWindow.h
+++ b/Editor/DecalWindow.h
@@ -3,16 +3,16 @@
class EditorComponent;
-class DecalWindow : public wiWindow
+class DecalWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiCheckBox placementCheckBox;
- wiLabel infoLabel;
- wiTextInputField decalNameField;
+ wi::gui::CheckBox placementCheckBox;
+ wi::gui::Label infoLabel;
+ wi::gui::TextInputField decalNameField;
};
diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp
index 22785aa94..f2f911e81 100644
--- a/Editor/Editor.cpp
+++ b/Editor/Editor.cpp
@@ -11,11 +11,11 @@
#include
#include
-using namespace wiGraphics;
-using namespace wiRectPacker;
-using namespace wiScene;
-using namespace wiECS;
-
+using namespace wi::graphics;
+using namespace wi::primitive;
+using namespace wi::rectpacker;
+using namespace wi::scene;
+using namespace wi::ecs;
#ifdef PLATFORM_UWP
#include
@@ -61,7 +61,7 @@ winrt::fire_and_forget uwp_copy_assets()
// scripts:
{
- wiHelper::StringConvert(rootdir + "scripts\\", wstr);
+ wi::helper::StringConvert(rootdir + "scripts\\", wstr);
auto src = co_await StorageFolder::GetFolderFromPathAsync(wstr.c_str());
if (src)
{
@@ -75,7 +75,7 @@ winrt::fire_and_forget uwp_copy_assets()
// models:
{
- wiHelper::StringConvert(rootdir + "models\\", wstr);
+ wi::helper::StringConvert(rootdir + "models\\", wstr);
auto src = co_await StorageFolder::GetFolderFromPathAsync(wstr.c_str());
if (src)
{
@@ -89,7 +89,7 @@ winrt::fire_and_forget uwp_copy_assets()
// Documentation:
{
- wiHelper::StringConvert(rootdir + "Documentation\\", wstr);
+ wi::helper::StringConvert(rootdir + "Documentation\\", wstr);
auto src = co_await StorageFolder::GetFolderFromPathAsync(wstr.c_str());
if (src)
{
@@ -105,10 +105,10 @@ winrt::fire_and_forget uwp_copy_assets()
void Editor::Initialize()
{
- MainComponent::Initialize();
+ Application::Initialize();
// With this mode, file data for resources will be kept around. This allows serializing embedded resource data inside scenes
- wiResourceManager::SetMode(wiResourceManager::MODE_ALLOW_RETAIN_FILEDATA);
+ wi::resourcemanager::SetMode(wi::resourcemanager::Mode::ALLOW_RETAIN_FILEDATA);
infoDisplay.active = true;
infoDisplay.watermark = true;
@@ -118,7 +118,7 @@ void Editor::Initialize()
infoDisplay.colorspace = true;
infoDisplay.heap_allocation_counter = true;
- wiRenderer::SetOcclusionCullingEnabled(true);
+ wi::renderer::SetOcclusionCullingEnabled(true);
loader.Load();
@@ -132,17 +132,16 @@ void Editor::Initialize()
void EditorLoadingScreen::Load()
{
- font = wiSpriteFont("Loading...", wiFontParams(0, 0, 36,
- WIFALIGN_CENTER, WIFALIGN_CENTER));
+ font = wi::SpriteFont("Loading...", wi::font::Params(0, 0, 36, wi::font::WIFALIGN_CENTER, wi::font::WIFALIGN_CENTER));
AddFont(&font);
- sprite = wiSprite("images/logo_small.png");
+ sprite = wi::Sprite("images/logo_small.png");
sprite.anim.opa = 1;
sprite.anim.repeatable = true;
sprite.params.siz = XMFLOAT2(128, 128);
sprite.params.pivot = XMFLOAT2(0.5f, 1.0f);
- sprite.params.quality = QUALITY_LINEAR;
- sprite.params.blendFlag = BLENDMODE_ALPHA;
+ sprite.params.quality = wi::image::QUALITY_LINEAR;
+ sprite.params.blendFlag = wi::enums::BLENDMODE_ALPHA;
AddSprite(&sprite);
LoadingScreen::Load();
@@ -151,7 +150,7 @@ void EditorLoadingScreen::Update(float dt)
{
font.params.posX = GetLogicalWidth()*0.5f;
font.params.posY = GetLogicalHeight()*0.5f;
- sprite.params.pos = XMFLOAT3(GetLogicalWidth()*0.5f, GetLogicalHeight()*0.5f - font.textHeight(), 0);
+ sprite.params.pos = XMFLOAT3(GetLogicalWidth()*0.5f, GetLogicalHeight()*0.5f - font.TextHeight(), 0);
LoadingScreen::Update(dt);
}
@@ -162,12 +161,12 @@ void EditorComponent::ChangeRenderPath(RENDERPATH path)
switch (path)
{
case EditorComponent::RENDERPATH_DEFAULT:
- renderPath = std::make_unique();
+ renderPath = std::make_unique();
pathTraceTargetSlider.SetVisible(false);
pathTraceStatisticsLabel.SetVisible(false);
break;
case EditorComponent::RENDERPATH_PATHTRACING:
- renderPath = std::make_unique();
+ renderPath = std::make_unique();
pathTraceTargetSlider.SetVisible(true);
pathTraceStatisticsLabel.SetVisible(true);
break;
@@ -180,7 +179,7 @@ void EditorComponent::ChangeRenderPath(RENDERPATH path)
renderPath->Load();
- wiGUI& gui = GetGUI();
+ wi::gui::GUI& gui = GetGUI();
// Destroy and recreate renderer and postprocess windows:
@@ -202,7 +201,7 @@ void EditorComponent::ResizeBuffers()
init(main->canvas);
RenderPath2D::ResizeBuffers();
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
renderPath->init(*this);
renderPath->ResizeBuffers();
@@ -416,18 +415,18 @@ void EditorComponent::Load()
uwp_copy_assets();
#endif // PLATFORM_UWP
- wiJobSystem::context ctx;
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { pointLightTex = wiResourceManager::Load("images/pointlight.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { spotLightTex = wiResourceManager::Load("images/spotlight.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { dirLightTex = wiResourceManager::Load("images/directional_light.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { areaLightTex = wiResourceManager::Load("images/arealight.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { decalTex = wiResourceManager::Load("images/decal.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { forceFieldTex = wiResourceManager::Load("images/forcefield.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { emitterTex = wiResourceManager::Load("images/emitter.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { hairTex = wiResourceManager::Load("images/hair.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { cameraTex = wiResourceManager::Load("images/camera.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { armatureTex = wiResourceManager::Load("images/armature.dds"); });
- wiJobSystem::Execute(ctx, [this](wiJobArgs args) { soundTex = wiResourceManager::Load("images/sound.dds"); });
+ wi::jobsystem::context ctx;
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { pointLightTex = wi::resourcemanager::Load("images/pointlight.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { spotLightTex = wi::resourcemanager::Load("images/spotlight.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { dirLightTex = wi::resourcemanager::Load("images/directional_light.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { areaLightTex = wi::resourcemanager::Load("images/arealight.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { decalTex = wi::resourcemanager::Load("images/decal.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { forceFieldTex = wi::resourcemanager::Load("images/forcefield.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { emitterTex = wi::resourcemanager::Load("images/emitter.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { hairTex = wi::resourcemanager::Load("images/hair.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { cameraTex = wi::resourcemanager::Load("images/camera.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { armatureTex = wi::resourcemanager::Load("images/armature.dds"); });
+ wi::jobsystem::Execute(ctx, [this](wi::jobsystem::JobArgs args) { soundTex = wi::resourcemanager::Load("images/sound.dds"); });
// wait for ctx is at the end of this function!
translator.Create();
@@ -437,189 +436,189 @@ void EditorComponent::Load()
rendererWnd_Toggle.Create("Renderer");
rendererWnd_Toggle.SetTooltip("Renderer settings window");
- rendererWnd_Toggle.OnClick([&](wiEventArgs args) {
+ rendererWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
rendererWnd.SetVisible(!rendererWnd.IsVisible());
});
GetGUI().AddWidget(&rendererWnd_Toggle);
postprocessWnd_Toggle.Create("PostProcess");
postprocessWnd_Toggle.SetTooltip("Postprocess settings window");
- postprocessWnd_Toggle.OnClick([&](wiEventArgs args) {
+ postprocessWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
postprocessWnd.SetVisible(!postprocessWnd.IsVisible());
});
GetGUI().AddWidget(&postprocessWnd_Toggle);
paintToolWnd_Toggle.Create("Paint Tool");
paintToolWnd_Toggle.SetTooltip("Paint tool window");
- paintToolWnd_Toggle.OnClick([&](wiEventArgs args) {
+ paintToolWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
paintToolWnd.SetVisible(!paintToolWnd.IsVisible());
});
GetGUI().AddWidget(&paintToolWnd_Toggle);
///////////////////////
- wiColor option_color_idle = wiColor(255, 145, 145, 100);
- wiColor option_color_focus = wiColor(255, 197, 193, 200);
+ wi::Color option_color_idle = wi::Color(255, 145, 145, 100);
+ wi::Color option_color_focus = wi::Color(255, 197, 193, 200);
weatherWnd_Toggle.Create("Weather");
- weatherWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- weatherWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ weatherWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ weatherWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
weatherWnd_Toggle.SetTooltip("Weather settings window");
- weatherWnd_Toggle.OnClick([&](wiEventArgs args) {
+ weatherWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
weatherWnd.SetVisible(!weatherWnd.IsVisible());
});
GetGUI().AddWidget(&weatherWnd_Toggle);
objectWnd_Toggle.Create("Object");
- objectWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- objectWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ objectWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ objectWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
objectWnd_Toggle.SetTooltip("Object settings window");
- objectWnd_Toggle.OnClick([&](wiEventArgs args) {
+ objectWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
objectWnd.SetVisible(!objectWnd.IsVisible());
});
GetGUI().AddWidget(&objectWnd_Toggle);
meshWnd_Toggle.Create("Mesh");
- meshWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- meshWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ meshWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ meshWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
meshWnd_Toggle.SetTooltip("Mesh settings window");
- meshWnd_Toggle.OnClick([&](wiEventArgs args) {
+ meshWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
meshWnd.SetVisible(!meshWnd.IsVisible());
});
GetGUI().AddWidget(&meshWnd_Toggle);
materialWnd_Toggle.Create("Material");
- materialWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- materialWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ materialWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ materialWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
materialWnd_Toggle.SetTooltip("Material settings window");
- materialWnd_Toggle.OnClick([&](wiEventArgs args) {
+ materialWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
materialWnd.SetVisible(!materialWnd.IsVisible());
});
GetGUI().AddWidget(&materialWnd_Toggle);
cameraWnd_Toggle.Create("Camera");
- cameraWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- cameraWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ cameraWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ cameraWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
cameraWnd_Toggle.SetTooltip("Camera settings window");
- cameraWnd_Toggle.OnClick([&](wiEventArgs args) {
+ cameraWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
cameraWnd.SetVisible(!cameraWnd.IsVisible());
});
GetGUI().AddWidget(&cameraWnd_Toggle);
envProbeWnd_Toggle.Create("EnvProbe");
- envProbeWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- envProbeWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ envProbeWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ envProbeWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
envProbeWnd_Toggle.SetTooltip("Environment probe settings window");
- envProbeWnd_Toggle.OnClick([&](wiEventArgs args) {
+ envProbeWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
envProbeWnd.SetVisible(!envProbeWnd.IsVisible());
});
GetGUI().AddWidget(&envProbeWnd_Toggle);
decalWnd_Toggle.Create("Decal");
- decalWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- decalWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ decalWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ decalWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
decalWnd_Toggle.SetTooltip("Decal settings window");
- decalWnd_Toggle.OnClick([&](wiEventArgs args) {
+ decalWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
decalWnd.SetVisible(!decalWnd.IsVisible());
});
GetGUI().AddWidget(&decalWnd_Toggle);
soundWnd_Toggle.Create("Sound");
- soundWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- soundWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ soundWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ soundWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
soundWnd_Toggle.SetTooltip("Sound settings window");
- soundWnd_Toggle.OnClick([&](wiEventArgs args) {
+ soundWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
soundWnd.SetVisible(!soundWnd.IsVisible());
});
GetGUI().AddWidget(&soundWnd_Toggle);
lightWnd_Toggle.Create("Light");
- lightWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- lightWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ lightWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ lightWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
lightWnd_Toggle.SetTooltip("Light settings window");
- lightWnd_Toggle.OnClick([&](wiEventArgs args) {
+ lightWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
lightWnd.SetVisible(!lightWnd.IsVisible());
});
GetGUI().AddWidget(&lightWnd_Toggle);
animWnd_Toggle.Create("Animation");
- animWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- animWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ animWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ animWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
animWnd_Toggle.SetTooltip("Animation inspector window");
- animWnd_Toggle.OnClick([&](wiEventArgs args) {
+ animWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
animWnd.SetVisible(!animWnd.IsVisible());
});
GetGUI().AddWidget(&animWnd_Toggle);
emitterWnd_Toggle.Create("Emitter");
- emitterWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- emitterWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ emitterWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ emitterWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
emitterWnd_Toggle.SetTooltip("Emitter Particle System properties");
- emitterWnd_Toggle.OnClick([&](wiEventArgs args) {
+ emitterWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
emitterWnd.SetVisible(!emitterWnd.IsVisible());
});
GetGUI().AddWidget(&emitterWnd_Toggle);
hairWnd_Toggle.Create("HairParticle");
- hairWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- hairWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ hairWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ hairWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
hairWnd_Toggle.SetTooltip("Hair Particle System properties");
- hairWnd_Toggle.OnClick([&](wiEventArgs args) {
+ hairWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
hairWnd.SetVisible(!hairWnd.IsVisible());
});
GetGUI().AddWidget(&hairWnd_Toggle);
forceFieldWnd_Toggle.Create("ForceField");
- forceFieldWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- forceFieldWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ forceFieldWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ forceFieldWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
forceFieldWnd_Toggle.SetTooltip("Force Field properties");
- forceFieldWnd_Toggle.OnClick([&](wiEventArgs args) {
+ forceFieldWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
forceFieldWnd.SetVisible(!forceFieldWnd.IsVisible());
});
GetGUI().AddWidget(&forceFieldWnd_Toggle);
springWnd_Toggle.Create("Spring");
- springWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- springWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ springWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ springWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
springWnd_Toggle.SetTooltip("Spring properties");
- springWnd_Toggle.OnClick([&](wiEventArgs args) {
+ springWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
springWnd.SetVisible(!springWnd.IsVisible());
});
GetGUI().AddWidget(&springWnd_Toggle);
ikWnd_Toggle.Create("IK");
- ikWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- ikWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ ikWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ ikWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
ikWnd_Toggle.SetTooltip("Inverse Kinematics properties");
- ikWnd_Toggle.OnClick([&](wiEventArgs args) {
+ ikWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
ikWnd.SetVisible(!ikWnd.IsVisible());
});
GetGUI().AddWidget(&ikWnd_Toggle);
transformWnd_Toggle.Create("Transform");
- transformWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- transformWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ transformWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ transformWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
transformWnd_Toggle.SetTooltip("Transform properties");
- transformWnd_Toggle.OnClick([&](wiEventArgs args) {
+ transformWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
transformWnd.SetVisible(!transformWnd.IsVisible());
});
GetGUI().AddWidget(&transformWnd_Toggle);
layerWnd_Toggle.Create("Layer");
- layerWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- layerWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ layerWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ layerWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
layerWnd_Toggle.SetTooltip("Layer Component");
- layerWnd_Toggle.OnClick([&](wiEventArgs args) {
+ layerWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
layerWnd.SetVisible(!layerWnd.IsVisible());
});
GetGUI().AddWidget(&layerWnd_Toggle);
nameWnd_Toggle.Create("Name");
- nameWnd_Toggle.SetColor(option_color_idle, wiWidget::IDLE);
- nameWnd_Toggle.SetColor(option_color_focus, wiWidget::FOCUS);
+ nameWnd_Toggle.SetColor(option_color_idle, wi::gui::IDLE);
+ nameWnd_Toggle.SetColor(option_color_focus, wi::gui::FOCUS);
nameWnd_Toggle.SetTooltip("Name Component");
- nameWnd_Toggle.OnClick([&](wiEventArgs args) {
+ nameWnd_Toggle.OnClick([&](wi::gui::EventArgs args) {
nameWnd.SetVisible(!nameWnd.IsVisible());
});
GetGUI().AddWidget(&nameWnd_Toggle);
@@ -630,7 +629,7 @@ void EditorComponent::Load()
translatorCheckBox.Create("Translator: ");
translatorCheckBox.SetTooltip("Enable the translator tool");
- translatorCheckBox.OnClick([&](wiEventArgs args) {
+ translatorCheckBox.OnClick([&](wi::gui::EventArgs args) {
translator.enabled = args.bValue;
});
GetGUI().AddWidget(&translatorCheckBox);
@@ -640,7 +639,7 @@ void EditorComponent::Load()
isTranslatorCheckBox.Create("T: ");
{
isScalatorCheckBox.SetTooltip("Scale");
- isScalatorCheckBox.OnClick([&](wiEventArgs args) {
+ isScalatorCheckBox.OnClick([&](wi::gui::EventArgs args) {
translator.isScalator = args.bValue;
translator.isTranslator = false;
translator.isRotator = false;
@@ -651,7 +650,7 @@ void EditorComponent::Load()
GetGUI().AddWidget(&isScalatorCheckBox);
isRotatorCheckBox.SetTooltip("Rotate");
- isRotatorCheckBox.OnClick([&](wiEventArgs args) {
+ isRotatorCheckBox.OnClick([&](wi::gui::EventArgs args) {
translator.isRotator = args.bValue;
translator.isScalator = false;
translator.isTranslator = false;
@@ -662,7 +661,7 @@ void EditorComponent::Load()
GetGUI().AddWidget(&isRotatorCheckBox);
isTranslatorCheckBox.SetTooltip("Translate");
- isTranslatorCheckBox.OnClick([&](wiEventArgs args) {
+ isTranslatorCheckBox.OnClick([&](wi::gui::EventArgs args) {
translator.isTranslator = args.bValue;
translator.isScalator = false;
translator.isRotator = false;
@@ -676,14 +675,14 @@ void EditorComponent::Load()
saveButton.Create("Save");
saveButton.SetTooltip("Save the current scene");
- saveButton.SetColor(wiColor(0, 198, 101, 180), wiWidget::WIDGETSTATE::IDLE);
- saveButton.SetColor(wiColor(0, 255, 140, 255), wiWidget::WIDGETSTATE::FOCUS);
- saveButton.OnClick([&](wiEventArgs args) {
+ saveButton.SetColor(wi::Color(0, 198, 101, 180), wi::gui::WIDGETSTATE::IDLE);
+ saveButton.SetColor(wi::Color(0, 255, 140, 255), wi::gui::WIDGETSTATE::FOCUS);
+ saveButton.OnClick([&](wi::gui::EventArgs args) {
const bool dump_to_header = saveModeComboBox.GetSelected() == 2;
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::SAVE;
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::SAVE;
if (dump_to_header)
{
params.description = "C++ header (.h)";
@@ -694,29 +693,29 @@ void EditorComponent::Load()
params.description = "Wicked Scene (.wiscene)";
params.extensions.push_back("wiscene");
}
- wiHelper::FileDialog(params, [=](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
- std::string filename = wiHelper::ReplaceExtension(fileName, params.extensions.front());
- wiArchive archive = dump_to_header ? wiArchive() : wiArchive(filename, false);
+ wi::helper::FileDialog(params, [=](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ std::string filename = wi::helper::ReplaceExtension(fileName, params.extensions.front());
+ wi::Archive archive = dump_to_header ? wi::Archive() : wi::Archive(filename, false);
if (archive.IsOpen())
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
- wiResourceManager::MODE embed_mode = (wiResourceManager::MODE)saveModeComboBox.GetItemUserData(saveModeComboBox.GetSelected());
- wiResourceManager::SetMode(embed_mode);
+ wi::resourcemanager::Mode embed_mode = (wi::resourcemanager::Mode)saveModeComboBox.GetItemUserData(saveModeComboBox.GetSelected());
+ wi::resourcemanager::SetMode(embed_mode);
scene.Serialize(archive);
if (dump_to_header)
{
- archive.SaveHeaderFile(filename, wiHelper::RemoveExtension(wiHelper::GetFileNameFromPath(filename)));
+ archive.SaveHeaderFile(filename, wi::helper::RemoveExtension(wi::helper::GetFileNameFromPath(filename)));
}
ResetHistory();
}
else
{
- wiHelper::messageBox("Could not create " + fileName + "!");
+ wi::helper::messageBox("Could not create " + fileName + "!");
}
});
});
@@ -726,78 +725,78 @@ void EditorComponent::Load()
modelButton.Create("Load Model");
modelButton.SetTooltip("Load a scene / import model into the editor...");
- modelButton.SetColor(wiColor(0, 89, 255, 180), wiWidget::WIDGETSTATE::IDLE);
- modelButton.SetColor(wiColor(112, 155, 255, 255), wiWidget::WIDGETSTATE::FOCUS);
- modelButton.OnClick([&](wiEventArgs args) {
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ modelButton.SetColor(wi::Color(0, 89, 255, 180), wi::gui::WIDGETSTATE::IDLE);
+ modelButton.SetColor(wi::Color(112, 155, 255, 255), wi::gui::WIDGETSTATE::FOCUS);
+ modelButton.OnClick([&](wi::gui::EventArgs args) {
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Model formats (.wiscene, .obj, .gltf, .glb)";
params.extensions.push_back("wiscene");
params.extensions.push_back("obj");
params.extensions.push_back("gltf");
params.extensions.push_back("glb");
- wiHelper::FileDialog(params, [&](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ wi::helper::FileDialog(params, [&](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
- size_t camera_count_prev = wiScene::GetScene().cameras.GetCount();
+ size_t camera_count_prev = wi::scene::GetScene().cameras.GetCount();
- main->loader.addLoadingFunction([=](wiJobArgs args) {
- std::string extension = wiHelper::toUpper(wiHelper::GetExtensionFromFileName(fileName));
+ main->loader.addLoadingFunction([=](wi::jobsystem::JobArgs args) {
+ std::string extension = wi::helper::toUpper(wi::helper::GetExtensionFromFileName(fileName));
if (!extension.compare("WISCENE")) // engine-serialized
{
- wiScene::LoadModel(fileName);
+ wi::scene::LoadModel(fileName);
}
else if (!extension.compare("OBJ")) // wavefront-obj
{
Scene scene;
ImportModel_OBJ(fileName, scene);
- wiScene::GetScene().Merge(scene);
+ wi::scene::GetScene().Merge(scene);
}
else if (!extension.compare("GLTF")) // text-based gltf
{
Scene scene;
ImportModel_GLTF(fileName, scene);
- wiScene::GetScene().Merge(scene);
+ wi::scene::GetScene().Merge(scene);
}
else if (!extension.compare("GLB")) // binary gltf
{
Scene scene;
ImportModel_GLTF(fileName, scene);
- wiScene::GetScene().Merge(scene);
+ wi::scene::GetScene().Merge(scene);
}
});
main->loader.onFinished([=] {
// Detect when the new scene contains a new camera, and snap the camera onto it:
- size_t camera_count = wiScene::GetScene().cameras.GetCount();
+ size_t camera_count = wi::scene::GetScene().cameras.GetCount();
if (camera_count > 0 && camera_count > camera_count_prev)
{
- Entity entity = wiScene::GetScene().cameras.GetEntity(camera_count_prev);
+ Entity entity = wi::scene::GetScene().cameras.GetEntity(camera_count_prev);
if (entity != INVALID_ENTITY)
{
- TransformComponent* camera_transform = wiScene::GetScene().transforms.GetComponent(entity);
+ TransformComponent* camera_transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (camera_transform != nullptr)
{
cameraWnd.camera_transform = *camera_transform;
}
- CameraComponent* cam = wiScene::GetScene().cameras.GetComponent(entity);
+ CameraComponent* cam = wi::scene::GetScene().cameras.GetComponent(entity);
if (cam != nullptr)
{
- wiScene::GetCamera() = *cam;
+ wi::scene::GetCamera() = *cam;
// camera aspect should be always for the current screen
- wiScene::GetCamera().width = (float)renderPath->GetInternalResolution().x;
- wiScene::GetCamera().height = (float)renderPath->GetInternalResolution().y;
+ wi::scene::GetCamera().width = (float)renderPath->GetInternalResolution().x;
+ wi::scene::GetCamera().height = (float)renderPath->GetInternalResolution().y;
}
}
}
- main->ActivatePath(this, 0.2f, wiColor::Black());
+ main->ActivatePath(this, 0.2f, wi::Color::Black());
weatherWnd.Update();
RefreshSceneGraphView();
});
- main->ActivatePath(&main->loader, 0.2f, wiColor::Black());
+ main->ActivatePath(&main->loader, 0.2f, wi::Color::Black());
ResetHistory();
});
});
@@ -807,16 +806,16 @@ void EditorComponent::Load()
scriptButton.Create("Load Script");
scriptButton.SetTooltip("Load a Lua script...");
- scriptButton.SetColor(wiColor(255, 33, 140, 180), wiWidget::WIDGETSTATE::IDLE);
- scriptButton.SetColor(wiColor(255, 100, 140, 255), wiWidget::WIDGETSTATE::FOCUS);
- scriptButton.OnClick([&](wiEventArgs args) {
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ scriptButton.SetColor(wi::Color(255, 33, 140, 180), wi::gui::WIDGETSTATE::IDLE);
+ scriptButton.SetColor(wi::Color(255, 100, 140, 255), wi::gui::WIDGETSTATE::FOCUS);
+ scriptButton.OnClick([&](wi::gui::EventArgs args) {
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Lua script";
params.extensions.push_back("lua");
- wiHelper::FileDialog(params, [](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
- wiLua::RunFile(fileName);
+ wi::helper::FileDialog(params, [](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ wi::lua::RunFile(fileName);
});
});
});
@@ -825,11 +824,11 @@ void EditorComponent::Load()
clearButton.Create("Clear World");
clearButton.SetTooltip("Delete every model from the scene");
- clearButton.SetColor(wiColor(255, 173, 43, 180), wiWidget::WIDGETSTATE::IDLE);
- clearButton.SetColor(wiColor(255, 235, 173, 255), wiWidget::WIDGETSTATE::FOCUS);
- clearButton.OnClick([&](wiEventArgs args) {
+ clearButton.SetColor(wi::Color(255, 173, 43, 180), wi::gui::WIDGETSTATE::IDLE);
+ clearButton.SetColor(wi::Color(255, 235, 173, 255), wi::gui::WIDGETSTATE::FOCUS);
+ clearButton.OnClick([&](wi::gui::EventArgs args) {
translator.selected.clear();
- wiRenderer::ClearWorld(wiScene::GetScene());
+ wi::renderer::ClearWorld(wi::scene::GetScene());
objectWnd.SetEntity(INVALID_ENTITY);
meshWnd.SetEntity(INVALID_ENTITY, -1);
lightWnd.SetEntity(INVALID_ENTITY);
@@ -855,9 +854,9 @@ void EditorComponent::Load()
helpButton.Create("?");
helpButton.SetTooltip("Help");
- helpButton.SetColor(wiColor(34, 158, 214, 180), wiWidget::WIDGETSTATE::IDLE);
- helpButton.SetColor(wiColor(113, 183, 214, 255), wiWidget::WIDGETSTATE::FOCUS);
- helpButton.OnClick([&](wiEventArgs args) {
+ helpButton.SetColor(wi::Color(34, 158, 214, 180), wi::gui::WIDGETSTATE::IDLE);
+ helpButton.SetColor(wi::Color(113, 183, 214, 255), wi::gui::WIDGETSTATE::FOCUS);
+ helpButton.OnClick([&](wi::gui::EventArgs args) {
helpLabel.SetVisible(!helpLabel.IsVisible());
});
GetGUI().AddWidget(&helpButton);
@@ -899,69 +898,69 @@ void EditorComponent::Load()
exitButton.Create("X");
exitButton.SetTooltip("Exit");
- exitButton.SetColor(wiColor(190, 0, 0, 180), wiWidget::WIDGETSTATE::IDLE);
- exitButton.SetColor(wiColor(255, 0, 0, 255), wiWidget::WIDGETSTATE::FOCUS);
- exitButton.OnClick([this](wiEventArgs args) {
- wiPlatform::Exit();
+ exitButton.SetColor(wi::Color(190, 0, 0, 180), wi::gui::WIDGETSTATE::IDLE);
+ exitButton.SetColor(wi::Color(255, 0, 0, 255), wi::gui::WIDGETSTATE::FOCUS);
+ exitButton.OnClick([this](wi::gui::EventArgs args) {
+ wi::platform::Exit();
});
GetGUI().AddWidget(&exitButton);
profilerEnabledCheckBox.Create("Profiler Enabled: ");
profilerEnabledCheckBox.SetTooltip("Toggle Profiler On/Off");
- profilerEnabledCheckBox.OnClick([&](wiEventArgs args) {
- wiProfiler::SetEnabled(args.bValue);
+ profilerEnabledCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ wi::profiler::SetEnabled(args.bValue);
});
- profilerEnabledCheckBox.SetCheck(wiProfiler::IsEnabled());
+ profilerEnabledCheckBox.SetCheck(wi::profiler::IsEnabled());
GetGUI().AddWidget(&profilerEnabledCheckBox);
physicsEnabledCheckBox.Create("Physics Simulation: ");
physicsEnabledCheckBox.SetTooltip("Toggle Physics Simulation On/Off");
- physicsEnabledCheckBox.OnClick([&](wiEventArgs args) {
- wiPhysicsEngine::SetSimulationEnabled(args.bValue);
+ physicsEnabledCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ wi::physics::SetSimulationEnabled(args.bValue);
});
- physicsEnabledCheckBox.SetCheck(wiPhysicsEngine::IsSimulationEnabled());
+ physicsEnabledCheckBox.SetCheck(wi::physics::IsSimulationEnabled());
GetGUI().AddWidget(&physicsEnabledCheckBox);
cinemaModeCheckBox.Create("Cinema Mode: ");
cinemaModeCheckBox.SetTooltip("Toggle Cinema Mode (All HUD disabled). Press ESC to exit.");
- cinemaModeCheckBox.OnClick([&](wiEventArgs args) {
+ cinemaModeCheckBox.OnClick([&](wi::gui::EventArgs args) {
if (renderPath != nullptr)
{
renderPath->GetGUI().SetVisible(false);
}
GetGUI().SetVisible(false);
- wiProfiler::SetEnabled(false);
+ wi::profiler::SetEnabled(false);
main->infoDisplay.active = false;
});
GetGUI().AddWidget(&cinemaModeCheckBox);
sceneGraphView.Create("Scene graph view");
- sceneGraphView.OnSelect([this](wiEventArgs args) {
+ sceneGraphView.OnSelect([this](wi::gui::EventArgs args) {
translator.selected.clear();
for (int i = 0; i < sceneGraphView.GetItemCount(); ++i)
{
- const wiTreeList::Item& item = sceneGraphView.GetItem(i);
+ const wi::gui::TreeList::Item& item = sceneGraphView.GetItem(i);
if (item.selected)
{
- wiScene::PickResult pick;
+ wi::scene::PickResult pick;
pick.entity = (Entity)item.userdata;
AddSelected(pick);
}
}
});
- sceneGraphView.SetColor(wiColor(100, 100, 100, 100), wiWidget::IDLE);
+ sceneGraphView.SetColor(wi::Color(100, 100, 100, 100), wi::gui::IDLE);
GetGUI().AddWidget(&sceneGraphView);
renderPathComboBox.Create("Render Path: ");
renderPathComboBox.AddItem("Default");
renderPathComboBox.AddItem("Path Tracing");
- renderPathComboBox.OnSelect([&](wiEventArgs args) {
+ renderPathComboBox.OnSelect([&](wi::gui::EventArgs args) {
ChangeRenderPath((RENDERPATH)args.iValue);
});
renderPathComboBox.SetSelected(RENDERPATH_DEFAULT);
@@ -971,12 +970,12 @@ void EditorComponent::Load()
saveModeComboBox.Create("Save Mode: ");
- saveModeComboBox.SetColor(wiColor(0, 198, 101, 180), wiWidget::WIDGETSTATE::IDLE);
- saveModeComboBox.SetColor(wiColor(0, 255, 140, 255), wiWidget::WIDGETSTATE::FOCUS);
- saveModeComboBox.AddItem("Embed resources", wiResourceManager::MODE_ALLOW_RETAIN_FILEDATA);
- saveModeComboBox.AddItem("No embedding", wiResourceManager::MODE_ALLOW_RETAIN_FILEDATA_BUT_DISABLE_EMBEDDING);
- saveModeComboBox.AddItem("Dump to header", wiResourceManager::MODE_ALLOW_RETAIN_FILEDATA);
- saveModeComboBox.SetTooltip("Choose whether to embed resources (textures, sounds...) in the scene file when saving, or keep them as separate files.\nThe Dump to header option will use embedding and create a C++ header file with byte data of the scene to be used with wiArchive serialization.");
+ saveModeComboBox.SetColor(wi::Color(0, 198, 101, 180), wi::gui::WIDGETSTATE::IDLE);
+ saveModeComboBox.SetColor(wi::Color(0, 255, 140, 255), wi::gui::WIDGETSTATE::FOCUS);
+ saveModeComboBox.AddItem("Embed resources", (uint64_t)wi::resourcemanager::Mode::ALLOW_RETAIN_FILEDATA);
+ saveModeComboBox.AddItem("No embedding", (uint64_t)wi::resourcemanager::Mode::ALLOW_RETAIN_FILEDATA_BUT_DISABLE_EMBEDDING);
+ saveModeComboBox.AddItem("Dump to header", (uint64_t)wi::resourcemanager::Mode::ALLOW_RETAIN_FILEDATA);
+ saveModeComboBox.SetTooltip("Choose whether to embed resources (textures, sounds...) in the scene file when saving, or keep them as separate files.\nThe Dump to header option will use embedding and create a C++ header file with byte data of the scene to be used with wi::Archive serialization.");
GetGUI().AddWidget(&saveModeComboBox);
@@ -1010,7 +1009,7 @@ void EditorComponent::Load()
layerWnd.Create(this);
nameWnd.Create(this);
- wiGUI& gui = GetGUI();
+ wi::gui::GUI& gui = GetGUI();
gui.AddWidget(&materialWnd);
gui.AddWidget(&weatherWnd);
gui.AddWidget(&objectWnd);
@@ -1033,7 +1032,7 @@ void EditorComponent::Load()
cameraWnd.ResetCam();
- wiJobSystem::Wait(ctx);
+ wi::jobsystem::Wait(ctx);
RenderPath2D::Load();
}
@@ -1055,10 +1054,10 @@ void EditorComponent::FixedUpdate()
}
void EditorComponent::Update(float dt)
{
- wiProfiler::range_id profrange = wiProfiler::BeginRangeCPU("Editor Update");
+ wi::profiler::range_id profrange = wi::profiler::BeginRangeCPU("Editor Update");
- Scene& scene = wiScene::GetScene();
- CameraComponent& camera = wiScene::GetCamera();
+ Scene& scene = wi::scene::GetScene();
+ CameraComponent& camera = wi::scene::GetCamera();
cameraWnd.Update();
animWnd.Update();
@@ -1068,7 +1067,7 @@ void EditorComponent::Update(float dt)
selectionOutlineTimer += dt;
bool clear_selected = false;
- if (wiInput::Press(wiInput::KEYBOARD_BUTTON_ESCAPE))
+ if (wi::input::Press(wi::input::KEYBOARD_BUTTON_ESCAPE))
{
if (cinemaModeCheckBox.GetCheck())
{
@@ -1089,19 +1088,19 @@ void EditorComponent::Update(float dt)
}
// Camera control:
- XMFLOAT4 currentMouse = wiInput::GetPointer();
- if (!wiBackLog::isActive() && !GetGUI().HasFocus())
+ XMFLOAT4 currentMouse = wi::input::GetPointer();
+ if (!wi::backlog::isActive() && !GetGUI().HasFocus())
{
static XMFLOAT4 originalMouse = XMFLOAT4(0, 0, 0, 0);
static bool camControlStart = true;
if (camControlStart)
{
- originalMouse = wiInput::GetPointer();
+ originalMouse = wi::input::GetPointer();
}
float xDif = 0, yDif = 0;
- if (wiInput::Down(wiInput::MOUSE_BUTTON_MIDDLE))
+ if (wi::input::Down(wi::input::MOUSE_BUTTON_MIDDLE))
{
camControlStart = false;
#if 0
@@ -1110,41 +1109,41 @@ void EditorComponent::Update(float dt)
yDif = currentMouse.y - originalMouse.y;
#else
// Mouse delta from hardware read:
- xDif = wiInput::GetMouseState().delta_position.x;
- yDif = wiInput::GetMouseState().delta_position.y;
+ xDif = wi::input::GetMouseState().delta_position.x;
+ yDif = wi::input::GetMouseState().delta_position.y;
#endif
xDif = 0.1f * xDif * (1.0f / 60.0f);
yDif = 0.1f * yDif * (1.0f / 60.0f);
- wiInput::SetPointer(originalMouse);
- wiInput::HidePointer(true);
+ wi::input::SetPointer(originalMouse);
+ wi::input::HidePointer(true);
}
else
{
camControlStart = true;
- wiInput::HidePointer(false);
+ wi::input::HidePointer(false);
}
const float buttonrotSpeed = 2.0f * dt;
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_LEFT))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_LEFT))
{
xDif -= buttonrotSpeed;
}
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_RIGHT))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_RIGHT))
{
xDif += buttonrotSpeed;
}
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_UP))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_UP))
{
yDif -= buttonrotSpeed;
}
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_DOWN))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_DOWN))
{
yDif += buttonrotSpeed;
}
- const XMFLOAT4 leftStick = wiInput::GetAnalog(wiInput::GAMEPAD_ANALOG_THUMBSTICK_L, 0);
- const XMFLOAT4 rightStick = wiInput::GetAnalog(wiInput::GAMEPAD_ANALOG_THUMBSTICK_R, 0);
- const XMFLOAT4 rightTrigger = wiInput::GetAnalog(wiInput::GAMEPAD_ANALOG_TRIGGER_R, 0);
+ const XMFLOAT4 leftStick = wi::input::GetAnalog(wi::input::GAMEPAD_ANALOG_THUMBSTICK_L, 0);
+ const XMFLOAT4 rightStick = wi::input::GetAnalog(wi::input::GAMEPAD_ANALOG_THUMBSTICK_R, 0);
+ const XMFLOAT4 rightTrigger = wi::input::GetAnalog(wi::input::GAMEPAD_ANALOG_TRIGGER_R, 0);
const float jostickrotspeed = 0.05f;
xDif += rightStick.x * jostickrotspeed;
@@ -1159,19 +1158,19 @@ void EditorComponent::Update(float dt)
// FPS Camera
const float clampedDT = std::min(dt, 0.1f); // if dt > 100 millisec, don't allow the camera to jump too far...
- const float speed = ((wiInput::Down(wiInput::KEYBOARD_BUTTON_LSHIFT) ? 10.0f : 1.0f) + rightTrigger.x * 10.0f) * cameraWnd.movespeedSlider.GetValue() * clampedDT;
+ const float speed = ((wi::input::Down(wi::input::KEYBOARD_BUTTON_LSHIFT) ? 10.0f : 1.0f) + rightTrigger.x * 10.0f) * cameraWnd.movespeedSlider.GetValue() * clampedDT;
XMVECTOR move = XMLoadFloat3(&cameraWnd.move);
XMVECTOR moveNew = XMVectorSet(leftStick.x, 0, leftStick.y, 0);
- if (!wiInput::Down(wiInput::KEYBOARD_BUTTON_LCONTROL))
+ if (!wi::input::Down(wi::input::KEYBOARD_BUTTON_LCONTROL))
{
// Only move camera if control not pressed
- if (wiInput::Down((wiInput::BUTTON)'A') || wiInput::Down(wiInput::GAMEPAD_BUTTON_LEFT)) { moveNew += XMVectorSet(-1, 0, 0, 0); }
- if (wiInput::Down((wiInput::BUTTON)'D') || wiInput::Down(wiInput::GAMEPAD_BUTTON_RIGHT)) { moveNew += XMVectorSet(1, 0, 0, 0); }
- if (wiInput::Down((wiInput::BUTTON)'W') || wiInput::Down(wiInput::GAMEPAD_BUTTON_UP)) { moveNew += XMVectorSet(0, 0, 1, 0); }
- if (wiInput::Down((wiInput::BUTTON)'S') || wiInput::Down(wiInput::GAMEPAD_BUTTON_DOWN)) { moveNew += XMVectorSet(0, 0, -1, 0); }
- if (wiInput::Down((wiInput::BUTTON)'E') || wiInput::Down(wiInput::GAMEPAD_BUTTON_2)) { moveNew += XMVectorSet(0, 1, 0, 0); }
- if (wiInput::Down((wiInput::BUTTON)'Q') || wiInput::Down(wiInput::GAMEPAD_BUTTON_1)) { moveNew += XMVectorSet(0, -1, 0, 0); }
+ if (wi::input::Down((wi::input::BUTTON)'A') || wi::input::Down(wi::input::GAMEPAD_BUTTON_LEFT)) { moveNew += XMVectorSet(-1, 0, 0, 0); }
+ if (wi::input::Down((wi::input::BUTTON)'D') || wi::input::Down(wi::input::GAMEPAD_BUTTON_RIGHT)) { moveNew += XMVectorSet(1, 0, 0, 0); }
+ if (wi::input::Down((wi::input::BUTTON)'W') || wi::input::Down(wi::input::GAMEPAD_BUTTON_UP)) { moveNew += XMVectorSet(0, 0, 1, 0); }
+ if (wi::input::Down((wi::input::BUTTON)'S') || wi::input::Down(wi::input::GAMEPAD_BUTTON_DOWN)) { moveNew += XMVectorSet(0, 0, -1, 0); }
+ if (wi::input::Down((wi::input::BUTTON)'E') || wi::input::Down(wi::input::GAMEPAD_BUTTON_2)) { moveNew += XMVectorSet(0, 1, 0, 0); }
+ if (wi::input::Down((wi::input::BUTTON)'Q') || wi::input::Down(wi::input::GAMEPAD_BUTTON_1)) { moveNew += XMVectorSet(0, -1, 0, 0); }
moveNew += XMVector3Normalize(moveNew);
}
moveNew *= speed;
@@ -1202,14 +1201,14 @@ void EditorComponent::Update(float dt)
{
// Orbital Camera
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_LSHIFT))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_LSHIFT))
{
XMVECTOR V = XMVectorAdd(camera.GetRight() * xDif, camera.GetUp() * yDif) * 10;
XMFLOAT3 vec;
XMStoreFloat3(&vec, V);
cameraWnd.camera_target.Translate(vec);
}
- else if (wiInput::Down(wiInput::KEYBOARD_BUTTON_LCONTROL) || currentMouse.z != 0.0f)
+ else if (wi::input::Down(wi::input::KEYBOARD_BUTTON_LCONTROL) || currentMouse.z != 0.0f)
{
cameraWnd.camera_transform.Translate(XMFLOAT3(0, 0, yDif * 4 + currentMouse.z));
cameraWnd.camera_transform.translation_local.z = std::min(0.0f, cameraWnd.camera_transform.translation_local.z);
@@ -1227,9 +1226,9 @@ void EditorComponent::Update(float dt)
// Begin picking:
unsigned int pickMask = rendererWnd.GetPickType();
- RAY pickRay = wiRenderer::GetPickRay((long)currentMouse.x, (long)currentMouse.y, *this);
+ Ray pickRay = wi::renderer::GetPickRay((long)currentMouse.x, (long)currentMouse.y, *this);
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
if (pickMask & PICK_LIGHT)
{
@@ -1240,9 +1239,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1257,9 +1256,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1274,9 +1273,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1291,9 +1290,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1308,9 +1307,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1323,12 +1322,12 @@ void EditorComponent::Update(float dt)
Entity entity = scene.probes.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- if (SPHERE(transform.GetPosition(), 1).intersects(pickRay))
+ if (Sphere(transform.GetPosition(), 1).intersects(pickRay))
{
- float dis = wiMath::Distance(transform.GetPosition(), pickRay.origin);
+ float dis = wi::math::Distance(transform.GetPosition(), pickRay.origin);
if (dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1345,9 +1344,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1362,9 +1361,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1379,9 +1378,9 @@ void EditorComponent::Update(float dt)
XMVECTOR disV = XMVector3LinePointDistance(XMLoadFloat3(&pickRay.origin), XMLoadFloat3(&pickRay.origin) + XMLoadFloat3(&pickRay.direction), transform.GetPositionV());
float dis = XMVectorGetX(disV);
- if (dis > 0.01f && dis < wiMath::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
+ if (dis > 0.01f && dis < wi::math::Distance(transform.GetPosition(), pickRay.origin) * 0.05f && dis < hovered.distance)
{
- hovered = wiScene::PickResult();
+ hovered = wi::scene::PickResult();
hovered.entity = entity;
hovered.distance = dis;
}
@@ -1392,12 +1391,12 @@ void EditorComponent::Update(float dt)
{
// Object picking only when mouse button down, because it can be slow with high polycount
if (
- wiInput::Down(wiInput::MOUSE_BUTTON_LEFT) ||
- wiInput::Down(wiInput::MOUSE_BUTTON_RIGHT) ||
+ wi::input::Down(wi::input::MOUSE_BUTTON_LEFT) ||
+ wi::input::Down(wi::input::MOUSE_BUTTON_RIGHT) ||
paintToolWnd.GetMode() != PaintToolWindow::MODE_DISABLED
)
{
- hovered = wiScene::Pick(pickRay, pickMask);
+ hovered = wi::scene::Pick(pickRay, pickMask);
}
}
}
@@ -1411,15 +1410,15 @@ void EditorComponent::Update(float dt)
const ObjectComponent* object = scene.objects.GetComponent(hovered.entity);
if (object != nullptr)
{
- if (translator.selected.empty() && object->GetRenderTypes() & RENDERTYPE_WATER)
+ if (translator.selected.empty() && object->GetRenderTypes() & wi::enums::RENDERTYPE_WATER)
{
- if (wiInput::Down(wiInput::MOUSE_BUTTON_LEFT))
+ if (wi::input::Down(wi::input::MOUSE_BUTTON_LEFT))
{
// if water, then put a water ripple onto it:
scene.PutWaterRipple("images/ripple.png", hovered.position);
}
}
- else if (decalWnd.placementCheckBox.GetCheck() && wiInput::Press(wiInput::MOUSE_BUTTON_LEFT))
+ else if (decalWnd.placementCheckBox.GetCheck() && wi::input::Press(wi::input::MOUSE_BUTTON_LEFT))
{
// if not water or softbody, put a decal on it:
static int decalselector = 0;
@@ -1440,10 +1439,10 @@ void EditorComponent::Update(float dt)
// Select...
static bool selectAll = false;
- if (wiInput::Press(wiInput::MOUSE_BUTTON_RIGHT) || selectAll || clear_selected)
+ if (wi::input::Press(wi::input::MOUSE_BUTTON_RIGHT) || selectAll || clear_selected)
{
- wiArchive& archive = AdvanceHistory();
+ wi::Archive& archive = AdvanceHistory();
archive << HISTORYOP_SELECTION;
// record PREVIOUS selection state...
archive << translator.selected.size();
@@ -1470,7 +1469,7 @@ void EditorComponent::Update(float dt)
// Parented objects won't be attached, but only the parents instead. Otherwise it would cause "double translation"
continue;
}
- wiScene::PickResult picked;
+ wi::scene::PickResult picked;
picked.entity = entity;
AddSelected(picked);
}
@@ -1479,12 +1478,12 @@ void EditorComponent::Update(float dt)
{
// Add the hovered item to the selection:
- if (!translator.selected.empty() && wiInput::Down(wiInput::KEYBOARD_BUTTON_LSHIFT))
+ if (!translator.selected.empty() && wi::input::Down(wi::input::KEYBOARD_BUTTON_LSHIFT))
{
// Union selection:
- wi::vector saved = translator.selected;
+ wi::vector saved = translator.selected;
translator.selected.clear();
- for (const wiScene::PickResult& picked : saved)
+ for (const wi::scene::PickResult& picked : saved)
{
AddSelected(picked);
}
@@ -1523,15 +1522,15 @@ void EditorComponent::Update(float dt)
}
// Control operations...
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_LCONTROL))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_LCONTROL))
{
// Select All
- if (wiInput::Press((wiInput::BUTTON)'A'))
+ if (wi::input::Press((wi::input::BUTTON)'A'))
{
selectAll = true;
}
// Copy
- if (wiInput::Press((wiInput::BUTTON)'C'))
+ if (wi::input::Press((wi::input::BUTTON)'C'))
{
auto prevSel = translator.selected;
@@ -1543,7 +1542,7 @@ void EditorComponent::Update(float dt)
}
}
// Paste
- if (wiInput::Press((wiInput::BUTTON)'V'))
+ if (wi::input::Press((wi::input::BUTTON)'V'))
{
auto prevSel = translator.selected;
translator.selected.clear();
@@ -1553,7 +1552,7 @@ void EditorComponent::Update(float dt)
clipboard >> count;
for (size_t i = 0; i < count; ++i)
{
- wiScene::PickResult picked;
+ wi::scene::PickResult picked;
picked.entity = scene.Entity_Serialize(clipboard);
AddSelected(picked);
}
@@ -1561,13 +1560,13 @@ void EditorComponent::Update(float dt)
RefreshSceneGraphView();
}
// Duplicate Instances
- if (wiInput::Press((wiInput::BUTTON)'D'))
+ if (wi::input::Press((wi::input::BUTTON)'D'))
{
auto prevSel = translator.selected;
translator.selected.clear();
for (auto& x : prevSel)
{
- wiScene::PickResult picked;
+ wi::scene::PickResult picked;
picked.entity = scene.Entity_Duplicate(x.entity);
AddSelected(picked);
}
@@ -1575,7 +1574,7 @@ void EditorComponent::Update(float dt)
RefreshSceneGraphView();
}
// Put Instances
- if (clipboard.IsOpen() && hovered.subsetIndex >= 0 && wiInput::Down(wiInput::KEYBOARD_BUTTON_LSHIFT) && wiInput::Press(wiInput::MOUSE_BUTTON_LEFT))
+ if (clipboard.IsOpen() && hovered.subsetIndex >= 0 && wi::input::Down(wi::input::KEYBOARD_BUTTON_LSHIFT) && wi::input::Press(wi::input::MOUSE_BUTTON_LEFT))
{
clipboard.SetReadModeAndResetPos(true);
size_t count;
@@ -1595,14 +1594,14 @@ void EditorComponent::Update(float dt)
RefreshSceneGraphView();
}
// Undo
- if (wiInput::Press((wiInput::BUTTON)'Z'))
+ if (wi::input::Press((wi::input::BUTTON)'Z'))
{
ConsumeHistoryOperation(true);
RefreshSceneGraphView();
}
// Redo
- if (wiInput::Press((wiInput::BUTTON)'Y'))
+ if (wi::input::Press((wi::input::BUTTON)'Y'))
{
ConsumeHistoryOperation(false);
@@ -1614,9 +1613,9 @@ void EditorComponent::Update(float dt)
// Delete
- if (wiInput::Press(wiInput::KEYBOARD_BUTTON_DELETE))
+ if (wi::input::Press(wi::input::KEYBOARD_BUTTON_DELETE))
{
- wiArchive& archive = AdvanceHistory();
+ wi::Archive& archive = AdvanceHistory();
archive << HISTORYOP_DELETE;
archive << translator.selected.size();
@@ -1661,7 +1660,7 @@ void EditorComponent::Update(float dt)
}
else
{
- const wiScene::PickResult& picked = translator.selected.back();
+ const wi::scene::PickResult& picked = translator.selected.back();
assert(picked.entity != INVALID_ENTITY);
objectWnd.SetEntity(picked.entity);
@@ -1746,7 +1745,7 @@ void EditorComponent::Update(float dt)
if (translator.IsDragEnded())
{
- wiArchive& archive = AdvanceHistory();
+ wi::Archive& archive = AdvanceHistory();
archive << HISTORYOP_TRANSLATOR;
archive << translator.GetDragDeltaMatrix();
}
@@ -1768,7 +1767,7 @@ void EditorComponent::Update(float dt)
camera.TransformCamera(cameraWnd.camera_transform);
camera.UpdateCamera();
- RenderPath3D_PathTracing* pathtracer = dynamic_cast(renderPath.get());
+ wi::RenderPath3D_PathTracing* pathtracer = dynamic_cast(renderPath.get());
if (pathtracer != nullptr)
{
pathtracer->setTargetSampleCount((int)pathTraceTargetSlider.GetValue());
@@ -1790,7 +1789,7 @@ void EditorComponent::Update(float dt)
pathTraceStatisticsLabel.SetText(ss);
}
- wiProfiler::EndRange(profrange);
+ wi::profiler::EndRange(profrange);
RenderPath2D::Update(dt);
@@ -1805,7 +1804,7 @@ void EditorComponent::PostUpdate()
}
void EditorComponent::Render() const
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
// Hovered item boxes:
if (!cinemaModeCheckBox.GetCheck())
@@ -1819,7 +1818,7 @@ void EditorComponent::Render() const
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, aabb.getAsBoxMatrix());
- wiRenderer::DrawBox(hoverBox, XMFLOAT4(0.5f, 0.5f, 0.5f, 0.5f));
+ wi::renderer::DrawBox(hoverBox, XMFLOAT4(0.5f, 0.5f, 0.5f, 0.5f));
}
const LightComponent* light = scene.lights.GetComponent(hovered.entity);
@@ -1829,13 +1828,13 @@ void EditorComponent::Render() const
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, aabb.getAsBoxMatrix());
- wiRenderer::DrawBox(hoverBox, XMFLOAT4(0.5f, 0.5f, 0, 0.5f));
+ wi::renderer::DrawBox(hoverBox, XMFLOAT4(0.5f, 0.5f, 0, 0.5f));
}
const DecalComponent* decal = scene.decals.GetComponent(hovered.entity);
if (decal != nullptr)
{
- wiRenderer::DrawBox(decal->world, XMFLOAT4(0.5f, 0, 0.5f, 0.5f));
+ wi::renderer::DrawBox(decal->world, XMFLOAT4(0.5f, 0, 0.5f, 0.5f));
}
const EnvironmentProbeComponent* probe = scene.probes.GetComponent(hovered.entity);
@@ -1845,15 +1844,15 @@ void EditorComponent::Render() const
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, aabb.getAsBoxMatrix());
- wiRenderer::DrawBox(hoverBox, XMFLOAT4(0.5f, 0.5f, 0.5f, 0.5f));
+ wi::renderer::DrawBox(hoverBox, XMFLOAT4(0.5f, 0.5f, 0.5f, 0.5f));
}
- const wiHairParticle* hair = scene.hairs.GetComponent(hovered.entity);
+ const wi::HairParticleSystem* hair = scene.hairs.GetComponent(hovered.entity);
if (hair != nullptr)
{
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, hair->aabb.getAsBoxMatrix());
- wiRenderer::DrawBox(hoverBox, XMFLOAT4(0, 0.5f, 0, 0.5f));
+ wi::renderer::DrawBox(hoverBox, XMFLOAT4(0, 0.5f, 0, 0.5f));
}
}
@@ -1863,11 +1862,11 @@ void EditorComponent::Render() const
for (size_t i = 0; i < scene.springs.GetCount(); ++i)
{
const SpringComponent& spring = scene.springs[i];
- wiRenderer::RenderablePoint point;
+ wi::renderer::RenderablePoint point;
point.position = spring.center_of_mass;
point.size = 0.05f;
point.color = XMFLOAT4(1, 1, 0, 1);
- wiRenderer::DrawPoint(point);
+ wi::renderer::DrawPoint(point);
}
}
}
@@ -1905,7 +1904,7 @@ void EditorComponent::Render() const
// also display decal OBB:
XMFLOAT4X4 selectionBox;
selectionBox = decal->world;
- wiRenderer::DrawBox(selectionBox, XMFLOAT4(1, 0, 1, 1));
+ wi::renderer::DrawBox(selectionBox, XMFLOAT4(1, 0, 1, 1));
}
const EnvironmentProbeComponent* probe = scene.probes.GetComponent(picked.entity);
@@ -1915,7 +1914,7 @@ void EditorComponent::Render() const
selectedAABB = AABB::Merge(selectedAABB, aabb);
}
- const wiHairParticle* hair = scene.hairs.GetComponent(picked.entity);
+ const wi::HairParticleSystem* hair = scene.hairs.GetComponent(picked.entity);
if (hair != nullptr)
{
selectedAABB = AABB::Merge(selectedAABB, hair->aabb);
@@ -1926,7 +1925,7 @@ void EditorComponent::Render() const
XMFLOAT4X4 selectionBox;
XMStoreFloat4x4(&selectionBox, selectedAABB.getAsBoxMatrix());
- wiRenderer::DrawBox(selectionBox, XMFLOAT4(1, 1, 1, 1));
+ wi::renderer::DrawBox(selectionBox, XMFLOAT4(1, 1, 1, 1));
}
paintToolWnd.DrawBrush();
@@ -1936,7 +1935,7 @@ void EditorComponent::Render() const
// Selection outline:
if(renderPath->GetDepthStencil() != nullptr && !translator.selected.empty())
{
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
CommandList cmd = device->BeginCommandList();
device->EventBegin("Editor - Selection Outline Mask", cmd);
@@ -1946,13 +1945,13 @@ void EditorComponent::Render() const
vp.height = (float)rt_selectionOutline[0].GetDesc().height;
device->BindViewports(1, &vp, cmd);
- wiImageParams fx;
+ wi::image::Params fx;
fx.enableFullScreen();
- fx.stencilComp = STENCILMODE::STENCILMODE_EQUAL;
+ fx.stencilComp = wi::image::STENCILMODE::STENCILMODE_EQUAL;
// We will specify the stencil ref in user-space, don't care about engine stencil refs here:
// Otherwise would need to take into account engine ref and draw multiple permutations of stencil refs.
- fx.stencilRefMode = STENCILREFMODE_USER;
+ fx.stencilRefMode = wi::image::STENCILREFMODE_USER;
// Materials outline:
{
@@ -1960,7 +1959,7 @@ void EditorComponent::Render() const
// Draw solid blocks of selected materials
fx.stencilRef = EDITORSTENCILREF_HIGHLIGHT_MATERIAL;
- wiImage::Draw(wiTextureHelper::getWhite(), fx, cmd);
+ wi::image::Draw(wi::texturehelper::getWhite(), fx, cmd);
device->RenderPassEnd(cmd);
}
@@ -1971,7 +1970,7 @@ void EditorComponent::Render() const
// Draw solid blocks of selected objects
fx.stencilRef = EDITORSTENCILREF_HIGHLIGHT_OBJECT;
- wiImage::Draw(wiTextureHelper::getWhite(), fx, cmd);
+ wi::image::Draw(wi::texturehelper::getWhite(), fx, cmd);
device->RenderPassEnd(cmd);
}
@@ -1995,27 +1994,27 @@ void EditorComponent::Compose(CommandList cmd) const
const float selectionColorIntensity = std::sin(selectionOutlineTimer * XM_2PI * 0.8f) * 0.5f + 0.5f;
if (renderPath->GetDepthStencil() != nullptr && !translator.selected.empty())
{
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
device->EventBegin("Editor - Selection Outline", cmd);
- wiRenderer::BindCommonResources(cmd);
- float opacity = wiMath::Lerp(0.4f, 1.0f, selectionColorIntensity);
+ wi::renderer::BindCommonResources(cmd);
+ float opacity = wi::math::Lerp(0.4f, 1.0f, selectionColorIntensity);
XMFLOAT4 col = selectionColor2;
col.w *= opacity;
- wiRenderer::Postprocess_Outline(rt_selectionOutline[0], cmd, 0.1f, 1, col);
+ wi::renderer::Postprocess_Outline(rt_selectionOutline[0], cmd, 0.1f, 1, col);
col = selectionColor;
col.w *= opacity;
- wiRenderer::Postprocess_Outline(rt_selectionOutline[1], cmd, 0.1f, 1, col);
+ wi::renderer::Postprocess_Outline(rt_selectionOutline[1], cmd, 0.1f, 1, col);
device->EventEnd(cmd);
}
- const CameraComponent& camera = wiScene::GetCamera();
+ const CameraComponent& camera = wi::scene::GetCamera();
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
- const wiColor inactiveEntityColor = wiColor::fromFloat4(XMFLOAT4(1, 1, 1, 0.5f));
- const wiColor hoveredEntityColor = wiColor::fromFloat4(XMFLOAT4(1, 1, 1, 1));
- const XMFLOAT4 glow = wiMath::Lerp(wiMath::Lerp(XMFLOAT4(1, 1, 1, 1), selectionColor, 0.4f), selectionColor, selectionColorIntensity);
- const wiColor selectedEntityColor = wiColor::fromFloat4(glow);
+ const wi::Color inactiveEntityColor = wi::Color::fromFloat4(XMFLOAT4(1, 1, 1, 0.5f));
+ const wi::Color hoveredEntityColor = wi::Color::fromFloat4(XMFLOAT4(1, 1, 1, 1));
+ const XMFLOAT4 glow = wi::math::Lerp(wi::math::Lerp(XMFLOAT4(1, 1, 1, 1), selectionColor, 0.4f), selectionColor, selectionColorIntensity);
+ const wi::Color selectedEntityColor = wi::Color::fromFloat4(glow);
// remove camera jittering
CameraComponent cam = *renderPath->camera;
@@ -2025,7 +2024,7 @@ void EditorComponent::Compose(CommandList cmd) const
const XMMATRIX R = XMLoadFloat3x3(&cam.rotationMatrix);
- wiImageParams fx;
+ wi::image::Params fx;
fx.customRotation = &R;
fx.customProjection = &VP;
@@ -2037,7 +2036,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.lights.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2060,16 +2059,16 @@ void EditorComponent::Compose(CommandList cmd) const
switch (light.GetType())
{
case LightComponent::POINT:
- wiImage::Draw(&pointLightTex->texture, fx, cmd);
+ wi::image::Draw(&pointLightTex.GetTexture(), fx, cmd);
break;
case LightComponent::SPOT:
- wiImage::Draw(&spotLightTex->texture, fx, cmd);
+ wi::image::Draw(&spotLightTex.GetTexture(), fx, cmd);
break;
case LightComponent::DIRECTIONAL:
- wiImage::Draw(&dirLightTex->texture, fx, cmd);
+ wi::image::Draw(&dirLightTex.GetTexture(), fx, cmd);
break;
default:
- wiImage::Draw(&areaLightTex->texture, fx, cmd);
+ wi::image::Draw(&areaLightTex.GetTexture(), fx, cmd);
break;
}
}
@@ -2083,7 +2082,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.decals.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2104,7 +2103,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&decalTex->texture, fx, cmd);
+ wi::image::Draw(&decalTex.GetTexture(), fx, cmd);
}
}
@@ -2116,7 +2115,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.forces.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2137,7 +2136,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&forceFieldTex->texture, fx, cmd);
+ wi::image::Draw(&forceFieldTex.GetTexture(), fx, cmd);
}
}
@@ -2149,7 +2148,7 @@ void EditorComponent::Compose(CommandList cmd) const
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2170,7 +2169,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&cameraTex->texture, fx, cmd);
+ wi::image::Draw(&cameraTex.GetTexture(), fx, cmd);
}
}
@@ -2181,7 +2180,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.armatures.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2202,7 +2201,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&armatureTex->texture, fx, cmd);
+ wi::image::Draw(&armatureTex.GetTexture(), fx, cmd);
}
}
@@ -2213,7 +2212,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.emitters.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2234,7 +2233,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&emitterTex->texture, fx, cmd);
+ wi::image::Draw(&emitterTex.GetTexture(), fx, cmd);
}
}
@@ -2245,7 +2244,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.hairs.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2266,7 +2265,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&hairTex->texture, fx, cmd);
+ wi::image::Draw(&hairTex.GetTexture(), fx, cmd);
}
}
@@ -2277,7 +2276,7 @@ void EditorComponent::Compose(CommandList cmd) const
Entity entity = scene.sounds.GetEntity(i);
const TransformComponent& transform = *scene.transforms.GetComponent(entity);
- float dist = wiMath::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
+ float dist = wi::math::Distance(transform.GetPosition(), camera.Eye) * 0.08f;
fx.pos = transform.GetPosition();
fx.siz = XMFLOAT2(dist, dist);
@@ -2298,7 +2297,7 @@ void EditorComponent::Compose(CommandList cmd) const
}
- wiImage::Draw(&soundTex->texture, fx, cmd);
+ wi::image::Draw(&soundTex.GetTexture(), fx, cmd);
}
}
@@ -2311,15 +2310,15 @@ void EditorComponent::Compose(CommandList cmd) const
RenderPath2D::Compose(cmd);
}
-void EditorComponent::PushToSceneGraphView(wiECS::Entity entity, int level)
+void EditorComponent::PushToSceneGraphView(wi::ecs::Entity entity, int level)
{
if (scenegraphview_added_items.count(entity) != 0)
{
return;
}
- const Scene& scene = wiScene::GetScene();
+ const Scene& scene = wi::scene::GetScene();
- wiTreeList::Item item;
+ wi::gui::TreeList::Item item;
item.level = level;
item.userdata = entity;
item.selected = IsSelected(entity);
@@ -2340,11 +2339,11 @@ void EditorComponent::PushToSceneGraphView(wiECS::Entity entity, int level)
}
void EditorComponent::RefreshSceneGraphView()
{
- const Scene& scene = wiScene::GetScene();
+ const Scene& scene = wi::scene::GetScene();
for (int i = 0; i < sceneGraphView.GetItemCount(); ++i)
{
- const wiTreeList::Item& item = sceneGraphView.GetItem(i);
+ const wi::gui::TreeList::Item& item = sceneGraphView.GetItem(i);
if (item.open)
{
scenegraphview_opened_items.insert((Entity)item.userdata);
@@ -2374,7 +2373,7 @@ void EditorComponent::RefreshSceneGraphView()
continue;
}
- wiTreeList::Item item;
+ wi::gui::TreeList::Item item;
item.userdata = entity;
item.selected = IsSelected(entity);
item.open = scenegraphview_opened_items.count(entity) != 0;
@@ -2394,7 +2393,7 @@ void EditorComponent::RefreshSceneGraphView()
continue;
}
- wiTreeList::Item item;
+ wi::gui::TreeList::Item item;
item.userdata = entity;
item.selected = IsSelected(entity);
item.open = scenegraphview_opened_items.count(entity) != 0;
@@ -2415,7 +2414,7 @@ void EditorComponent::ClearSelected()
}
void EditorComponent::AddSelected(Entity entity)
{
- wiScene::PickResult res;
+ wi::scene::PickResult res;
res.entity = entity;
AddSelected(res);
}
@@ -2456,7 +2455,7 @@ void EditorComponent::ResetHistory()
historyPos = -1;
history.clear();
}
-wiArchive& EditorComponent::AdvanceHistory()
+wi::Archive& EditorComponent::AdvanceHistory()
{
historyPos++;
@@ -2479,9 +2478,9 @@ void EditorComponent::ConsumeHistoryOperation(bool undo)
historyPos++;
}
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
- wiArchive& archive = history[historyPos];
+ wi::Archive& archive = history[historyPos];
archive.SetReadModeAndResetPos(true);
int temp;
@@ -2538,12 +2537,12 @@ void EditorComponent::ConsumeHistoryOperation(bool undo)
{
// Read selections states from archive:
- wi::vector selectedBEFORE;
+ wi::vector selectedBEFORE;
size_t selectionCountBEFORE;
archive >> selectionCountBEFORE;
for (size_t i = 0; i < selectionCountBEFORE; ++i)
{
- wiScene::PickResult sel;
+ wi::scene::PickResult sel;
archive >> sel.entity;
archive >> sel.position;
archive >> sel.normal;
@@ -2553,12 +2552,12 @@ void EditorComponent::ConsumeHistoryOperation(bool undo)
selectedBEFORE.push_back(sel);
}
- wi::vector selectedAFTER;
+ wi::vector selectedAFTER;
size_t selectionCountAFTER;
archive >> selectionCountAFTER;
for (size_t i = 0; i < selectionCountAFTER; ++i)
{
- wiScene::PickResult sel;
+ wi::scene::PickResult sel;
archive >> sel.entity;
archive >> sel.position;
archive >> sel.normal;
diff --git a/Editor/Editor.h b/Editor/Editor.h
index d0a5e719b..19be5e553 100644
--- a/Editor/Editor.h
+++ b/Editor/Editor.h
@@ -24,21 +24,21 @@
#include "LayerWindow.h"
#include "NameWindow.h"
-class EditorLoadingScreen : public LoadingScreen
+class EditorLoadingScreen : public wi::LoadingScreen
{
private:
- wiSprite sprite;
- wiSpriteFont font;
+ wi::Sprite sprite;
+ wi::SpriteFont font;
public:
void Load() override;
void Update(float dt) override;
};
class Editor;
-class EditorComponent : public RenderPath2D
+class EditorComponent : public wi::RenderPath2D
{
private:
- std::shared_ptr pointLightTex, spotLightTex, dirLightTex, areaLightTex, decalTex, forceFieldTex, emitterTex, hairTex, cameraTex, armatureTex, soundTex;
+ wi::Resource pointLightTex, spotLightTex, dirLightTex, areaLightTex, decalTex, forceFieldTex, emitterTex, hairTex, cameraTex, armatureTex, soundTex;
public:
MaterialWindow materialWnd;
PostprocessWindow postprocessWnd;
@@ -64,61 +64,61 @@ public:
Editor* main = nullptr;
- wiButton rendererWnd_Toggle;
- wiButton postprocessWnd_Toggle;
- wiButton paintToolWnd_Toggle;
- wiButton weatherWnd_Toggle;
- wiButton objectWnd_Toggle;
- wiButton meshWnd_Toggle;
- wiButton materialWnd_Toggle;
- wiButton cameraWnd_Toggle;
- wiButton envProbeWnd_Toggle;
- wiButton decalWnd_Toggle;
- wiButton soundWnd_Toggle;
- wiButton lightWnd_Toggle;
- wiButton animWnd_Toggle;
- wiButton emitterWnd_Toggle;
- wiButton hairWnd_Toggle;
- wiButton forceFieldWnd_Toggle;
- wiButton springWnd_Toggle;
- wiButton ikWnd_Toggle;
- wiButton transformWnd_Toggle;
- wiButton layerWnd_Toggle;
- wiButton nameWnd_Toggle;
- wiCheckBox translatorCheckBox;
- wiCheckBox isScalatorCheckBox;
- wiCheckBox isRotatorCheckBox;
- wiCheckBox isTranslatorCheckBox;
- wiButton saveButton;
- wiComboBox saveModeComboBox;
- wiButton modelButton;
- wiButton scriptButton;
- wiButton clearButton;
- wiButton helpButton;
- wiButton exitButton;
- wiCheckBox profilerEnabledCheckBox;
- wiCheckBox physicsEnabledCheckBox;
- wiCheckBox cinemaModeCheckBox;
- wiComboBox renderPathComboBox;
- wiLabel helpLabel;
+ wi::gui::Button rendererWnd_Toggle;
+ wi::gui::Button postprocessWnd_Toggle;
+ wi::gui::Button paintToolWnd_Toggle;
+ wi::gui::Button weatherWnd_Toggle;
+ wi::gui::Button objectWnd_Toggle;
+ wi::gui::Button meshWnd_Toggle;
+ wi::gui::Button materialWnd_Toggle;
+ wi::gui::Button cameraWnd_Toggle;
+ wi::gui::Button envProbeWnd_Toggle;
+ wi::gui::Button decalWnd_Toggle;
+ wi::gui::Button soundWnd_Toggle;
+ wi::gui::Button lightWnd_Toggle;
+ wi::gui::Button animWnd_Toggle;
+ wi::gui::Button emitterWnd_Toggle;
+ wi::gui::Button hairWnd_Toggle;
+ wi::gui::Button forceFieldWnd_Toggle;
+ wi::gui::Button springWnd_Toggle;
+ wi::gui::Button ikWnd_Toggle;
+ wi::gui::Button transformWnd_Toggle;
+ wi::gui::Button layerWnd_Toggle;
+ wi::gui::Button nameWnd_Toggle;
+ wi::gui::CheckBox translatorCheckBox;
+ wi::gui::CheckBox isScalatorCheckBox;
+ wi::gui::CheckBox isRotatorCheckBox;
+ wi::gui::CheckBox isTranslatorCheckBox;
+ wi::gui::Button saveButton;
+ wi::gui::ComboBox saveModeComboBox;
+ wi::gui::Button modelButton;
+ wi::gui::Button scriptButton;
+ wi::gui::Button clearButton;
+ wi::gui::Button helpButton;
+ wi::gui::Button exitButton;
+ wi::gui::CheckBox profilerEnabledCheckBox;
+ wi::gui::CheckBox physicsEnabledCheckBox;
+ wi::gui::CheckBox cinemaModeCheckBox;
+ wi::gui::ComboBox renderPathComboBox;
+ wi::gui::Label helpLabel;
- wiTreeList sceneGraphView;
- wi::unordered_set scenegraphview_added_items;
- wi::unordered_set scenegraphview_opened_items;
- void PushToSceneGraphView(wiECS::Entity entity, int level);
+ wi::gui::TreeList sceneGraphView;
+ wi::unordered_set scenegraphview_added_items;
+ wi::unordered_set scenegraphview_opened_items;
+ void PushToSceneGraphView(wi::ecs::Entity entity, int level);
void RefreshSceneGraphView();
- wiSlider pathTraceTargetSlider;
- wiLabel pathTraceStatisticsLabel;
+ wi::gui::Slider pathTraceTargetSlider;
+ wi::gui::Label pathTraceStatisticsLabel;
- std::unique_ptr renderPath;
+ std::unique_ptr renderPath;
enum RENDERPATH
{
RENDERPATH_DEFAULT,
RENDERPATH_PATHTRACING,
};
void ChangeRenderPath(RENDERPATH path);
- const wiGraphics::Texture* GetGUIBlurredBackground() const override { return renderPath->GetGUIBlurredBackground(); }
+ const wi::graphics::Texture* GetGUIBlurredBackground() const override { return renderPath->GetGUIBlurredBackground(); }
void ResizeBuffers() override;
void ResizeLayout() override;
@@ -129,7 +129,7 @@ public:
void Update(float dt) override;
void PostUpdate() override;
void Render() const override;
- void Compose(wiGraphics::CommandList cmd) const override;
+ void Compose(wi::graphics::CommandList cmd) const override;
enum EDITORSTENCILREF
@@ -139,26 +139,26 @@ public:
EDITORSTENCILREF_HIGHLIGHT_MATERIAL = 0x02,
EDITORSTENCILREF_LAST = 0x0F,
};
- wiGraphics::Texture rt_selectionOutline_MSAA;
- wiGraphics::Texture rt_selectionOutline[2];
- wiGraphics::RenderPass renderpass_selectionOutline[2];
+ wi::graphics::Texture rt_selectionOutline_MSAA;
+ wi::graphics::Texture rt_selectionOutline[2];
+ wi::graphics::RenderPass renderpass_selectionOutline[2];
float selectionOutlineTimer = 0;
const XMFLOAT4 selectionColor = XMFLOAT4(1, 0.6f, 0, 1);
const XMFLOAT4 selectionColor2 = XMFLOAT4(0, 1, 0.6f, 0.35f);
Translator translator;
- wiScene::PickResult hovered;
+ wi::scene::PickResult hovered;
void ClearSelected();
- void AddSelected(wiECS::Entity entity);
- void AddSelected(const wiScene::PickResult& picked);
- bool IsSelected(wiECS::Entity entity) const;
+ void AddSelected(wi::ecs::Entity entity);
+ void AddSelected(const wi::scene::PickResult& picked);
+ bool IsSelected(wi::ecs::Entity entity) const;
- wiArchive clipboard;
+ wi::Archive clipboard;
- wi::vector history;
+ wi::vector history;
int historyPos = -1;
enum HistoryOperationType
{
@@ -170,11 +170,11 @@ public:
};
void ResetHistory();
- wiArchive& AdvanceHistory();
+ wi::Archive& AdvanceHistory();
void ConsumeHistoryOperation(bool undo);
};
-class Editor : public MainComponent
+class Editor : public wi::Application
{
public:
EditorComponent renderComponent;
diff --git a/Editor/EmitterWindow.cpp b/Editor/EmitterWindow.cpp
index 92f00f5d4..30daf7795 100644
--- a/Editor/EmitterWindow.cpp
+++ b/Editor/EmitterWindow.cpp
@@ -4,12 +4,12 @@
#include
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void EmitterWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Emitter Window");
+ wi::gui::Window::Create("Emitter Window");
SetSize(XMFLOAT2(680, 700));
float x = 200;
@@ -21,8 +21,8 @@ void EmitterWindow::Create(EditorComponent* editor)
emitterNameField.Create("EmitterName");
emitterNameField.SetPos(XMFLOAT2(x, y += step));
emitterNameField.SetSize(XMFLOAT2(300, itemheight));
- emitterNameField.OnInputAccepted([=](wiEventArgs args) {
- NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
+ emitterNameField.OnInputAccepted([=](wi::gui::EventArgs args) {
+ NameComponent* name = wi::scene::GetScene().names.GetComponent(entity);
if (name != nullptr)
{
*name = args.sValue;
@@ -35,8 +35,8 @@ void EmitterWindow::Create(EditorComponent* editor)
addButton.Create("Add Emitter");
addButton.SetPos(XMFLOAT2(x, y += step));
addButton.SetSize(XMFLOAT2(150, itemheight));
- addButton.OnClick([=](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ addButton.OnClick([=](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
Entity entity = scene.Entity_CreateEmitter("editorEmitter");
editor->ClearSelected();
editor->AddSelected(entity);
@@ -49,7 +49,7 @@ void EmitterWindow::Create(EditorComponent* editor)
restartButton.Create("Restart Emitter");
restartButton.SetPos(XMFLOAT2(x + 160, y));
restartButton.SetSize(XMFLOAT2(150, itemheight));
- restartButton.OnClick([&](wiEventArgs args) {
+ restartButton.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -63,7 +63,7 @@ void EmitterWindow::Create(EditorComponent* editor)
meshComboBox.SetSize(XMFLOAT2(300, itemheight));
meshComboBox.SetPos(XMFLOAT2(x, y += step));
meshComboBox.SetEnabled(false);
- meshComboBox.OnSelect([&](wiEventArgs args) {
+ meshComboBox.OnSelect([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -73,7 +73,7 @@ void EmitterWindow::Create(EditorComponent* editor)
}
else
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
emitter->meshID = scene.meshes.GetEntity(args.iValue - 1);
}
}
@@ -88,11 +88,11 @@ void EmitterWindow::Create(EditorComponent* editor)
shaderTypeComboBox.AddItem("SOFT + DISTORTION");
shaderTypeComboBox.AddItem("SIMPLEST");
shaderTypeComboBox.AddItem("SOFT + LIGHTING");
- shaderTypeComboBox.OnSelect([&](wiEventArgs args) {
+ shaderTypeComboBox.OnSelect([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
- emitter->shaderType = (wiEmittedParticle::PARTICLESHADERTYPE)args.iValue;
+ emitter->shaderType = (wi::EmittedParticleSystem::PARTICLESHADERTYPE)args.iValue;
}
});
shaderTypeComboBox.SetEnabled(false);
@@ -103,7 +103,7 @@ void EmitterWindow::Create(EditorComponent* editor)
sortCheckBox.Create("Sorting Enabled: ");
sortCheckBox.SetPos(XMFLOAT2(x, y += step));
sortCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- sortCheckBox.OnClick([&](wiEventArgs args) {
+ sortCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -118,7 +118,7 @@ void EmitterWindow::Create(EditorComponent* editor)
depthCollisionsCheckBox.Create("Depth Buffer Collisions Enabled: ");
depthCollisionsCheckBox.SetPos(XMFLOAT2(x + 250, y));
depthCollisionsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- depthCollisionsCheckBox.OnClick([&](wiEventArgs args) {
+ depthCollisionsCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -133,7 +133,7 @@ void EmitterWindow::Create(EditorComponent* editor)
sphCheckBox.Create("SPH - FluidSim: ");
sphCheckBox.SetPos(XMFLOAT2(x + 400, y));
sphCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- sphCheckBox.OnClick([&](wiEventArgs args) {
+ sphCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -148,7 +148,7 @@ void EmitterWindow::Create(EditorComponent* editor)
pauseCheckBox.Create("PAUSE: ");
pauseCheckBox.SetPos(XMFLOAT2(x, y += step));
pauseCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- pauseCheckBox.OnClick([&](wiEventArgs args) {
+ pauseCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -163,7 +163,7 @@ void EmitterWindow::Create(EditorComponent* editor)
debugCheckBox.Create("DEBUG: ");
debugCheckBox.SetPos(XMFLOAT2(x + 120, y));
debugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- debugCheckBox.OnClick([&](wiEventArgs args) {
+ debugCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -178,7 +178,7 @@ void EmitterWindow::Create(EditorComponent* editor)
volumeCheckBox.Create("Volume: ");
volumeCheckBox.SetPos(XMFLOAT2(x + 250, y));
volumeCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- volumeCheckBox.OnClick([&](wiEventArgs args) {
+ volumeCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -193,7 +193,7 @@ void EmitterWindow::Create(EditorComponent* editor)
frameBlendingCheckBox.Create("Frame Blending: ");
frameBlendingCheckBox.SetPos(XMFLOAT2(x + 400, y));
frameBlendingCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- frameBlendingCheckBox.OnClick([&](wiEventArgs args) {
+ frameBlendingCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -220,7 +220,7 @@ void EmitterWindow::Create(EditorComponent* editor)
frameRateInput.SetText("");
frameRateInput.SetTooltip("Enter a value to enable looping sprite sheet animation (frames per second). Set 0 for animation along paritcle lifetime.");
frameRateInput.SetDescription("Frame Rate: ");
- frameRateInput.OnInputAccepted([this](wiEventArgs args) {
+ frameRateInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -235,7 +235,7 @@ void EmitterWindow::Create(EditorComponent* editor)
framesXInput.SetText("");
framesXInput.SetTooltip("How many horizontal frames there are in the spritesheet.");
framesXInput.SetDescription("Frames X: ");
- framesXInput.OnInputAccepted([this](wiEventArgs args) {
+ framesXInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -250,7 +250,7 @@ void EmitterWindow::Create(EditorComponent* editor)
framesYInput.SetText("");
framesYInput.SetTooltip("How many vertical frames there are in the spritesheet.");
framesYInput.SetDescription("Frames Y: ");
- framesYInput.OnInputAccepted([this](wiEventArgs args) {
+ framesYInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -265,7 +265,7 @@ void EmitterWindow::Create(EditorComponent* editor)
frameCountInput.SetText("");
frameCountInput.SetTooltip("Enter a value to enable the random sprite sheet frame selection's max frame number.");
frameCountInput.SetDescription("Frame Count: ");
- frameCountInput.OnInputAccepted([this](wiEventArgs args) {
+ frameCountInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -280,7 +280,7 @@ void EmitterWindow::Create(EditorComponent* editor)
frameStartInput.SetText("");
frameStartInput.SetTooltip("Specifies the starting frame of the animation.");
frameStartInput.SetDescription("Start Frame: ");
- frameStartInput.OnInputAccepted([this](wiEventArgs args) {
+ frameStartInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -298,7 +298,7 @@ void EmitterWindow::Create(EditorComponent* editor)
VelocityXInput.SetTooltip("Vector X component");
VelocityXInput.SetPos(XMFLOAT2(x, y += step));
VelocityXInput.SetSize(XMFLOAT2(38, itemheight));
- VelocityXInput.OnInputAccepted([&](wiEventArgs args) {
+ VelocityXInput.OnInputAccepted([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -312,7 +312,7 @@ void EmitterWindow::Create(EditorComponent* editor)
VelocityYInput.SetTooltip("Vector Y component");
VelocityYInput.SetPos(XMFLOAT2(x + 40, y));
VelocityYInput.SetSize(XMFLOAT2(38, itemheight));
- VelocityYInput.OnInputAccepted([&](wiEventArgs args) {
+ VelocityYInput.OnInputAccepted([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -326,7 +326,7 @@ void EmitterWindow::Create(EditorComponent* editor)
VelocityZInput.SetTooltip("Vector Z component");
VelocityZInput.SetPos(XMFLOAT2(x + 80, y));
VelocityZInput.SetSize(XMFLOAT2(38, itemheight));
- VelocityZInput.OnInputAccepted([&](wiEventArgs args) {
+ VelocityZInput.OnInputAccepted([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -343,7 +343,7 @@ void EmitterWindow::Create(EditorComponent* editor)
GravityXInput.SetTooltip("Vector X component");
GravityXInput.SetPos(XMFLOAT2(x + 200, y));
GravityXInput.SetSize(XMFLOAT2(38, itemheight));
- GravityXInput.OnInputAccepted([&](wiEventArgs args) {
+ GravityXInput.OnInputAccepted([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -357,7 +357,7 @@ void EmitterWindow::Create(EditorComponent* editor)
GravityYInput.SetTooltip("Vector Y component");
GravityYInput.SetPos(XMFLOAT2(x + 240, y));
GravityYInput.SetSize(XMFLOAT2(38, itemheight));
- GravityYInput.OnInputAccepted([&](wiEventArgs args) {
+ GravityYInput.OnInputAccepted([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -371,7 +371,7 @@ void EmitterWindow::Create(EditorComponent* editor)
GravityZInput.SetTooltip("Vector Z component");
GravityZInput.SetPos(XMFLOAT2(x + 280, y));
GravityZInput.SetSize(XMFLOAT2(38, itemheight));
- GravityZInput.OnInputAccepted([&](wiEventArgs args) {
+ GravityZInput.OnInputAccepted([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -383,7 +383,7 @@ void EmitterWindow::Create(EditorComponent* editor)
maxParticlesSlider.Create(100.0f, 1000000.0f, 10000, 100000, "Max particle count: ");
maxParticlesSlider.SetSize(XMFLOAT2(360, itemheight));
maxParticlesSlider.SetPos(XMFLOAT2(x, y += step));
- maxParticlesSlider.OnSlide([&](wiEventArgs args) {
+ maxParticlesSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -397,7 +397,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitCountSlider.Create(0.0f, 10000.0f, 1.0f, 100000, "Emit count per sec: ");
emitCountSlider.SetSize(XMFLOAT2(360, itemheight));
emitCountSlider.SetPos(XMFLOAT2(x, y += step));
- emitCountSlider.OnSlide([&](wiEventArgs args) {
+ emitCountSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -411,7 +411,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitSizeSlider.Create(0.01f, 10.0f, 1.0f, 100000, "Size: ");
emitSizeSlider.SetSize(XMFLOAT2(360, itemheight));
emitSizeSlider.SetPos(XMFLOAT2(x, y += step));
- emitSizeSlider.OnSlide([&](wiEventArgs args) {
+ emitSizeSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -425,7 +425,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitRotationSlider.Create(0.0f, 1.0f, 0.0f, 100000, "Rotation: ");
emitRotationSlider.SetSize(XMFLOAT2(360, itemheight));
emitRotationSlider.SetPos(XMFLOAT2(x, y += step));
- emitRotationSlider.OnSlide([&](wiEventArgs args) {
+ emitRotationSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -439,7 +439,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitNormalSlider.Create(0.0f, 100.0f, 1.0f, 100000, "Normal factor: ");
emitNormalSlider.SetSize(XMFLOAT2(360, itemheight));
emitNormalSlider.SetPos(XMFLOAT2(x, y += step));
- emitNormalSlider.OnSlide([&](wiEventArgs args) {
+ emitNormalSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -453,7 +453,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitScalingSlider.Create(0.0f, 100.0f, 1.0f, 100000, "Scaling: ");
emitScalingSlider.SetSize(XMFLOAT2(360, itemheight));
emitScalingSlider.SetPos(XMFLOAT2(x, y += step));
- emitScalingSlider.OnSlide([&](wiEventArgs args) {
+ emitScalingSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -467,7 +467,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitLifeSlider.Create(0.0f, 100.0f, 1.0f, 10000, "Life span: ");
emitLifeSlider.SetSize(XMFLOAT2(360, itemheight));
emitLifeSlider.SetPos(XMFLOAT2(x, y += step));
- emitLifeSlider.OnSlide([&](wiEventArgs args) {
+ emitLifeSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -481,7 +481,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitRandomnessSlider.Create(0.0f, 1.0f, 1.0f, 100000, "Randomness: ");
emitRandomnessSlider.SetSize(XMFLOAT2(360, itemheight));
emitRandomnessSlider.SetPos(XMFLOAT2(x, y += step));
- emitRandomnessSlider.OnSlide([&](wiEventArgs args) {
+ emitRandomnessSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -495,7 +495,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitLifeRandomnessSlider.Create(0.0f, 2.0f, 0.0f, 100000, "Life randomness: ");
emitLifeRandomnessSlider.SetSize(XMFLOAT2(360, itemheight));
emitLifeRandomnessSlider.SetPos(XMFLOAT2(x, y += step));
- emitLifeRandomnessSlider.OnSlide([&](wiEventArgs args) {
+ emitLifeRandomnessSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -509,7 +509,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitColorRandomnessSlider.Create(0.0f, 2.0f, 0.0f, 100000, "Color randomness: ");
emitColorRandomnessSlider.SetSize(XMFLOAT2(360, itemheight));
emitColorRandomnessSlider.SetPos(XMFLOAT2(x, y += step));
- emitColorRandomnessSlider.OnSlide([&](wiEventArgs args) {
+ emitColorRandomnessSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -523,7 +523,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitMotionBlurSlider.Create(0.0f, 1.0f, 1.0f, 100000, "Motion blur: ");
emitMotionBlurSlider.SetSize(XMFLOAT2(360, itemheight));
emitMotionBlurSlider.SetPos(XMFLOAT2(x, y += step));
- emitMotionBlurSlider.OnSlide([&](wiEventArgs args) {
+ emitMotionBlurSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -537,7 +537,7 @@ void EmitterWindow::Create(EditorComponent* editor)
emitMassSlider.Create(0.1f, 100.0f, 1.0f, 100000, "Mass: ");
emitMassSlider.SetSize(XMFLOAT2(360, itemheight));
emitMassSlider.SetPos(XMFLOAT2(x, y += step));
- emitMassSlider.OnSlide([&](wiEventArgs args) {
+ emitMassSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -553,7 +553,7 @@ void EmitterWindow::Create(EditorComponent* editor)
timestepSlider.Create(-1, 0.016f, -1, 100000, "Timestep: ");
timestepSlider.SetSize(XMFLOAT2(360, itemheight));
timestepSlider.SetPos(XMFLOAT2(x, y += step));
- timestepSlider.OnSlide([&](wiEventArgs args) {
+ timestepSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -569,7 +569,7 @@ void EmitterWindow::Create(EditorComponent* editor)
dragSlider.Create(-1, 0.016f, -1, 100000, "Drag: ");
dragSlider.SetSize(XMFLOAT2(360, itemheight));
dragSlider.SetPos(XMFLOAT2(x, y += step));
- dragSlider.OnSlide([&](wiEventArgs args) {
+ dragSlider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -587,7 +587,7 @@ void EmitterWindow::Create(EditorComponent* editor)
sph_h_Slider.Create(0.1f, 100.0f, 1.0f, 100000, "SPH Smoothing Radius (h): ");
sph_h_Slider.SetSize(XMFLOAT2(360, itemheight));
sph_h_Slider.SetPos(XMFLOAT2(x, y += step));
- sph_h_Slider.OnSlide([&](wiEventArgs args) {
+ sph_h_Slider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -601,7 +601,7 @@ void EmitterWindow::Create(EditorComponent* editor)
sph_K_Slider.Create(0.1f, 100.0f, 1.0f, 100000, "SPH Pressure Constant (K): ");
sph_K_Slider.SetSize(XMFLOAT2(360, itemheight));
sph_K_Slider.SetPos(XMFLOAT2(x, y += step));
- sph_K_Slider.OnSlide([&](wiEventArgs args) {
+ sph_K_Slider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -615,7 +615,7 @@ void EmitterWindow::Create(EditorComponent* editor)
sph_p0_Slider.Create(0.1f, 100.0f, 1.0f, 100000, "SPH Reference Density (p0): ");
sph_p0_Slider.SetSize(XMFLOAT2(360, itemheight));
sph_p0_Slider.SetPos(XMFLOAT2(x, y += step));
- sph_p0_Slider.OnSlide([&](wiEventArgs args) {
+ sph_p0_Slider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -629,7 +629,7 @@ void EmitterWindow::Create(EditorComponent* editor)
sph_e_Slider.Create(0.1f, 100.0f, 1.0f, 100000, "SPH Viscosity (e): ");
sph_e_Slider.SetSize(XMFLOAT2(360, itemheight));
sph_e_Slider.SetPos(XMFLOAT2(x, y += step));
- sph_e_Slider.OnSlide([&](wiEventArgs args) {
+ sph_e_Slider.OnSlide([&](wi::gui::EventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
{
@@ -715,15 +715,15 @@ void EmitterWindow::SetEntity(Entity entity)
}
-wiEmittedParticle* EmitterWindow::GetEmitter()
+wi::EmittedParticleSystem* EmitterWindow::GetEmitter()
{
if (entity == INVALID_ENTITY)
{
return nullptr;
}
- Scene& scene = wiScene::GetScene();
- wiEmittedParticle* emitter = scene.emitters.GetComponent(entity);
+ Scene& scene = wi::scene::GetScene();
+ wi::EmittedParticleSystem* emitter = scene.emitters.GetComponent(entity);
return emitter;
}
@@ -736,7 +736,7 @@ void EmitterWindow::UpdateData()
return;
}
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
meshComboBox.ClearItems();
meshComboBox.AddItem("NO MESH");
diff --git a/Editor/EmitterWindow.h b/Editor/EmitterWindow.h
index 580eb8202..0c8218aeb 100644
--- a/Editor/EmitterWindow.h
+++ b/Editor/EmitterWindow.h
@@ -5,62 +5,62 @@ class EditorComponent;
class MaterialWindow;
-class EmitterWindow : public wiWindow
+class EmitterWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
void UpdateData();
- wiScene::wiEmittedParticle* GetEmitter();
+ wi::EmittedParticleSystem* GetEmitter();
- wiTextInputField emitterNameField;
- wiButton addButton;
- wiButton restartButton;
- wiComboBox meshComboBox;
- wiComboBox shaderTypeComboBox;
- wiLabel infoLabel;
- wiSlider maxParticlesSlider;
- wiCheckBox sortCheckBox;
- wiCheckBox depthCollisionsCheckBox;
- wiCheckBox sphCheckBox;
- wiCheckBox pauseCheckBox;
- wiCheckBox debugCheckBox;
- wiCheckBox volumeCheckBox;
- wiCheckBox frameBlendingCheckBox;
- wiSlider emitCountSlider;
- wiSlider emitSizeSlider;
- wiSlider emitRotationSlider;
- wiSlider emitNormalSlider;
- wiSlider emitScalingSlider;
- wiSlider emitLifeSlider;
- wiSlider emitRandomnessSlider;
- wiSlider emitLifeRandomnessSlider;
- wiSlider emitColorRandomnessSlider;
- wiSlider emitMotionBlurSlider;
- wiSlider emitMassSlider;
- wiSlider timestepSlider;
- wiSlider dragSlider;
- wiTextInputField VelocityXInput;
- wiTextInputField VelocityYInput;
- wiTextInputField VelocityZInput;
- wiTextInputField GravityXInput;
- wiTextInputField GravityYInput;
- wiTextInputField GravityZInput;
+ wi::gui::TextInputField emitterNameField;
+ wi::gui::Button addButton;
+ wi::gui::Button restartButton;
+ wi::gui::ComboBox meshComboBox;
+ wi::gui::ComboBox shaderTypeComboBox;
+ wi::gui::Label infoLabel;
+ wi::gui::Slider maxParticlesSlider;
+ wi::gui::CheckBox sortCheckBox;
+ wi::gui::CheckBox depthCollisionsCheckBox;
+ wi::gui::CheckBox sphCheckBox;
+ wi::gui::CheckBox pauseCheckBox;
+ wi::gui::CheckBox debugCheckBox;
+ wi::gui::CheckBox volumeCheckBox;
+ wi::gui::CheckBox frameBlendingCheckBox;
+ wi::gui::Slider emitCountSlider;
+ wi::gui::Slider emitSizeSlider;
+ wi::gui::Slider emitRotationSlider;
+ wi::gui::Slider emitNormalSlider;
+ wi::gui::Slider emitScalingSlider;
+ wi::gui::Slider emitLifeSlider;
+ wi::gui::Slider emitRandomnessSlider;
+ wi::gui::Slider emitLifeRandomnessSlider;
+ wi::gui::Slider emitColorRandomnessSlider;
+ wi::gui::Slider emitMotionBlurSlider;
+ wi::gui::Slider emitMassSlider;
+ wi::gui::Slider timestepSlider;
+ wi::gui::Slider dragSlider;
+ wi::gui::TextInputField VelocityXInput;
+ wi::gui::TextInputField VelocityYInput;
+ wi::gui::TextInputField VelocityZInput;
+ wi::gui::TextInputField GravityXInput;
+ wi::gui::TextInputField GravityYInput;
+ wi::gui::TextInputField GravityZInput;
- wiSlider sph_h_Slider;
- wiSlider sph_K_Slider;
- wiSlider sph_p0_Slider;
- wiSlider sph_e_Slider;
+ wi::gui::Slider sph_h_Slider;
+ wi::gui::Slider sph_K_Slider;
+ wi::gui::Slider sph_p0_Slider;
+ wi::gui::Slider sph_e_Slider;
- wiTextInputField frameRateInput;
- wiTextInputField framesXInput;
- wiTextInputField framesYInput;
- wiTextInputField frameCountInput;
- wiTextInputField frameStartInput;
+ wi::gui::TextInputField frameRateInput;
+ wi::gui::TextInputField framesXInput;
+ wi::gui::TextInputField framesYInput;
+ wi::gui::TextInputField frameCountInput;
+ wi::gui::TextInputField frameStartInput;
};
diff --git a/Editor/EnvProbeWindow.cpp b/Editor/EnvProbeWindow.cpp
index 3759354bf..53ffeb355 100644
--- a/Editor/EnvProbeWindow.cpp
+++ b/Editor/EnvProbeWindow.cpp
@@ -2,12 +2,12 @@
#include "EnvProbeWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void EnvProbeWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Environment Probe Window");
+ wi::gui::Window::Create("Environment Probe Window");
SetSize(XMFLOAT2(300, 200));
float x = 100, y = 5, step = 35;
@@ -15,8 +15,8 @@ void EnvProbeWindow::Create(EditorComponent* editor)
realTimeCheckBox.Create("RealTime: ");
realTimeCheckBox.SetPos(XMFLOAT2(x, y += step));
realTimeCheckBox.SetEnabled(false);
- realTimeCheckBox.OnClick([&](wiEventArgs args) {
- EnvironmentProbeComponent* probe = wiScene::GetScene().probes.GetComponent(entity);
+ realTimeCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ EnvironmentProbeComponent* probe = wi::scene::GetScene().probes.GetComponent(entity);
if (probe != nullptr)
{
probe->SetRealTime(args.bValue);
@@ -27,10 +27,10 @@ void EnvProbeWindow::Create(EditorComponent* editor)
generateButton.Create("Put");
generateButton.SetPos(XMFLOAT2(x, y += step));
- generateButton.OnClick([=](wiEventArgs args) {
+ generateButton.OnClick([=](wi::gui::EventArgs args) {
XMFLOAT3 pos;
- XMStoreFloat3(&pos, XMVectorAdd(wiScene::GetCamera().GetEye(), wiScene::GetCamera().GetAt() * 4));
- Entity entity = wiScene::GetScene().Entity_CreateEnvironmentProbe("editorProbe", pos);
+ XMStoreFloat3(&pos, XMVectorAdd(wi::scene::GetCamera().GetEye(), wi::scene::GetCamera().GetAt() * 4));
+ Entity entity = wi::scene::GetScene().Entity_CreateEnvironmentProbe("editorProbe", pos);
editor->ClearSelected();
editor->AddSelected(entity);
editor->RefreshSceneGraphView();
@@ -41,8 +41,8 @@ void EnvProbeWindow::Create(EditorComponent* editor)
refreshButton.Create("Refresh");
refreshButton.SetPos(XMFLOAT2(x, y += step));
refreshButton.SetEnabled(false);
- refreshButton.OnClick([&](wiEventArgs args) {
- EnvironmentProbeComponent* probe = wiScene::GetScene().probes.GetComponent(entity);
+ refreshButton.OnClick([&](wi::gui::EventArgs args) {
+ EnvironmentProbeComponent* probe = wi::scene::GetScene().probes.GetComponent(entity);
if (probe != nullptr)
{
probe->SetDirty();
@@ -53,8 +53,8 @@ void EnvProbeWindow::Create(EditorComponent* editor)
refreshAllButton.Create("Refresh All");
refreshAllButton.SetPos(XMFLOAT2(x, y += step));
refreshAllButton.SetEnabled(true);
- refreshAllButton.OnClick([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ refreshAllButton.OnClick([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
for (size_t i = 0; i < scene.probes.GetCount(); ++i)
{
EnvironmentProbeComponent& probe = scene.probes[i];
@@ -76,7 +76,7 @@ void EnvProbeWindow::SetEntity(Entity entity)
{
this->entity = entity;
- const EnvironmentProbeComponent* probe = wiScene::GetScene().probes.GetComponent(entity);
+ const EnvironmentProbeComponent* probe = wi::scene::GetScene().probes.GetComponent(entity);
if (probe == nullptr)
{
diff --git a/Editor/EnvProbeWindow.h b/Editor/EnvProbeWindow.h
index aa2b44313..627314997 100644
--- a/Editor/EnvProbeWindow.h
+++ b/Editor/EnvProbeWindow.h
@@ -3,17 +3,17 @@
class EditorComponent;
-class EnvProbeWindow : public wiWindow
+class EnvProbeWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiCheckBox realTimeCheckBox;
- wiButton generateButton;
- wiButton refreshButton;
- wiButton refreshAllButton;
+ wi::gui::CheckBox realTimeCheckBox;
+ wi::gui::Button generateButton;
+ wi::gui::Button refreshButton;
+ wi::gui::Button refreshAllButton;
};
diff --git a/Editor/ForceFieldWindow.cpp b/Editor/ForceFieldWindow.cpp
index 3bc4ec05f..1488edb2c 100644
--- a/Editor/ForceFieldWindow.cpp
+++ b/Editor/ForceFieldWindow.cpp
@@ -2,13 +2,13 @@
#include "ForceFieldWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void ForceFieldWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Force Field Window");
+ wi::gui::Window::Create("Force Field Window");
SetSize(XMFLOAT2(420, 120));
float x = 150;
@@ -19,9 +19,9 @@ void ForceFieldWindow::Create(EditorComponent* editor)
addButton.Create("Add Force Field");
addButton.SetSize(XMFLOAT2(150, hei));
addButton.SetPos(XMFLOAT2(x, y += step));
- addButton.OnClick([=](wiEventArgs args) {
- Entity entity = wiScene::GetScene().Entity_CreateForce("editorForce");
- ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity);
+ addButton.OnClick([=](wi::gui::EventArgs args) {
+ Entity entity = wi::scene::GetScene().Entity_CreateForce("editorForce");
+ ForceFieldComponent* force = wi::scene::GetScene().forces.GetComponent(entity);
if (force != nullptr)
{
switch (typeComboBox.GetSelected())
@@ -53,8 +53,8 @@ void ForceFieldWindow::Create(EditorComponent* editor)
typeComboBox.Create("Force Field type: ");
typeComboBox.SetPos(XMFLOAT2(x, y += step));
typeComboBox.SetSize(XMFLOAT2(200, hei));
- typeComboBox.OnSelect([&](wiEventArgs args) {
- ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity);
+ typeComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ ForceFieldComponent* force = wi::scene::GetScene().forces.GetComponent(entity);
if (force != nullptr && args.iValue >= 0)
{
switch (args.iValue)
@@ -81,8 +81,8 @@ void ForceFieldWindow::Create(EditorComponent* editor)
gravitySlider.Create(-10, 10, 0, 100000, "Gravity: ");
gravitySlider.SetSize(XMFLOAT2(200, hei));
gravitySlider.SetPos(XMFLOAT2(x, y += step));
- gravitySlider.OnSlide([&](wiEventArgs args) {
- ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity);
+ gravitySlider.OnSlide([&](wi::gui::EventArgs args) {
+ ForceFieldComponent* force = wi::scene::GetScene().forces.GetComponent(entity);
if (force != nullptr)
{
force->gravity = args.fValue;
@@ -96,8 +96,8 @@ void ForceFieldWindow::Create(EditorComponent* editor)
rangeSlider.Create(0.0f, 100.0f, 10, 100000, "Range: ");
rangeSlider.SetSize(XMFLOAT2(200, hei));
rangeSlider.SetPos(XMFLOAT2(x, y += step));
- rangeSlider.OnSlide([&](wiEventArgs args) {
- ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity);
+ rangeSlider.OnSlide([&](wi::gui::EventArgs args) {
+ ForceFieldComponent* force = wi::scene::GetScene().forces.GetComponent(entity);
if (force != nullptr)
{
force->range_local = args.fValue;
@@ -119,7 +119,7 @@ void ForceFieldWindow::SetEntity(Entity entity)
{
this->entity = entity;
- const ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity);
+ const ForceFieldComponent* force = wi::scene::GetScene().forces.GetComponent(entity);
if (force != nullptr)
{
diff --git a/Editor/ForceFieldWindow.h b/Editor/ForceFieldWindow.h
index 06491e967..ac9d326a6 100644
--- a/Editor/ForceFieldWindow.h
+++ b/Editor/ForceFieldWindow.h
@@ -3,17 +3,17 @@
class EditorComponent;
-class ForceFieldWindow : public wiWindow
+class ForceFieldWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiComboBox typeComboBox;
- wiSlider gravitySlider;
- wiSlider rangeSlider;
- wiButton addButton;
+ wi::gui::ComboBox typeComboBox;
+ wi::gui::Slider gravitySlider;
+ wi::gui::Slider rangeSlider;
+ wi::gui::Button addButton;
};
diff --git a/Editor/HairParticleWindow.cpp b/Editor/HairParticleWindow.cpp
index 255bc9ed9..b787a08da 100644
--- a/Editor/HairParticleWindow.cpp
+++ b/Editor/HairParticleWindow.cpp
@@ -2,12 +2,12 @@
#include "HairParticleWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void HairParticleWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Hair Particle System Window");
+ wi::gui::Window::Create("Hair Particle System Window");
SetSize(XMFLOAT2(600, 260));
float x = 160;
@@ -19,8 +19,8 @@ void HairParticleWindow::Create(EditorComponent* editor)
addButton.Create("Add Hair Particle System");
addButton.SetPos(XMFLOAT2(x, y += step));
addButton.SetSize(XMFLOAT2(200, hei));
- addButton.OnClick([=](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ addButton.OnClick([=](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
Entity entity = scene.Entity_CreateHair("editorHair");
editor->ClearSelected();
editor->AddSelected(entity);
@@ -34,7 +34,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
meshComboBox.SetSize(XMFLOAT2(300, hei));
meshComboBox.SetPos(XMFLOAT2(x, y += step));
meshComboBox.SetEnabled(false);
- meshComboBox.OnSelect([&](wiEventArgs args) {
+ meshComboBox.OnSelect([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -44,7 +44,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
}
else
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
hair->meshID = scene.meshes.GetEntity(args.iValue - 1);
}
}
@@ -55,7 +55,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
countSlider.Create(0, 100000, 1000, 100000, "Strand Count: ");
countSlider.SetSize(XMFLOAT2(360, hei));
countSlider.SetPos(XMFLOAT2(x, y += step));
- countSlider.OnSlide([&](wiEventArgs args) {
+ countSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -69,7 +69,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
lengthSlider.Create(0, 4, 1, 100000, "Particle Length: ");
lengthSlider.SetSize(XMFLOAT2(360, hei));
lengthSlider.SetPos(XMFLOAT2(x, y += step));
- lengthSlider.OnSlide([&](wiEventArgs args) {
+ lengthSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -83,7 +83,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
stiffnessSlider.Create(0, 20, 5, 100000, "Particle Stiffness: ");
stiffnessSlider.SetSize(XMFLOAT2(360, hei));
stiffnessSlider.SetPos(XMFLOAT2(x, y += step));
- stiffnessSlider.OnSlide([&](wiEventArgs args) {
+ stiffnessSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -97,7 +97,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
randomnessSlider.Create(0, 1, 0.2f, 100000, "Particle Randomness: ");
randomnessSlider.SetSize(XMFLOAT2(360, hei));
randomnessSlider.SetPos(XMFLOAT2(x, y += step));
- randomnessSlider.OnSlide([&](wiEventArgs args) {
+ randomnessSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -111,7 +111,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
segmentcountSlider.Create(1, 10, 1, 9, "Segment Count: ");
segmentcountSlider.SetSize(XMFLOAT2(360, hei));
segmentcountSlider.SetPos(XMFLOAT2(x, y += step));
- segmentcountSlider.OnSlide([&](wiEventArgs args) {
+ segmentcountSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -125,7 +125,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
randomSeedSlider.Create(1, 12345, 1, 12344, "Random seed: ");
randomSeedSlider.SetSize(XMFLOAT2(360, hei));
randomSeedSlider.SetPos(XMFLOAT2(x, y += step));
- randomSeedSlider.OnSlide([&](wiEventArgs args) {
+ randomSeedSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -139,7 +139,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
viewDistanceSlider.Create(0, 1000, 100, 10000, "View distance: ");
viewDistanceSlider.SetSize(XMFLOAT2(360, hei));
viewDistanceSlider.SetPos(XMFLOAT2(x, y += step));
- viewDistanceSlider.OnSlide([&](wiEventArgs args) {
+ viewDistanceSlider.OnSlide([&](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -156,7 +156,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
framesXInput.SetText("");
framesXInput.SetTooltip("How many horizontal frames there are in the spritesheet.");
framesXInput.SetDescription("Frames X: ");
- framesXInput.OnInputAccepted([this](wiEventArgs args) {
+ framesXInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -171,7 +171,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
framesYInput.SetText("");
framesYInput.SetTooltip("How many vertical frames there are in the spritesheet.");
framesYInput.SetDescription("Frames Y: ");
- framesYInput.OnInputAccepted([this](wiEventArgs args) {
+ framesYInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -188,7 +188,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
frameCountInput.SetText("");
frameCountInput.SetTooltip("Enter a value to enable the random sprite sheet frame selection's max frame number.");
frameCountInput.SetDescription("Frame Count: ");
- frameCountInput.OnInputAccepted([this](wiEventArgs args) {
+ frameCountInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -203,7 +203,7 @@ void HairParticleWindow::Create(EditorComponent* editor)
frameStartInput.SetText("");
frameStartInput.SetTooltip("Specifies the first frame of the sheet that can be used.");
frameStartInput.SetDescription("First Frame: ");
- frameStartInput.OnInputAccepted([this](wiEventArgs args) {
+ frameStartInput.OnInputAccepted([this](wi::gui::EventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
@@ -251,15 +251,15 @@ void HairParticleWindow::SetEntity(Entity entity)
addButton.SetEnabled(true);
}
-wiHairParticle* HairParticleWindow::GetHair()
+wi::HairParticleSystem* HairParticleWindow::GetHair()
{
if (entity == INVALID_ENTITY)
{
return nullptr;
}
- Scene& scene = wiScene::GetScene();
- wiHairParticle* hair = scene.hairs.GetComponent(entity);
+ Scene& scene = wi::scene::GetScene();
+ wi::HairParticleSystem* hair = scene.hairs.GetComponent(entity);
return hair;
}
@@ -272,7 +272,7 @@ void HairParticleWindow::UpdateData()
return;
}
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
meshComboBox.ClearItems();
meshComboBox.AddItem("NO MESH");
diff --git a/Editor/HairParticleWindow.h b/Editor/HairParticleWindow.h
index dc12a70e9..a972fd223 100644
--- a/Editor/HairParticleWindow.h
+++ b/Editor/HairParticleWindow.h
@@ -5,31 +5,31 @@ class EditorComponent;
class MaterialWindow;
-class HairParticleWindow : public wiWindow
+class HairParticleWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
void UpdateData();
- wiScene::wiHairParticle* GetHair();
+ wi::HairParticleSystem* GetHair();
- wiButton addButton;
- wiComboBox meshComboBox;
- wiSlider lengthSlider;
- wiSlider stiffnessSlider;
- wiSlider randomnessSlider;
- wiSlider countSlider;
- wiSlider segmentcountSlider;
- wiSlider randomSeedSlider;
- wiSlider viewDistanceSlider;
- wiTextInputField framesXInput;
- wiTextInputField framesYInput;
- wiTextInputField frameCountInput;
- wiTextInputField frameStartInput;
+ wi::gui::Button addButton;
+ wi::gui::ComboBox meshComboBox;
+ wi::gui::Slider lengthSlider;
+ wi::gui::Slider stiffnessSlider;
+ wi::gui::Slider randomnessSlider;
+ wi::gui::Slider countSlider;
+ wi::gui::Slider segmentcountSlider;
+ wi::gui::Slider randomSeedSlider;
+ wi::gui::Slider viewDistanceSlider;
+ wi::gui::TextInputField framesXInput;
+ wi::gui::TextInputField framesYInput;
+ wi::gui::TextInputField frameCountInput;
+ wi::gui::TextInputField frameStartInput;
};
diff --git a/Editor/IKWindow.cpp b/Editor/IKWindow.cpp
index d51bbde65..9c58f3d9f 100644
--- a/Editor/IKWindow.cpp
+++ b/Editor/IKWindow.cpp
@@ -2,13 +2,13 @@
#include "IKWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void IKWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Inverse Kinematics (IK) Window");
+ wi::gui::Window::Create("Inverse Kinematics (IK) Window");
SetSize(XMFLOAT2(400, 150));
float x = 120;
@@ -27,8 +27,8 @@ void IKWindow::Create(EditorComponent* editor)
targetCombo.SetSize(XMFLOAT2(siz, hei));
targetCombo.SetPos(XMFLOAT2(x, y += step));
targetCombo.SetEnabled(false);
- targetCombo.OnSelect([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ targetCombo.OnSelect([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
InverseKinematicsComponent* ik = scene.inverse_kinematics.GetComponent(entity);
if (ik != nullptr)
{
@@ -49,8 +49,8 @@ void IKWindow::Create(EditorComponent* editor)
disabledCheckBox.SetTooltip("Disable simulation.");
disabledCheckBox.SetPos(XMFLOAT2(x, y += step));
disabledCheckBox.SetSize(XMFLOAT2(hei, hei));
- disabledCheckBox.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().inverse_kinematics.GetComponent(entity)->SetDisabled(args.bValue);
+ disabledCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().inverse_kinematics.GetComponent(entity)->SetDisabled(args.bValue);
});
AddWidget(&disabledCheckBox);
@@ -58,8 +58,8 @@ void IKWindow::Create(EditorComponent* editor)
chainLengthSlider.SetTooltip("How far the hierarchy chain is simulated backwards from this entity");
chainLengthSlider.SetPos(XMFLOAT2(x, y += step));
chainLengthSlider.SetSize(XMFLOAT2(siz, hei));
- chainLengthSlider.OnSlide([&](wiEventArgs args) {
- wiScene::GetScene().inverse_kinematics.GetComponent(entity)->chain_length = args.iValue;
+ chainLengthSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::scene::GetScene().inverse_kinematics.GetComponent(entity)->chain_length = args.iValue;
});
AddWidget(&chainLengthSlider);
@@ -67,8 +67,8 @@ void IKWindow::Create(EditorComponent* editor)
iterationCountSlider.SetTooltip("How many iterations to compute the inverse kinematics for. Higher values are slower but more accurate.");
iterationCountSlider.SetPos(XMFLOAT2(x, y += step));
iterationCountSlider.SetSize(XMFLOAT2(siz, hei));
- iterationCountSlider.OnSlide([&](wiEventArgs args) {
- wiScene::GetScene().inverse_kinematics.GetComponent(entity)->iteration_count = args.iValue;
+ iterationCountSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::scene::GetScene().inverse_kinematics.GetComponent(entity)->iteration_count = args.iValue;
});
AddWidget(&iterationCountSlider);
@@ -82,7 +82,7 @@ void IKWindow::SetEntity(Entity entity)
{
this->entity = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
const InverseKinematicsComponent* ik = scene.inverse_kinematics.GetComponent(entity);
if (ik != nullptr)
@@ -112,7 +112,7 @@ void IKWindow::SetEntity(Entity entity)
SetEnabled(false);
}
- const TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ const TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
createButton.SetEnabled(true);
@@ -120,16 +120,16 @@ void IKWindow::SetEntity(Entity entity)
if (ik == nullptr)
{
createButton.SetText("Create");
- createButton.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().inverse_kinematics.Create(entity).chain_length = 1;
+ createButton.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().inverse_kinematics.Create(entity).chain_length = 1;
SetEntity(entity);
});
}
else
{
createButton.SetText("Remove");
- createButton.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().inverse_kinematics.Remove_KeepSorted(entity);
+ createButton.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().inverse_kinematics.Remove_KeepSorted(entity);
SetEntity(entity);
});
}
diff --git a/Editor/IKWindow.h b/Editor/IKWindow.h
index 5ae99cef0..dfd71acc1 100644
--- a/Editor/IKWindow.h
+++ b/Editor/IKWindow.h
@@ -3,18 +3,18 @@
class EditorComponent;
-class IKWindow : public wiWindow
+class IKWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiButton createButton;
- wiComboBox targetCombo;
- wiCheckBox disabledCheckBox;
- wiSlider chainLengthSlider;
- wiSlider iterationCountSlider;
+ wi::gui::Button createButton;
+ wi::gui::ComboBox targetCombo;
+ wi::gui::CheckBox disabledCheckBox;
+ wi::gui::Slider chainLengthSlider;
+ wi::gui::Slider iterationCountSlider;
};
diff --git a/Editor/LayerWindow.cpp b/Editor/LayerWindow.cpp
index f25bf244e..462dfe185 100644
--- a/Editor/LayerWindow.cpp
+++ b/Editor/LayerWindow.cpp
@@ -2,13 +2,13 @@
#include "LayerWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void LayerWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Layer Window");
+ wi::gui::Window::Create("Layer Window");
SetSize(XMFLOAT2(410, 160));
float x = 30;
@@ -21,12 +21,12 @@ void LayerWindow::Create(EditorComponent* editor)
layers[i].Create("");
layers[i].SetText(std::to_string(i) + ": ");
layers[i].SetPos(XMFLOAT2(x + (i % 8) * 50, y + (i / 8 + 1) * step));
- layers[i].OnClick([=](wiEventArgs args) {
+ layers[i].OnClick([=](wi::gui::EventArgs args) {
- LayerComponent* layer = wiScene::GetScene().layers.GetComponent(entity);
+ LayerComponent* layer = wi::scene::GetScene().layers.GetComponent(entity);
if (layer == nullptr)
{
- layer = &wiScene::GetScene().layers.Create(entity);
+ layer = &wi::scene::GetScene().layers.Create(entity);
}
if (args.bValue)
@@ -46,11 +46,11 @@ void LayerWindow::Create(EditorComponent* editor)
enableAllButton.Create("Enable ALL");
enableAllButton.SetPos(XMFLOAT2(x, y));
- enableAllButton.OnClick([this](wiEventArgs args) {
- LayerComponent* layer = wiScene::GetScene().layers.GetComponent(entity);
+ enableAllButton.OnClick([this](wi::gui::EventArgs args) {
+ LayerComponent* layer = wi::scene::GetScene().layers.GetComponent(entity);
if (layer == nullptr)
{
- layer = &wiScene::GetScene().layers.Create(entity);
+ layer = &wi::scene::GetScene().layers.Create(entity);
}
if (layer == nullptr)
return;
@@ -60,11 +60,11 @@ void LayerWindow::Create(EditorComponent* editor)
enableNoneButton.Create("Enable NONE");
enableNoneButton.SetPos(XMFLOAT2(x + 120, y));
- enableNoneButton.OnClick([this](wiEventArgs args) {
- LayerComponent* layer = wiScene::GetScene().layers.GetComponent(entity);
+ enableNoneButton.OnClick([this](wi::gui::EventArgs args) {
+ LayerComponent* layer = wi::scene::GetScene().layers.GetComponent(entity);
if (layer == nullptr)
{
- layer = &wiScene::GetScene().layers.Create(entity);
+ layer = &wi::scene::GetScene().layers.Create(entity);
}
if (layer == nullptr)
return;
@@ -86,7 +86,7 @@ void LayerWindow::SetEntity(Entity entity)
{
SetEnabled(true);
- LayerComponent* layer = wiScene::GetScene().layers.GetComponent(entity);
+ LayerComponent* layer = wi::scene::GetScene().layers.GetComponent(entity);
if (layer == nullptr)
{
for (uint32_t i = 0; i < 32; ++i)
@@ -101,13 +101,13 @@ void LayerWindow::SetEntity(Entity entity)
layers[i].SetCheck(layer->GetLayerMask() & 1 << i);
}
- HierarchyComponent* hier = wiScene::GetScene().hierarchy.GetComponent(entity);
+ HierarchyComponent* hier = wi::scene::GetScene().hierarchy.GetComponent(entity);
if (hier != nullptr)
{
hier->layerMask_bind = layer->layerMask;
}
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->SetDirty();
diff --git a/Editor/LayerWindow.h b/Editor/LayerWindow.h
index 97d009316..23ed7ce24 100644
--- a/Editor/LayerWindow.h
+++ b/Editor/LayerWindow.h
@@ -3,16 +3,16 @@
class EditorComponent;
-class LayerWindow : public wiWindow
+class LayerWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiCheckBox layers[32];
- wiButton enableAllButton;
- wiButton enableNoneButton;
+ wi::gui::CheckBox layers[32];
+ wi::gui::Button enableAllButton;
+ wi::gui::Button enableNoneButton;
};
diff --git a/Editor/LightWindow.cpp b/Editor/LightWindow.cpp
index cb49b053e..0995c8bc8 100644
--- a/Editor/LightWindow.cpp
+++ b/Editor/LightWindow.cpp
@@ -4,14 +4,14 @@
#include
-using namespace wiECS;
-using namespace wiGraphics;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::graphics;
+using namespace wi::scene;
void LightWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Light Window");
+ wi::gui::Window::Create("Light Window");
SetSize(XMFLOAT2(650, 500));
float x = 450;
@@ -22,8 +22,8 @@ void LightWindow::Create(EditorComponent* editor)
energySlider.Create(0.1f, 64, 0, 100000, "Energy: ");
energySlider.SetSize(XMFLOAT2(100, hei));
energySlider.SetPos(XMFLOAT2(x, y += step));
- energySlider.OnSlide([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ energySlider.OnSlide([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->energy = args.fValue;
@@ -36,8 +36,8 @@ void LightWindow::Create(EditorComponent* editor)
rangeSlider.Create(1, 1000, 0, 100000, "Range: ");
rangeSlider.SetSize(XMFLOAT2(100, hei));
rangeSlider.SetPos(XMFLOAT2(x, y += step));
- rangeSlider.OnSlide([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ rangeSlider.OnSlide([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->range_local = args.fValue;
@@ -50,8 +50,8 @@ void LightWindow::Create(EditorComponent* editor)
//radiusSlider.Create(0.01f, 10, 0, 100000, "Radius: ");
//radiusSlider.SetSize(XMFLOAT2(100, hei));
//radiusSlider.SetPos(XMFLOAT2(x, y += step));
- //radiusSlider.OnSlide([&](wiEventArgs args) {
- // LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ //radiusSlider.OnSlide([&](wi::gui::EventArgs args) {
+ // LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
// if (light != nullptr)
// {
// light->radius = args.fValue;
@@ -64,8 +64,8 @@ void LightWindow::Create(EditorComponent* editor)
//widthSlider.Create(1, 10, 0, 100000, "Width: ");
//widthSlider.SetSize(XMFLOAT2(100, hei));
//widthSlider.SetPos(XMFLOAT2(x, y += step));
- //widthSlider.OnSlide([&](wiEventArgs args) {
- // LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ //widthSlider.OnSlide([&](wi::gui::EventArgs args) {
+ // LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
// if (light != nullptr)
// {
// light->width = args.fValue;
@@ -78,8 +78,8 @@ void LightWindow::Create(EditorComponent* editor)
//heightSlider.Create(1, 10, 0, 100000, "Height: ");
//heightSlider.SetSize(XMFLOAT2(100, hei));
//heightSlider.SetPos(XMFLOAT2(x, y += step));
- //heightSlider.OnSlide([&](wiEventArgs args) {
- // LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ //heightSlider.OnSlide([&](wi::gui::EventArgs args) {
+ // LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
// if (light != nullptr)
// {
// light->height = args.fValue;
@@ -92,8 +92,8 @@ void LightWindow::Create(EditorComponent* editor)
fovSlider.Create(0.1f, XM_PI - 0.01f, 0, 100000, "FOV: ");
fovSlider.SetSize(XMFLOAT2(100, hei));
fovSlider.SetPos(XMFLOAT2(x, y += step));
- fovSlider.OnSlide([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ fovSlider.OnSlide([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->fov = args.fValue;
@@ -106,8 +106,8 @@ void LightWindow::Create(EditorComponent* editor)
shadowCheckBox.Create("Shadow: ");
shadowCheckBox.SetSize(XMFLOAT2(hei, hei));
shadowCheckBox.SetPos(XMFLOAT2(x, y += step));
- shadowCheckBox.OnClick([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ shadowCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->SetCastShadow(args.bValue);
@@ -120,8 +120,8 @@ void LightWindow::Create(EditorComponent* editor)
volumetricsCheckBox.Create("Volumetric: ");
volumetricsCheckBox.SetSize(XMFLOAT2(hei, hei));
volumetricsCheckBox.SetPos(XMFLOAT2(x, y += step));
- volumetricsCheckBox.OnClick([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ volumetricsCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->SetVolumetricsEnabled(args.bValue);
@@ -134,8 +134,8 @@ void LightWindow::Create(EditorComponent* editor)
haloCheckBox.Create("Visualizer: ");
haloCheckBox.SetSize(XMFLOAT2(hei, hei));
haloCheckBox.SetPos(XMFLOAT2(x, y += step));
- haloCheckBox.OnClick([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ haloCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->SetVisualizerEnabled(args.bValue);
@@ -148,8 +148,8 @@ void LightWindow::Create(EditorComponent* editor)
staticCheckBox.Create("Static: ");
staticCheckBox.SetSize(XMFLOAT2(hei, hei));
staticCheckBox.SetPos(XMFLOAT2(x, y += step));
- staticCheckBox.OnClick([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ staticCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->SetStatic(args.bValue);
@@ -162,9 +162,9 @@ void LightWindow::Create(EditorComponent* editor)
addLightButton.Create("Add Light");
addLightButton.SetPos(XMFLOAT2(x, y += step));
addLightButton.SetSize(XMFLOAT2(150, hei));
- addLightButton.OnClick([=](wiEventArgs args) {
- Entity entity = wiScene::GetScene().Entity_CreateLight("editorLight", XMFLOAT3(0, 3, 0), XMFLOAT3(1, 1, 1), 2, 60);
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ addLightButton.OnClick([=](wi::gui::EventArgs args) {
+ Entity entity = wi::scene::GetScene().Entity_CreateLight("editorLight", XMFLOAT3(0, 3, 0), XMFLOAT3(1, 1, 1), 2, 60);
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->type = (LightComponent::LightType)typeSelectorComboBox.GetSelected();
@@ -186,8 +186,8 @@ void LightWindow::Create(EditorComponent* editor)
colorPicker.SetPos(XMFLOAT2(10, 30));
colorPicker.SetVisible(true);
colorPicker.SetEnabled(false);
- colorPicker.OnColorChanged([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ colorPicker.OnColorChanged([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
light->color = args.color.toFloat3();
@@ -198,8 +198,8 @@ void LightWindow::Create(EditorComponent* editor)
typeSelectorComboBox.Create("Type: ");
typeSelectorComboBox.SetSize(XMFLOAT2(150, hei));
typeSelectorComboBox.SetPos(XMFLOAT2(x, y += step));
- typeSelectorComboBox.OnSelect([&](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ typeSelectorComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr && args.iValue >= 0)
{
light->SetType((LightComponent::LightType)args.iValue);
@@ -236,8 +236,8 @@ void LightWindow::Create(EditorComponent* editor)
lensflare_Button[i].SetTooltip("Load a lensflare texture to this slot");
lensflare_Button[i].SetPos(XMFLOAT2(x, y += step));
lensflare_Button[i].SetSize(XMFLOAT2(260, hei));
- lensflare_Button[i].OnClick([=](wiEventArgs args) {
- LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ lensflare_Button[i].OnClick([=](wi::gui::EventArgs args) {
+ LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light == nullptr)
return;
@@ -247,23 +247,23 @@ void LightWindow::Create(EditorComponent* editor)
light->lensFlareNames.resize(i + 1);
}
- if (light->lensFlareRimTextures[i] != nullptr)
+ if (light->lensFlareRimTextures[i].IsValid())
{
light->lensFlareNames[i] = "";
- light->lensFlareRimTextures[i] = nullptr;
+ light->lensFlareRimTextures[i] = {};
lensflare_Button[i].SetText("");
}
else
{
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Texture";
- params.extensions = wiResourceManager::GetSupportedImageExtensions();
- wiHelper::FileDialog(params, [this, light, i](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
- light->lensFlareRimTextures[i] = wiResourceManager::Load(fileName, wiResourceManager::IMPORT_RETAIN_FILEDATA);
+ params.extensions = wi::resourcemanager::GetSupportedImageExtensions();
+ wi::helper::FileDialog(params, [this, light, i](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ light->lensFlareRimTextures[i] = wi::resourcemanager::Load(fileName, wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA);
light->lensFlareNames[i] = fileName;
- lensflare_Button[i].SetText(wiHelper::GetFileNameFromPath(fileName));
+ lensflare_Button[i].SetText(wi::helper::GetFileNameFromPath(fileName));
});
});
}
@@ -282,7 +282,7 @@ void LightWindow::SetEntity(Entity entity)
{
this->entity = entity;
- const LightComponent* light = wiScene::GetScene().lights.GetComponent(entity);
+ const LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity);
if (light != nullptr)
{
@@ -302,16 +302,16 @@ void LightWindow::SetEntity(Entity entity)
staticCheckBox.SetEnabled(true);
staticCheckBox.SetCheck(light->IsStatic());
colorPicker.SetEnabled(true);
- colorPicker.SetPickColor(wiColor::fromFloat3(light->color));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(light->color));
typeSelectorComboBox.SetSelected((int)light->GetType());
SetLightType(light->GetType());
for (size_t i = 0; i < arraysize(lensflare_Button); ++i)
{
- if (light->lensFlareRimTextures.size() > i && light->lensFlareRimTextures[i] && !light->lensFlareNames[i].empty())
+ if (light->lensFlareRimTextures.size() > i && light->lensFlareRimTextures[i].IsValid() && !light->lensFlareNames[i].empty())
{
- lensflare_Button[i].SetText(wiHelper::GetFileNameFromPath(light->lensFlareNames[i]));
+ lensflare_Button[i].SetText(wi::helper::GetFileNameFromPath(light->lensFlareNames[i]));
}
else
{
diff --git a/Editor/LightWindow.h b/Editor/LightWindow.h
index a0d1e2b8b..f3b4b612f 100644
--- a/Editor/LightWindow.h
+++ b/Editor/LightWindow.h
@@ -3,31 +3,31 @@
class EditorComponent;
-class LightWindow : public wiWindow
+class LightWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- void SetLightType(wiScene::LightComponent::LightType type);
+ void SetLightType(wi::scene::LightComponent::LightType type);
- wiSlider energySlider;
- wiSlider rangeSlider;
- wiSlider radiusSlider;
- wiSlider widthSlider;
- wiSlider heightSlider;
- wiSlider fovSlider;
- wiCheckBox shadowCheckBox;
- wiCheckBox haloCheckBox;
- wiCheckBox volumetricsCheckBox;
- wiCheckBox staticCheckBox;
- wiButton addLightButton;
- wiColorPicker colorPicker;
- wiComboBox typeSelectorComboBox;
+ wi::gui::Slider energySlider;
+ wi::gui::Slider rangeSlider;
+ wi::gui::Slider radiusSlider;
+ wi::gui::Slider widthSlider;
+ wi::gui::Slider heightSlider;
+ wi::gui::Slider fovSlider;
+ wi::gui::CheckBox shadowCheckBox;
+ wi::gui::CheckBox haloCheckBox;
+ wi::gui::CheckBox volumetricsCheckBox;
+ wi::gui::CheckBox staticCheckBox;
+ wi::gui::Button addLightButton;
+ wi::gui::ColorPicker colorPicker;
+ wi::gui::ComboBox typeSelectorComboBox;
- wiLabel lensflare_Label;
- wiButton lensflare_Button[7];
+ wi::gui::Label lensflare_Label;
+ wi::gui::Button lensflare_Button[7];
};
diff --git a/Editor/MaterialWindow.cpp b/Editor/MaterialWindow.cpp
index 8491ea309..17f5d9063 100644
--- a/Editor/MaterialWindow.cpp
+++ b/Editor/MaterialWindow.cpp
@@ -2,13 +2,13 @@
#include "MaterialWindow.h"
#include "Editor.h"
-using namespace wiGraphics;
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::graphics;
+using namespace wi::ecs;
+using namespace wi::scene;
void MaterialWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Material Window");
+ wi::gui::Window::Create("Material Window");
SetSize(XMFLOAT2(720, 620));
float x = 670, y = 0;
@@ -19,8 +19,8 @@ void MaterialWindow::Create(EditorComponent* editor)
shadowReceiveCheckBox.SetTooltip("Receives shadow or not?");
shadowReceiveCheckBox.SetPos(XMFLOAT2(540, y += step));
shadowReceiveCheckBox.SetSize(XMFLOAT2(hei, hei));
- shadowReceiveCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ shadowReceiveCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetReceiveShadow(args.bValue);
});
@@ -30,8 +30,8 @@ void MaterialWindow::Create(EditorComponent* editor)
shadowCasterCheckBox.SetTooltip("The subset will contribute to the scene shadows if enabled.");
shadowCasterCheckBox.SetPos(XMFLOAT2(670, y));
shadowCasterCheckBox.SetSize(XMFLOAT2(hei, hei));
- shadowCasterCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ shadowCasterCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetCastShadow(args.bValue);
});
@@ -41,8 +41,8 @@ void MaterialWindow::Create(EditorComponent* editor)
useVertexColorsCheckBox.SetTooltip("Enable if you want to render the mesh with vertex colors (must have appropriate vertex buffer)");
useVertexColorsCheckBox.SetPos(XMFLOAT2(670, y += step));
useVertexColorsCheckBox.SetSize(XMFLOAT2(hei, hei));
- useVertexColorsCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ useVertexColorsCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetUseVertexColors(args.bValue);
});
@@ -52,8 +52,8 @@ void MaterialWindow::Create(EditorComponent* editor)
specularGlossinessCheckBox.SetTooltip("If enabled, surface map will be viewed like it contains specular color (RGB) and smoothness (A)");
specularGlossinessCheckBox.SetPos(XMFLOAT2(670, y += step));
specularGlossinessCheckBox.SetSize(XMFLOAT2(hei, hei));
- specularGlossinessCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ specularGlossinessCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetUseSpecularGlossinessWorkflow(args.bValue);
SetEntity(entity);
@@ -64,8 +64,8 @@ void MaterialWindow::Create(EditorComponent* editor)
occlusionPrimaryCheckBox.SetTooltip("If enabled, surface map's RED channel will be used as occlusion map");
occlusionPrimaryCheckBox.SetPos(XMFLOAT2(670, y += step));
occlusionPrimaryCheckBox.SetSize(XMFLOAT2(hei, hei));
- occlusionPrimaryCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ occlusionPrimaryCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetOcclusionEnabled_Primary(args.bValue);
});
@@ -75,8 +75,8 @@ void MaterialWindow::Create(EditorComponent* editor)
occlusionSecondaryCheckBox.SetTooltip("If enabled, occlusion map's RED channel will be used as occlusion map");
occlusionSecondaryCheckBox.SetPos(XMFLOAT2(670, y += step));
occlusionSecondaryCheckBox.SetSize(XMFLOAT2(hei, hei));
- occlusionSecondaryCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ occlusionSecondaryCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetOcclusionEnabled_Secondary(args.bValue);
});
@@ -86,8 +86,8 @@ void MaterialWindow::Create(EditorComponent* editor)
windCheckBox.SetTooltip("If enabled, vertex wind weights will affect how much wind offset affects the subset.");
windCheckBox.SetPos(XMFLOAT2(670, y += step));
windCheckBox.SetSize(XMFLOAT2(hei, hei));
- windCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ windCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetUseWind(args.bValue);
});
@@ -97,8 +97,8 @@ void MaterialWindow::Create(EditorComponent* editor)
doubleSidedCheckBox.SetTooltip("Decide whether to render both sides of the material (It's also possible to set this behaviour per mesh).");
doubleSidedCheckBox.SetPos(XMFLOAT2(540, y));
doubleSidedCheckBox.SetSize(XMFLOAT2(hei, hei));
- doubleSidedCheckBox.OnClick([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ doubleSidedCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetDoubleSided(args.bValue);
});
@@ -111,11 +111,11 @@ void MaterialWindow::Create(EditorComponent* editor)
shaderTypeComboBox.Create("Shader: ");
- shaderTypeComboBox.SetTooltip("Select a shader for this material. \nCustom shaders (*) will also show up here (see wiRenderer:RegisterCustomShader() for more info.)\nNote that custom shaders (*) can't select between blend modes, as they are created with an explicit blend mode.");
+ shaderTypeComboBox.SetTooltip("Select a shader for this material. \nCustom shaders (*) will also show up here (see wi::renderer:RegisterCustomShader() for more info.)\nNote that custom shaders (*) can't select between blend modes, as they are created with an explicit blend mode.");
shaderTypeComboBox.SetPos(XMFLOAT2(x, y += step));
shaderTypeComboBox.SetSize(XMFLOAT2(wid, hei));
- shaderTypeComboBox.OnSelect([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ shaderTypeComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
if (args.iValue >= MaterialComponent::SHADERTYPE_COUNT)
@@ -141,7 +141,7 @@ void MaterialWindow::Create(EditorComponent* editor)
shaderTypeComboBox.AddItem("Water", MaterialComponent::SHADERTYPE_WATER);
shaderTypeComboBox.AddItem("Cartoon", MaterialComponent::SHADERTYPE_CARTOON);
shaderTypeComboBox.AddItem("Unlit", MaterialComponent::SHADERTYPE_UNLIT);
- for (auto& x : wiRenderer::GetCustomShaders())
+ for (auto& x : wi::renderer::GetCustomShaders())
{
shaderTypeComboBox.AddItem("*" + x.name);
}
@@ -152,11 +152,11 @@ void MaterialWindow::Create(EditorComponent* editor)
blendModeComboBox.Create("Blend mode: ");
blendModeComboBox.SetPos(XMFLOAT2(x, y += step));
blendModeComboBox.SetSize(XMFLOAT2(wid, hei));
- blendModeComboBox.OnSelect([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ blendModeComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr && args.iValue >= 0)
{
- material->userBlendMode = (BLENDMODE)args.iValue;
+ material->userBlendMode = (wi::enums::BLENDMODE)args.iValue;
}
});
blendModeComboBox.AddItem("Opaque");
@@ -172,8 +172,8 @@ void MaterialWindow::Create(EditorComponent* editor)
shadingRateComboBox.SetTooltip("Select shading rate for this material. \nSelecting larger shading rate will decrease rendering quality of this material, \nbut increases performance.\nRequires hardware support for variable shading rate");
shadingRateComboBox.SetPos(XMFLOAT2(x, y += step));
shadingRateComboBox.SetSize(XMFLOAT2(wid, hei));
- shadingRateComboBox.OnSelect([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ shadingRateComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->shadingRate = (ShadingRate)args.iValue;
@@ -200,8 +200,8 @@ void MaterialWindow::Create(EditorComponent* editor)
normalMapSlider.SetTooltip("How much the normal map should distort the face normals (bumpiness).");
normalMapSlider.SetSize(XMFLOAT2(wid, hei));
normalMapSlider.SetPos(XMFLOAT2(x, y += step));
- normalMapSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ normalMapSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetNormalMapStrength(args.fValue);
});
@@ -211,8 +211,8 @@ void MaterialWindow::Create(EditorComponent* editor)
roughnessSlider.SetTooltip("Adjust the surface roughness. Rough surfaces are less shiny, more matte.");
roughnessSlider.SetSize(XMFLOAT2(wid, hei));
roughnessSlider.SetPos(XMFLOAT2(x, y += step));
- roughnessSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ roughnessSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetRoughness(args.fValue);
});
@@ -222,8 +222,8 @@ void MaterialWindow::Create(EditorComponent* editor)
reflectanceSlider.SetTooltip("Adjust the surface [non-metal] reflectivity (also called specularFactor).\nNote: this is not available in specular-glossiness workflow");
reflectanceSlider.SetSize(XMFLOAT2(wid, hei));
reflectanceSlider.SetPos(XMFLOAT2(x, y += step));
- reflectanceSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ reflectanceSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetReflectance(args.fValue);
});
@@ -233,8 +233,8 @@ void MaterialWindow::Create(EditorComponent* editor)
metalnessSlider.SetTooltip("The more metal-like the surface is, the more the its color will contribute to the reflection color.\nNote: this is not available in specular-glossiness workflow");
metalnessSlider.SetSize(XMFLOAT2(wid, hei));
metalnessSlider.SetPos(XMFLOAT2(x, y += step));
- metalnessSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ metalnessSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetMetalness(args.fValue);
});
@@ -244,8 +244,8 @@ void MaterialWindow::Create(EditorComponent* editor)
alphaRefSlider.SetTooltip("Adjust the alpha cutoff threshold. Alpha cutout can affect performance");
alphaRefSlider.SetSize(XMFLOAT2(wid, hei));
alphaRefSlider.SetPos(XMFLOAT2(x, y += step));
- alphaRefSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ alphaRefSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetAlphaRef(args.fValue);
});
@@ -255,8 +255,8 @@ void MaterialWindow::Create(EditorComponent* editor)
emissiveSlider.SetTooltip("Adjust the light emission of the surface. The color of the light emitted is that of the color of the material.");
emissiveSlider.SetSize(XMFLOAT2(wid, hei));
emissiveSlider.SetPos(XMFLOAT2(x, y += step));
- emissiveSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ emissiveSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetEmissiveStrength(args.fValue);
});
@@ -266,8 +266,8 @@ void MaterialWindow::Create(EditorComponent* editor)
transmissionSlider.SetTooltip("Adjust the transmissiveness. More transmissiveness means more diffuse light is transmitted instead of absorbed.");
transmissionSlider.SetSize(XMFLOAT2(wid, hei));
transmissionSlider.SetPos(XMFLOAT2(x, y += step));
- transmissionSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ transmissionSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetTransmissionAmount(args.fValue);
});
@@ -277,8 +277,8 @@ void MaterialWindow::Create(EditorComponent* editor)
refractionSlider.SetTooltip("Adjust the refraction amount for transmissive materials.");
refractionSlider.SetSize(XMFLOAT2(wid, hei));
refractionSlider.SetPos(XMFLOAT2(x, y += step));
- refractionSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ refractionSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetRefractionAmount(args.fValue);
});
@@ -288,8 +288,8 @@ void MaterialWindow::Create(EditorComponent* editor)
pomSlider.SetTooltip("Adjust how much the bump map should modulate the surface parallax effect. \nOnly works with PBR + Parallax shader.");
pomSlider.SetSize(XMFLOAT2(wid, hei));
pomSlider.SetPos(XMFLOAT2(x, y += step));
- pomSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ pomSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetParallaxOcclusionMapping(args.fValue);
});
@@ -299,8 +299,8 @@ void MaterialWindow::Create(EditorComponent* editor)
displacementMappingSlider.SetTooltip("Adjust how much the bump map should modulate the geometry when using tessellation.");
displacementMappingSlider.SetSize(XMFLOAT2(wid, hei));
displacementMappingSlider.SetPos(XMFLOAT2(x, y += step));
- displacementMappingSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ displacementMappingSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetDisplacementMapping(args.fValue);
});
@@ -310,8 +310,8 @@ void MaterialWindow::Create(EditorComponent* editor)
subsurfaceScatteringSlider.SetTooltip("Subsurface scattering amount. \nYou can also adjust the subsurface color by selecting it in the color picker");
subsurfaceScatteringSlider.SetSize(XMFLOAT2(wid, hei));
subsurfaceScatteringSlider.SetPos(XMFLOAT2(x, y += step));
- subsurfaceScatteringSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ subsurfaceScatteringSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetSubsurfaceScatteringAmount(args.fValue);
});
@@ -321,8 +321,8 @@ void MaterialWindow::Create(EditorComponent* editor)
texAnimFrameRateSlider.SetTooltip("Adjust the texture animation frame rate (frames per second). Any value above 0 will make the material dynamic.");
texAnimFrameRateSlider.SetSize(XMFLOAT2(wid, hei));
texAnimFrameRateSlider.SetPos(XMFLOAT2(x, y += step));
- texAnimFrameRateSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ texAnimFrameRateSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->texAnimFrameRate = args.fValue;
@@ -334,8 +334,8 @@ void MaterialWindow::Create(EditorComponent* editor)
texAnimDirectionSliderU.SetTooltip("Adjust the texture animation speed along the U direction in texture space.");
texAnimDirectionSliderU.SetSize(XMFLOAT2(wid, hei));
texAnimDirectionSliderU.SetPos(XMFLOAT2(x, y += step));
- texAnimDirectionSliderU.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ texAnimDirectionSliderU.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->texAnimDirection.x = args.fValue;
@@ -347,8 +347,8 @@ void MaterialWindow::Create(EditorComponent* editor)
texAnimDirectionSliderV.SetTooltip("Adjust the texture animation speed along the V direction in texture space.");
texAnimDirectionSliderV.SetSize(XMFLOAT2(wid, hei));
texAnimDirectionSliderV.SetPos(XMFLOAT2(x, y += step));
- texAnimDirectionSliderV.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ texAnimDirectionSliderV.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->texAnimDirection.y = args.fValue;
@@ -360,8 +360,8 @@ void MaterialWindow::Create(EditorComponent* editor)
texMulSliderX.SetTooltip("Adjust the texture mapping size.");
texMulSliderX.SetSize(XMFLOAT2(wid, hei));
texMulSliderX.SetPos(XMFLOAT2(x, y += step));
- texMulSliderX.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ texMulSliderX.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->SetDirty();
@@ -374,8 +374,8 @@ void MaterialWindow::Create(EditorComponent* editor)
texMulSliderY.SetTooltip("Adjust the texture mapping size.");
texMulSliderY.SetSize(XMFLOAT2(wid, hei));
texMulSliderY.SetPos(XMFLOAT2(x, y += step));
- texMulSliderY.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ texMulSliderY.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->SetDirty();
@@ -389,8 +389,8 @@ void MaterialWindow::Create(EditorComponent* editor)
sheenRoughnessSlider.SetTooltip("This affects roughness of sheen layer for cloth shading.");
sheenRoughnessSlider.SetSize(XMFLOAT2(wid, hei));
sheenRoughnessSlider.SetPos(XMFLOAT2(x, y += step));
- sheenRoughnessSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ sheenRoughnessSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->SetSheenRoughness(args.fValue);
@@ -402,8 +402,8 @@ void MaterialWindow::Create(EditorComponent* editor)
clearcoatSlider.SetTooltip("This affects clearcoat layer blending.");
clearcoatSlider.SetSize(XMFLOAT2(wid, hei));
clearcoatSlider.SetPos(XMFLOAT2(x, y += step));
- clearcoatSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ clearcoatSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->SetClearcoatFactor(args.fValue);
@@ -415,8 +415,8 @@ void MaterialWindow::Create(EditorComponent* editor)
clearcoatRoughnessSlider.SetTooltip("This affects roughness of clear coat layer.");
clearcoatRoughnessSlider.SetSize(XMFLOAT2(wid, hei));
clearcoatRoughnessSlider.SetPos(XMFLOAT2(x, y += step));
- clearcoatRoughnessSlider.OnSlide([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ clearcoatRoughnessSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
material->SetClearcoatRoughness(args.fValue);
@@ -435,8 +435,8 @@ void MaterialWindow::Create(EditorComponent* editor)
materialNameField.SetTooltip("Set a name for the material...");
materialNameField.SetPos(XMFLOAT2(10, y += step));
materialNameField.SetSize(XMFLOAT2(300, hei));
- materialNameField.OnInputAccepted([=](wiEventArgs args) {
- NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
+ materialNameField.OnInputAccepted([=](wi::gui::EventArgs args) {
+ NameComponent* name = wi::scene::GetScene().names.GetComponent(entity);
if (name != nullptr)
{
*name = args.sValue;
@@ -449,8 +449,8 @@ void MaterialWindow::Create(EditorComponent* editor)
newMaterialButton.Create("New Material");
newMaterialButton.SetPos(XMFLOAT2(10 + 5 + 300, y));
newMaterialButton.SetSize(XMFLOAT2(100, hei));
- newMaterialButton.OnClick([=](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ newMaterialButton.OnClick([=](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
Entity entity = scene.Entity_CreateMaterial("editorMaterial");
editor->ClearSelected();
editor->AddSelected(entity);
@@ -474,8 +474,8 @@ void MaterialWindow::Create(EditorComponent* editor)
colorPicker.SetPos(XMFLOAT2(10, y += step));
colorPicker.SetVisible(true);
colorPicker.SetEnabled(true);
- colorPicker.OnColorChanged([&](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ colorPicker.OnColorChanged([&](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
switch (colorComboBox.GetSelected())
@@ -559,7 +559,7 @@ void MaterialWindow::Create(EditorComponent* editor)
break;
}
}
- textureSlotComboBox.OnSelect([this](wiEventArgs args)
+ textureSlotComboBox.OnSelect([this](wi::gui::EventArgs args)
{
switch (args.iValue)
@@ -607,7 +607,7 @@ void MaterialWindow::Create(EditorComponent* editor)
break;
}
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material == nullptr)
return;
textureSlotButton.SetImage(material->textures[args.iValue].resource);
@@ -620,36 +620,36 @@ void MaterialWindow::Create(EditorComponent* editor)
textureSlotButton.Create("");
textureSlotButton.SetSize(XMFLOAT2(180, 180));
textureSlotButton.SetPos(XMFLOAT2(textureSlotComboBox.GetPosition().x + textureSlotComboBox.GetScale().x - textureSlotButton.GetScale().x, y += step));
- textureSlotButton.sprites[wiWidget::IDLE].params.color = wiColor::White();
- textureSlotButton.sprites[wiWidget::FOCUS].params.color = wiColor::Gray();
- textureSlotButton.sprites[wiWidget::ACTIVE].params.color = wiColor::White();
- textureSlotButton.sprites[wiWidget::DEACTIVATING].params.color = wiColor::Gray();
- textureSlotButton.OnClick([this](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ textureSlotButton.sprites[wi::gui::IDLE].params.color = wi::Color::White();
+ textureSlotButton.sprites[wi::gui::FOCUS].params.color = wi::Color::Gray();
+ textureSlotButton.sprites[wi::gui::ACTIVE].params.color = wi::Color::White();
+ textureSlotButton.sprites[wi::gui::DEACTIVATING].params.color = wi::Color::Gray();
+ textureSlotButton.OnClick([this](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material == nullptr)
return;
int slot = textureSlotComboBox.GetSelected();
- if (material->textures[slot].resource != nullptr)
+ if (material->textures[slot].resource.IsValid())
{
- material->textures[slot].resource = nullptr;
+ material->textures[slot].resource = {};
material->textures[slot].name = "";
material->SetDirty();
textureSlotLabel.SetText("");
}
else
{
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Texture";
- params.extensions = wiResourceManager::GetSupportedImageExtensions();
- wiHelper::FileDialog(params, [this, material, slot](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
- material->textures[slot].resource = wiResourceManager::Load(fileName, wiResourceManager::IMPORT_RETAIN_FILEDATA);
+ params.extensions = wi::resourcemanager::GetSupportedImageExtensions();
+ wi::helper::FileDialog(params, [this, material, slot](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ material->textures[slot].resource = wi::resourcemanager::Load(fileName, wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA);
material->textures[slot].name = fileName;
material->SetDirty();
- textureSlotLabel.SetText(wiHelper::GetFileNameFromPath(fileName));
+ textureSlotLabel.SetText(wi::helper::GetFileNameFromPath(fileName));
});
});
}
@@ -668,8 +668,8 @@ void MaterialWindow::Create(EditorComponent* editor)
textureSlotUvsetField.SetTooltip("uv set number");
textureSlotUvsetField.SetPos(XMFLOAT2(x + textureSlotLabel.GetScale().x + 2, y));
textureSlotUvsetField.SetSize(XMFLOAT2(hei, hei));
- textureSlotUvsetField.OnInputAccepted([this](wiEventArgs args) {
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
+ textureSlotUvsetField.OnInputAccepted([this](wi::gui::EventArgs args) {
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
{
int slot = textureSlotComboBox.GetSelected();
@@ -691,7 +691,7 @@ void MaterialWindow::SetEntity(Entity entity)
{
this->entity = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
MaterialComponent* material = scene.materials.GetComponent(entity);
if (material != nullptr)
@@ -743,19 +743,19 @@ void MaterialWindow::SetEntity(Entity entity)
{
default:
case 0:
- colorPicker.SetPickColor(wiColor::fromFloat4(material->baseColor));
+ colorPicker.SetPickColor(wi::Color::fromFloat4(material->baseColor));
break;
case 1:
- colorPicker.SetPickColor(wiColor::fromFloat4(material->specularColor));
+ colorPicker.SetPickColor(wi::Color::fromFloat4(material->specularColor));
break;
case 2:
- colorPicker.SetPickColor(wiColor::fromFloat3(XMFLOAT3(material->emissiveColor.x, material->emissiveColor.y, material->emissiveColor.z)));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(XMFLOAT3(material->emissiveColor.x, material->emissiveColor.y, material->emissiveColor.z)));
break;
case 3:
- colorPicker.SetPickColor(wiColor::fromFloat3(XMFLOAT3(material->subsurfaceScattering.x, material->subsurfaceScattering.y, material->subsurfaceScattering.z)));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(XMFLOAT3(material->subsurfaceScattering.x, material->subsurfaceScattering.y, material->subsurfaceScattering.z)));
break;
case 4:
- colorPicker.SetPickColor(wiColor::fromFloat3(XMFLOAT3(material->sheenColor.x, material->sheenColor.y, material->sheenColor.z)));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(XMFLOAT3(material->sheenColor.x, material->sheenColor.y, material->sheenColor.z)));
break;
}
@@ -798,7 +798,7 @@ void MaterialWindow::SetEntity(Entity entity)
clearcoatSlider.SetValue(material->clearcoat);
clearcoatRoughnessSlider.SetValue(material->clearcoatRoughness);
- shadingRateComboBox.SetEnabled(wiGraphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::VARIABLE_RATE_SHADING));
+ shadingRateComboBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::VARIABLE_RATE_SHADING));
if (material->IsUsingSpecularGlossinessWorkflow())
{
@@ -808,7 +808,7 @@ void MaterialWindow::SetEntity(Entity entity)
int slot = textureSlotComboBox.GetSelected();
textureSlotButton.SetImage(material->textures[slot].resource);
- textureSlotLabel.SetText(wiHelper::GetFileNameFromPath(material->textures[slot].name));
+ textureSlotLabel.SetText(wi::helper::GetFileNameFromPath(material->textures[slot].name));
textureSlotUvsetField.SetText(std::to_string(material->textures[slot].uvset));
}
else
@@ -818,7 +818,7 @@ void MaterialWindow::SetEntity(Entity entity)
colorComboBox.SetEnabled(false);
colorPicker.SetEnabled(false);
- textureSlotButton.SetImage(nullptr);
+ textureSlotButton.SetImage(wi::Resource());
textureSlotLabel.SetText("");
textureSlotUvsetField.SetText("");
}
diff --git a/Editor/MaterialWindow.h b/Editor/MaterialWindow.h
index aa7d0ad77..34dc1fcb3 100644
--- a/Editor/MaterialWindow.h
+++ b/Editor/MaterialWindow.h
@@ -3,53 +3,53 @@
class EditorComponent;
-class MaterialWindow : public wiWindow
+class MaterialWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiTextInputField materialNameField;
- wiButton newMaterialButton;
- wiCheckBox shadowReceiveCheckBox;
- wiCheckBox shadowCasterCheckBox;
- wiCheckBox useVertexColorsCheckBox;
- wiCheckBox specularGlossinessCheckBox;
- wiCheckBox occlusionPrimaryCheckBox;
- wiCheckBox occlusionSecondaryCheckBox;
- wiCheckBox windCheckBox;
- wiCheckBox doubleSidedCheckBox;
- wiSlider normalMapSlider;
- wiSlider roughnessSlider;
- wiSlider reflectanceSlider;
- wiSlider metalnessSlider;
- wiSlider emissiveSlider;
- wiSlider transmissionSlider;
- wiSlider refractionSlider;
- wiSlider pomSlider;
- wiSlider displacementMappingSlider;
- wiSlider subsurfaceScatteringSlider;
- wiSlider texAnimFrameRateSlider;
- wiSlider texAnimDirectionSliderU;
- wiSlider texAnimDirectionSliderV;
- wiSlider texMulSliderX;
- wiSlider texMulSliderY;
- wiSlider alphaRefSlider;
- wiComboBox shaderTypeComboBox;
- wiComboBox blendModeComboBox;
- wiComboBox shadingRateComboBox;
- wiSlider sheenRoughnessSlider;
- wiSlider clearcoatSlider;
- wiSlider clearcoatRoughnessSlider;
+ wi::gui::TextInputField materialNameField;
+ wi::gui::Button newMaterialButton;
+ wi::gui::CheckBox shadowReceiveCheckBox;
+ wi::gui::CheckBox shadowCasterCheckBox;
+ wi::gui::CheckBox useVertexColorsCheckBox;
+ wi::gui::CheckBox specularGlossinessCheckBox;
+ wi::gui::CheckBox occlusionPrimaryCheckBox;
+ wi::gui::CheckBox occlusionSecondaryCheckBox;
+ wi::gui::CheckBox windCheckBox;
+ wi::gui::CheckBox doubleSidedCheckBox;
+ wi::gui::Slider normalMapSlider;
+ wi::gui::Slider roughnessSlider;
+ wi::gui::Slider reflectanceSlider;
+ wi::gui::Slider metalnessSlider;
+ wi::gui::Slider emissiveSlider;
+ wi::gui::Slider transmissionSlider;
+ wi::gui::Slider refractionSlider;
+ wi::gui::Slider pomSlider;
+ wi::gui::Slider displacementMappingSlider;
+ wi::gui::Slider subsurfaceScatteringSlider;
+ wi::gui::Slider texAnimFrameRateSlider;
+ wi::gui::Slider texAnimDirectionSliderU;
+ wi::gui::Slider texAnimDirectionSliderV;
+ wi::gui::Slider texMulSliderX;
+ wi::gui::Slider texMulSliderY;
+ wi::gui::Slider alphaRefSlider;
+ wi::gui::ComboBox shaderTypeComboBox;
+ wi::gui::ComboBox blendModeComboBox;
+ wi::gui::ComboBox shadingRateComboBox;
+ wi::gui::Slider sheenRoughnessSlider;
+ wi::gui::Slider clearcoatSlider;
+ wi::gui::Slider clearcoatRoughnessSlider;
- wiComboBox colorComboBox;
- wiColorPicker colorPicker;
+ wi::gui::ComboBox colorComboBox;
+ wi::gui::ColorPicker colorPicker;
- wiComboBox textureSlotComboBox;
- wiButton textureSlotButton;
- wiLabel textureSlotLabel;
- wiTextInputField textureSlotUvsetField;
+ wi::gui::ComboBox textureSlotComboBox;
+ wi::gui::Button textureSlotButton;
+ wi::gui::Label textureSlotLabel;
+ wi::gui::TextInputField textureSlotUvsetField;
};
diff --git a/Editor/MeshWindow.cpp b/Editor/MeshWindow.cpp
index 38c48d97d..444ddbabe 100644
--- a/Editor/MeshWindow.cpp
+++ b/Editor/MeshWindow.cpp
@@ -8,15 +8,15 @@
#include
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
-struct TerraGen : public wiWindow
+struct TerraGen : public wi::gui::Window
{
- wiSlider dimXSlider;
- wiSlider dimYSlider;
- wiSlider dimZSlider;
- wiButton heightmapButton;
+ wi::gui::Slider dimXSlider;
+ wi::gui::Slider dimYSlider;
+ wi::gui::Slider dimZSlider;
+ wi::gui::Button heightmapButton;
// heightmap texture:
unsigned char* rgb = nullptr;
@@ -25,7 +25,7 @@ struct TerraGen : public wiWindow
TerraGen()
{
- wiWindow::Create("TerraGen");
+ wi::gui::Window::Create("TerraGen");
SetSize(XMFLOAT2(260, 130));
float xx = 20;
@@ -76,7 +76,7 @@ struct TerraGen : public wiWindow
void MeshWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Mesh Window");
+ wi::gui::Window::Create("Mesh Window");
SetSize(XMFLOAT2(580, 580));
float x = 150;
@@ -87,7 +87,7 @@ void MeshWindow::Create(EditorComponent* editor)
meshInfoLabel.Create("Mesh Info");
meshInfoLabel.SetPos(XMFLOAT2(x - 50, y += step));
meshInfoLabel.SetSize(XMFLOAT2(450, 190));
- meshInfoLabel.SetColor(wiColor::Transparent());
+ meshInfoLabel.SetColor(wi::Color::Transparent());
AddWidget(&meshInfoLabel);
// Left side:
@@ -97,8 +97,8 @@ void MeshWindow::Create(EditorComponent* editor)
subsetComboBox.SetSize(XMFLOAT2(40, hei));
subsetComboBox.SetPos(XMFLOAT2(x, y += step));
subsetComboBox.SetEnabled(false);
- subsetComboBox.OnSelect([=](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ subsetComboBox.OnSelect([=](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
MeshComponent* mesh = scene.meshes.GetComponent(entity);
if (mesh != nullptr)
{
@@ -116,20 +116,20 @@ void MeshWindow::Create(EditorComponent* editor)
terrainCheckBox.SetTooltip("If enabled, the mesh will use multiple materials and blend between them based on vertex colors.");
terrainCheckBox.SetSize(XMFLOAT2(hei, hei));
terrainCheckBox.SetPos(XMFLOAT2(x, y += step));
- terrainCheckBox.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ terrainCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->SetTerrain(args.bValue);
if (args.bValue && mesh->vertex_colors.empty())
{
mesh->vertex_colors.resize(mesh->vertex_positions.size());
- std::fill(mesh->vertex_colors.begin(), mesh->vertex_colors.end(), wiColor::Red().rgba); // fill red (meaning only blend base material)
+ std::fill(mesh->vertex_colors.begin(), mesh->vertex_colors.end(), wi::Color::Red().rgba); // fill red (meaning only blend base material)
mesh->CreateRenderData();
for (auto& subset : mesh->subsets)
{
- MaterialComponent* material = wiScene::GetScene().materials.GetComponent(subset.materialID);
+ MaterialComponent* material = wi::scene::GetScene().materials.GetComponent(subset.materialID);
if (material != nullptr)
{
material->SetUseVertexColors(true);
@@ -145,8 +145,8 @@ void MeshWindow::Create(EditorComponent* editor)
doubleSidedCheckBox.SetTooltip("If enabled, the inside of the mesh will be visible.");
doubleSidedCheckBox.SetSize(XMFLOAT2(hei, hei));
doubleSidedCheckBox.SetPos(XMFLOAT2(x, y += step));
- doubleSidedCheckBox.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ doubleSidedCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->SetDoubleSided(args.bValue);
@@ -158,9 +158,9 @@ void MeshWindow::Create(EditorComponent* editor)
softbodyCheckBox.SetTooltip("Enable soft body simulation. Tip: Use the Paint Tool to control vertex pinning.");
softbodyCheckBox.SetSize(XMFLOAT2(hei, hei));
softbodyCheckBox.SetPos(XMFLOAT2(x, y += step));
- softbodyCheckBox.OnClick([&](wiEventArgs args) {
+ softbodyCheckBox.OnClick([&](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
SoftBodyPhysicsComponent* physicscomponent = scene.softbodies.GetComponent(entity);
if (args.bValue)
@@ -188,8 +188,8 @@ void MeshWindow::Create(EditorComponent* editor)
massSlider.SetTooltip("Set the mass amount for the physics engine.");
massSlider.SetSize(XMFLOAT2(100, hei));
massSlider.SetPos(XMFLOAT2(x, y += step));
- massSlider.OnSlide([&](wiEventArgs args) {
- SoftBodyPhysicsComponent* physicscomponent = wiScene::GetScene().softbodies.GetComponent(entity);
+ massSlider.OnSlide([&](wi::gui::EventArgs args) {
+ SoftBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().softbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->mass = args.fValue;
@@ -201,8 +201,8 @@ void MeshWindow::Create(EditorComponent* editor)
frictionSlider.SetTooltip("Set the friction amount for the physics engine.");
frictionSlider.SetSize(XMFLOAT2(100, hei));
frictionSlider.SetPos(XMFLOAT2(x, y += step));
- frictionSlider.OnSlide([&](wiEventArgs args) {
- SoftBodyPhysicsComponent* physicscomponent = wiScene::GetScene().softbodies.GetComponent(entity);
+ frictionSlider.OnSlide([&](wi::gui::EventArgs args) {
+ SoftBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().softbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->friction = args.fValue;
@@ -214,8 +214,8 @@ void MeshWindow::Create(EditorComponent* editor)
restitutionSlider.SetTooltip("Set the restitution amount for the physics engine.");
restitutionSlider.SetSize(XMFLOAT2(100, hei));
restitutionSlider.SetPos(XMFLOAT2(x, y += step));
- restitutionSlider.OnSlide([&](wiEventArgs args) {
- SoftBodyPhysicsComponent* physicscomponent = wiScene::GetScene().softbodies.GetComponent(entity);
+ restitutionSlider.OnSlide([&](wi::gui::EventArgs args) {
+ SoftBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().softbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->restitution = args.fValue;
@@ -227,8 +227,8 @@ void MeshWindow::Create(EditorComponent* editor)
impostorCreateButton.SetTooltip("Create an impostor image of the mesh. The mesh will be replaced by this image when far away, to render faster.");
impostorCreateButton.SetSize(XMFLOAT2(240, hei));
impostorCreateButton.SetPos(XMFLOAT2(x - 50, y += step));
- impostorCreateButton.OnClick([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ impostorCreateButton.OnClick([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
ImpostorComponent* impostor = scene.impostors.GetComponent(entity);
if (impostor == nullptr)
{
@@ -247,8 +247,8 @@ void MeshWindow::Create(EditorComponent* editor)
impostorDistanceSlider.SetTooltip("Assign the distance where the mesh geometry should be switched to the impostor image.");
impostorDistanceSlider.SetSize(XMFLOAT2(100, hei));
impostorDistanceSlider.SetPos(XMFLOAT2(x, y += step));
- impostorDistanceSlider.OnSlide([&](wiEventArgs args) {
- ImpostorComponent* impostor = wiScene::GetScene().impostors.GetComponent(entity);
+ impostorDistanceSlider.OnSlide([&](wi::gui::EventArgs args) {
+ ImpostorComponent* impostor = wi::scene::GetScene().impostors.GetComponent(entity);
if (impostor != nullptr)
{
impostor->swapInDistance = args.fValue;
@@ -260,8 +260,8 @@ void MeshWindow::Create(EditorComponent* editor)
tessellationFactorSlider.SetTooltip("Set the dynamic tessellation amount. Tessellation should be enabled in the Renderer window and your GPU must support it!");
tessellationFactorSlider.SetSize(XMFLOAT2(100, hei));
tessellationFactorSlider.SetPos(XMFLOAT2(x, y += step));
- tessellationFactorSlider.OnSlide([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ tessellationFactorSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->tessellationFactor = args.fValue;
@@ -273,8 +273,8 @@ void MeshWindow::Create(EditorComponent* editor)
flipCullingButton.SetTooltip("Flip faces to reverse triangle culling order.");
flipCullingButton.SetSize(XMFLOAT2(240, hei));
flipCullingButton.SetPos(XMFLOAT2(x - 50, y += step));
- flipCullingButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ flipCullingButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->FlipCulling();
@@ -287,8 +287,8 @@ void MeshWindow::Create(EditorComponent* editor)
flipNormalsButton.SetTooltip("Flip surface normals.");
flipNormalsButton.SetSize(XMFLOAT2(240, hei));
flipNormalsButton.SetPos(XMFLOAT2(x - 50, y += step));
- flipNormalsButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ flipNormalsButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->FlipNormals();
@@ -301,8 +301,8 @@ void MeshWindow::Create(EditorComponent* editor)
computeNormalsSmoothButton.SetTooltip("Compute surface normals of the mesh. Resulting normals will be unique per vertex. This can reduce vertex count, but is slow.");
computeNormalsSmoothButton.SetSize(XMFLOAT2(240, hei));
computeNormalsSmoothButton.SetPos(XMFLOAT2(x - 50, y += step));
- computeNormalsSmoothButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ computeNormalsSmoothButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->ComputeNormals(MeshComponent::COMPUTE_NORMALS_SMOOTH);
@@ -315,8 +315,8 @@ void MeshWindow::Create(EditorComponent* editor)
computeNormalsHardButton.SetTooltip("Compute surface normals of the mesh. Resulting normals will be unique per face. This can increase vertex count.");
computeNormalsHardButton.SetSize(XMFLOAT2(240, hei));
computeNormalsHardButton.SetPos(XMFLOAT2(x - 50, y += step));
- computeNormalsHardButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ computeNormalsHardButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->ComputeNormals(MeshComponent::COMPUTE_NORMALS_HARD);
@@ -329,8 +329,8 @@ void MeshWindow::Create(EditorComponent* editor)
recenterButton.SetTooltip("Recenter mesh to AABB center.");
recenterButton.SetSize(XMFLOAT2(240, hei));
recenterButton.SetPos(XMFLOAT2(x - 50, y += step));
- recenterButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ recenterButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->Recenter();
@@ -343,8 +343,8 @@ void MeshWindow::Create(EditorComponent* editor)
recenterToBottomButton.SetTooltip("Recenter mesh to AABB bottom.");
recenterToBottomButton.SetSize(XMFLOAT2(240, hei));
recenterToBottomButton.SetPos(XMFLOAT2(x - 50, y += step));
- recenterToBottomButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ recenterToBottomButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
mesh->RecenterToBottom();
@@ -357,8 +357,8 @@ void MeshWindow::Create(EditorComponent* editor)
optimizeButton.SetTooltip("Run the meshoptimizer library.");
optimizeButton.SetSize(XMFLOAT2(240, hei));
optimizeButton.SetPos(XMFLOAT2(x - 50, y += step));
- optimizeButton.OnClick([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ optimizeButton.OnClick([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
// https://github.com/zeux/meshoptimizer#vertex-cache-optimization
@@ -387,8 +387,8 @@ void MeshWindow::Create(EditorComponent* editor)
subsetMaterialComboBox.SetSize(XMFLOAT2(200, hei));
subsetMaterialComboBox.SetPos(XMFLOAT2(x + 180, y += step));
subsetMaterialComboBox.SetEnabled(false);
- subsetMaterialComboBox.OnSelect([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ subsetMaterialComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
MeshComponent* mesh = scene.meshes.GetComponent(entity);
if (mesh != nullptr && subset >= 0 && subset < mesh->subsets.size())
{
@@ -411,8 +411,8 @@ void MeshWindow::Create(EditorComponent* editor)
terrainMat1Combo.SetSize(XMFLOAT2(200, hei));
terrainMat1Combo.SetPos(XMFLOAT2(x + 180, y += step));
terrainMat1Combo.SetEnabled(false);
- terrainMat1Combo.OnSelect([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ terrainMat1Combo.OnSelect([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
if (args.iValue == 0)
@@ -421,7 +421,7 @@ void MeshWindow::Create(EditorComponent* editor)
}
else
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
mesh->terrain_material1 = scene.materials.GetEntity(args.iValue - 1);
}
}
@@ -433,8 +433,8 @@ void MeshWindow::Create(EditorComponent* editor)
terrainMat2Combo.SetSize(XMFLOAT2(200, hei));
terrainMat2Combo.SetPos(XMFLOAT2(x + 180, y += step));
terrainMat2Combo.SetEnabled(false);
- terrainMat2Combo.OnSelect([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ terrainMat2Combo.OnSelect([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
if (args.iValue == 0)
@@ -443,7 +443,7 @@ void MeshWindow::Create(EditorComponent* editor)
}
else
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
mesh->terrain_material2 = scene.materials.GetEntity(args.iValue - 1);
}
}
@@ -455,8 +455,8 @@ void MeshWindow::Create(EditorComponent* editor)
terrainMat3Combo.SetSize(XMFLOAT2(200, hei));
terrainMat3Combo.SetPos(XMFLOAT2(x + 180, y += step));
terrainMat3Combo.SetEnabled(false);
- terrainMat3Combo.OnSelect([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ terrainMat3Combo.OnSelect([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr)
{
if (args.iValue == 0)
@@ -465,7 +465,7 @@ void MeshWindow::Create(EditorComponent* editor)
}
else
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
mesh->terrain_material3 = scene.materials.GetEntity(args.iValue - 1);
}
}
@@ -477,7 +477,7 @@ void MeshWindow::Create(EditorComponent* editor)
terrainGenButton.SetTooltip("Generate terrain meshes.");
terrainGenButton.SetSize(XMFLOAT2(200, hei));
terrainGenButton.SetPos(XMFLOAT2(x + 180, y += step));
- terrainGenButton.OnClick([=](wiEventArgs args) {
+ terrainGenButton.OnClick([=](wi::gui::EventArgs args) {
terragen.Cleanup();
terragen.SetVisible(true);
@@ -490,7 +490,7 @@ void MeshWindow::Create(EditorComponent* editor)
terrainGenButton.translation.y)
);
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
Entity entity = scene.Entity_CreateObject("editorTerrain");
ObjectComponent& object = *scene.objects.GetComponent(entity);
object.meshID = scene.Entity_CreateMesh("terrainMesh");
@@ -519,7 +519,7 @@ void MeshWindow::Create(EditorComponent* editor)
mesh->vertex_positions[index] = XMFLOAT3((float)i - (float)width * 0.5f, 0, (float)j - (float)height * 0.5f);
if (rgb != nullptr)
mesh->vertex_positions[index].y = ((float)rgb[index * channelCount] - 127.0f) * heightmap_scale;
- mesh->vertex_colors[index] = wiColor::Red().rgba;
+ mesh->vertex_colors[index] = wi::Color::Red().rgba;
XMFLOAT2 uv = XMFLOAT2((float)i / (float)width, (float)j / (float)height);
mesh->vertex_uvset_0[index] = uv;
mesh->vertex_uvset_1[index] = uv;
@@ -553,7 +553,7 @@ void MeshWindow::Create(EditorComponent* editor)
generate_mesh(128, 128);
editor->ClearSelected();
- wiScene::PickResult pick;
+ wi::scene::PickResult pick;
pick.entity = entity;
pick.subsetIndex = 0;
editor->AddSelected(pick);
@@ -563,28 +563,28 @@ void MeshWindow::Create(EditorComponent* editor)
- terragen.dimXSlider.OnSlide([=](wiEventArgs args) {
+ terragen.dimXSlider.OnSlide([=](wi::gui::EventArgs args) {
terragen.width = (int)terragen.dimXSlider.GetValue();
terragen.height = (int)terragen.dimZSlider.GetValue();
generate_mesh(terragen.width, terragen.height);
});
- terragen.dimZSlider.OnSlide([=](wiEventArgs args) {
+ terragen.dimZSlider.OnSlide([=](wi::gui::EventArgs args) {
terragen.width = (int)terragen.dimXSlider.GetValue();
terragen.height = (int)terragen.dimZSlider.GetValue();
generate_mesh(terragen.width, terragen.height);
});
- terragen.dimYSlider.OnSlide([=](wiEventArgs args) {
+ terragen.dimYSlider.OnSlide([=](wi::gui::EventArgs args) {
generate_mesh(terragen.width, terragen.height, terragen.rgb, terragen.channelCount, args.fValue);
});
- terragen.heightmapButton.OnClick([=](wiEventArgs args) {
+ terragen.heightmapButton.OnClick([=](wi::gui::EventArgs args) {
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Texture";
- params.extensions = wiResourceManager::GetSupportedImageExtensions();
- wiHelper::FileDialog(params, [=](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ params.extensions = wi::resourcemanager::GetSupportedImageExtensions();
+ wi::helper::FileDialog(params, [=](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
if (terragen.rgb != nullptr)
{
stbi_image_free(terragen.rgb);
@@ -606,8 +606,8 @@ void MeshWindow::Create(EditorComponent* editor)
morphTargetCombo.Create("Morph Target:");
morphTargetCombo.SetSize(XMFLOAT2(100, hei));
morphTargetCombo.SetPos(XMFLOAT2(x + 280, y += step));
- morphTargetCombo.OnSelect([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ morphTargetCombo.OnSelect([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr && args.iValue < (int)mesh->targets.size())
{
morphTargetSlider.SetValue(mesh->targets[args.iValue].weight);
@@ -620,8 +620,8 @@ void MeshWindow::Create(EditorComponent* editor)
morphTargetSlider.SetTooltip("Set the weight for morph target");
morphTargetSlider.SetSize(XMFLOAT2(100, hei));
morphTargetSlider.SetPos(XMFLOAT2(x + 280, y += step));
- morphTargetSlider.OnSlide([&](wiEventArgs args) {
- MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity);
+ morphTargetSlider.OnSlide([&](wi::gui::EventArgs args) {
+ MeshComponent* mesh = wi::scene::GetScene().meshes.GetComponent(entity);
if (mesh != nullptr && morphTargetCombo.GetSelected() < (int)mesh->targets.size())
{
mesh->targets[morphTargetCombo.GetSelected()].weight = args.fValue;
@@ -643,7 +643,7 @@ void MeshWindow::SetEntity(Entity entity, int subset)
this->entity = entity;
this->subset = subset;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
const MeshComponent* mesh = scene.meshes.GetComponent(entity);
@@ -735,7 +735,7 @@ void MeshWindow::SetEntity(Entity entity, int subset)
softbodyCheckBox.SetCheck(false);
- SoftBodyPhysicsComponent* physicscomponent = wiScene::GetScene().softbodies.GetComponent(entity);
+ SoftBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().softbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
softbodyCheckBox.SetCheck(true);
diff --git a/Editor/MeshWindow.h b/Editor/MeshWindow.h
index 0e9a58e23..4d2b52830 100644
--- a/Editor/MeshWindow.h
+++ b/Editor/MeshWindow.h
@@ -3,41 +3,41 @@
class EditorComponent;
-class MeshWindow : public wiWindow
+class MeshWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
+ wi::ecs::Entity entity;
int subset = -1;
- void SetEntity(wiECS::Entity entity, int subset);
+ void SetEntity(wi::ecs::Entity entity, int subset);
- wiLabel meshInfoLabel;
- wiComboBox subsetComboBox;
- wiComboBox subsetMaterialComboBox;
- wiCheckBox doubleSidedCheckBox;
- wiCheckBox softbodyCheckBox;
- wiSlider massSlider;
- wiSlider frictionSlider;
- wiSlider restitutionSlider;
- wiButton impostorCreateButton;
- wiSlider impostorDistanceSlider;
- wiSlider tessellationFactorSlider;
- wiButton flipCullingButton;
- wiButton flipNormalsButton;
- wiButton computeNormalsSmoothButton;
- wiButton computeNormalsHardButton;
- wiButton recenterButton;
- wiButton recenterToBottomButton;
- wiButton optimizeButton;
+ wi::gui::Label meshInfoLabel;
+ wi::gui::ComboBox subsetComboBox;
+ wi::gui::ComboBox subsetMaterialComboBox;
+ wi::gui::CheckBox doubleSidedCheckBox;
+ wi::gui::CheckBox softbodyCheckBox;
+ wi::gui::Slider massSlider;
+ wi::gui::Slider frictionSlider;
+ wi::gui::Slider restitutionSlider;
+ wi::gui::Button impostorCreateButton;
+ wi::gui::Slider impostorDistanceSlider;
+ wi::gui::Slider tessellationFactorSlider;
+ wi::gui::Button flipCullingButton;
+ wi::gui::Button flipNormalsButton;
+ wi::gui::Button computeNormalsSmoothButton;
+ wi::gui::Button computeNormalsHardButton;
+ wi::gui::Button recenterButton;
+ wi::gui::Button recenterToBottomButton;
+ wi::gui::Button optimizeButton;
- wiCheckBox terrainCheckBox;
- wiComboBox terrainMat1Combo;
- wiComboBox terrainMat2Combo;
- wiComboBox terrainMat3Combo;
- wiButton terrainGenButton;
+ wi::gui::CheckBox terrainCheckBox;
+ wi::gui::ComboBox terrainMat1Combo;
+ wi::gui::ComboBox terrainMat2Combo;
+ wi::gui::ComboBox terrainMat3Combo;
+ wi::gui::Button terrainGenButton;
- wiComboBox morphTargetCombo;
- wiSlider morphTargetSlider;
+ wi::gui::ComboBox morphTargetCombo;
+ wi::gui::Slider morphTargetSlider;
};
diff --git a/Editor/ModelImporter.h b/Editor/ModelImporter.h
index 8ebdba870..591f0e173 100644
--- a/Editor/ModelImporter.h
+++ b/Editor/ModelImporter.h
@@ -1,11 +1,11 @@
#pragma once
#include
-namespace wiScene
+namespace wi::scene
{
struct Scene;
}
-void ImportModel_OBJ(const std::string& fileName, wiScene::Scene& scene);
-void ImportModel_GLTF(const std::string& fileName, wiScene::Scene& scene);
+void ImportModel_OBJ(const std::string& fileName, wi::scene::Scene& scene);
+void ImportModel_GLTF(const std::string& fileName, wi::scene::Scene& scene);
diff --git a/Editor/ModelImporter_GLTF.cpp b/Editor/ModelImporter_GLTF.cpp
index 29f8fd9c3..a96d526b5 100644
--- a/Editor/ModelImporter_GLTF.cpp
+++ b/Editor/ModelImporter_GLTF.cpp
@@ -15,9 +15,9 @@
#define TINYGLTF_NO_STB_IMAGE_WRITE
#include "tiny_gltf.h"
-using namespace wiGraphics;
-using namespace wiScene;
-using namespace wiECS;
+using namespace wi::graphics;
+using namespace wi::scene;
+using namespace wi::ecs;
// Transform the data from glTF space to engine-space:
@@ -28,7 +28,7 @@ namespace tinygltf
{
bool FileExists(const std::string& abs_filename, void*) {
- return wiHelper::FileExists(abs_filename);
+ return wi::helper::FileExists(abs_filename);
}
std::string ExpandFilePath(const std::string& filepath, void*) {
@@ -81,12 +81,12 @@ namespace tinygltf
bool ReadWholeFile(wi::vector* out, std::string* err,
const std::string& filepath, void*) {
- return wiHelper::FileRead(filepath, *out);
+ return wi::helper::FileRead(filepath, *out);
}
bool WriteWholeFile(std::string* err, const std::string& filepath,
const std::vector& contents, void*) {
- return wiHelper::FileWrite(filepath, contents.data(), contents.size());
+ return wi::helper::FileWrite(filepath, contents.data(), contents.size());
}
bool LoadImageData(Image *image, const int image_idx, std::string *err,
@@ -101,28 +101,28 @@ namespace tinygltf
std::string ss;
do {
ss.clear();
- ss += "gltfimport_" + std::to_string(wiRandom::getRandom(std::numeric_limits::max())) + ".png";
- } while (wiResourceManager::Contains(ss)); // this is to avoid overwriting an existing imported image
+ ss += "gltfimport_" + std::to_string(wi::random::GetRandom(std::numeric_limits::max())) + ".png";
+ } while (wi::resourcemanager::Contains(ss)); // this is to avoid overwriting an existing imported image
image->uri = ss;
}
- auto resource = wiResourceManager::Load(
+ auto resource = wi::resourcemanager::Load(
image->uri,
- wiResourceManager::IMPORT_RETAIN_FILEDATA,
+ wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA,
(const uint8_t*)bytes,
(size_t)size
);
- if (resource == nullptr)
+ if (!resource.IsValid())
{
return false;
}
- image->width = resource->texture.desc.width;
- image->height = resource->texture.desc.height;
+ image->width = resource.GetTexture().desc.width;
+ image->height = resource.GetTexture().desc.height;
image->component = 4;
- wiResourceManager::ResourceSerializer* seri = (wiResourceManager::ResourceSerializer*)userdata;
+ wi::resourcemanager::ResourceSerializer* seri = (wi::resourcemanager::ResourceSerializer*)userdata;
seri->resources.push_back(resource);
return true;
@@ -190,7 +190,7 @@ void LoadNode(int nodeIndex, Entity parent, LoaderState& state)
node.name = "cam" + std::to_string(camID++);
}
- entity = scene.Entity_CreateCamera(node.name, wiScene::GetCamera().width, wiScene::GetCamera().height, 0.1f, 800);
+ entity = scene.Entity_CreateCamera(node.name, wi::scene::GetCamera().width, wi::scene::GetCamera().height, 0.1f, 800);
}
if (entity == INVALID_ENTITY)
@@ -254,9 +254,9 @@ void LoadNode(int nodeIndex, Entity parent, LoaderState& state)
void ImportModel_GLTF(const std::string& fileName, Scene& scene)
{
- std::string directory = wiHelper::GetDirectoryFromPath(fileName);
- std::string name = wiHelper::GetFileNameFromPath(fileName);
- std::string extension = wiHelper::toUpper(wiHelper::GetExtensionFromFileName(name));
+ std::string directory = wi::helper::GetDirectoryFromPath(fileName);
+ std::string name = wi::helper::GetFileNameFromPath(fileName);
+ std::string extension = wi::helper::toUpper(wi::helper::GetExtensionFromFileName(name));
tinygltf::TinyGLTF loader;
@@ -271,7 +271,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
callbacks.ExpandFilePath = tinygltf::ExpandFilePath;
loader.SetFsCallbacks(callbacks);
- wiResourceManager::ResourceSerializer seri; // keep this alive to not delete loaded images while importing gltf
+ wi::resourcemanager::ResourceSerializer seri; // keep this alive to not delete loaded images while importing gltf
loader.SetImageLoader(tinygltf::LoadImageData, &seri);
loader.SetImageWriter(tinygltf::WriteImageData, nullptr);
@@ -279,7 +279,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
state.scene = &scene;
wi::vector filedata;
- ret = wiHelper::FileRead(fileName, filedata);
+ ret = wi::helper::FileRead(fileName, filedata);
if (ret)
{
@@ -304,7 +304,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
}
if (!ret) {
- wiHelper::messageBox(err, "GLTF error!");
+ wi::helper::messageBox(err, "GLTF error!");
}
Entity rootEntity = CreateEntity();
@@ -349,7 +349,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::BASECOLORMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::BASECOLORMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::BASECOLORMAP].name = img.uri;
material.textures[MaterialComponent::BASECOLORMAP].uvset = baseColorTexture->second.TextureTexCoord();
}
@@ -362,7 +362,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::NORMALMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::NORMALMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::NORMALMAP].name = img.uri;
material.textures[MaterialComponent::NORMALMAP].uvset = normalTexture->second.TextureTexCoord();
}
@@ -375,7 +375,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SURFACEMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SURFACEMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SURFACEMAP].name = img.uri;
material.textures[MaterialComponent::SURFACEMAP].uvset = metallicRoughnessTexture->second.TextureTexCoord();
}
@@ -388,7 +388,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::EMISSIVEMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::EMISSIVEMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::EMISSIVEMAP].name = img.uri;
material.textures[MaterialComponent::EMISSIVEMAP].uvset = emissiveTexture->second.TextureTexCoord();
}
@@ -401,7 +401,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::OCCLUSIONMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::OCCLUSIONMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::OCCLUSIONMAP].name = img.uri;
material.textures[MaterialComponent::OCCLUSIONMAP].uvset = occlusionTexture->second.TextureTexCoord();
material.SetOcclusionEnabled_Secondary(true);
@@ -437,7 +437,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
{
if (alphaMode->second.string_value.compare("BLEND") == 0)
{
- material.userBlendMode = BLENDMODE_ALPHA;
+ material.userBlendMode = wi::enums::BLENDMODE_ALPHA;
}
}
@@ -469,7 +469,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::TRANSMISSIONMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::TRANSMISSIONMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::TRANSMISSIONMAP].name = img.uri;
material.textures[MaterialComponent::TRANSMISSIONMAP].uvset = (uint32_t)ext_transmission->second.Get("transmissionTexture").Get("texCoord").Get();
}
@@ -493,7 +493,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::BASECOLORMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::BASECOLORMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::BASECOLORMAP].name = img.uri;
material.textures[MaterialComponent::BASECOLORMAP].uvset = (uint32_t)specularGlossinessWorkflow->second.Get("diffuseTexture").Get("texCoord").Get();
}
@@ -507,7 +507,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SURFACEMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SURFACEMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SURFACEMAP].name = img.uri;
material.textures[MaterialComponent::SURFACEMAP].uvset = (uint32_t)specularGlossinessWorkflow->second.Get("specularGlossinessTexture").Get("texCoord").Get();
}
@@ -561,7 +561,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SHEENCOLORMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SHEENCOLORMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SHEENCOLORMAP].name = img.uri;
material.textures[MaterialComponent::SHEENCOLORMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
@@ -581,7 +581,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SHEENROUGHNESSMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SHEENROUGHNESSMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SHEENROUGHNESSMAP].name = img.uri;
material.textures[MaterialComponent::SHEENROUGHNESSMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
@@ -617,7 +617,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::CLEARCOATMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::CLEARCOATMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::CLEARCOATMAP].name = img.uri;
material.textures[MaterialComponent::CLEARCOATMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
@@ -637,7 +637,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::CLEARCOATROUGHNESSMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::CLEARCOATROUGHNESSMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::CLEARCOATROUGHNESSMAP].name = img.uri;
material.textures[MaterialComponent::CLEARCOATROUGHNESSMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
@@ -652,7 +652,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::CLEARCOATNORMALMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::CLEARCOATNORMALMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::CLEARCOATNORMALMAP].name = img.uri;
material.textures[MaterialComponent::CLEARCOATNORMALMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
@@ -686,7 +686,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
}
if (ext_specular->second.Has("specularTexture"))
{
- if (material.textures[MaterialComponent::SURFACEMAP].resource == nullptr)
+ if (!material.textures[MaterialComponent::SURFACEMAP].resource.IsValid())
{
auto& param = ext_specular->second.Get("specularTexture");
int index = param.Get("index").Get();
@@ -697,11 +697,11 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SURFACEMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SURFACEMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SURFACEMAP].name = img.uri;
material.textures[MaterialComponent::SURFACEMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
- else if (material.textures[MaterialComponent::SPECULARMAP].resource == nullptr)
+ else if (!material.textures[MaterialComponent::SPECULARMAP].resource.IsValid())
{
auto& param = ext_specular->second.Get("specularTexture");
int index = param.Get("index").Get();
@@ -712,13 +712,13 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SPECULARMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SPECULARMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SPECULARMAP].name = img.uri;
material.textures[MaterialComponent::SPECULARMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
else
{
- wiBackLog::post("[KHR_materials_specular warning] specularTexture must be either in surfaceMap.a or specularColorTexture.a! specularTexture discarded!", wiBackLog::LogLevel::Warning);
+ wi::backlog::post("[KHR_materials_specular warning] specularTexture must be either in surfaceMap.a or specularColorTexture.a! specularTexture discarded!", wi::backlog::LogLevel::Warning);
}
}
if (ext_specular->second.Has("specularColorTexture"))
@@ -732,7 +732,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
img_source = tex.extensions["KHR_texture_basisu"].Get("source").Get();
}
auto& img = state.gltfModel.images[img_source];
- material.textures[MaterialComponent::SPECULARMAP].resource = wiResourceManager::Load(img.uri);
+ material.textures[MaterialComponent::SPECULARMAP].resource = wi::resourcemanager::Load(img.uri);
material.textures[MaterialComponent::SPECULARMAP].name = img.uri;
material.textures[MaterialComponent::SPECULARMAP].uvset = (uint32_t)param.Get("texCoord").Get();
}
@@ -955,7 +955,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
for (size_t i = 0; i < vertexCount; ++i)
{
const XMFLOAT4& color = *(XMFLOAT4*)((size_t)data + i * stride);
- uint32_t rgba = wiMath::CompressColor(color);
+ uint32_t rgba = wi::math::CompressColor(color);
mesh.vertex_colors[vertexOffset + i] = rgba;
}
diff --git a/Editor/ModelImporter_OBJ.cpp b/Editor/ModelImporter_OBJ.cpp
index 24f9edd5b..209dc5f23 100644
--- a/Editor/ModelImporter_OBJ.cpp
+++ b/Editor/ModelImporter_OBJ.cpp
@@ -9,9 +9,9 @@
#include
#include
-using namespace wiGraphics;
-using namespace wiScene;
-using namespace wiECS;
+using namespace wi::graphics;
+using namespace wi::scene;
+using namespace wi::ecs;
struct membuf : std::streambuf
{
@@ -40,7 +40,7 @@ public:
}
wi::vector filedata;
- if (!wiHelper::FileRead(filepath, filedata))
+ if (!wi::helper::FileRead(filepath, filedata))
{
std::string ss;
ss += "WARN: Material file [ " + filepath + " ] not found.\n";
@@ -74,8 +74,8 @@ static const bool transform_to_LH = true;
void ImportModel_OBJ(const std::string& fileName, Scene& scene)
{
- std::string directory = wiHelper::GetDirectoryFromPath(fileName);
- std::string name = wiHelper::GetFileNameFromPath(fileName);
+ std::string directory = wi::helper::GetDirectoryFromPath(fileName);
+ std::string name = wi::helper::GetFileNameFromPath(fileName);
tinyobj::attrib_t obj_attrib;
wi::vector obj_shapes;
@@ -83,7 +83,7 @@ void ImportModel_OBJ(const std::string& fileName, Scene& scene)
std::string obj_errors;
wi::vector filedata;
- bool success = wiHelper::FileRead(fileName, filedata);
+ bool success = wi::helper::FileRead(fileName, filedata);
if (success)
{
@@ -99,7 +99,7 @@ void ImportModel_OBJ(const std::string& fileName, Scene& scene)
if (!obj_errors.empty())
{
- wiBackLog::post(obj_errors, wiBackLog::LogLevel::Error);
+ wi::backlog::post(obj_errors, wi::backlog::LogLevel::Error);
}
if (success)
@@ -232,10 +232,10 @@ void ImportModel_OBJ(const std::string& fileName, Scene& scene)
// eliminate duplicate vertices by means of hashing:
size_t vertexHash = 0;
- wiHelper::hash_combine(vertexHash, index.vertex_index);
- wiHelper::hash_combine(vertexHash, index.normal_index);
- wiHelper::hash_combine(vertexHash, index.texcoord_index);
- wiHelper::hash_combine(vertexHash, materialIndex);
+ wi::helper::hash_combine(vertexHash, index.vertex_index);
+ wi::helper::hash_combine(vertexHash, index.normal_index);
+ wi::helper::hash_combine(vertexHash, index.texcoord_index);
+ wi::helper::hash_combine(vertexHash, materialIndex);
if (uniqueVertices.count(vertexHash) == 0)
{
@@ -254,6 +254,6 @@ void ImportModel_OBJ(const std::string& fileName, Scene& scene)
}
else
{
- wiHelper::messageBox("OBJ import failed! Check backlog for errors!", "Error!");
+ wi::helper::messageBox("OBJ import failed! Check backlog for errors!", "Error!");
}
}
diff --git a/Editor/NameWindow.cpp b/Editor/NameWindow.cpp
index ed439b281..27e1105dd 100644
--- a/Editor/NameWindow.cpp
+++ b/Editor/NameWindow.cpp
@@ -2,13 +2,13 @@
#include "NameWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void NameWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Name Window");
+ wi::gui::Window::Create("Name Window");
SetSize(XMFLOAT2(360, 80));
float x = 60;
@@ -21,11 +21,11 @@ void NameWindow::Create(EditorComponent* editor)
nameInput.SetDescription("Name: ");
nameInput.SetPos(XMFLOAT2(x, y += step));
nameInput.SetSize(XMFLOAT2(siz, hei));
- nameInput.OnInputAccepted([=](wiEventArgs args) {
- NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
+ nameInput.OnInputAccepted([=](wi::gui::EventArgs args) {
+ NameComponent* name = wi::scene::GetScene().names.GetComponent(entity);
if (name == nullptr)
{
- name = &wiScene::GetScene().names.Create(entity);
+ name = &wi::scene::GetScene().names.Create(entity);
}
name->name = args.sValue;
@@ -47,7 +47,7 @@ void NameWindow::SetEntity(Entity entity)
{
SetEnabled(true);
- NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
+ NameComponent* name = wi::scene::GetScene().names.GetComponent(entity);
if (name != nullptr)
{
nameInput.SetValue(name->name);
diff --git a/Editor/NameWindow.h b/Editor/NameWindow.h
index 14e3ba035..2935dbeb0 100644
--- a/Editor/NameWindow.h
+++ b/Editor/NameWindow.h
@@ -3,14 +3,14 @@
class EditorComponent;
-class NameWindow : public wiWindow
+class NameWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiTextInputField nameInput;
+ wi::gui::TextInputField nameInput;
};
diff --git a/Editor/ObjectWindow.cpp b/Editor/ObjectWindow.cpp
index dabb1f8a2..145943f15 100644
--- a/Editor/ObjectWindow.cpp
+++ b/Editor/ObjectWindow.cpp
@@ -7,8 +7,8 @@
#include
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
static void SetPixel(uint8_t *dest, int destWidth, int x, int y, const uint8_t *color)
@@ -90,7 +90,7 @@ static Atlas_Dim GenerateMeshAtlas(MeshComponent& meshcomponent, uint32_t resolu
mesh.indexFormat = xatlas::IndexFormat::UInt32;
xatlas::AddMeshError::Enum error = xatlas::AddMesh(atlas, mesh);
if (error != xatlas::AddMeshError::Success) {
- wiHelper::messageBox(xatlas::StringForEnum(error), "Adding mesh to xatlas failed!");
+ wi::helper::messageBox(xatlas::StringForEnum(error), "Adding mesh to xatlas failed!");
return dim;
}
}
@@ -260,7 +260,7 @@ void ObjectWindow::Create(EditorComponent* editor)
{
this->editor = editor;
- wiWindow::Create("Object Window");
+ wi::gui::Window::Create("Object Window");
SetSize(XMFLOAT2(660, 500));
float x = 200;
@@ -279,8 +279,8 @@ void ObjectWindow::Create(EditorComponent* editor)
renderableCheckBox.SetSize(XMFLOAT2(hei, hei));
renderableCheckBox.SetPos(XMFLOAT2(x, y += step));
renderableCheckBox.SetCheck(true);
- renderableCheckBox.OnClick([&](wiEventArgs args) {
- ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
+ renderableCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ ObjectComponent* object = wi::scene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->SetRenderable(args.bValue);
@@ -293,8 +293,8 @@ void ObjectWindow::Create(EditorComponent* editor)
shadowCheckBox.SetSize(XMFLOAT2(hei, hei));
shadowCheckBox.SetPos(XMFLOAT2(x, y += step));
shadowCheckBox.SetCheck(true);
- shadowCheckBox.OnClick([&](wiEventArgs args) {
- ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
+ shadowCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ ObjectComponent* object = wi::scene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->SetCastShadow(args.bValue);
@@ -306,8 +306,8 @@ void ObjectWindow::Create(EditorComponent* editor)
ditherSlider.SetTooltip("Adjust transparency of the object. Opaque materials will use dithered transparency in this case!");
ditherSlider.SetSize(XMFLOAT2(100, hei));
ditherSlider.SetPos(XMFLOAT2(x, y += step));
- ditherSlider.OnSlide([&](wiEventArgs args) {
- ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
+ ditherSlider.OnSlide([&](wi::gui::EventArgs args) {
+ ObjectComponent* object = wi::scene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->color.w = 1 - args.fValue;
@@ -319,8 +319,8 @@ void ObjectWindow::Create(EditorComponent* editor)
cascadeMaskSlider.SetTooltip("How many shadow cascades to skip when rendering this object into shadow maps? (0: skip none, it will be in all cascades, 1: skip first (biggest cascade), ...etc...");
cascadeMaskSlider.SetSize(XMFLOAT2(100, hei));
cascadeMaskSlider.SetPos(XMFLOAT2(x, y += step));
- cascadeMaskSlider.OnSlide([&](wiEventArgs args) {
- ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
+ cascadeMaskSlider.OnSlide([&](wi::gui::EventArgs args) {
+ ObjectComponent* object = wi::scene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
object->cascadeMask = (uint32_t)args.iValue;
@@ -346,12 +346,12 @@ void ObjectWindow::Create(EditorComponent* editor)
collisionShapeComboBox.AddItem("Capsule");
collisionShapeComboBox.AddItem("Convex Hull");
collisionShapeComboBox.AddItem("Triangle Mesh");
- collisionShapeComboBox.OnSelect([&](wiEventArgs args)
+ collisionShapeComboBox.OnSelect([&](wi::gui::EventArgs args)
{
if (entity == INVALID_ENTITY)
return;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
RigidBodyPhysicsComponent* physicscomponent = scene.rigidbodies.GetComponent(entity);
if (args.iValue == 0)
@@ -451,8 +451,8 @@ void ObjectWindow::Create(EditorComponent* editor)
XSlider.Create(0, 10, 1, 100000, "X: ");
XSlider.SetSize(XMFLOAT2(100, hei));
XSlider.SetPos(XMFLOAT2(x, y += step));
- XSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ XSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
switch (physicscomponent->shape)
@@ -476,8 +476,8 @@ void ObjectWindow::Create(EditorComponent* editor)
YSlider.Create(0, 10, 1, 100000, "Y: ");
YSlider.SetSize(XMFLOAT2(100, hei));
YSlider.SetPos(XMFLOAT2(x, y += step));
- YSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ YSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
switch (physicscomponent->shape)
@@ -498,8 +498,8 @@ void ObjectWindow::Create(EditorComponent* editor)
ZSlider.Create(0, 10, 1, 100000, "Z: ");
ZSlider.SetSize(XMFLOAT2(100, hei));
ZSlider.SetPos(XMFLOAT2(x, y += step));
- ZSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ ZSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
switch (physicscomponent->shape)
@@ -518,8 +518,8 @@ void ObjectWindow::Create(EditorComponent* editor)
massSlider.SetTooltip("Set the mass amount for the physics engine.");
massSlider.SetSize(XMFLOAT2(100, hei));
massSlider.SetPos(XMFLOAT2(x, y += step));
- massSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ massSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->mass = args.fValue;
@@ -531,8 +531,8 @@ void ObjectWindow::Create(EditorComponent* editor)
frictionSlider.SetTooltip("Set the friction amount for the physics engine.");
frictionSlider.SetSize(XMFLOAT2(100, hei));
frictionSlider.SetPos(XMFLOAT2(x, y += step));
- frictionSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ frictionSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->friction = args.fValue;
@@ -544,8 +544,8 @@ void ObjectWindow::Create(EditorComponent* editor)
restitutionSlider.SetTooltip("Set the restitution amount for the physics engine.");
restitutionSlider.SetSize(XMFLOAT2(100, hei));
restitutionSlider.SetPos(XMFLOAT2(x, y += step));
- restitutionSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ restitutionSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->restitution = args.fValue;
@@ -557,8 +557,8 @@ void ObjectWindow::Create(EditorComponent* editor)
lineardampingSlider.SetTooltip("Set the linear damping amount for the physics engine.");
lineardampingSlider.SetSize(XMFLOAT2(100, hei));
lineardampingSlider.SetPos(XMFLOAT2(x, y += step));
- lineardampingSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ lineardampingSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->damping_linear = args.fValue;
@@ -570,8 +570,8 @@ void ObjectWindow::Create(EditorComponent* editor)
angulardampingSlider.SetTooltip("Set the mass amount for the physics engine.");
angulardampingSlider.SetSize(XMFLOAT2(100, hei));
angulardampingSlider.SetPos(XMFLOAT2(x, y += step));
- angulardampingSlider.OnSlide([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ angulardampingSlider.OnSlide([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->damping_angular = args.fValue;
@@ -584,8 +584,8 @@ void ObjectWindow::Create(EditorComponent* editor)
kinematicCheckBox.SetSize(XMFLOAT2(hei, hei));
kinematicCheckBox.SetPos(XMFLOAT2(x, y += step));
kinematicCheckBox.SetCheck(false);
- kinematicCheckBox.OnClick([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ kinematicCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->SetKinematic(args.bValue);
@@ -598,8 +598,8 @@ void ObjectWindow::Create(EditorComponent* editor)
disabledeactivationCheckBox.SetSize(XMFLOAT2(hei, hei));
disabledeactivationCheckBox.SetPos(XMFLOAT2(x, y += step));
disabledeactivationCheckBox.SetCheck(false);
- disabledeactivationCheckBox.OnClick([&](wiEventArgs args) {
- RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity);
+ disabledeactivationCheckBox.OnClick([&](wi::gui::EventArgs args) {
+ RigidBodyPhysicsComponent* physicscomponent = wi::scene::GetScene().rigidbodies.GetComponent(entity);
if (physicscomponent != nullptr)
{
physicscomponent->SetDisableDeactivation(args.bValue);
@@ -615,10 +615,10 @@ void ObjectWindow::Create(EditorComponent* editor)
lightmapResolutionSlider.SetTooltip("Set the approximate resolution for this object's lightmap. This will be packed into the larger global lightmap later.");
lightmapResolutionSlider.SetSize(XMFLOAT2(100, hei));
lightmapResolutionSlider.SetPos(XMFLOAT2(x, y += step));
- lightmapResolutionSlider.OnSlide([&](wiEventArgs args) {
+ lightmapResolutionSlider.OnSlide([&](wi::gui::EventArgs args) {
// unfortunately, we must be pow2 with full float lightmap format, otherwise it could be unlimited (but accumulation blending would suffer then)
// or at least for me, downloading the lightmap was glitching out when non-pow 2 and RGBA32_FLOAT format
- lightmapResolutionSlider.SetValue(float(wiMath::GetNextPowerOfTwo(uint32_t(args.fValue))));
+ lightmapResolutionSlider.SetValue(float(wi::math::GetNextPowerOfTwo(uint32_t(args.fValue))));
});
AddWidget(&lightmapResolutionSlider);
@@ -636,9 +636,9 @@ void ObjectWindow::Create(EditorComponent* editor)
generateLightmapButton.SetTooltip("Render the lightmap for only this object. It will automatically combined with the global lightmap.");
generateLightmapButton.SetPos(XMFLOAT2(x, y));
generateLightmapButton.SetSize(XMFLOAT2(140, hei));
- generateLightmapButton.OnClick([&](wiEventArgs args) {
+ generateLightmapButton.OnClick([&](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
enum UV_GEN_TYPE
{
@@ -668,7 +668,7 @@ void ObjectWindow::Create(EditorComponent* editor)
}
- wiJobSystem::context ctx;
+ wi::jobsystem::context ctx;
for (auto& it : gen_meshes)
{
@@ -685,12 +685,12 @@ void ObjectWindow::Create(EditorComponent* editor)
}
else if (gen_type == UV_GEN_GENERATE_ATLAS)
{
- wiJobSystem::Execute(ctx, [&](wiJobArgs args) {
+ wi::jobsystem::Execute(ctx, [&](wi::jobsystem::JobArgs args) {
it.second = GenerateMeshAtlas(mesh, (uint32_t)lightmapResolutionSlider.GetValue());
});
}
}
- wiJobSystem::Wait(ctx);
+ wi::jobsystem::Wait(ctx);
for (auto& x : gen_objects)
{
@@ -717,9 +717,9 @@ void ObjectWindow::Create(EditorComponent* editor)
stopLightmapGenButton.SetTooltip("Stop the lightmap rendering and save the lightmap.");
stopLightmapGenButton.SetPos(XMFLOAT2(x, y += step));
stopLightmapGenButton.SetSize(XMFLOAT2(140, hei));
- stopLightmapGenButton.OnClick([&](wiEventArgs args) {
+ stopLightmapGenButton.OnClick([&](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
for (auto& x : this->editor->translator.selected)
{
@@ -738,9 +738,9 @@ void ObjectWindow::Create(EditorComponent* editor)
clearLightmapButton.SetTooltip("Clear the lightmap from this object.");
clearLightmapButton.SetPos(XMFLOAT2(x, y += step));
clearLightmapButton.SetSize(XMFLOAT2(140, hei));
- clearLightmapButton.OnClick([&](wiEventArgs args) {
+ clearLightmapButton.OnClick([&](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
for (auto& x : this->editor->translator.selected)
{
@@ -768,8 +768,8 @@ void ObjectWindow::Create(EditorComponent* editor)
colorPicker.SetPos(XMFLOAT2(350, y += step));
colorPicker.SetVisible(true);
colorPicker.SetEnabled(true);
- colorPicker.OnColorChanged([&](wiEventArgs args) {
- ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity);
+ colorPicker.OnColorChanged([&](wi::gui::EventArgs args) {
+ ObjectComponent* object = wi::scene::GetScene().objects.GetComponent(entity);
if (object != nullptr)
{
switch (colorComboBox.GetSelected())
@@ -804,7 +804,7 @@ void ObjectWindow::SetEntity(Entity entity)
this->entity = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
const ObjectComponent* object = scene.objects.GetComponent(entity);
@@ -824,10 +824,10 @@ void ObjectWindow::SetEntity(Entity entity)
{
default:
case 0:
- colorPicker.SetPickColor(wiColor::fromFloat4(object->color));
+ colorPicker.SetPickColor(wi::Color::fromFloat4(object->color));
break;
case 1:
- colorPicker.SetPickColor(wiColor::fromFloat4(object->emissiveColor));
+ colorPicker.SetPickColor(wi::Color::fromFloat4(object->emissiveColor));
break;
}
diff --git a/Editor/ObjectWindow.h b/Editor/ObjectWindow.h
index 68ff19d73..206798e74 100644
--- a/Editor/ObjectWindow.h
+++ b/Editor/ObjectWindow.h
@@ -3,41 +3,41 @@
class EditorComponent;
-class ObjectWindow : public wiWindow
+class ObjectWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
EditorComponent* editor;
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiLabel nameLabel;
- wiCheckBox renderableCheckBox;
- wiCheckBox shadowCheckBox;
- wiSlider ditherSlider;
- wiSlider cascadeMaskSlider;
+ wi::gui::Label nameLabel;
+ wi::gui::CheckBox renderableCheckBox;
+ wi::gui::CheckBox shadowCheckBox;
+ wi::gui::Slider ditherSlider;
+ wi::gui::Slider cascadeMaskSlider;
- wiComboBox colorComboBox;
- wiColorPicker colorPicker;
+ wi::gui::ComboBox colorComboBox;
+ wi::gui::ColorPicker colorPicker;
- wiLabel physicsLabel;
- wiComboBox collisionShapeComboBox;
- wiSlider XSlider;
- wiSlider YSlider;
- wiSlider ZSlider;
- wiSlider massSlider;
- wiSlider frictionSlider;
- wiSlider restitutionSlider;
- wiSlider lineardampingSlider;
- wiSlider angulardampingSlider;
- wiCheckBox disabledeactivationCheckBox;
- wiCheckBox kinematicCheckBox;
+ wi::gui::Label physicsLabel;
+ wi::gui::ComboBox collisionShapeComboBox;
+ wi::gui::Slider XSlider;
+ wi::gui::Slider YSlider;
+ wi::gui::Slider ZSlider;
+ wi::gui::Slider massSlider;
+ wi::gui::Slider frictionSlider;
+ wi::gui::Slider restitutionSlider;
+ wi::gui::Slider lineardampingSlider;
+ wi::gui::Slider angulardampingSlider;
+ wi::gui::CheckBox disabledeactivationCheckBox;
+ wi::gui::CheckBox kinematicCheckBox;
- wiSlider lightmapResolutionSlider;
- wiComboBox lightmapSourceUVSetComboBox;
- wiButton generateLightmapButton;
- wiButton stopLightmapGenButton;
- wiButton clearLightmapButton;
+ wi::gui::Slider lightmapResolutionSlider;
+ wi::gui::ComboBox lightmapSourceUVSetComboBox;
+ wi::gui::Button generateLightmapButton;
+ wi::gui::Button stopLightmapGenButton;
+ wi::gui::Button clearLightmapButton;
};
diff --git a/Editor/PaintToolWindow.cpp b/Editor/PaintToolWindow.cpp
index 00ca9ccf3..a3250052c 100644
--- a/Editor/PaintToolWindow.cpp
+++ b/Editor/PaintToolWindow.cpp
@@ -5,15 +5,15 @@
#include
-using namespace wiECS;
-using namespace wiScene;
-using namespace wiGraphics;
+using namespace wi::ecs;
+using namespace wi::scene;
+using namespace wi::graphics;
void PaintToolWindow::Create(EditorComponent* editor)
{
this->editor = editor;
- wiWindow::Create("Paint Tool Window");
+ wi::gui::Window::Create("Paint Tool Window");
SetSize(XMFLOAT2(400, 600));
float x = 100;
@@ -37,7 +37,7 @@ void PaintToolWindow::Create(EditorComponent* editor)
modeComboBox.AddItem("Hairparticle - Length (Alpha)");
modeComboBox.AddItem("Wind weight (Alpha)");
modeComboBox.SetSelected(0);
- modeComboBox.OnSelect([&](wiEventArgs args) {
+ modeComboBox.OnSelect([&](wi::gui::EventArgs args) {
textureSlotComboBox.SetEnabled(false);
saveTextureButton.SetEnabled(false);
switch (args.iValue)
@@ -86,7 +86,7 @@ void PaintToolWindow::Create(EditorComponent* editor)
infoLabel.Create("Paint Tool is disabled.");
infoLabel.SetSize(XMFLOAT2(400 - 20, 100));
infoLabel.SetPos(XMFLOAT2(10, y));
- infoLabel.SetColor(wiColor::Transparent());
+ infoLabel.SetColor(wi::Color::Transparent());
AddWidget(&infoLabel);
y += infoLabel.GetScale().y - step + 5;
@@ -159,9 +159,9 @@ void PaintToolWindow::Create(EditorComponent* editor)
saveTextureButton.SetSize(XMFLOAT2(200, hei));
saveTextureButton.SetPos(XMFLOAT2(x, y += step));
saveTextureButton.SetEnabled(false);
- saveTextureButton.OnClick([this] (wiEventArgs args) {
+ saveTextureButton.OnClick([this] (wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
ObjectComponent* object = scene.objects.GetComponent(entity);
if (object == nullptr || object->meshID == INVALID_ENTITY)
return;
@@ -179,13 +179,13 @@ void PaintToolWindow::Create(EditorComponent* editor)
uint64_t sel = textureSlotComboBox.GetItemUserData(textureSlotComboBox.GetSelected());
wi::vector texturefiledata;
- if (wiHelper::saveTextureToMemoryFile(editTexture, "PNG", texturefiledata))
+ if (wi::helper::saveTextureToMemoryFile(editTexture, "PNG", texturefiledata))
{
- material->textures[sel].resource->filedata = texturefiledata;
+ material->textures[sel].resource.SetFileData(texturefiledata);
}
else
{
- wiHelper::messageBox("Saving texture failed! :(");
+ wi::helper::messageBox("Saving texture failed! :(");
}
});
@@ -208,21 +208,21 @@ void PaintToolWindow::Update(float dt)
XMFLOAT2 posNew;
posNew.x = editor->GetLogicalWidth() * 0.5f;
posNew.y = editor->GetLogicalHeight() * 0.5f;
- if (editor->GetGUI().HasFocus() || wiBackLog::isActive() || entity == INVALID_ENTITY)
+ if (editor->GetGUI().HasFocus() || wi::backlog::isActive() || entity == INVALID_ENTITY)
{
pos = posNew;
return;
}
- const bool pointer_down = wiInput::Down(wiInput::MOUSE_BUTTON_LEFT);
+ const bool pointer_down = wi::input::Down(wi::input::MOUSE_BUTTON_LEFT);
if (!pointer_down)
{
stroke_dist = FLT_MAX;
}
- auto pointer = wiInput::GetPointer();
+ auto pointer = wi::input::GetPointer();
posNew = XMFLOAT2(pointer.x, pointer.y);
- stroke_dist += wiMath::Distance(pos, posNew);
+ stroke_dist += wi::math::Distance(pos, posNew);
const float pressure = pressureCheckBox.GetCheck() ? pointer.w : 1.0f;
const float spacing = spacingSlider.GetValue();
@@ -241,13 +241,13 @@ void PaintToolWindow::Update(float dt)
const float pressure_radius = radius * pressure;
const float amount = amountSlider.GetValue();
const float falloff = falloffSlider.GetValue();
- const wiColor color = colorPicker.GetPickColor();
+ const wi::Color color = colorPicker.GetPickColor();
const XMFLOAT4 color_float = color.toFloat4();
const bool backfaces = backfaceCheckBox.GetCheck();
const bool wireframe = wireCheckBox.GetCheck();
- Scene& scene = wiScene::GetScene();
- const CameraComponent& camera = wiScene::GetCamera();
+ Scene& scene = wi::scene::GetScene();
+ const CameraComponent& camera = wi::scene::GetCamera();
const XMVECTOR C = XMLoadFloat2(&pos);
const XMMATRIX VP = camera.GetViewProjection();
const XMVECTOR MUL = XMVectorSet(0.5f, -0.5f, 1, 1);
@@ -259,7 +259,7 @@ void PaintToolWindow::Update(float dt)
{
case MODE_TEXTURE:
{
- const wiScene::PickResult& intersect = editor->hovered;
+ const wi::scene::PickResult& intersect = editor->hovered;
if (intersect.entity != entity)
break;
@@ -296,7 +296,7 @@ void PaintToolWindow::Update(float dt)
if (painting)
{
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
CommandList cmd = device->BeginCommandList();
RecordHistory(true, cmd);
@@ -304,10 +304,10 @@ void PaintToolWindow::Update(float dt)
// Need to requery this because RecordHistory might swap textures on material:
editTexture = GetEditTextureSlot(*material, &uvset);
- device->BindComputeShader(wiRenderer::GetShader(CSTYPE_PAINT_TEXTURE), cmd);
+ device->BindComputeShader(wi::renderer::GetShader(wi::enums::CSTYPE_PAINT_TEXTURE), cmd);
- wiRenderer::BindCommonResources(cmd);
- device->BindResource(wiTextureHelper::getWhite(), 0, cmd);
+ wi::renderer::BindCommonResources(cmd);
+ device->BindResource(wi::texturehelper::getWhite(), 0, cmd);
device->BindUAV(&editTexture, 0, cmd);
PaintTextureCB cb;
@@ -328,10 +328,10 @@ void PaintToolWindow::Update(float dt)
device->Barrier(barriers, arraysize(barriers), cmd);
- wiRenderer::GenerateMipChain(editTexture, wiRenderer::MIPGENFILTER::MIPGENFILTER_LINEAR, cmd);
+ wi::renderer::GenerateMipChain(editTexture, wi::renderer::MIPGENFILTER::MIPGENFILTER_LINEAR, cmd);
}
- wiRenderer::PaintRadius paintrad;
+ wi::renderer::PaintRadius paintrad;
paintrad.objectEntity = entity;
paintrad.subset = subset;
paintrad.radius = radius;
@@ -339,7 +339,7 @@ void PaintToolWindow::Update(float dt)
paintrad.uvset = uvset;
paintrad.dimensions.x = desc.width;
paintrad.dimensions.y = desc.height;
- wiRenderer::DrawPaintRadius(paintrad);
+ wi::renderer::DrawPaintRadius(paintrad);
}
break;
@@ -404,7 +404,7 @@ void PaintToolWindow::Update(float dt)
if (mesh->vertex_colors.empty())
{
mesh->vertex_colors.resize(mesh->vertex_positions.size());
- std::fill(mesh->vertex_colors.begin(), mesh->vertex_colors.end(), wiColor::White().rgba); // fill white
+ std::fill(mesh->vertex_colors.begin(), mesh->vertex_colors.end(), wi::Color::White().rgba); // fill white
rebuild = true;
}
break;
@@ -430,7 +430,7 @@ void PaintToolWindow::Update(float dt)
}
else
{
- P = wiScene::SkinVertex(*mesh, *armature, (uint32_t)j, &N);
+ P = wi::scene::SkinVertex(*mesh, *armature, (uint32_t)j, &N);
}
P = XMVector3Transform(P, W);
N = XMVector3Normalize(XMVector3TransformNormal(N, W));
@@ -457,15 +457,15 @@ void PaintToolWindow::Update(float dt)
{
case MODE_VERTEXCOLOR:
{
- wiColor vcol = mesh->vertex_colors[j];
- vcol = wiColor::lerp(vcol, color, affection);
+ wi::Color vcol = mesh->vertex_colors[j];
+ vcol = wi::Color::lerp(vcol, color, affection);
mesh->vertex_colors[j] = vcol.rgba;
}
break;
case MODE_WIND:
{
- wiColor vcol = wiColor(0, 0, 0, mesh->vertex_windweights[j]);
- vcol = wiColor::lerp(vcol, color, affection);
+ wi::Color vcol = wi::Color(0, 0, 0, mesh->vertex_windweights[j]);
+ vcol = wi::Color::lerp(vcol, color, affection);
mesh->vertex_windweights[j] = vcol.getA();
}
break;
@@ -487,20 +487,20 @@ void PaintToolWindow::Update(float dt)
continue;
const XMVECTOR P[arraysize(triangle)] = {
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wiScene::SkinVertex(*mesh, *armature, triangle[0]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wiScene::SkinVertex(*mesh, *armature, triangle[1]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wiScene::SkinVertex(*mesh, *armature, triangle[2]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[0]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[1]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[2]), W),
};
- wiRenderer::RenderableTriangle tri;
+ wi::renderer::RenderableTriangle tri;
XMStoreFloat3(&tri.positionA, P[0]);
XMStoreFloat3(&tri.positionB, P[1]);
XMStoreFloat3(&tri.positionC, P[2]);
if (mode == MODE_WIND)
{
- tri.colorA = wiColor(mesh->vertex_windweights[triangle[0]], 0, 0, 255);
- tri.colorB = wiColor(mesh->vertex_windweights[triangle[1]], 0, 0, 255);
- tri.colorC = wiColor(mesh->vertex_windweights[triangle[2]], 0, 0, 255);
+ tri.colorA = wi::Color(mesh->vertex_windweights[triangle[0]], 0, 0, 255);
+ tri.colorB = wi::Color(mesh->vertex_windweights[triangle[1]], 0, 0, 255);
+ tri.colorC = wi::Color(mesh->vertex_windweights[triangle[2]], 0, 0, 255);
}
else
{
@@ -508,7 +508,7 @@ void PaintToolWindow::Update(float dt)
tri.colorB.w = 0.8f;
tri.colorC.w = 0.8f;
}
- wiRenderer::DrawTriangle(tri, true);
+ wi::renderer::DrawTriangle(tri, true);
}
}
@@ -561,7 +561,7 @@ void PaintToolWindow::Update(float dt)
}
else
{
- P = wiScene::SkinVertex(*mesh, *armature, (uint32_t)j, &N);
+ P = wi::scene::SkinVertex(*mesh, *armature, (uint32_t)j, &N);
}
P = XMVector3Transform(P, W);
N = XMVector3Normalize(XMVector3TransformNormal(N, W));
@@ -616,19 +616,19 @@ void PaintToolWindow::Update(float dt)
mesh->indices[j + 2],
};
const XMVECTOR P[arraysize(triangle)] = {
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wiScene::SkinVertex(*mesh, *armature, triangle[0]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wiScene::SkinVertex(*mesh, *armature, triangle[1]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wiScene::SkinVertex(*mesh, *armature, triangle[2]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[0]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[1]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[2]), W),
};
- wiRenderer::RenderableTriangle tri;
+ wi::renderer::RenderableTriangle tri;
XMStoreFloat3(&tri.positionA, P[0]);
XMStoreFloat3(&tri.positionB, P[1]);
XMStoreFloat3(&tri.positionC, P[2]);
tri.colorA.w = 0.8f;
tri.colorB.w = 0.8f;
tri.colorC.w = 0.8f;
- wiRenderer::DrawTriangle(tri, true);
+ wi::renderer::DrawTriangle(tri, true);
}
}
@@ -655,7 +655,7 @@ void PaintToolWindow::Update(float dt)
break;
// Painting:
- if (pointer_moved && wiInput::Down(wiInput::MOUSE_BUTTON_LEFT))
+ if (pointer_moved && wi::input::Down(wi::input::MOUSE_BUTTON_LEFT))
{
size_t j = 0;
for (auto& ind : softbody->physicsToGraphicsVertexMapping)
@@ -688,7 +688,7 @@ void PaintToolWindow::Update(float dt)
const float weight0 = softbody->weights[physicsIndex0];
const float weight1 = softbody->weights[physicsIndex1];
const float weight2 = softbody->weights[physicsIndex2];
- wiRenderer::RenderableTriangle tri;
+ wi::renderer::RenderableTriangle tri;
if (softbody->vertex_positions_simulation.empty())
{
XMStoreFloat3(&tri.positionA, XMVector3Transform(XMLoadFloat3(&mesh->vertex_positions[graphicsIndex0]), W));
@@ -715,12 +715,12 @@ void PaintToolWindow::Update(float dt)
tri.colorC = XMFLOAT4(1, 1, 1, 1);
if (wireframe)
{
- wiRenderer::DrawTriangle(tri, true);
+ wi::renderer::DrawTriangle(tri, true);
}
if (weight0 == 0 && weight1 == 0 && weight2 == 0)
{
tri.colorA = tri.colorB = tri.colorC = XMFLOAT4(1, 0, 0, 0.8f);
- wiRenderer::DrawTriangle(tri);
+ wi::renderer::DrawTriangle(tri);
}
}
}
@@ -730,7 +730,7 @@ void PaintToolWindow::Update(float dt)
case MODE_HAIRPARTICLE_REMOVE_TRIANGLE:
case MODE_HAIRPARTICLE_LENGTH:
{
- wiHairParticle* hair = scene.hairs.GetComponent(entity);
+ wi::HairParticleSystem* hair = scene.hairs.GetComponent(entity);
if (hair == nullptr || hair->meshID == INVALID_ENTITY)
break;
@@ -758,7 +758,7 @@ void PaintToolWindow::Update(float dt)
}
else
{
- P = wiScene::SkinVertex(*mesh, *armature, (uint32_t)j, &N);
+ P = wi::scene::SkinVertex(*mesh, *armature, (uint32_t)j, &N);
}
P = XMVector3Transform(P, W);
N = XMVector3Normalize(XMVector3TransformNormal(N, W));
@@ -787,14 +787,14 @@ void PaintToolWindow::Update(float dt)
if (hair->vertex_lengths[j] > 0) // don't change distribution
{
const float affection = amount * std::pow(1.0f - (dist / pressure_radius), falloff);
- hair->vertex_lengths[j] = wiMath::Lerp(hair->vertex_lengths[j], color_float.w, affection);
+ hair->vertex_lengths[j] = wi::math::Lerp(hair->vertex_lengths[j], color_float.w, affection);
// don't let it "remove" the vertex by keeping its length above zero:
// (because if removed, distribution also changes which might be distracting)
- hair->vertex_lengths[j] = wiMath::Clamp(hair->vertex_lengths[j], 1.0f / 255.0f, 1.0f);
+ hair->vertex_lengths[j] = wi::math::Clamp(hair->vertex_lengths[j], 1.0f / 255.0f, 1.0f);
}
break;
}
- hair->_flags |= wiHairParticle::REBUILD_BUFFERS;
+ hair->_flags |= wi::HairParticleSystem::REBUILD_BUFFERS;
}
}
}
@@ -809,16 +809,16 @@ void PaintToolWindow::Update(float dt)
mesh->indices[j + 2],
};
const XMVECTOR P[arraysize(triangle)] = {
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wiScene::SkinVertex(*mesh, *armature, triangle[0]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wiScene::SkinVertex(*mesh, *armature, triangle[1]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wiScene::SkinVertex(*mesh, *armature, triangle[2]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[0]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[1]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[2]), W),
};
- wiRenderer::RenderableTriangle tri;
+ wi::renderer::RenderableTriangle tri;
XMStoreFloat3(&tri.positionA, P[0]);
XMStoreFloat3(&tri.positionB, P[1]);
XMStoreFloat3(&tri.positionC, P[2]);
- wiRenderer::DrawTriangle(tri, true);
+ wi::renderer::DrawTriangle(tri, true);
}
for (size_t j = 0; j < hair->indices.size() && wireframe; j += 3)
@@ -829,17 +829,17 @@ void PaintToolWindow::Update(float dt)
hair->indices[j + 2],
};
const XMVECTOR P[arraysize(triangle)] = {
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wiScene::SkinVertex(*mesh, *armature, triangle[0]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wiScene::SkinVertex(*mesh, *armature, triangle[1]), W),
- XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wiScene::SkinVertex(*mesh, *armature, triangle[2]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[0]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[0]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[1]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[1]), W),
+ XMVector3Transform(armature == nullptr ? XMLoadFloat3(&mesh->vertex_positions[triangle[2]]) : wi::scene::SkinVertex(*mesh, *armature, triangle[2]), W),
};
- wiRenderer::RenderableTriangle tri;
+ wi::renderer::RenderableTriangle tri;
XMStoreFloat3(&tri.positionA, P[0]);
XMStoreFloat3(&tri.positionB, P[1]);
XMStoreFloat3(&tri.positionC, P[2]);
tri.colorA = tri.colorB = tri.colorC = XMFLOAT4(1, 0, 1, 0.9f);
- wiRenderer::DrawTriangle(tri, false);
+ wi::renderer::DrawTriangle(tri, false);
}
}
}
@@ -850,7 +850,7 @@ void PaintToolWindow::Update(float dt)
void PaintToolWindow::DrawBrush() const
{
const MODE mode = GetMode();
- if (mode == MODE_DISABLED || mode == MODE_TEXTURE || entity == INVALID_ENTITY || wiBackLog::isActive())
+ if (mode == MODE_DISABLED || mode == MODE_TEXTURE || entity == INVALID_ENTITY || wi::backlog::isActive())
return;
const int segmentcount = 36;
@@ -860,13 +860,13 @@ void PaintToolWindow::DrawBrush() const
{
const float angle0 = rot + (float)i / (float)segmentcount * XM_2PI;
const float angle1 = rot + (float)(i + 1) / (float)segmentcount * XM_2PI;
- wiRenderer::RenderableLine2D line;
+ wi::renderer::RenderableLine2D line;
line.start.x = pos.x + sinf(angle0) * radius;
line.start.y = pos.y + cosf(angle0) * radius;
line.end.x = pos.x + sinf(angle1) * radius;
line.end.y = pos.y + cosf(angle1) * radius;
line.color_end = line.color_start = i%2 == 0 ? XMFLOAT4(0, 0, 0, 0.8f): XMFLOAT4(1,1,1,1);
- wiRenderer::DrawLine(line);
+ wi::renderer::DrawLine(line);
}
}
@@ -875,7 +875,7 @@ PaintToolWindow::MODE PaintToolWindow::GetMode() const
{
return (MODE)modeComboBox.GetSelected();
}
-void PaintToolWindow::SetEntity(wiECS::Entity value, int subsetindex)
+void PaintToolWindow::SetEntity(wi::ecs::Entity value, int subsetindex)
{
entity = value;
subset = subsetindex;
@@ -901,14 +901,14 @@ void PaintToolWindow::RecordHistory(bool start, CommandList cmd)
// Start history recording (undo)
currentHistory = &editor->AdvanceHistory();
- wiArchive& archive = *currentHistory;
+ wi::Archive& archive = *currentHistory;
archive << EditorComponent::HISTORYOP_PAINTTOOL;
archive << (uint32_t)GetMode();
archive << entity;
}
else
{
- if (!history_needs_recording_end || wiInput::Down(wiInput::MOUSE_BUTTON_LEFT))
+ if (!history_needs_recording_end || wi::input::Down(wi::input::MOUSE_BUTTON_LEFT))
return;
history_needs_recording_end = false;
history_needs_recording_start = false;
@@ -916,8 +916,8 @@ void PaintToolWindow::RecordHistory(bool start, CommandList cmd)
// End history recording (redo)
}
- wiArchive& archive = *currentHistory;
- Scene& scene = wiScene::GetScene();
+ wi::Archive& archive = *currentHistory;
+ Scene& scene = wi::scene::GetScene();
switch (GetMode())
{
@@ -950,7 +950,7 @@ void PaintToolWindow::RecordHistory(bool start, CommandList cmd)
if (start)
{
// Make a copy of texture to edit and replace material resource:
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
Texture newTex;
TextureDesc desc = editTexture.GetDesc();
desc.format = Format::R8G8B8A8_UNORM; // force format to one that is writable by GPU
@@ -963,8 +963,8 @@ void PaintToolWindow::RecordHistory(bool start, CommandList cmd)
subresource_index = device->CreateSubresource(&newTex, SubresourceType::UAV, 0, 1, i, 1);
assert(subresource_index == i);
}
- assert(cmd != wiGraphics::INVALID_COMMANDLIST);
- wiRenderer::CopyTexture2D(newTex, -1, 0, 0, editTexture, 0, cmd);
+ assert(cmd != wi::graphics::INVALID_COMMANDLIST);
+ wi::renderer::CopyTexture2D(newTex, -1, 0, 0, editTexture, 0, cmd);
ReplaceEditTextureSlot(*material, newTex);
}
@@ -1029,7 +1029,7 @@ void PaintToolWindow::RecordHistory(bool start, CommandList cmd)
case PaintToolWindow::MODE_HAIRPARTICLE_REMOVE_TRIANGLE:
case PaintToolWindow::MODE_HAIRPARTICLE_LENGTH:
{
- wiHairParticle* hair = scene.hairs.GetComponent(entity);
+ wi::HairParticleSystem* hair = scene.hairs.GetComponent(entity);
if (hair == nullptr)
break;
@@ -1041,7 +1041,7 @@ void PaintToolWindow::RecordHistory(bool start, CommandList cmd)
break;
}
}
-void PaintToolWindow::ConsumeHistoryOperation(wiArchive& archive, bool undo)
+void PaintToolWindow::ConsumeHistoryOperation(wi::Archive& archive, bool undo)
{
MODE historymode;
archive >> (uint32_t&)historymode;
@@ -1049,7 +1049,7 @@ void PaintToolWindow::ConsumeHistoryOperation(wiArchive& archive, bool undo)
modeComboBox.SetSelected(historymode);
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
switch (historymode)
{
@@ -1208,13 +1208,13 @@ void PaintToolWindow::ConsumeHistoryOperation(wiArchive& archive, bool undo)
case PaintToolWindow::MODE_HAIRPARTICLE_REMOVE_TRIANGLE:
case PaintToolWindow::MODE_HAIRPARTICLE_LENGTH:
{
- wiHairParticle* hair = scene.hairs.GetComponent(entity);
+ wi::HairParticleSystem* hair = scene.hairs.GetComponent(entity);
if (hair == nullptr)
break;
- wiHairParticle undo_hair;
+ wi::HairParticleSystem undo_hair;
archive >> undo_hair.vertex_lengths;
- wiHairParticle redo_hair;
+ wi::HairParticleSystem redo_hair;
archive >> redo_hair.vertex_lengths;
if (undo)
@@ -1226,7 +1226,7 @@ void PaintToolWindow::ConsumeHistoryOperation(wiArchive& archive, bool undo)
hair->vertex_lengths = redo_hair.vertex_lengths;
}
- hair->_flags |= wiHairParticle::REBUILD_BUFFERS;
+ hair->_flags |= wi::HairParticleSystem::REBUILD_BUFFERS;
}
break;
default:
@@ -1237,17 +1237,17 @@ void PaintToolWindow::ConsumeHistoryOperation(wiArchive& archive, bool undo)
Texture PaintToolWindow::GetEditTextureSlot(const MaterialComponent& material, int* uvset)
{
uint64_t sel = textureSlotComboBox.GetItemUserData(textureSlotComboBox.GetSelected());
- if (material.textures[sel].resource == nullptr)
+ if (!material.textures[sel].resource.IsValid())
{
return Texture();
}
if (uvset)
*uvset = material.textures[sel].uvset;
- return material.textures[sel].resource->texture;
+ return material.textures[sel].resource.GetTexture();
}
-void PaintToolWindow::ReplaceEditTextureSlot(wiScene::MaterialComponent& material, const Texture& texture)
+void PaintToolWindow::ReplaceEditTextureSlot(wi::scene::MaterialComponent& material, const Texture& texture)
{
uint64_t sel = textureSlotComboBox.GetItemUserData(textureSlotComboBox.GetSelected());
- material.textures[sel].resource->texture = texture;
+ material.textures[sel].resource.SetTexture(texture);
material.SetDirty();
}
diff --git a/Editor/PaintToolWindow.h b/Editor/PaintToolWindow.h
index 4708a97e4..a51302298 100644
--- a/Editor/PaintToolWindow.h
+++ b/Editor/PaintToolWindow.h
@@ -3,35 +3,35 @@
class EditorComponent;
-class PaintToolWindow : public wiWindow
+class PaintToolWindow : public wi::gui::Window
{
float rot = 0;
float stroke_dist = 0;
bool history_needs_recording_start = false;
bool history_needs_recording_end = false;
size_t history_textureIndex = 0;
- wi::vector history_textures; // we'd like to keep history textures in GPU memory to avoid GPU readback
- wiGraphics::Texture GetEditTextureSlot(const wiScene::MaterialComponent& material, int* uvset = nullptr);
- void ReplaceEditTextureSlot(wiScene::MaterialComponent& material, const wiGraphics::Texture& texture);
+ wi::vector history_textures; // we'd like to keep history textures in GPU memory to avoid GPU readback
+ wi::graphics::Texture GetEditTextureSlot(const wi::scene::MaterialComponent& material, int* uvset = nullptr);
+ void ReplaceEditTextureSlot(wi::scene::MaterialComponent& material, const wi::graphics::Texture& texture);
public:
void Create(EditorComponent* editor);
EditorComponent* editor = nullptr;
- wiECS::Entity entity = wiECS::INVALID_ENTITY;
+ wi::ecs::Entity entity = wi::ecs::INVALID_ENTITY;
int subset = -1;
- wiComboBox modeComboBox;
- wiLabel infoLabel;
- wiSlider radiusSlider;
- wiSlider amountSlider;
- wiSlider falloffSlider;
- wiSlider spacingSlider;
- wiCheckBox backfaceCheckBox;
- wiCheckBox wireCheckBox;
- wiCheckBox pressureCheckBox;
- wiColorPicker colorPicker;
- wiComboBox textureSlotComboBox;
- wiButton saveTextureButton;
+ wi::gui::ComboBox modeComboBox;
+ wi::gui::Label infoLabel;
+ wi::gui::Slider radiusSlider;
+ wi::gui::Slider amountSlider;
+ wi::gui::Slider falloffSlider;
+ wi::gui::Slider spacingSlider;
+ wi::gui::CheckBox backfaceCheckBox;
+ wi::gui::CheckBox wireCheckBox;
+ wi::gui::CheckBox pressureCheckBox;
+ wi::gui::ColorPicker colorPicker;
+ wi::gui::ComboBox textureSlotComboBox;
+ wi::gui::Button saveTextureButton;
void Update(float dt);
void DrawBrush() const;
@@ -53,9 +53,9 @@ public:
MODE_WIND,
};
MODE GetMode() const;
- void SetEntity(wiECS::Entity value, int subsetindex = -1);
+ void SetEntity(wi::ecs::Entity value, int subsetindex = -1);
- wiArchive* currentHistory = nullptr;
- void RecordHistory(bool start, wiGraphics::CommandList cmd = wiGraphics::INVALID_COMMANDLIST);
- void ConsumeHistoryOperation(wiArchive& archive, bool undo);
+ wi::Archive* currentHistory = nullptr;
+ void RecordHistory(bool start, wi::graphics::CommandList cmd = wi::graphics::INVALID_COMMANDLIST);
+ void ConsumeHistoryOperation(wi::Archive& archive, bool undo);
};
diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp
index 2717f34c2..33575c8e6 100644
--- a/Editor/PostprocessWindow.cpp
+++ b/Editor/PostprocessWindow.cpp
@@ -4,12 +4,11 @@
#include
-using namespace wiGraphics;
-
+using namespace wi::graphics;
void PostprocessWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("PostProcess Window");
+ wi::gui::Window::Create("PostProcess Window");
SetSize(XMFLOAT2(420, 500));
float x = 150;
@@ -23,7 +22,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
exposureSlider.SetSize(XMFLOAT2(100, hei));
exposureSlider.SetPos(XMFLOAT2(x, y += step));
exposureSlider.SetValue(editor->renderPath->getExposure());
- exposureSlider.OnSlide([=](wiEventArgs args) {
+ exposureSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setExposure(args.fValue);
});
AddWidget(&exposureSlider);
@@ -34,7 +33,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
lensFlareCheckBox.SetSize(XMFLOAT2(hei, hei));
lensFlareCheckBox.SetPos(XMFLOAT2(x, y += step));
lensFlareCheckBox.SetCheck(editor->renderPath->getLensFlareEnabled());
- lensFlareCheckBox.OnClick([=](wiEventArgs args) {
+ lensFlareCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setLensFlareEnabled(args.bValue);
});
AddWidget(&lensFlareCheckBox);
@@ -45,7 +44,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
lightShaftsCheckBox.SetSize(XMFLOAT2(hei, hei));
lightShaftsCheckBox.SetPos(XMFLOAT2(x, y += step));
lightShaftsCheckBox.SetCheck(editor->renderPath->getLightShaftsEnabled());
- lightShaftsCheckBox.OnClick([=](wiEventArgs args) {
+ lightShaftsCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setLightShaftsEnabled(args.bValue);
});
AddWidget(&lightShaftsCheckBox);
@@ -59,23 +58,23 @@ void PostprocessWindow::Create(EditorComponent* editor)
aoComboBox.AddItem("SSAO");
aoComboBox.AddItem("HBAO");
aoComboBox.AddItem("MSAO");
- if (wiGraphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING))
+ if (wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING))
{
aoComboBox.AddItem("RTAO");
}
aoComboBox.SetSelected(editor->renderPath->getAO());
- aoComboBox.OnSelect([=](wiEventArgs args) {
- editor->renderPath->setAO((RenderPath3D::AO)args.iValue);
+ aoComboBox.OnSelect([=](wi::gui::EventArgs args) {
+ editor->renderPath->setAO((wi::RenderPath3D::AO)args.iValue);
switch (editor->renderPath->getAO())
{
- case RenderPath3D::AO_SSAO:
+ case wi::RenderPath3D::AO_SSAO:
aoRangeSlider.SetEnabled(true);
aoRangeSlider.SetValue(2.0f);
aoSampleCountSlider.SetEnabled(true);
aoSampleCountSlider.SetValue(9.0f);
break;
- case RenderPath3D::AO_RTAO:
+ case wi::RenderPath3D::AO_RTAO:
aoRangeSlider.SetEnabled(true);
aoRangeSlider.SetValue(10.0f);
aoSampleCountSlider.SetEnabled(false);
@@ -96,7 +95,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
aoPowerSlider.SetSize(XMFLOAT2(100, hei));
aoPowerSlider.SetPos(XMFLOAT2(x + 100, y += step));
aoPowerSlider.SetValue((float)editor->renderPath->getAOPower());
- aoPowerSlider.OnSlide([=](wiEventArgs args) {
+ aoPowerSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setAOPower(args.fValue);
});
AddWidget(&aoPowerSlider);
@@ -106,7 +105,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
aoRangeSlider.SetSize(XMFLOAT2(100, hei));
aoRangeSlider.SetPos(XMFLOAT2(x + 100, y += step));
aoRangeSlider.SetValue((float)editor->renderPath->getAOPower());
- aoRangeSlider.OnSlide([=](wiEventArgs args) {
+ aoRangeSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setAORange(args.fValue);
});
AddWidget(&aoRangeSlider);
@@ -116,7 +115,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
aoSampleCountSlider.SetSize(XMFLOAT2(100, hei));
aoSampleCountSlider.SetPos(XMFLOAT2(x + 100, y += step));
aoSampleCountSlider.SetValue((float)editor->renderPath->getAOPower());
- aoSampleCountSlider.OnSlide([=](wiEventArgs args) {
+ aoSampleCountSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setAOSampleCount(args.iValue);
});
AddWidget(&aoSampleCountSlider);
@@ -127,7 +126,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
ssrCheckBox.SetSize(XMFLOAT2(hei, hei));
ssrCheckBox.SetPos(XMFLOAT2(x, y += step));
ssrCheckBox.SetCheck(editor->renderPath->getSSREnabled());
- ssrCheckBox.OnClick([=](wiEventArgs args) {
+ ssrCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setSSREnabled(args.bValue);
});
AddWidget(&ssrCheckBox);
@@ -138,19 +137,19 @@ void PostprocessWindow::Create(EditorComponent* editor)
raytracedReflectionsCheckBox.SetSize(XMFLOAT2(hei, hei));
raytracedReflectionsCheckBox.SetPos(XMFLOAT2(x + 200, y));
raytracedReflectionsCheckBox.SetCheck(editor->renderPath->getRaytracedReflectionEnabled());
- raytracedReflectionsCheckBox.OnClick([=](wiEventArgs args) {
+ raytracedReflectionsCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setRaytracedReflectionsEnabled(args.bValue);
});
AddWidget(&raytracedReflectionsCheckBox);
- raytracedReflectionsCheckBox.SetEnabled(wiGraphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING));
+ raytracedReflectionsCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING));
screenSpaceShadowsCheckBox.Create("SS Shadows: ");
screenSpaceShadowsCheckBox.SetTooltip("Enable screen space contact shadows. This can add small shadows details to shadow maps in screen space.");
screenSpaceShadowsCheckBox.SetSize(XMFLOAT2(hei, hei));
screenSpaceShadowsCheckBox.SetPos(XMFLOAT2(x, y += step));
- screenSpaceShadowsCheckBox.SetCheck(wiRenderer::GetScreenSpaceShadowsEnabled());
- screenSpaceShadowsCheckBox.OnClick([=](wiEventArgs args) {
- wiRenderer::SetScreenSpaceShadowsEnabled(args.bValue);
+ screenSpaceShadowsCheckBox.SetCheck(wi::renderer::GetScreenSpaceShadowsEnabled());
+ screenSpaceShadowsCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::renderer::SetScreenSpaceShadowsEnabled(args.bValue);
});
AddWidget(&screenSpaceShadowsCheckBox);
@@ -159,7 +158,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
screenSpaceShadowsRangeSlider.SetSize(XMFLOAT2(100, hei));
screenSpaceShadowsRangeSlider.SetPos(XMFLOAT2(x + 100, y));
screenSpaceShadowsRangeSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowRange());
- screenSpaceShadowsRangeSlider.OnSlide([=](wiEventArgs args) {
+ screenSpaceShadowsRangeSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setScreenSpaceShadowRange(args.fValue);
});
AddWidget(&screenSpaceShadowsRangeSlider);
@@ -169,7 +168,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
screenSpaceShadowsStepCountSlider.SetSize(XMFLOAT2(100, hei));
screenSpaceShadowsStepCountSlider.SetPos(XMFLOAT2(x + 100, y += step));
screenSpaceShadowsStepCountSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowSampleCount());
- screenSpaceShadowsStepCountSlider.OnSlide([=](wiEventArgs args) {
+ screenSpaceShadowsStepCountSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setScreenSpaceShadowSampleCount(args.iValue);
});
AddWidget(&screenSpaceShadowsStepCountSlider);
@@ -179,7 +178,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
eyeAdaptionCheckBox.SetSize(XMFLOAT2(hei, hei));
eyeAdaptionCheckBox.SetPos(XMFLOAT2(x, y += step));
eyeAdaptionCheckBox.SetCheck(editor->renderPath->getEyeAdaptionEnabled());
- eyeAdaptionCheckBox.OnClick([=](wiEventArgs args) {
+ eyeAdaptionCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setEyeAdaptionEnabled(args.bValue);
});
AddWidget(&eyeAdaptionCheckBox);
@@ -189,7 +188,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
eyeAdaptionKeySlider.SetSize(XMFLOAT2(100, hei));
eyeAdaptionKeySlider.SetPos(XMFLOAT2(x + 100, y));
eyeAdaptionKeySlider.SetValue(editor->renderPath->getEyeAdaptionKey());
- eyeAdaptionKeySlider.OnSlide([=](wiEventArgs args) {
+ eyeAdaptionKeySlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setEyeAdaptionKey(args.fValue);
});
AddWidget(&eyeAdaptionKeySlider);
@@ -199,7 +198,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
eyeAdaptionRateSlider.SetSize(XMFLOAT2(100, hei));
eyeAdaptionRateSlider.SetPos(XMFLOAT2(x + 100, y += step));
eyeAdaptionRateSlider.SetValue(editor->renderPath->getEyeAdaptionRate());
- eyeAdaptionRateSlider.OnSlide([=](wiEventArgs args) {
+ eyeAdaptionRateSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setEyeAdaptionRate(args.fValue);
});
AddWidget(&eyeAdaptionRateSlider);
@@ -210,7 +209,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
motionBlurCheckBox.SetSize(XMFLOAT2(hei, hei));
motionBlurCheckBox.SetPos(XMFLOAT2(x, y += step));
motionBlurCheckBox.SetCheck(editor->renderPath->getMotionBlurEnabled());
- motionBlurCheckBox.OnClick([=](wiEventArgs args) {
+ motionBlurCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setMotionBlurEnabled(args.bValue);
});
AddWidget(&motionBlurCheckBox);
@@ -221,7 +220,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
motionBlurStrengthSlider.SetSize(XMFLOAT2(100, hei));
motionBlurStrengthSlider.SetPos(XMFLOAT2(x + 100, y));
motionBlurStrengthSlider.SetValue(editor->renderPath->getMotionBlurStrength());
- motionBlurStrengthSlider.OnSlide([=](wiEventArgs args) {
+ motionBlurStrengthSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setMotionBlurStrength(args.fValue);
});
AddWidget(&motionBlurStrengthSlider);
@@ -232,7 +231,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
depthOfFieldCheckBox.SetSize(XMFLOAT2(hei, hei));
depthOfFieldCheckBox.SetPos(XMFLOAT2(x, y += step));
depthOfFieldCheckBox.SetCheck(editor->renderPath->getDepthOfFieldEnabled());
- depthOfFieldCheckBox.OnClick([=](wiEventArgs args) {
+ depthOfFieldCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setDepthOfFieldEnabled(args.bValue);
});
AddWidget(&depthOfFieldCheckBox);
@@ -243,7 +242,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
depthOfFieldScaleSlider.SetSize(XMFLOAT2(100, hei));
depthOfFieldScaleSlider.SetPos(XMFLOAT2(x + 100, y));
depthOfFieldScaleSlider.SetValue(editor->renderPath->getDepthOfFieldStrength());
- depthOfFieldScaleSlider.OnSlide([=](wiEventArgs args) {
+ depthOfFieldScaleSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setDepthOfFieldStrength(args.fValue);
});
AddWidget(&depthOfFieldScaleSlider);
@@ -254,7 +253,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
bloomCheckBox.SetSize(XMFLOAT2(hei, hei));
bloomCheckBox.SetPos(XMFLOAT2(x, y += step));
bloomCheckBox.SetCheck(editor->renderPath->getBloomEnabled());
- bloomCheckBox.OnClick([=](wiEventArgs args) {
+ bloomCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setBloomEnabled(args.bValue);
});
AddWidget(&bloomCheckBox);
@@ -264,7 +263,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
bloomStrengthSlider.SetSize(XMFLOAT2(100, hei));
bloomStrengthSlider.SetPos(XMFLOAT2(x + 100, y));
bloomStrengthSlider.SetValue(editor->renderPath->getBloomThreshold());
- bloomStrengthSlider.OnSlide([=](wiEventArgs args) {
+ bloomStrengthSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setBloomThreshold(args.fValue);
});
AddWidget(&bloomStrengthSlider);
@@ -275,7 +274,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
fxaaCheckBox.SetSize(XMFLOAT2(hei, hei));
fxaaCheckBox.SetPos(XMFLOAT2(x, y += step));
fxaaCheckBox.SetCheck(editor->renderPath->getFXAAEnabled());
- fxaaCheckBox.OnClick([=](wiEventArgs args) {
+ fxaaCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setFXAAEnabled(args.bValue);
});
AddWidget(&fxaaCheckBox);
@@ -285,7 +284,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
colorGradingCheckBox.SetSize(XMFLOAT2(hei, hei));
colorGradingCheckBox.SetPos(XMFLOAT2(x, y += step));
colorGradingCheckBox.SetCheck(editor->renderPath->getColorGradingEnabled());
- colorGradingCheckBox.OnClick([=](wiEventArgs args) {
+ colorGradingCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setColorGradingEnabled(args.bValue);
});
AddWidget(&colorGradingCheckBox);
@@ -295,7 +294,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
ditherCheckBox.SetSize(XMFLOAT2(hei, hei));
ditherCheckBox.SetPos(XMFLOAT2(x, y += step));
ditherCheckBox.SetCheck(editor->renderPath->getDitherEnabled());
- ditherCheckBox.OnClick([=](wiEventArgs args) {
+ ditherCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setDitherEnabled(args.bValue);
});
AddWidget(&ditherCheckBox);
@@ -306,7 +305,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
sharpenFilterCheckBox.SetSize(XMFLOAT2(hei, hei));
sharpenFilterCheckBox.SetPos(XMFLOAT2(x, y += step));
sharpenFilterCheckBox.SetCheck(editor->renderPath->getSharpenFilterEnabled());
- sharpenFilterCheckBox.OnClick([=](wiEventArgs args) {
+ sharpenFilterCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setSharpenFilterEnabled(args.bValue);
});
AddWidget(&sharpenFilterCheckBox);
@@ -317,7 +316,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
sharpenFilterAmountSlider.SetSize(XMFLOAT2(100, hei));
sharpenFilterAmountSlider.SetPos(XMFLOAT2(x + 100, y));
sharpenFilterAmountSlider.SetValue(editor->renderPath->getSharpenFilterAmount());
- sharpenFilterAmountSlider.OnSlide([=](wiEventArgs args) {
+ sharpenFilterAmountSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setSharpenFilterAmount(args.fValue);
});
AddWidget(&sharpenFilterAmountSlider);
@@ -327,7 +326,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
outlineCheckBox.SetSize(XMFLOAT2(hei, hei));
outlineCheckBox.SetPos(XMFLOAT2(x, y += step));
outlineCheckBox.SetCheck(editor->renderPath->getOutlineEnabled());
- outlineCheckBox.OnClick([=](wiEventArgs args) {
+ outlineCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setOutlineEnabled(args.bValue);
});
AddWidget(&outlineCheckBox);
@@ -337,7 +336,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
outlineThresholdSlider.SetSize(XMFLOAT2(100, hei));
outlineThresholdSlider.SetPos(XMFLOAT2(x + 100, y));
outlineThresholdSlider.SetValue(editor->renderPath->getOutlineThreshold());
- outlineThresholdSlider.OnSlide([=](wiEventArgs args) {
+ outlineThresholdSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setOutlineThreshold(args.fValue);
});
AddWidget(&outlineThresholdSlider);
@@ -347,7 +346,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
outlineThicknessSlider.SetSize(XMFLOAT2(100, hei));
outlineThicknessSlider.SetPos(XMFLOAT2(x + 100, y += step));
outlineThicknessSlider.SetValue(editor->renderPath->getOutlineThickness());
- outlineThicknessSlider.OnSlide([=](wiEventArgs args) {
+ outlineThicknessSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setOutlineThickness(args.fValue);
});
AddWidget(&outlineThicknessSlider);
@@ -357,7 +356,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
chromaticaberrationCheckBox.SetSize(XMFLOAT2(hei, hei));
chromaticaberrationCheckBox.SetPos(XMFLOAT2(x, y += step));
chromaticaberrationCheckBox.SetCheck(editor->renderPath->getOutlineEnabled());
- chromaticaberrationCheckBox.OnClick([=](wiEventArgs args) {
+ chromaticaberrationCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setChromaticAberrationEnabled(args.bValue);
});
AddWidget(&chromaticaberrationCheckBox);
@@ -367,7 +366,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
chromaticaberrationSlider.SetSize(XMFLOAT2(100, hei));
chromaticaberrationSlider.SetPos(XMFLOAT2(x + 100, y));
chromaticaberrationSlider.SetValue(editor->renderPath->getChromaticAberrationAmount());
- chromaticaberrationSlider.OnSlide([=](wiEventArgs args) {
+ chromaticaberrationSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setChromaticAberrationAmount(args.fValue);
});
AddWidget(&chromaticaberrationSlider);
@@ -377,7 +376,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
fsrCheckBox.SetSize(XMFLOAT2(hei, hei));
fsrCheckBox.SetPos(XMFLOAT2(x, y += step));
fsrCheckBox.SetCheck(editor->renderPath->getFSREnabled());
- fsrCheckBox.OnClick([=](wiEventArgs args) {
+ fsrCheckBox.OnClick([=](wi::gui::EventArgs args) {
editor->renderPath->setFSREnabled(args.bValue);
});
AddWidget(&fsrCheckBox);
@@ -387,7 +386,7 @@ void PostprocessWindow::Create(EditorComponent* editor)
fsrSlider.SetSize(XMFLOAT2(100, hei));
fsrSlider.SetPos(XMFLOAT2(x + 100, y));
fsrSlider.SetValue(editor->renderPath->getFSRSharpness());
- fsrSlider.OnSlide([=](wiEventArgs args) {
+ fsrSlider.OnSlide([=](wi::gui::EventArgs args) {
editor->renderPath->setFSRSharpness(args.fValue);
});
AddWidget(&fsrSlider);
diff --git a/Editor/PostprocessWindow.h b/Editor/PostprocessWindow.h
index 4f4c5012f..cccad26ff 100644
--- a/Editor/PostprocessWindow.h
+++ b/Editor/PostprocessWindow.h
@@ -3,44 +3,44 @@
class EditorComponent;
-class PostprocessWindow : public wiWindow
+class PostprocessWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiSlider exposureSlider;
- wiCheckBox lensFlareCheckBox;
- wiCheckBox lightShaftsCheckBox;
- wiComboBox aoComboBox;
- wiSlider aoPowerSlider;
- wiSlider aoRangeSlider;
- wiSlider aoSampleCountSlider;
- wiCheckBox ssrCheckBox;
- wiCheckBox raytracedReflectionsCheckBox;
- wiCheckBox screenSpaceShadowsCheckBox;
- wiSlider screenSpaceShadowsStepCountSlider;
- wiSlider screenSpaceShadowsRangeSlider;
- wiCheckBox eyeAdaptionCheckBox;
- wiSlider eyeAdaptionKeySlider;
- wiSlider eyeAdaptionRateSlider;
- wiCheckBox motionBlurCheckBox;
- wiSlider motionBlurStrengthSlider;
- wiCheckBox depthOfFieldCheckBox;
- wiSlider depthOfFieldScaleSlider;
- wiCheckBox bloomCheckBox;
- wiSlider bloomStrengthSlider;
- wiCheckBox fxaaCheckBox;
- wiCheckBox colorGradingCheckBox;
- wiCheckBox ditherCheckBox;
- wiCheckBox sharpenFilterCheckBox;
- wiSlider sharpenFilterAmountSlider;
- wiCheckBox outlineCheckBox;
- wiSlider outlineThresholdSlider;
- wiSlider outlineThicknessSlider;
- wiCheckBox chromaticaberrationCheckBox;
- wiSlider chromaticaberrationSlider;
- wiCheckBox fsrCheckBox;
- wiSlider fsrSlider;
+ wi::gui::Slider exposureSlider;
+ wi::gui::CheckBox lensFlareCheckBox;
+ wi::gui::CheckBox lightShaftsCheckBox;
+ wi::gui::ComboBox aoComboBox;
+ wi::gui::Slider aoPowerSlider;
+ wi::gui::Slider aoRangeSlider;
+ wi::gui::Slider aoSampleCountSlider;
+ wi::gui::CheckBox ssrCheckBox;
+ wi::gui::CheckBox raytracedReflectionsCheckBox;
+ wi::gui::CheckBox screenSpaceShadowsCheckBox;
+ wi::gui::Slider screenSpaceShadowsStepCountSlider;
+ wi::gui::Slider screenSpaceShadowsRangeSlider;
+ wi::gui::CheckBox eyeAdaptionCheckBox;
+ wi::gui::Slider eyeAdaptionKeySlider;
+ wi::gui::Slider eyeAdaptionRateSlider;
+ wi::gui::CheckBox motionBlurCheckBox;
+ wi::gui::Slider motionBlurStrengthSlider;
+ wi::gui::CheckBox depthOfFieldCheckBox;
+ wi::gui::Slider depthOfFieldScaleSlider;
+ wi::gui::CheckBox bloomCheckBox;
+ wi::gui::Slider bloomStrengthSlider;
+ wi::gui::CheckBox fxaaCheckBox;
+ wi::gui::CheckBox colorGradingCheckBox;
+ wi::gui::CheckBox ditherCheckBox;
+ wi::gui::CheckBox sharpenFilterCheckBox;
+ wi::gui::Slider sharpenFilterAmountSlider;
+ wi::gui::CheckBox outlineCheckBox;
+ wi::gui::Slider outlineThresholdSlider;
+ wi::gui::Slider outlineThicknessSlider;
+ wi::gui::CheckBox chromaticaberrationCheckBox;
+ wi::gui::Slider chromaticaberrationSlider;
+ wi::gui::CheckBox fsrCheckBox;
+ wi::gui::Slider fsrSlider;
};
diff --git a/Editor/RendererWindow.cpp b/Editor/RendererWindow.cpp
index ef6c8bef1..333720484 100644
--- a/Editor/RendererWindow.cpp
+++ b/Editor/RendererWindow.cpp
@@ -1,17 +1,14 @@
#include "stdafx.h"
#include "RendererWindow.h"
-#include "RenderPath3D.h"
#include "Editor.h"
-#include "wiPhysicsEngine.h"
-
void RendererWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Renderer Window");
+ wi::gui::Window::Create("Renderer Window");
- wiRenderer::SetToDrawDebugEnvProbes(true);
- wiRenderer::SetToDrawGridHelper(true);
- wiRenderer::SetToDrawDebugCameras(true);
+ wi::renderer::SetToDrawDebugEnvProbes(true);
+ wi::renderer::SetToDrawGridHelper(true);
+ wi::renderer::SetToDrawDebugCameras(true);
SetSize(XMFLOAT2(580, 550));
@@ -23,8 +20,8 @@ void RendererWindow::Create(EditorComponent* editor)
vsyncCheckBox.SetPos(XMFLOAT2(x, y += step));
vsyncCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
vsyncCheckBox.SetCheck(editor->main->swapChain.desc.vsync);
- vsyncCheckBox.OnClick([=](wiEventArgs args) {
- wiEvent::SetVSync(args.bValue);
+ vsyncCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::eventhandler::SetVSync(args.bValue);
});
AddWidget(&vsyncCheckBox);
@@ -40,10 +37,10 @@ void RendererWindow::Create(EditorComponent* editor)
occlusionCullingCheckBox.SetScriptTip("SetOcclusionCullingEnabled(bool enabled)");
occlusionCullingCheckBox.SetPos(XMFLOAT2(x, y += step));
occlusionCullingCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- occlusionCullingCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetOcclusionCullingEnabled(args.bValue);
+ occlusionCullingCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetOcclusionCullingEnabled(args.bValue);
});
- occlusionCullingCheckBox.SetCheck(wiRenderer::GetOcclusionCullingEnabled());
+ occlusionCullingCheckBox.SetCheck(wi::renderer::GetOcclusionCullingEnabled());
AddWidget(&occlusionCullingCheckBox);
resolutionScaleSlider.Create(0.25f, 2.0f, 1.0f, 7.0f, "Resolution Scale: ");
@@ -51,7 +48,7 @@ void RendererWindow::Create(EditorComponent* editor)
resolutionScaleSlider.SetSize(XMFLOAT2(100, itemheight));
resolutionScaleSlider.SetPos(XMFLOAT2(x, y += step));
resolutionScaleSlider.SetValue(editor->resolutionScale);
- resolutionScaleSlider.OnSlide([editor](wiEventArgs args) {
+ resolutionScaleSlider.OnSlide([editor](wi::gui::EventArgs args) {
if (editor->resolutionScale != args.fValue)
{
editor->renderPath->resolutionScale = args.fValue;
@@ -65,69 +62,69 @@ void RendererWindow::Create(EditorComponent* editor)
surfelGICheckBox.SetTooltip("Surfel GI is a raytraced diffuse GI using raytracing and surface cache.");
surfelGICheckBox.SetPos(XMFLOAT2(x, y += step));
surfelGICheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- surfelGICheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetSurfelGIEnabled(args.bValue);
+ surfelGICheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetSurfelGIEnabled(args.bValue);
});
- surfelGICheckBox.SetCheck(wiRenderer::GetSurfelGIEnabled());
+ surfelGICheckBox.SetCheck(wi::renderer::GetSurfelGIEnabled());
AddWidget(&surfelGICheckBox);
surfelGIDebugCheckBox.Create("DEBUG: ");
surfelGIDebugCheckBox.SetTooltip("Toggle Surfel GI visualization.");
surfelGIDebugCheckBox.SetPos(XMFLOAT2(x + 122, y));
surfelGIDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- surfelGIDebugCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetSurfelGIDebugEnabled(args.bValue);
+ surfelGIDebugCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetSurfelGIDebugEnabled(args.bValue);
});
- surfelGIDebugCheckBox.SetCheck(wiRenderer::GetSurfelGIDebugEnabled());
+ surfelGIDebugCheckBox.SetCheck(wi::renderer::GetSurfelGIDebugEnabled());
AddWidget(&surfelGIDebugCheckBox);
voxelRadianceCheckBox.Create("Voxel GI: ");
voxelRadianceCheckBox.SetTooltip("Toggle voxel Global Illumination computation.");
voxelRadianceCheckBox.SetPos(XMFLOAT2(x, y += step));
voxelRadianceCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- voxelRadianceCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceEnabled(args.bValue);
+ voxelRadianceCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceEnabled(args.bValue);
});
- voxelRadianceCheckBox.SetCheck(wiRenderer::GetVoxelRadianceEnabled());
+ voxelRadianceCheckBox.SetCheck(wi::renderer::GetVoxelRadianceEnabled());
AddWidget(&voxelRadianceCheckBox);
voxelRadianceDebugCheckBox.Create("DEBUG: ");
voxelRadianceDebugCheckBox.SetTooltip("Toggle Voxel GI visualization.");
voxelRadianceDebugCheckBox.SetPos(XMFLOAT2(x + 122, y));
voxelRadianceDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- voxelRadianceDebugCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawVoxelHelper(args.bValue);
+ voxelRadianceDebugCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawVoxelHelper(args.bValue);
});
- voxelRadianceDebugCheckBox.SetCheck(wiRenderer::GetToDrawVoxelHelper());
+ voxelRadianceDebugCheckBox.SetCheck(wi::renderer::GetToDrawVoxelHelper());
AddWidget(&voxelRadianceDebugCheckBox);
voxelRadianceSecondaryBounceCheckBox.Create("Secondary Light Bounce: ");
voxelRadianceSecondaryBounceCheckBox.SetTooltip("Toggle secondary light bounce computation for Voxel GI.");
voxelRadianceSecondaryBounceCheckBox.SetPos(XMFLOAT2(x, y += step));
voxelRadianceSecondaryBounceCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- voxelRadianceSecondaryBounceCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceSecondaryBounceEnabled(args.bValue);
+ voxelRadianceSecondaryBounceCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceSecondaryBounceEnabled(args.bValue);
});
- voxelRadianceSecondaryBounceCheckBox.SetCheck(wiRenderer::GetVoxelRadianceSecondaryBounceEnabled());
+ voxelRadianceSecondaryBounceCheckBox.SetCheck(wi::renderer::GetVoxelRadianceSecondaryBounceEnabled());
AddWidget(&voxelRadianceSecondaryBounceCheckBox);
voxelRadianceReflectionsCheckBox.Create("Reflections: ");
voxelRadianceReflectionsCheckBox.SetTooltip("Toggle specular reflections computation for Voxel GI.");
voxelRadianceReflectionsCheckBox.SetPos(XMFLOAT2(x + 122, y));
voxelRadianceReflectionsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- voxelRadianceReflectionsCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceReflectionsEnabled(args.bValue);
+ voxelRadianceReflectionsCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceReflectionsEnabled(args.bValue);
});
- voxelRadianceReflectionsCheckBox.SetCheck(wiRenderer::GetVoxelRadianceReflectionsEnabled());
+ voxelRadianceReflectionsCheckBox.SetCheck(wi::renderer::GetVoxelRadianceReflectionsEnabled());
AddWidget(&voxelRadianceReflectionsCheckBox);
voxelRadianceVoxelSizeSlider.Create(0.25, 2, 1, 7, "Voxel GI Voxel Size: ");
voxelRadianceVoxelSizeSlider.SetTooltip("Adjust the voxel size for Voxel GI calculations.");
voxelRadianceVoxelSizeSlider.SetSize(XMFLOAT2(100, itemheight));
voxelRadianceVoxelSizeSlider.SetPos(XMFLOAT2(x, y += step));
- voxelRadianceVoxelSizeSlider.SetValue(wiRenderer::GetVoxelRadianceVoxelSize());
- voxelRadianceVoxelSizeSlider.OnSlide([&](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceVoxelSize(args.fValue);
+ voxelRadianceVoxelSizeSlider.SetValue(wi::renderer::GetVoxelRadianceVoxelSize());
+ voxelRadianceVoxelSizeSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceVoxelSize(args.fValue);
});
AddWidget(&voxelRadianceVoxelSizeSlider);
@@ -135,9 +132,9 @@ void RendererWindow::Create(EditorComponent* editor)
voxelRadianceConeTracingSlider.SetTooltip("Adjust the number of cones sampled in the radiance gathering phase.");
voxelRadianceConeTracingSlider.SetSize(XMFLOAT2(100, itemheight));
voxelRadianceConeTracingSlider.SetPos(XMFLOAT2(x, y += step));
- voxelRadianceConeTracingSlider.SetValue((float)wiRenderer::GetVoxelRadianceNumCones());
- voxelRadianceConeTracingSlider.OnSlide([&](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceNumCones(args.iValue);
+ voxelRadianceConeTracingSlider.SetValue((float)wi::renderer::GetVoxelRadianceNumCones());
+ voxelRadianceConeTracingSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceNumCones(args.iValue);
});
AddWidget(&voxelRadianceConeTracingSlider);
@@ -145,9 +142,9 @@ void RendererWindow::Create(EditorComponent* editor)
voxelRadianceRayStepSizeSlider.SetTooltip("Adjust the precision of ray marching for cone tracing step. Lower values = more precision but slower performance.");
voxelRadianceRayStepSizeSlider.SetSize(XMFLOAT2(100, itemheight));
voxelRadianceRayStepSizeSlider.SetPos(XMFLOAT2(x, y += step));
- voxelRadianceRayStepSizeSlider.SetValue(wiRenderer::GetVoxelRadianceRayStepSize());
- voxelRadianceRayStepSizeSlider.OnSlide([&](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceRayStepSize(args.fValue);
+ voxelRadianceRayStepSizeSlider.SetValue(wi::renderer::GetVoxelRadianceRayStepSize());
+ voxelRadianceRayStepSizeSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceRayStepSize(args.fValue);
});
AddWidget(&voxelRadianceRayStepSizeSlider);
@@ -155,9 +152,9 @@ void RendererWindow::Create(EditorComponent* editor)
voxelRadianceMaxDistanceSlider.SetTooltip("Adjust max raymarching distance for voxel GI.");
voxelRadianceMaxDistanceSlider.SetSize(XMFLOAT2(100, itemheight));
voxelRadianceMaxDistanceSlider.SetPos(XMFLOAT2(x, y += step));
- voxelRadianceMaxDistanceSlider.SetValue(wiRenderer::GetVoxelRadianceMaxDistance());
- voxelRadianceMaxDistanceSlider.OnSlide([&](wiEventArgs args) {
- wiRenderer::SetVoxelRadianceMaxDistance(args.fValue);
+ voxelRadianceMaxDistanceSlider.SetValue(wi::renderer::GetVoxelRadianceMaxDistance());
+ voxelRadianceMaxDistanceSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::renderer::SetVoxelRadianceMaxDistance(args.fValue);
});
AddWidget(&voxelRadianceMaxDistanceSlider);
@@ -165,73 +162,73 @@ void RendererWindow::Create(EditorComponent* editor)
wireFrameCheckBox.SetTooltip("Visualize the scene as a wireframe");
wireFrameCheckBox.SetPos(XMFLOAT2(x, y += step));
wireFrameCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- wireFrameCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetWireRender(args.bValue);
+ wireFrameCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetWireRender(args.bValue);
});
- wireFrameCheckBox.SetCheck(wiRenderer::IsWireRender());
+ wireFrameCheckBox.SetCheck(wi::renderer::IsWireRender());
AddWidget(&wireFrameCheckBox);
variableRateShadingClassificationCheckBox.Create("VRS Classification: ");
variableRateShadingClassificationCheckBox.SetTooltip("Enable classification of variable rate shading on the screen. Less important parts will be shaded with lesser resolution.\nRequires Tier2 support for variable shading rate");
variableRateShadingClassificationCheckBox.SetPos(XMFLOAT2(x, y += step));
variableRateShadingClassificationCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- variableRateShadingClassificationCheckBox.OnClick([editor](wiEventArgs args) {
- wiRenderer::SetVariableRateShadingClassification(args.bValue);
+ variableRateShadingClassificationCheckBox.OnClick([editor](wi::gui::EventArgs args) {
+ wi::renderer::SetVariableRateShadingClassification(args.bValue);
editor->ResizeBuffers();
});
- variableRateShadingClassificationCheckBox.SetCheck(wiRenderer::GetVariableRateShadingClassification());
+ variableRateShadingClassificationCheckBox.SetCheck(wi::renderer::GetVariableRateShadingClassification());
AddWidget(&variableRateShadingClassificationCheckBox);
- variableRateShadingClassificationCheckBox.SetEnabled(wiGraphics::GetDevice()->CheckCapability(wiGraphics::GraphicsDeviceCapability::VARIABLE_RATE_SHADING_TIER2));
+ variableRateShadingClassificationCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(wi::graphics::GraphicsDeviceCapability::VARIABLE_RATE_SHADING_TIER2));
variableRateShadingClassificationDebugCheckBox.Create("DEBUG: ");
variableRateShadingClassificationDebugCheckBox.SetTooltip("Toggle visualization of variable rate shading classification feature");
variableRateShadingClassificationDebugCheckBox.SetPos(XMFLOAT2(x + 122, y));
variableRateShadingClassificationDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- variableRateShadingClassificationDebugCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetVariableRateShadingClassificationDebug(args.bValue);
+ variableRateShadingClassificationDebugCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetVariableRateShadingClassificationDebug(args.bValue);
});
- variableRateShadingClassificationDebugCheckBox.SetCheck(wiRenderer::GetVariableRateShadingClassificationDebug());
+ variableRateShadingClassificationDebugCheckBox.SetCheck(wi::renderer::GetVariableRateShadingClassificationDebug());
AddWidget(&variableRateShadingClassificationDebugCheckBox);
- variableRateShadingClassificationDebugCheckBox.SetEnabled(wiGraphics::GetDevice()->CheckCapability(wiGraphics::GraphicsDeviceCapability::VARIABLE_RATE_SHADING_TIER2));
+ variableRateShadingClassificationDebugCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(wi::graphics::GraphicsDeviceCapability::VARIABLE_RATE_SHADING_TIER2));
advancedLightCullingCheckBox.Create("2.5D Light Culling: ");
advancedLightCullingCheckBox.SetTooltip("Enable a more aggressive light culling approach which can result in slower culling but faster rendering (Tiled renderer only)");
advancedLightCullingCheckBox.SetPos(XMFLOAT2(x, y += step));
advancedLightCullingCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- advancedLightCullingCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetAdvancedLightCulling(args.bValue);
+ advancedLightCullingCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetAdvancedLightCulling(args.bValue);
});
- advancedLightCullingCheckBox.SetCheck(wiRenderer::GetAdvancedLightCulling());
+ advancedLightCullingCheckBox.SetCheck(wi::renderer::GetAdvancedLightCulling());
AddWidget(&advancedLightCullingCheckBox);
debugLightCullingCheckBox.Create("DEBUG: ");
debugLightCullingCheckBox.SetTooltip("Toggle visualization of the screen space light culling heatmap grid (Tiled renderer only)");
debugLightCullingCheckBox.SetPos(XMFLOAT2(x + 122, y));
debugLightCullingCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- debugLightCullingCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetDebugLightCulling(args.bValue);
+ debugLightCullingCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetDebugLightCulling(args.bValue);
});
- debugLightCullingCheckBox.SetCheck(wiRenderer::GetDebugLightCulling());
+ debugLightCullingCheckBox.SetCheck(wi::renderer::GetDebugLightCulling());
AddWidget(&debugLightCullingCheckBox);
tessellationCheckBox.Create("Tessellation Enabled: ");
tessellationCheckBox.SetTooltip("Enable tessellation feature. You also need to specify a tessellation factor for individual objects.");
tessellationCheckBox.SetPos(XMFLOAT2(x, y += step));
tessellationCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- tessellationCheckBox.OnClick([=](wiEventArgs args) {
- wiRenderer::SetTessellationEnabled(args.bValue);
+ tessellationCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::renderer::SetTessellationEnabled(args.bValue);
});
- tessellationCheckBox.SetCheck(wiRenderer::GetTessellationEnabled());
+ tessellationCheckBox.SetCheck(wi::renderer::GetTessellationEnabled());
AddWidget(&tessellationCheckBox);
- tessellationCheckBox.SetEnabled(wiGraphics::GetDevice()->CheckCapability(wiGraphics::GraphicsDeviceCapability::TESSELLATION));
+ tessellationCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(wi::graphics::GraphicsDeviceCapability::TESSELLATION));
speedMultiplierSlider.Create(0, 4, 1, 100000, "Speed: ");
speedMultiplierSlider.SetTooltip("Adjust the global speed (time multiplier)");
speedMultiplierSlider.SetSize(XMFLOAT2(100, itemheight));
speedMultiplierSlider.SetPos(XMFLOAT2(x, y += step));
- speedMultiplierSlider.SetValue(wiRenderer::GetGameSpeed());
- speedMultiplierSlider.OnSlide([&](wiEventArgs args) {
- wiRenderer::SetGameSpeed(args.fValue);
+ speedMultiplierSlider.SetValue(wi::renderer::GetGameSpeed());
+ speedMultiplierSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::renderer::SetGameSpeed(args.fValue);
});
AddWidget(&speedMultiplierSlider);
@@ -239,9 +236,9 @@ void RendererWindow::Create(EditorComponent* editor)
transparentShadowsCheckBox.SetTooltip("Enables color tinted shadows and refraction caustics effects for transparent objects and water.");
transparentShadowsCheckBox.SetPos(XMFLOAT2(x, y += step));
transparentShadowsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- transparentShadowsCheckBox.SetCheck(wiRenderer::GetTransparentShadowsEnabled());
- transparentShadowsCheckBox.OnClick([=](wiEventArgs args) {
- wiRenderer::SetTransparentShadowsEnabled(args.bValue);
+ transparentShadowsCheckBox.SetCheck(wi::renderer::GetTransparentShadowsEnabled());
+ transparentShadowsCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::renderer::SetTransparentShadowsEnabled(args.bValue);
});
AddWidget(&transparentShadowsCheckBox);
@@ -249,20 +246,20 @@ void RendererWindow::Create(EditorComponent* editor)
shadowTypeComboBox.SetSize(XMFLOAT2(100, itemheight));
shadowTypeComboBox.SetPos(XMFLOAT2(x, y += step));
shadowTypeComboBox.AddItem("Shadowmaps");
- if (wiGraphics::GetDevice()->CheckCapability(wiGraphics::GraphicsDeviceCapability::RAYTRACING))
+ if (wi::graphics::GetDevice()->CheckCapability(wi::graphics::GraphicsDeviceCapability::RAYTRACING))
{
shadowTypeComboBox.AddItem("Ray traced");
}
- shadowTypeComboBox.OnSelect([&](wiEventArgs args) {
+ shadowTypeComboBox.OnSelect([&](wi::gui::EventArgs args) {
switch (args.iValue)
{
default:
case 0:
- wiRenderer::SetRaytracedShadowsEnabled(false);
+ wi::renderer::SetRaytracedShadowsEnabled(false);
break;
case 1:
- wiRenderer::SetRaytracedShadowsEnabled(true);
+ wi::renderer::SetRaytracedShadowsEnabled(true);
break;
}
});
@@ -280,30 +277,30 @@ void RendererWindow::Create(EditorComponent* editor)
shadowProps2DComboBox.AddItem("1024");
shadowProps2DComboBox.AddItem("2048");
shadowProps2DComboBox.AddItem("4096");
- shadowProps2DComboBox.OnSelect([&](wiEventArgs args) {
+ shadowProps2DComboBox.OnSelect([&](wi::gui::EventArgs args) {
switch (args.iValue)
{
case 0:
- wiRenderer::SetShadowProps2D(0, -1);
+ wi::renderer::SetShadowProps2D(0, -1);
break;
case 1:
- wiRenderer::SetShadowProps2D(128, -1);
+ wi::renderer::SetShadowProps2D(128, -1);
break;
case 2:
- wiRenderer::SetShadowProps2D(256, -1);
+ wi::renderer::SetShadowProps2D(256, -1);
break;
case 3:
- wiRenderer::SetShadowProps2D(512, -1);
+ wi::renderer::SetShadowProps2D(512, -1);
break;
case 4:
- wiRenderer::SetShadowProps2D(1024, -1);
+ wi::renderer::SetShadowProps2D(1024, -1);
break;
case 5:
- wiRenderer::SetShadowProps2D(2048, -1);
+ wi::renderer::SetShadowProps2D(2048, -1);
break;
case 6:
- wiRenderer::SetShadowProps2D(4096, -1);
+ wi::renderer::SetShadowProps2D(4096, -1);
break;
default:
break;
@@ -324,29 +321,29 @@ void RendererWindow::Create(EditorComponent* editor)
shadowPropsCubeComboBox.AddItem("1024");
shadowPropsCubeComboBox.AddItem("2048");
shadowPropsCubeComboBox.AddItem("4096");
- shadowPropsCubeComboBox.OnSelect([&](wiEventArgs args) {
+ shadowPropsCubeComboBox.OnSelect([&](wi::gui::EventArgs args) {
switch (args.iValue)
{
case 0:
- wiRenderer::SetShadowPropsCube(0, -1);
+ wi::renderer::SetShadowPropsCube(0, -1);
break;
case 1:
- wiRenderer::SetShadowPropsCube(128, -1);
+ wi::renderer::SetShadowPropsCube(128, -1);
break;
case 2:
- wiRenderer::SetShadowPropsCube(256, -1);
+ wi::renderer::SetShadowPropsCube(256, -1);
break;
case 3:
- wiRenderer::SetShadowPropsCube(512, -1);
+ wi::renderer::SetShadowPropsCube(512, -1);
break;
case 4:
- wiRenderer::SetShadowPropsCube(1024, -1);
+ wi::renderer::SetShadowPropsCube(1024, -1);
break;
case 5:
- wiRenderer::SetShadowPropsCube(2048, -1);
+ wi::renderer::SetShadowPropsCube(2048, -1);
break;
case 6:
- wiRenderer::SetShadowPropsCube(4096, -1);
+ wi::renderer::SetShadowPropsCube(4096, -1);
break;
default:
break;
@@ -364,7 +361,7 @@ void RendererWindow::Create(EditorComponent* editor)
MSAAComboBox.AddItem("2");
MSAAComboBox.AddItem("4");
MSAAComboBox.AddItem("8");
- MSAAComboBox.OnSelect([=](wiEventArgs args) {
+ MSAAComboBox.OnSelect([=](wi::gui::EventArgs args) {
switch (args.iValue)
{
case 0:
@@ -392,10 +389,10 @@ void RendererWindow::Create(EditorComponent* editor)
temporalAACheckBox.SetTooltip("Toggle Temporal Anti Aliasing. It is a supersampling techique which is performed across multiple frames.");
temporalAACheckBox.SetPos(XMFLOAT2(x, y += step));
temporalAACheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- temporalAACheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetTemporalAAEnabled(args.bValue);
+ temporalAACheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetTemporalAAEnabled(args.bValue);
});
- temporalAACheckBox.SetCheck(wiRenderer::GetTemporalAAEnabled());
+ temporalAACheckBox.SetCheck(wi::renderer::GetTemporalAAEnabled());
AddWidget(&temporalAACheckBox);
temporalAADebugCheckBox.Create("DEBUGJitter: ");
@@ -403,10 +400,10 @@ void RendererWindow::Create(EditorComponent* editor)
temporalAADebugCheckBox.SetTooltip("Disable blending of frame history. Camera Subpixel jitter will be visible.");
temporalAADebugCheckBox.SetPos(XMFLOAT2(x + 122, y));
temporalAADebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- temporalAADebugCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetTemporalAADebugEnabled(args.bValue);
+ temporalAADebugCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetTemporalAADebugEnabled(args.bValue);
});
- temporalAADebugCheckBox.SetCheck(wiRenderer::GetTemporalAADebugEnabled());
+ temporalAADebugCheckBox.SetCheck(wi::renderer::GetTemporalAADebugEnabled());
AddWidget(&temporalAADebugCheckBox);
textureQualityComboBox.Create("Texture Quality: ");
@@ -416,28 +413,28 @@ void RendererWindow::Create(EditorComponent* editor)
textureQualityComboBox.AddItem("Bilinear");
textureQualityComboBox.AddItem("Trilinear");
textureQualityComboBox.AddItem("Anisotropic");
- textureQualityComboBox.OnSelect([&](wiEventArgs args) {
- wiGraphics::SamplerDesc desc = wiRenderer::GetSampler(SAMPLER_OBJECTSHADER)->GetDesc();
+ textureQualityComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ wi::graphics::SamplerDesc desc = wi::renderer::GetSampler(wi::enums::SAMPLER_OBJECTSHADER)->GetDesc();
switch (args.iValue)
{
case 0:
- desc.filter = wiGraphics::Filter::MIN_MAG_MIP_POINT;
+ desc.filter = wi::graphics::Filter::MIN_MAG_MIP_POINT;
break;
case 1:
- desc.filter = wiGraphics::Filter::MIN_MAG_LINEAR_MIP_POINT;
+ desc.filter = wi::graphics::Filter::MIN_MAG_LINEAR_MIP_POINT;
break;
case 2:
- desc.filter = wiGraphics::Filter::MIN_MAG_MIP_LINEAR;
+ desc.filter = wi::graphics::Filter::MIN_MAG_MIP_LINEAR;
break;
case 3:
- desc.filter = wiGraphics::Filter::ANISOTROPIC;
+ desc.filter = wi::graphics::Filter::ANISOTROPIC;
break;
default:
break;
}
- wiRenderer::ModifyObjectSampler(desc);
+ wi::renderer::ModifyObjectSampler(desc);
});
textureQualityComboBox.SetSelected(3);
@@ -448,10 +445,10 @@ void RendererWindow::Create(EditorComponent* editor)
mipLodBiasSlider.SetTooltip("Bias the rendered mip map level of the material textures.");
mipLodBiasSlider.SetSize(XMFLOAT2(100, itemheight));
mipLodBiasSlider.SetPos(XMFLOAT2(x, y += step));
- mipLodBiasSlider.OnSlide([&](wiEventArgs args) {
- wiGraphics::SamplerDesc desc = wiRenderer::GetSampler(SAMPLER_OBJECTSHADER)->GetDesc();
- desc.mip_lod_bias = wiMath::Clamp(args.fValue, -15.9f, 15.9f);
- wiRenderer::ModifyObjectSampler(desc);
+ mipLodBiasSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::graphics::SamplerDesc desc = wi::renderer::GetSampler(wi::enums::SAMPLER_OBJECTSHADER)->GetDesc();
+ desc.mip_lod_bias = wi::math::Clamp(args.fValue, -15.9f, 15.9f);
+ wi::renderer::ModifyObjectSampler(desc);
});
AddWidget(&mipLodBiasSlider);
@@ -459,9 +456,9 @@ void RendererWindow::Create(EditorComponent* editor)
raytraceBounceCountSlider.SetTooltip("How many light bounces to compute when doing ray tracing.");
raytraceBounceCountSlider.SetSize(XMFLOAT2(100, itemheight));
raytraceBounceCountSlider.SetPos(XMFLOAT2(x, y += step));
- raytraceBounceCountSlider.SetValue((float)wiRenderer::GetRaytraceBounceCount());
- raytraceBounceCountSlider.OnSlide([&](wiEventArgs args) {
- wiRenderer::SetRaytraceBounceCount((uint32_t)args.iValue);
+ raytraceBounceCountSlider.SetValue((float)wi::renderer::GetRaytraceBounceCount());
+ raytraceBounceCountSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::renderer::SetRaytraceBounceCount((uint32_t)args.iValue);
});
AddWidget(&raytraceBounceCountSlider);
@@ -474,10 +471,10 @@ void RendererWindow::Create(EditorComponent* editor)
physicsDebugCheckBox.SetTooltip("Visualize the physics world");
physicsDebugCheckBox.SetPos(XMFLOAT2(x, y += step));
physicsDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- physicsDebugCheckBox.OnClick([](wiEventArgs args) {
- wiPhysicsEngine::SetDebugDrawEnabled(args.bValue);
+ physicsDebugCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::physics::SetDebugDrawEnabled(args.bValue);
});
- physicsDebugCheckBox.SetCheck(wiPhysicsEngine::IsDebugDrawEnabled());
+ physicsDebugCheckBox.SetCheck(wi::physics::IsDebugDrawEnabled());
AddWidget(&physicsDebugCheckBox);
partitionBoxesCheckBox.Create("SPTree visualizer: ");
@@ -485,10 +482,10 @@ void RendererWindow::Create(EditorComponent* editor)
partitionBoxesCheckBox.SetScriptTip("SetDebugPartitionTreeEnabled(bool enabled)");
partitionBoxesCheckBox.SetPos(XMFLOAT2(x, y += step));
partitionBoxesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- partitionBoxesCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawDebugPartitionTree(args.bValue);
+ partitionBoxesCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawDebugPartitionTree(args.bValue);
});
- partitionBoxesCheckBox.SetCheck(wiRenderer::GetToDrawDebugPartitionTree());
+ partitionBoxesCheckBox.SetCheck(wi::renderer::GetToDrawDebugPartitionTree());
AddWidget(&partitionBoxesCheckBox);
boneLinesCheckBox.Create("Bone line visualizer: ");
@@ -496,10 +493,10 @@ void RendererWindow::Create(EditorComponent* editor)
boneLinesCheckBox.SetScriptTip("SetDebugBonesEnabled(bool enabled)");
boneLinesCheckBox.SetPos(XMFLOAT2(x, y += step));
boneLinesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- boneLinesCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawDebugBoneLines(args.bValue);
+ boneLinesCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawDebugBoneLines(args.bValue);
});
- boneLinesCheckBox.SetCheck(wiRenderer::GetToDrawDebugBoneLines());
+ boneLinesCheckBox.SetCheck(wi::renderer::GetToDrawDebugBoneLines());
AddWidget(&boneLinesCheckBox);
debugEmittersCheckBox.Create("Emitter visualizer: ");
@@ -507,10 +504,10 @@ void RendererWindow::Create(EditorComponent* editor)
debugEmittersCheckBox.SetScriptTip("SetDebugEmittersEnabled(bool enabled)");
debugEmittersCheckBox.SetPos(XMFLOAT2(x, y += step));
debugEmittersCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- debugEmittersCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawDebugEmitters(args.bValue);
+ debugEmittersCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawDebugEmitters(args.bValue);
});
- debugEmittersCheckBox.SetCheck(wiRenderer::GetToDrawDebugEmitters());
+ debugEmittersCheckBox.SetCheck(wi::renderer::GetToDrawDebugEmitters());
AddWidget(&debugEmittersCheckBox);
debugForceFieldsCheckBox.Create("Force Field visualizer: ");
@@ -518,50 +515,50 @@ void RendererWindow::Create(EditorComponent* editor)
debugForceFieldsCheckBox.SetScriptTip("SetDebugForceFieldsEnabled(bool enabled)");
debugForceFieldsCheckBox.SetPos(XMFLOAT2(x, y += step));
debugForceFieldsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- debugForceFieldsCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawDebugForceFields(args.bValue);
+ debugForceFieldsCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawDebugForceFields(args.bValue);
});
- debugForceFieldsCheckBox.SetCheck(wiRenderer::GetToDrawDebugForceFields());
+ debugForceFieldsCheckBox.SetCheck(wi::renderer::GetToDrawDebugForceFields());
AddWidget(&debugForceFieldsCheckBox);
debugRaytraceBVHCheckBox.Create("Raytrace BVH visualizer: ");
debugRaytraceBVHCheckBox.SetTooltip("Visualize scene BVH if raytracing is enabled");
debugRaytraceBVHCheckBox.SetPos(XMFLOAT2(x, y += step));
debugRaytraceBVHCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- debugRaytraceBVHCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetRaytraceDebugBVHVisualizerEnabled(args.bValue);
+ debugRaytraceBVHCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetRaytraceDebugBVHVisualizerEnabled(args.bValue);
});
- debugRaytraceBVHCheckBox.SetCheck(wiRenderer::GetRaytraceDebugBVHVisualizerEnabled());
+ debugRaytraceBVHCheckBox.SetCheck(wi::renderer::GetRaytraceDebugBVHVisualizerEnabled());
AddWidget(&debugRaytraceBVHCheckBox);
envProbesCheckBox.Create("Env probe visualizer: ");
envProbesCheckBox.SetTooltip("Toggle visualization of environment probes as reflective spheres");
envProbesCheckBox.SetPos(XMFLOAT2(x, y += step));
envProbesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- envProbesCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawDebugEnvProbes(args.bValue);
+ envProbesCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawDebugEnvProbes(args.bValue);
});
- envProbesCheckBox.SetCheck(wiRenderer::GetToDrawDebugEnvProbes());
+ envProbesCheckBox.SetCheck(wi::renderer::GetToDrawDebugEnvProbes());
AddWidget(&envProbesCheckBox);
cameraVisCheckBox.Create("Camera Proxy visualizer: ");
cameraVisCheckBox.SetTooltip("Toggle visualization of camera proxies in the scene");
cameraVisCheckBox.SetPos(XMFLOAT2(x, y += step));
cameraVisCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- cameraVisCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawDebugCameras(args.bValue);
+ cameraVisCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawDebugCameras(args.bValue);
});
- cameraVisCheckBox.SetCheck(wiRenderer::GetToDrawDebugCameras());
+ cameraVisCheckBox.SetCheck(wi::renderer::GetToDrawDebugCameras());
AddWidget(&cameraVisCheckBox);
gridHelperCheckBox.Create("Grid helper: ");
gridHelperCheckBox.SetTooltip("Toggle showing of unit visualizer grid in the world origin");
gridHelperCheckBox.SetPos(XMFLOAT2(x, y += step));
gridHelperCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- gridHelperCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetToDrawGridHelper(args.bValue);
+ gridHelperCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetToDrawGridHelper(args.bValue);
});
- gridHelperCheckBox.SetCheck(wiRenderer::GetToDrawGridHelper());
+ gridHelperCheckBox.SetCheck(wi::renderer::GetToDrawGridHelper());
AddWidget(&gridHelperCheckBox);
@@ -641,10 +638,10 @@ void RendererWindow::Create(EditorComponent* editor)
freezeCullingCameraCheckBox.SetTooltip("Freeze culling camera update. Scene culling will not be updated with the view");
freezeCullingCameraCheckBox.SetPos(XMFLOAT2(x, y += step * 2));
freezeCullingCameraCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- freezeCullingCameraCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetFreezeCullingCameraEnabled(args.bValue);
+ freezeCullingCameraCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetFreezeCullingCameraEnabled(args.bValue);
});
- freezeCullingCameraCheckBox.SetCheck(wiRenderer::GetFreezeCullingCameraEnabled());
+ freezeCullingCameraCheckBox.SetCheck(wi::renderer::GetFreezeCullingCameraEnabled());
AddWidget(&freezeCullingCameraCheckBox);
@@ -653,10 +650,10 @@ void RendererWindow::Create(EditorComponent* editor)
disableAlbedoMapsCheckBox.SetTooltip("Disables albedo maps on objects for easier lighting debugging");
disableAlbedoMapsCheckBox.SetPos(XMFLOAT2(x, y += step));
disableAlbedoMapsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- disableAlbedoMapsCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetDisableAlbedoMaps(args.bValue);
+ disableAlbedoMapsCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetDisableAlbedoMaps(args.bValue);
});
- disableAlbedoMapsCheckBox.SetCheck(wiRenderer::IsDisableAlbedoMaps());
+ disableAlbedoMapsCheckBox.SetCheck(wi::renderer::IsDisableAlbedoMaps());
AddWidget(&disableAlbedoMapsCheckBox);
@@ -664,10 +661,10 @@ void RendererWindow::Create(EditorComponent* editor)
forceDiffuseLightingCheckBox.SetTooltip("Sets every surface fully diffuse, with zero specularity");
forceDiffuseLightingCheckBox.SetPos(XMFLOAT2(x, y += step));
forceDiffuseLightingCheckBox.SetSize(XMFLOAT2(itemheight, itemheight));
- forceDiffuseLightingCheckBox.OnClick([](wiEventArgs args) {
- wiRenderer::SetForceDiffuseLighting(args.bValue);
+ forceDiffuseLightingCheckBox.OnClick([](wi::gui::EventArgs args) {
+ wi::renderer::SetForceDiffuseLighting(args.bValue);
});
- forceDiffuseLightingCheckBox.SetCheck(wiRenderer::IsForceDiffuseLighting());
+ forceDiffuseLightingCheckBox.SetCheck(wi::renderer::IsForceDiffuseLighting());
AddWidget(&forceDiffuseLightingCheckBox);
@@ -723,24 +720,24 @@ uint32_t RendererWindow::GetPickType() const
return pickType;
}
-void RendererWindow::UpdateSwapChainFormats(wiGraphics::SwapChain* swapChain)
+void RendererWindow::UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain)
{
swapchainComboBox.OnSelect(nullptr);
swapchainComboBox.ClearItems();
- swapchainComboBox.AddItem("SDR 8bit", static_cast(wiGraphics::Format::R8G8B8A8_UNORM));
- swapchainComboBox.AddItem("SDR 10bit", static_cast(wiGraphics::Format::R10G10B10A2_UNORM));
- if (wiGraphics::GetDevice()->IsSwapChainSupportsHDR(swapChain))
+ swapchainComboBox.AddItem("SDR 8bit", static_cast(wi::graphics::Format::R8G8B8A8_UNORM));
+ swapchainComboBox.AddItem("SDR 10bit", static_cast(wi::graphics::Format::R10G10B10A2_UNORM));
+ if (wi::graphics::GetDevice()->IsSwapChainSupportsHDR(swapChain))
{
- swapchainComboBox.AddItem("HDR 10bit", static_cast(wiGraphics::Format::R10G10B10A2_UNORM));
- swapchainComboBox.AddItem("HDR 16bit", static_cast(wiGraphics::Format::R16G16B16A16_FLOAT));
+ swapchainComboBox.AddItem("HDR 10bit", static_cast(wi::graphics::Format::R10G10B10A2_UNORM));
+ swapchainComboBox.AddItem("HDR 16bit", static_cast(wi::graphics::Format::R16G16B16A16_FLOAT));
switch (swapChain->desc.format)
{
default:
- case wiGraphics::Format::R8G8B8A8_UNORM:
+ case wi::graphics::Format::R8G8B8A8_UNORM:
swapchainComboBox.SetSelected(0);
break;
- case wiGraphics::Format::R10G10B10A2_UNORM:
+ case wi::graphics::Format::R10G10B10A2_UNORM:
if (swapChain->desc.allow_hdr)
{
swapchainComboBox.SetSelected(2);
@@ -750,7 +747,7 @@ void RendererWindow::UpdateSwapChainFormats(wiGraphics::SwapChain* swapChain)
swapchainComboBox.SetSelected(1);
}
break;
- case wiGraphics::Format::R16G16B16A16_FLOAT:
+ case wi::graphics::Format::R16G16B16A16_FLOAT:
swapchainComboBox.SetSelected(4);
break;
}
@@ -760,21 +757,21 @@ void RendererWindow::UpdateSwapChainFormats(wiGraphics::SwapChain* swapChain)
switch (swapChain->desc.format)
{
default:
- case wiGraphics::Format::R8G8B8A8_UNORM:
+ case wi::graphics::Format::R8G8B8A8_UNORM:
swapchainComboBox.SetSelected(0);
break;
- case wiGraphics::Format::R10G10B10A2_UNORM:
+ case wi::graphics::Format::R10G10B10A2_UNORM:
swapchainComboBox.SetSelected(1);
break;
- case wiGraphics::Format::R16G16B16A16_FLOAT:
+ case wi::graphics::Format::R16G16B16A16_FLOAT:
swapchainComboBox.SetSelected(1);
break;
}
}
- swapchainComboBox.OnSelect([=](wiEventArgs args) {
+ swapchainComboBox.OnSelect([=](wi::gui::EventArgs args) {
- swapChain->desc.format = (wiGraphics::Format)args.userdata;
+ swapChain->desc.format = (wi::graphics::Format)args.userdata;
switch (args.iValue)
{
default:
@@ -788,7 +785,7 @@ void RendererWindow::UpdateSwapChainFormats(wiGraphics::SwapChain* swapChain)
break;
}
- bool success = wiGraphics::GetDevice()->CreateSwapChain(&swapChain->desc, nullptr, swapChain);
+ bool success = wi::graphics::GetDevice()->CreateSwapChain(&swapChain->desc, nullptr, swapChain);
assert(success);
});
}
diff --git a/Editor/RendererWindow.h b/Editor/RendererWindow.h
index aa631543e..e933792d0 100644
--- a/Editor/RendererWindow.h
+++ b/Editor/RendererWindow.h
@@ -6,7 +6,7 @@ class EditorComponent;
enum PICKTYPE
{
PICK_VOID = 0,
- PICK_OBJECT = RENDERTYPE_OPAQUE | RENDERTYPE_TRANSPARENT | RENDERTYPE_WATER,
+ PICK_OBJECT = wi::enums::RENDERTYPE_ALL,
PICK_LIGHT = 8,
PICK_DECAL = 16,
PICK_ENVPROBE = 32,
@@ -18,68 +18,68 @@ enum PICKTYPE
PICK_SOUND = 2048,
};
-class RendererWindow : public wiWindow
+class RendererWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editorcomponent);
- wiCheckBox vsyncCheckBox;
- wiComboBox swapchainComboBox;
- wiCheckBox occlusionCullingCheckBox;
- wiSlider resolutionScaleSlider;
- wiCheckBox surfelGICheckBox;
- wiCheckBox surfelGIDebugCheckBox;
- wiCheckBox voxelRadianceCheckBox;
- wiCheckBox voxelRadianceDebugCheckBox;
- wiCheckBox voxelRadianceSecondaryBounceCheckBox;
- wiCheckBox voxelRadianceReflectionsCheckBox;
- wiSlider voxelRadianceVoxelSizeSlider;
- wiSlider voxelRadianceConeTracingSlider;
- wiSlider voxelRadianceRayStepSizeSlider;
- wiSlider voxelRadianceMaxDistanceSlider;
- wiCheckBox physicsDebugCheckBox;
- wiCheckBox partitionBoxesCheckBox;
- wiCheckBox boneLinesCheckBox;
- wiCheckBox debugEmittersCheckBox;
- wiCheckBox debugForceFieldsCheckBox;
- wiCheckBox debugRaytraceBVHCheckBox;
- wiCheckBox wireFrameCheckBox;
- wiCheckBox variableRateShadingClassificationCheckBox;
- wiCheckBox variableRateShadingClassificationDebugCheckBox;
- wiCheckBox advancedLightCullingCheckBox;
- wiCheckBox debugLightCullingCheckBox;
- wiCheckBox tessellationCheckBox;
- wiCheckBox envProbesCheckBox;
- wiCheckBox gridHelperCheckBox;
- wiCheckBox cameraVisCheckBox;
- wiCheckBox pickTypeObjectCheckBox;
- wiCheckBox pickTypeEnvProbeCheckBox;
- wiCheckBox pickTypeLightCheckBox;
- wiCheckBox pickTypeDecalCheckBox;
- wiCheckBox pickTypeForceFieldCheckBox;
- wiCheckBox pickTypeEmitterCheckBox;
- wiCheckBox pickTypeHairCheckBox;
- wiCheckBox pickTypeCameraCheckBox;
- wiCheckBox pickTypeArmatureCheckBox;
- wiCheckBox pickTypeSoundCheckBox;
- wiSlider speedMultiplierSlider;
- wiCheckBox transparentShadowsCheckBox;
- wiComboBox shadowTypeComboBox;
- wiComboBox shadowProps2DComboBox;
- wiComboBox shadowPropsCubeComboBox;
- wiComboBox MSAAComboBox;
- wiCheckBox temporalAACheckBox;
- wiCheckBox temporalAADebugCheckBox;
- wiComboBox textureQualityComboBox;
- wiSlider mipLodBiasSlider;
- wiSlider raytraceBounceCountSlider;
+ wi::gui::CheckBox vsyncCheckBox;
+ wi::gui::ComboBox swapchainComboBox;
+ wi::gui::CheckBox occlusionCullingCheckBox;
+ wi::gui::Slider resolutionScaleSlider;
+ wi::gui::CheckBox surfelGICheckBox;
+ wi::gui::CheckBox surfelGIDebugCheckBox;
+ wi::gui::CheckBox voxelRadianceCheckBox;
+ wi::gui::CheckBox voxelRadianceDebugCheckBox;
+ wi::gui::CheckBox voxelRadianceSecondaryBounceCheckBox;
+ wi::gui::CheckBox voxelRadianceReflectionsCheckBox;
+ wi::gui::Slider voxelRadianceVoxelSizeSlider;
+ wi::gui::Slider voxelRadianceConeTracingSlider;
+ wi::gui::Slider voxelRadianceRayStepSizeSlider;
+ wi::gui::Slider voxelRadianceMaxDistanceSlider;
+ wi::gui::CheckBox physicsDebugCheckBox;
+ wi::gui::CheckBox partitionBoxesCheckBox;
+ wi::gui::CheckBox boneLinesCheckBox;
+ wi::gui::CheckBox debugEmittersCheckBox;
+ wi::gui::CheckBox debugForceFieldsCheckBox;
+ wi::gui::CheckBox debugRaytraceBVHCheckBox;
+ wi::gui::CheckBox wireFrameCheckBox;
+ wi::gui::CheckBox variableRateShadingClassificationCheckBox;
+ wi::gui::CheckBox variableRateShadingClassificationDebugCheckBox;
+ wi::gui::CheckBox advancedLightCullingCheckBox;
+ wi::gui::CheckBox debugLightCullingCheckBox;
+ wi::gui::CheckBox tessellationCheckBox;
+ wi::gui::CheckBox envProbesCheckBox;
+ wi::gui::CheckBox gridHelperCheckBox;
+ wi::gui::CheckBox cameraVisCheckBox;
+ wi::gui::CheckBox pickTypeObjectCheckBox;
+ wi::gui::CheckBox pickTypeEnvProbeCheckBox;
+ wi::gui::CheckBox pickTypeLightCheckBox;
+ wi::gui::CheckBox pickTypeDecalCheckBox;
+ wi::gui::CheckBox pickTypeForceFieldCheckBox;
+ wi::gui::CheckBox pickTypeEmitterCheckBox;
+ wi::gui::CheckBox pickTypeHairCheckBox;
+ wi::gui::CheckBox pickTypeCameraCheckBox;
+ wi::gui::CheckBox pickTypeArmatureCheckBox;
+ wi::gui::CheckBox pickTypeSoundCheckBox;
+ wi::gui::Slider speedMultiplierSlider;
+ wi::gui::CheckBox transparentShadowsCheckBox;
+ wi::gui::ComboBox shadowTypeComboBox;
+ wi::gui::ComboBox shadowProps2DComboBox;
+ wi::gui::ComboBox shadowPropsCubeComboBox;
+ wi::gui::ComboBox MSAAComboBox;
+ wi::gui::CheckBox temporalAACheckBox;
+ wi::gui::CheckBox temporalAADebugCheckBox;
+ wi::gui::ComboBox textureQualityComboBox;
+ wi::gui::Slider mipLodBiasSlider;
+ wi::gui::Slider raytraceBounceCountSlider;
- wiCheckBox freezeCullingCameraCheckBox;
- wiCheckBox disableAlbedoMapsCheckBox;
- wiCheckBox forceDiffuseLightingCheckBox;
+ wi::gui::CheckBox freezeCullingCameraCheckBox;
+ wi::gui::CheckBox disableAlbedoMapsCheckBox;
+ wi::gui::CheckBox forceDiffuseLightingCheckBox;
uint32_t GetPickType() const;
- void UpdateSwapChainFormats(wiGraphics::SwapChain* swapChain);
+ void UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain);
};
diff --git a/Editor/SoundWindow.cpp b/Editor/SoundWindow.cpp
index 244f73db2..c3708bf1e 100644
--- a/Editor/SoundWindow.cpp
+++ b/Editor/SoundWindow.cpp
@@ -3,13 +3,13 @@
#include "wiAudio.h"
#include "Editor.h"
-using namespace wiGraphics;
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::graphics;
+using namespace wi::ecs;
+using namespace wi::scene;
void SoundWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Sound Window");
+ wi::gui::Window::Create("Sound Window");
SetSize(XMFLOAT2(440, 220));
float x = 20;
@@ -20,8 +20,8 @@ void SoundWindow::Create(EditorComponent* editor)
reverbComboBox.Create("Reverb: ");
reverbComboBox.SetPos(XMFLOAT2(x + 80, y += step));
reverbComboBox.SetSize(XMFLOAT2(180, hei));
- reverbComboBox.OnSelect([&](wiEventArgs args) {
- wiAudio::SetReverb((wiAudio::REVERB_PRESET)args.iValue);
+ reverbComboBox.OnSelect([&](wi::gui::EventArgs args) {
+ wi::audio::SetReverb((wi::audio::REVERB_PRESET)args.iValue);
});
reverbComboBox.AddItem("DEFAULT");
reverbComboBox.AddItem("GENERIC");
@@ -62,13 +62,13 @@ void SoundWindow::Create(EditorComponent* editor)
addButton.SetTooltip("Add a sound file to the scene.");
addButton.SetPos(XMFLOAT2(x, y += step));
addButton.SetSize(XMFLOAT2(80, hei));
- addButton.OnClick([=](wiEventArgs args) {
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ addButton.OnClick([=](wi::gui::EventArgs args) {
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Sound";
- params.extensions = wiResourceManager::GetSupportedSoundExtensions();
- wiHelper::FileDialog(params, [=](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ params.extensions = wi::resourcemanager::GetSupportedSoundExtensions();
+ wi::helper::FileDialog(params, [=](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
Entity entity = GetScene().Entity_CreateSound("editorSound", fileName);
editor->ClearSelected();
editor->AddSelected(entity);
@@ -88,11 +88,11 @@ void SoundWindow::Create(EditorComponent* editor)
nameField.SetTooltip("Enter a sound name to identify this entity...");
nameField.SetPos(XMFLOAT2(x, y += step));
nameField.SetSize(XMFLOAT2(300, hei));
- nameField.OnInputAccepted([=](wiEventArgs args) {
- NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
+ nameField.OnInputAccepted([=](wi::gui::EventArgs args) {
+ NameComponent* name = wi::scene::GetScene().names.GetComponent(entity);
if (name == nullptr)
{
- name = &wiScene::GetScene().names.Create(entity);
+ name = &wi::scene::GetScene().names.Create(entity);
}
*name = args.sValue;
@@ -105,7 +105,7 @@ void SoundWindow::Create(EditorComponent* editor)
playstopButton.SetTooltip("Play/Stop selected sound instance.");
playstopButton.SetPos(XMFLOAT2(x, y += step));
playstopButton.SetSize(XMFLOAT2(80, hei));
- playstopButton.OnClick([&](wiEventArgs args) {
+ playstopButton.OnClick([&](wi::gui::EventArgs args) {
SoundComponent* sound = GetScene().sounds.GetComponent(entity);
if (sound != nullptr)
{
@@ -128,7 +128,7 @@ void SoundWindow::Create(EditorComponent* editor)
loopedCheckbox.SetTooltip("Enable looping for the selected sound instance.");
loopedCheckbox.SetPos(XMFLOAT2(x + 150, y));
loopedCheckbox.SetSize(XMFLOAT2(hei, hei));
- loopedCheckbox.OnClick([&](wiEventArgs args) {
+ loopedCheckbox.OnClick([&](wi::gui::EventArgs args) {
SoundComponent* sound = GetScene().sounds.GetComponent(entity);
if (sound != nullptr)
{
@@ -142,12 +142,12 @@ void SoundWindow::Create(EditorComponent* editor)
reverbCheckbox.SetTooltip("Enable/disable reverb.");
reverbCheckbox.SetPos(XMFLOAT2(x + 240, y));
reverbCheckbox.SetSize(XMFLOAT2(hei, hei));
- reverbCheckbox.OnClick([&](wiEventArgs args) {
+ reverbCheckbox.OnClick([&](wi::gui::EventArgs args) {
SoundComponent* sound = GetScene().sounds.GetComponent(entity);
if (sound != nullptr)
{
sound->soundinstance.SetEnableReverb(args.bValue);
- wiAudio::CreateSoundInstance(&sound->soundResource->sound, &sound->soundinstance);
+ wi::audio::CreateSoundInstance(&sound->soundResource.GetSound(), &sound->soundinstance);
}
});
AddWidget(&reverbCheckbox);
@@ -157,12 +157,12 @@ void SoundWindow::Create(EditorComponent* editor)
disable3dCheckbox.SetTooltip("Sounds in the scene are 3D spatial by default. Select this to disable 3D effect.");
disable3dCheckbox.SetPos(XMFLOAT2(x + 300, y));
disable3dCheckbox.SetSize(XMFLOAT2(hei, hei));
- disable3dCheckbox.OnClick([&](wiEventArgs args) {
+ disable3dCheckbox.OnClick([&](wi::gui::EventArgs args) {
SoundComponent* sound = GetScene().sounds.GetComponent(entity);
if (sound != nullptr)
{
sound->SetDisable3D(args.bValue);
- wiAudio::CreateSoundInstance(&sound->soundResource->sound, &sound->soundinstance);
+ wi::audio::CreateSoundInstance(&sound->soundResource.GetSound(), &sound->soundinstance);
}
});
AddWidget(&disable3dCheckbox);
@@ -172,7 +172,7 @@ void SoundWindow::Create(EditorComponent* editor)
volumeSlider.SetTooltip("Set volume level for the selected sound instance.");
volumeSlider.SetPos(XMFLOAT2(x + 60, y += step));
volumeSlider.SetSize(XMFLOAT2(240, hei));
- volumeSlider.OnSlide([&](wiEventArgs args) {
+ volumeSlider.OnSlide([&](wi::gui::EventArgs args) {
SoundComponent* sound = GetScene().sounds.GetComponent(entity);
if (sound != nullptr)
{
@@ -185,12 +185,12 @@ void SoundWindow::Create(EditorComponent* editor)
submixComboBox.Create("Submix: ");
submixComboBox.SetPos(XMFLOAT2(x + 80, y += step));
submixComboBox.SetSize(XMFLOAT2(180, hei));
- submixComboBox.OnSelect([&](wiEventArgs args) {
+ submixComboBox.OnSelect([&](wi::gui::EventArgs args) {
SoundComponent* sound = GetScene().sounds.GetComponent(entity);
if (sound != nullptr)
{
- sound->soundinstance.type = (wiAudio::SUBMIX_TYPE)args.iValue;
- wiAudio::CreateSoundInstance(&sound->soundResource->sound, &sound->soundinstance);
+ sound->soundinstance.type = (wi::audio::SUBMIX_TYPE)args.iValue;
+ wi::audio::CreateSoundInstance(&sound->soundResource.GetSound(), &sound->soundinstance);
}
});
submixComboBox.AddItem("SOUNDEFFECT");
@@ -213,7 +213,7 @@ void SoundWindow::SetEntity(Entity entity)
{
this->entity = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
SoundComponent* sound = scene.sounds.GetComponent(entity);
NameComponent* name = scene.names.GetComponent(entity);
diff --git a/Editor/SoundWindow.h b/Editor/SoundWindow.h
index c0f89bc3e..326d3fcd9 100644
--- a/Editor/SoundWindow.h
+++ b/Editor/SoundWindow.h
@@ -3,22 +3,22 @@
class EditorComponent;
-class SoundWindow : public wiWindow
+class SoundWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity = wiECS::INVALID_ENTITY;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity = wi::ecs::INVALID_ENTITY;
+ void SetEntity(wi::ecs::Entity entity);
- wiComboBox reverbComboBox;
- wiButton addButton;
- wiLabel filenameLabel;
- wiTextInputField nameField;
- wiButton playstopButton;
- wiCheckBox loopedCheckbox;
- wiCheckBox reverbCheckbox;
- wiCheckBox disable3dCheckbox;
- wiSlider volumeSlider;
- wiComboBox submixComboBox;
+ wi::gui::ComboBox reverbComboBox;
+ wi::gui::Button addButton;
+ wi::gui::Label filenameLabel;
+ wi::gui::TextInputField nameField;
+ wi::gui::Button playstopButton;
+ wi::gui::CheckBox loopedCheckbox;
+ wi::gui::CheckBox reverbCheckbox;
+ wi::gui::CheckBox disable3dCheckbox;
+ wi::gui::Slider volumeSlider;
+ wi::gui::ComboBox submixComboBox;
};
diff --git a/Editor/SpringWindow.cpp b/Editor/SpringWindow.cpp
index d9c331c38..ba44ca7db 100644
--- a/Editor/SpringWindow.cpp
+++ b/Editor/SpringWindow.cpp
@@ -2,13 +2,13 @@
#include "SpringWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void SpringWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Spring Window");
+ wi::gui::Window::Create("Spring Window");
SetSize(XMFLOAT2(460, 200));
float x = 150;
@@ -33,8 +33,8 @@ void SpringWindow::Create(EditorComponent* editor)
disabledCheckBox.SetTooltip("Disable simulation.");
disabledCheckBox.SetPos(XMFLOAT2(x, y += step));
disabledCheckBox.SetSize(XMFLOAT2(hei, hei));
- disabledCheckBox.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().springs.GetComponent(entity)->SetDisabled(args.bValue);
+ disabledCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.GetComponent(entity)->SetDisabled(args.bValue);
});
AddWidget(&disabledCheckBox);
@@ -42,8 +42,8 @@ void SpringWindow::Create(EditorComponent* editor)
stretchCheckBox.SetTooltip("Stretch means that length from parent transform won't be preserved.");
stretchCheckBox.SetPos(XMFLOAT2(x, y += step));
stretchCheckBox.SetSize(XMFLOAT2(hei, hei));
- stretchCheckBox.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().springs.GetComponent(entity)->SetStretchEnabled(args.bValue);
+ stretchCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.GetComponent(entity)->SetStretchEnabled(args.bValue);
});
AddWidget(&stretchCheckBox);
@@ -51,8 +51,8 @@ void SpringWindow::Create(EditorComponent* editor)
gravityCheckBox.SetTooltip("Whether global gravity should affect the spring");
gravityCheckBox.SetPos(XMFLOAT2(x, y += step));
gravityCheckBox.SetSize(XMFLOAT2(hei, hei));
- gravityCheckBox.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().springs.GetComponent(entity)->SetGravityEnabled(args.bValue);
+ gravityCheckBox.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.GetComponent(entity)->SetGravityEnabled(args.bValue);
});
AddWidget(&gravityCheckBox);
@@ -60,8 +60,8 @@ void SpringWindow::Create(EditorComponent* editor)
stiffnessSlider.SetTooltip("The stiffness affects how strongly the spring tries to orient itself to rest pose (higher values increase the jiggliness)");
stiffnessSlider.SetPos(XMFLOAT2(x, y += step));
stiffnessSlider.SetSize(XMFLOAT2(siz, hei));
- stiffnessSlider.OnSlide([&](wiEventArgs args) {
- wiScene::GetScene().springs.GetComponent(entity)->stiffness = args.fValue;
+ stiffnessSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.GetComponent(entity)->stiffness = args.fValue;
});
AddWidget(&stiffnessSlider);
@@ -69,8 +69,8 @@ void SpringWindow::Create(EditorComponent* editor)
dampingSlider.SetTooltip("The damping affects how fast energy is lost (higher values make the spring come to rest faster)");
dampingSlider.SetPos(XMFLOAT2(x, y += step));
dampingSlider.SetSize(XMFLOAT2(siz, hei));
- dampingSlider.OnSlide([&](wiEventArgs args) {
- wiScene::GetScene().springs.GetComponent(entity)->damping = args.fValue;
+ dampingSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.GetComponent(entity)->damping = args.fValue;
});
AddWidget(&dampingSlider);
@@ -78,8 +78,8 @@ void SpringWindow::Create(EditorComponent* editor)
windSlider.SetTooltip("How much the global wind effect affects the spring");
windSlider.SetPos(XMFLOAT2(x, y += step));
windSlider.SetSize(XMFLOAT2(siz, hei));
- windSlider.OnSlide([&](wiEventArgs args) {
- wiScene::GetScene().springs.GetComponent(entity)->wind_affection = args.fValue;
+ windSlider.OnSlide([&](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.GetComponent(entity)->wind_affection = args.fValue;
});
AddWidget(&windSlider);
@@ -93,7 +93,7 @@ void SpringWindow::SetEntity(Entity entity)
{
this->entity = entity;
- const SpringComponent* spring = wiScene::GetScene().springs.GetComponent(entity);
+ const SpringComponent* spring = wi::scene::GetScene().springs.GetComponent(entity);
if (spring != nullptr)
{
@@ -111,7 +111,7 @@ void SpringWindow::SetEntity(Entity entity)
SetEnabled(false);
}
- const TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ const TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
createButton.SetEnabled(true);
@@ -119,16 +119,16 @@ void SpringWindow::SetEntity(Entity entity)
if (spring == nullptr)
{
createButton.SetText("Create");
- createButton.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().springs.Create(entity);
+ createButton.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.Create(entity);
SetEntity(entity);
});
}
else
{
createButton.SetText("Remove");
- createButton.OnClick([=](wiEventArgs args) {
- wiScene::GetScene().springs.Remove_KeepSorted(entity);
+ createButton.OnClick([=](wi::gui::EventArgs args) {
+ wi::scene::GetScene().springs.Remove_KeepSorted(entity);
SetEntity(entity);
});
}
diff --git a/Editor/SpringWindow.h b/Editor/SpringWindow.h
index 53ffa5dab..d1a40efec 100644
--- a/Editor/SpringWindow.h
+++ b/Editor/SpringWindow.h
@@ -3,21 +3,21 @@
class EditorComponent;
-class SpringWindow : public wiWindow
+class SpringWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiButton createButton;
- wiCheckBox debugCheckBox;
- wiCheckBox disabledCheckBox;
- wiCheckBox stretchCheckBox;
- wiCheckBox gravityCheckBox;
- wiSlider stiffnessSlider;
- wiSlider dampingSlider;
- wiSlider windSlider;
+ wi::gui::Button createButton;
+ wi::gui::CheckBox debugCheckBox;
+ wi::gui::CheckBox disabledCheckBox;
+ wi::gui::CheckBox stretchCheckBox;
+ wi::gui::CheckBox gravityCheckBox;
+ wi::gui::Slider stiffnessSlider;
+ wi::gui::Slider dampingSlider;
+ wi::gui::Slider windSlider;
};
diff --git a/Editor/TransformWindow.cpp b/Editor/TransformWindow.cpp
index 339439e26..11ca17744 100644
--- a/Editor/TransformWindow.cpp
+++ b/Editor/TransformWindow.cpp
@@ -2,13 +2,13 @@
#include "TransformWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void TransformWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Transform Window");
+ wi::gui::Window::Create("Transform Window");
SetSize(XMFLOAT2(460, 180));
float x = 100;
@@ -21,9 +21,9 @@ void TransformWindow::Create(EditorComponent* editor)
createButton.SetTooltip("Create a new entity with only a trasform component");
createButton.SetPos(XMFLOAT2(x, y += step));
createButton.SetSize(XMFLOAT2(350, hei));
- createButton.OnClick([=](wiEventArgs args) {
+ createButton.OnClick([=](wi::gui::EventArgs args) {
Entity entity = CreateEntity();
- wiScene::GetScene().transforms.Create(entity);
+ wi::scene::GetScene().transforms.Create(entity);
editor->ClearSelected();
editor->AddSelected(entity);
editor->RefreshSceneGraphView();
@@ -35,8 +35,8 @@ void TransformWindow::Create(EditorComponent* editor)
parentCombo.SetSize(XMFLOAT2(330, hei));
parentCombo.SetPos(XMFLOAT2(x, y += step));
parentCombo.SetEnabled(false);
- parentCombo.OnSelect([&](wiEventArgs args) {
- Scene& scene = wiScene::GetScene();
+ parentCombo.OnSelect([&](wi::gui::EventArgs args) {
+ Scene& scene = wi::scene::GetScene();
scene.Component_Detach(entity);
@@ -54,8 +54,8 @@ void TransformWindow::Create(EditorComponent* editor)
txInput.SetDescription("Translation X: ");
txInput.SetPos(XMFLOAT2(x, y += step));
txInput.SetSize(XMFLOAT2(siz, hei));
- txInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ txInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->translation_local.x = args.fValue;
@@ -69,8 +69,8 @@ void TransformWindow::Create(EditorComponent* editor)
tyInput.SetDescription("Translation Y: ");
tyInput.SetPos(XMFLOAT2(x, y += step));
tyInput.SetSize(XMFLOAT2(siz, hei));
- tyInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ tyInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->translation_local.y = args.fValue;
@@ -84,8 +84,8 @@ void TransformWindow::Create(EditorComponent* editor)
tzInput.SetDescription("Translation Z: ");
tzInput.SetPos(XMFLOAT2(x, y += step));
tzInput.SetSize(XMFLOAT2(siz, hei));
- tzInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ tzInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->translation_local.z = args.fValue;
@@ -105,8 +105,8 @@ void TransformWindow::Create(EditorComponent* editor)
rxInput.SetDescription("Rotation X: ");
rxInput.SetPos(XMFLOAT2(x, y += step));
rxInput.SetSize(XMFLOAT2(siz, hei));
- rxInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ rxInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->rotation_local.x = args.fValue;
@@ -120,8 +120,8 @@ void TransformWindow::Create(EditorComponent* editor)
ryInput.SetDescription("Rotation Y: ");
ryInput.SetPos(XMFLOAT2(x, y += step));
ryInput.SetSize(XMFLOAT2(siz, hei));
- ryInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ ryInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->rotation_local.y = args.fValue;
@@ -135,8 +135,8 @@ void TransformWindow::Create(EditorComponent* editor)
rzInput.SetDescription("Rotation Z: ");
rzInput.SetPos(XMFLOAT2(x, y += step));
rzInput.SetSize(XMFLOAT2(siz, hei));
- rzInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ rzInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->rotation_local.z = args.fValue;
@@ -150,8 +150,8 @@ void TransformWindow::Create(EditorComponent* editor)
rwInput.SetDescription("Rotation W: ");
rwInput.SetPos(XMFLOAT2(x, y += step));
rwInput.SetSize(XMFLOAT2(siz, hei));
- rwInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ rwInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->rotation_local.w = args.fValue;
@@ -172,8 +172,8 @@ void TransformWindow::Create(EditorComponent* editor)
sxInput.SetDescription("Scale X: ");
sxInput.SetPos(XMFLOAT2(x, y += step));
sxInput.SetSize(XMFLOAT2(siz, hei));
- sxInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ sxInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->scale_local.x = args.fValue;
@@ -187,8 +187,8 @@ void TransformWindow::Create(EditorComponent* editor)
syInput.SetDescription("Scale Y: ");
syInput.SetPos(XMFLOAT2(x, y += step));
syInput.SetSize(XMFLOAT2(siz, hei));
- syInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ syInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->scale_local.y = args.fValue;
@@ -202,8 +202,8 @@ void TransformWindow::Create(EditorComponent* editor)
szInput.SetDescription("Scale Z: ");
szInput.SetPos(XMFLOAT2(x, y += step));
szInput.SetSize(XMFLOAT2(siz, hei));
- szInput.OnInputAccepted([&](wiEventArgs args) {
- TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity);
+ szInput.OnInputAccepted([&](wi::gui::EventArgs args) {
+ TransformComponent* transform = wi::scene::GetScene().transforms.GetComponent(entity);
if (transform != nullptr)
{
transform->scale_local.z = args.fValue;
@@ -222,7 +222,7 @@ void TransformWindow::SetEntity(Entity entity)
{
this->entity = entity;
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
const TransformComponent* transform = scene.transforms.GetComponent(entity);
if (transform != nullptr)
diff --git a/Editor/TransformWindow.h b/Editor/TransformWindow.h
index 489e4a788..ad6885270 100644
--- a/Editor/TransformWindow.h
+++ b/Editor/TransformWindow.h
@@ -3,29 +3,29 @@
class EditorComponent;
-class TransformWindow : public wiWindow
+class TransformWindow : public wi::gui::Window
{
public:
void Create(EditorComponent* editor);
- wiECS::Entity entity;
- void SetEntity(wiECS::Entity entity);
+ wi::ecs::Entity entity;
+ void SetEntity(wi::ecs::Entity entity);
- wiButton createButton;
+ wi::gui::Button createButton;
- wiComboBox parentCombo;
+ wi::gui::ComboBox parentCombo;
- wiTextInputField txInput;
- wiTextInputField tyInput;
- wiTextInputField tzInput;
+ wi::gui::TextInputField txInput;
+ wi::gui::TextInputField tyInput;
+ wi::gui::TextInputField tzInput;
- wiTextInputField rxInput;
- wiTextInputField ryInput;
- wiTextInputField rzInput;
- wiTextInputField rwInput;
+ wi::gui::TextInputField rxInput;
+ wi::gui::TextInputField ryInput;
+ wi::gui::TextInputField rzInput;
+ wi::gui::TextInputField rwInput;
- wiTextInputField sxInput;
- wiTextInputField syInput;
- wiTextInputField szInput;
+ wi::gui::TextInputField sxInput;
+ wi::gui::TextInputField syInput;
+ wi::gui::TextInputField szInput;
};
diff --git a/Editor/Translator.cpp b/Editor/Translator.cpp
index f305fef5d..bff1ed5f9 100644
--- a/Editor/Translator.cpp
+++ b/Editor/Translator.cpp
@@ -4,11 +4,12 @@
#include "wiInput.h"
#include "wiMath.h"
#include "shaders/ShaderInterop_Renderer.h"
-#include "wiEvent.h"
+#include "wiEventHandler.h"
-using namespace wiGraphics;
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
+using namespace wi::graphics;
+using namespace wi::primitive;
PipelineState pso_solidpart;
PipelineState pso_wirepart;
@@ -24,17 +25,17 @@ namespace Translator_Internal
{
void LoadShaders()
{
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
{
PipelineStateDesc desc;
- desc.vs = wiRenderer::GetShader(VSTYPE_VERTEXCOLOR);
- desc.ps = wiRenderer::GetShader(PSTYPE_VERTEXCOLOR);
- desc.il = wiRenderer::GetInputLayout(ILTYPE_VERTEXCOLOR);
- desc.dss = wiRenderer::GetDepthStencilState(DSSTYPE_DEPTHDISABLED);
- desc.rs = wiRenderer::GetRasterizerState(RSTYPE_DOUBLESIDED);
- desc.bs = wiRenderer::GetBlendState(BSTYPE_ADDITIVE);
+ desc.vs = wi::renderer::GetShader(wi::enums::VSTYPE_VERTEXCOLOR);
+ desc.ps = wi::renderer::GetShader(wi::enums::PSTYPE_VERTEXCOLOR);
+ desc.il = wi::renderer::GetInputLayout(wi::enums::ILTYPE_VERTEXCOLOR);
+ desc.dss = wi::renderer::GetDepthStencilState(wi::enums::DSSTYPE_DEPTHDISABLED);
+ desc.rs = wi::renderer::GetRasterizerState(wi::enums::RSTYPE_DOUBLESIDED);
+ desc.bs = wi::renderer::GetBlendState(wi::enums::BSTYPE_ADDITIVE);
desc.pt = PrimitiveTopology::TRIANGLELIST;
device->CreatePipelineState(&desc, &pso_solidpart);
@@ -43,12 +44,12 @@ namespace Translator_Internal
{
PipelineStateDesc desc;
- desc.vs = wiRenderer::GetShader(VSTYPE_VERTEXCOLOR);
- desc.ps = wiRenderer::GetShader(PSTYPE_VERTEXCOLOR);
- desc.il = wiRenderer::GetInputLayout(ILTYPE_VERTEXCOLOR);
- desc.dss = wiRenderer::GetDepthStencilState(DSSTYPE_DEPTHDISABLED);
- desc.rs = wiRenderer::GetRasterizerState(RSTYPE_WIRE_DOUBLESIDED_SMOOTH);
- desc.bs = wiRenderer::GetBlendState(BSTYPE_TRANSPARENT);
+ desc.vs = wi::renderer::GetShader(wi::enums::VSTYPE_VERTEXCOLOR);
+ desc.ps = wi::renderer::GetShader(wi::enums::PSTYPE_VERTEXCOLOR);
+ desc.il = wi::renderer::GetInputLayout(wi::enums::ILTYPE_VERTEXCOLOR);
+ desc.dss = wi::renderer::GetDepthStencilState(wi::enums::DSSTYPE_DEPTHDISABLED);
+ desc.rs = wi::renderer::GetRasterizerState(wi::enums::RSTYPE_WIRE_DOUBLESIDED_SMOOTH);
+ desc.bs = wi::renderer::GetBlendState(wi::enums::BSTYPE_TRANSPARENT);
desc.pt = PrimitiveTopology::LINELIST;
device->CreatePipelineState(&desc, &pso_wirepart);
@@ -58,7 +59,7 @@ namespace Translator_Internal
void Translator::Create()
{
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
if (!vertexBuffer_Axis.IsValid())
{
@@ -155,7 +156,7 @@ void Translator::Create()
}
}
-void Translator::Update(const wiCanvas& canvas)
+void Translator::Update(const wi::Canvas& canvas)
{
if (selected.empty())
{
@@ -165,8 +166,8 @@ void Translator::Update(const wiCanvas& canvas)
dragStarted = false;
dragEnded = false;
- XMFLOAT4 pointer = wiInput::GetPointer();
- const CameraComponent& cam = wiScene::GetCamera();
+ XMFLOAT4 pointer = wi::input::GetPointer();
+ const CameraComponent& cam = wi::scene::GetCamera();
XMVECTOR pos = transform.GetPositionV();
if (enabled)
@@ -180,9 +181,9 @@ void Translator::Update(const wiCanvas& canvas)
XMMATRIX W = XMMatrixIdentity();
XMFLOAT3 p = transform.GetPosition();
- dist = wiMath::Distance(p, cam.Eye) * 0.05f;
+ dist = wi::math::Distance(p, cam.Eye) * 0.05f;
- RAY ray = wiRenderer::GetPickRay((long)pointer.x, (long)pointer.y, canvas);
+ Ray ray = wi::renderer::GetPickRay((long)pointer.x, (long)pointer.y, canvas);
XMVECTOR x, y, z, xy, xz, yz;
@@ -267,12 +268,12 @@ void Translator::Update(const wiCanvas& canvas)
}
}
- if (dragging || (state != TRANSLATOR_IDLE && wiInput::Press(wiInput::MOUSE_BUTTON_LEFT)))
+ if (dragging || (state != TRANSLATOR_IDLE && wi::input::Press(wi::input::MOUSE_BUTTON_LEFT)))
{
if (!dragging)
{
dragStarted = true;
- dragDeltaMatrix = IDENTITYMATRIX;
+ dragDeltaMatrix = wi::math::IDENTITY_MATRIX;
}
XMVECTOR plane, planeNormal;
@@ -313,12 +314,12 @@ void Translator::Update(const wiCanvas& canvas)
}
plane = XMPlaneFromPointNormal(pos, XMVector3Normalize(planeNormal));
- RAY ray = wiRenderer::GetPickRay((long)pointer.x, (long)pointer.y, canvas);
+ Ray ray = wi::renderer::GetPickRay((long)pointer.x, (long)pointer.y, canvas);
XMVECTOR rayOrigin = XMLoadFloat3(&ray.origin);
XMVECTOR rayDir = XMLoadFloat3(&ray.direction);
XMVECTOR intersection = XMPlaneIntersectLine(plane, rayOrigin, rayOrigin + rayDir*cam.zFarP);
- ray = wiRenderer::GetPickRay((long)prevPointer.x, (long)prevPointer.y, canvas);
+ ray = wi::renderer::GetPickRay((long)prevPointer.x, (long)prevPointer.y, canvas);
rayOrigin = XMLoadFloat3(&ray.origin);
rayDir = XMLoadFloat3(&ray.direction);
XMVECTOR intersectionPrev = XMPlaneIntersectLine(plane, rayOrigin, rayOrigin + rayDir*cam.zFarP);
@@ -327,22 +328,22 @@ void Translator::Update(const wiCanvas& canvas)
if (state == TRANSLATOR_X)
{
XMVECTOR A = pos, B = pos + XMVectorSet(1, 0, 0, 0);
- XMVECTOR P = wiMath::GetClosestPointToLine(A, B, intersection);
- XMVECTOR PPrev = wiMath::GetClosestPointToLine(A, B, intersectionPrev);
+ XMVECTOR P = wi::math::GetClosestPointToLine(A, B, intersection);
+ XMVECTOR PPrev = wi::math::GetClosestPointToLine(A, B, intersectionPrev);
deltaV = P - PPrev;
}
else if (state == TRANSLATOR_Y)
{
XMVECTOR A = pos, B = pos + XMVectorSet(0, 1, 0, 0);
- XMVECTOR P = wiMath::GetClosestPointToLine(A, B, intersection);
- XMVECTOR PPrev = wiMath::GetClosestPointToLine(A, B, intersectionPrev);
+ XMVECTOR P = wi::math::GetClosestPointToLine(A, B, intersection);
+ XMVECTOR PPrev = wi::math::GetClosestPointToLine(A, B, intersectionPrev);
deltaV = P - PPrev;
}
else if (state == TRANSLATOR_Z)
{
XMVECTOR A = pos, B = pos + XMVectorSet(0, 0, 1, 0);
- XMVECTOR P = wiMath::GetClosestPointToLine(A, B, intersection);
- XMVECTOR PPrev = wiMath::GetClosestPointToLine(A, B, intersectionPrev);
+ XMVECTOR P = wi::math::GetClosestPointToLine(A, B, intersection);
+ XMVECTOR PPrev = wi::math::GetClosestPointToLine(A, B, intersectionPrev);
deltaV = P - PPrev;
}
else
@@ -389,7 +390,7 @@ void Translator::Update(const wiCanvas& canvas)
dragging = true;
}
- if (!wiInput::Down(wiInput::MOUSE_BUTTON_LEFT))
+ if (!wi::input::Down(wi::input::MOUSE_BUTTON_LEFT))
{
if (dragging)
{
@@ -423,13 +424,13 @@ void Translator::Draw(const CameraComponent& camera, CommandList cmd) const
if (!shaders_loaded)
{
shaders_loaded = true;
- static wiEvent::Handle handle = wiEvent::Subscribe(SYSTEM_EVENT_RELOAD_SHADERS, [](uint64_t userdata) { Translator_Internal::LoadShaders(); });
+ static wi::eventhandler::Handle handle = wi::eventhandler::Subscribe(wi::eventhandler::EVENT_RELOAD_SHADERS, [](uint64_t userdata) { Translator_Internal::LoadShaders(); });
Translator_Internal::LoadShaders();
}
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
device->EventBegin("Editor - Translator", cmd);
@@ -523,7 +524,7 @@ void Translator::Draw(const CameraComponent& camera, CommandList cmd) const
void Translator::PreTranslate()
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
// Find the center of all the entities that are selected:
XMVECTOR centerV = XMVectorSet(0, 0, 0, 0);
@@ -567,7 +568,7 @@ void Translator::PreTranslate()
}
void Translator::PostTranslate()
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
for (auto& x : selected)
{
diff --git a/Editor/Translator.h b/Editor/Translator.h
index 76fea0515..45e23dbb8 100644
--- a/Editor/Translator.h
+++ b/Editor/Translator.h
@@ -7,23 +7,23 @@ class Translator
{
private:
XMFLOAT4 prevPointer = XMFLOAT4(0, 0, 0, 0);
- XMFLOAT4X4 dragDeltaMatrix = IDENTITYMATRIX;
+ XMFLOAT4X4 dragDeltaMatrix = wi::math::IDENTITY_MATRIX;
bool dragging = false;
bool dragStarted = false;
bool dragEnded = false;
public:
void Create();
- void Update(const wiCanvas& canvas);
- void Draw(const wiScene::CameraComponent& camera, wiGraphics::CommandList cmd) const;
+ void Update(const wi::Canvas& canvas);
+ void Draw(const wi::scene::CameraComponent& camera, wi::graphics::CommandList cmd) const;
// Attach selection to translator temporarily
void PreTranslate();
// Apply translator to selection
void PostTranslate();
- wiScene::TransformComponent transform;
- wi::vector selected;
+ wi::scene::TransformComponent transform;
+ wi::vector selected;
bool enabled = false;
diff --git a/Editor/WeatherWindow.cpp b/Editor/WeatherWindow.cpp
index 8458b1e2c..bdd538f79 100644
--- a/Editor/WeatherWindow.cpp
+++ b/Editor/WeatherWindow.cpp
@@ -2,13 +2,13 @@
#include "WeatherWindow.h"
#include "Editor.h"
-using namespace wiECS;
-using namespace wiScene;
-using namespace wiGraphics;
+using namespace wi::ecs;
+using namespace wi::scene;
+using namespace wi::graphics;
void WeatherWindow::Create(EditorComponent* editor)
{
- wiWindow::Create("Weather Window");
+ wi::gui::Window::Create("Weather Window");
SetSize(XMFLOAT2(660, 610));
float x = 180;
@@ -20,7 +20,7 @@ void WeatherWindow::Create(EditorComponent* editor)
heightFogCheckBox.Create("Height fog: ");
heightFogCheckBox.SetSize(XMFLOAT2(hei, hei));
heightFogCheckBox.SetPos(XMFLOAT2(x + 100, y += step));
- heightFogCheckBox.OnClick([&](wiEventArgs args) {
+ heightFogCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.SetHeightFog(args.bValue);
});
@@ -29,7 +29,7 @@ void WeatherWindow::Create(EditorComponent* editor)
fogStartSlider.Create(0, 5000, 0, 100000, "Fog Start: ");
fogStartSlider.SetSize(XMFLOAT2(100, hei));
fogStartSlider.SetPos(XMFLOAT2(x, y += step));
- fogStartSlider.OnSlide([&](wiEventArgs args) {
+ fogStartSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().fogStart = args.fValue;
});
AddWidget(&fogStartSlider);
@@ -37,7 +37,7 @@ void WeatherWindow::Create(EditorComponent* editor)
fogEndSlider.Create(1, 5000, 1000, 10000, "Fog End: ");
fogEndSlider.SetSize(XMFLOAT2(100, hei));
fogEndSlider.SetPos(XMFLOAT2(x, y += step));
- fogEndSlider.OnSlide([&](wiEventArgs args) {
+ fogEndSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().fogEnd = args.fValue;
});
AddWidget(&fogEndSlider);
@@ -45,7 +45,7 @@ void WeatherWindow::Create(EditorComponent* editor)
fogHeightStartSlider.Create(-100, 100, 1, 10000, "Fog Height Start: ");
fogHeightStartSlider.SetSize(XMFLOAT2(100, hei));
fogHeightStartSlider.SetPos(XMFLOAT2(x, y += step));
- fogHeightStartSlider.OnSlide([&](wiEventArgs args) {
+ fogHeightStartSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().fogHeightStart = args.fValue;
});
AddWidget(&fogHeightStartSlider);
@@ -53,7 +53,7 @@ void WeatherWindow::Create(EditorComponent* editor)
fogHeightEndSlider.Create(-100, 100, 3, 10000, "Fog Height End: ");
fogHeightEndSlider.SetSize(XMFLOAT2(100, hei));
fogHeightEndSlider.SetPos(XMFLOAT2(x, y += step));
- fogHeightEndSlider.OnSlide([&](wiEventArgs args) {
+ fogHeightEndSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().fogHeightEnd = args.fValue;
});
AddWidget(&fogHeightEndSlider);
@@ -61,7 +61,7 @@ void WeatherWindow::Create(EditorComponent* editor)
fogHeightSkySlider.Create(0, 1, 0, 10000, "Fog Height Sky: ");
fogHeightSkySlider.SetSize(XMFLOAT2(100, hei));
fogHeightSkySlider.SetPos(XMFLOAT2(x, y += step));
- fogHeightSkySlider.OnSlide([&](wiEventArgs args) {
+ fogHeightSkySlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().fogHeightSky = args.fValue;
});
AddWidget(&fogHeightSkySlider);
@@ -69,7 +69,7 @@ void WeatherWindow::Create(EditorComponent* editor)
cloudinessSlider.Create(0, 1, 0.0f, 10000, "Cloudiness: ");
cloudinessSlider.SetSize(XMFLOAT2(100, hei));
cloudinessSlider.SetPos(XMFLOAT2(x, y += step));
- cloudinessSlider.OnSlide([&](wiEventArgs args) {
+ cloudinessSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().cloudiness = args.fValue;
});
AddWidget(&cloudinessSlider);
@@ -77,7 +77,7 @@ void WeatherWindow::Create(EditorComponent* editor)
cloudScaleSlider.Create(0.00005f, 0.001f, 0.0005f, 10000, "Cloud Scale: ");
cloudScaleSlider.SetSize(XMFLOAT2(100, hei));
cloudScaleSlider.SetPos(XMFLOAT2(x, y += step));
- cloudScaleSlider.OnSlide([&](wiEventArgs args) {
+ cloudScaleSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().cloudScale = args.fValue;
});
AddWidget(&cloudScaleSlider);
@@ -85,7 +85,7 @@ void WeatherWindow::Create(EditorComponent* editor)
cloudSpeedSlider.Create(0.001f, 0.2f, 0.1f, 10000, "Cloud Speed: ");
cloudSpeedSlider.SetSize(XMFLOAT2(100, hei));
cloudSpeedSlider.SetPos(XMFLOAT2(x, y += step));
- cloudSpeedSlider.OnSlide([&](wiEventArgs args) {
+ cloudSpeedSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().cloudSpeed = args.fValue;
});
AddWidget(&cloudSpeedSlider);
@@ -93,7 +93,7 @@ void WeatherWindow::Create(EditorComponent* editor)
windSpeedSlider.Create(0.0f, 4.0f, 1.0f, 10000, "Wind Speed: ");
windSpeedSlider.SetSize(XMFLOAT2(100, hei));
windSpeedSlider.SetPos(XMFLOAT2(x, y += step));
- windSpeedSlider.OnSlide([&](wiEventArgs args) {
+ windSpeedSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().windSpeed = args.fValue;
});
AddWidget(&windSpeedSlider);
@@ -101,7 +101,7 @@ void WeatherWindow::Create(EditorComponent* editor)
windMagnitudeSlider.Create(0.0f, 0.2f, 0.0f, 10000, "Wind Magnitude: ");
windMagnitudeSlider.SetSize(XMFLOAT2(100, hei));
windMagnitudeSlider.SetPos(XMFLOAT2(x, y += step));
- windMagnitudeSlider.OnSlide([&](wiEventArgs args) {
+ windMagnitudeSlider.OnSlide([&](wi::gui::EventArgs args) {
UpdateWind();
});
AddWidget(&windMagnitudeSlider);
@@ -109,7 +109,7 @@ void WeatherWindow::Create(EditorComponent* editor)
windDirectionSlider.Create(0, 1, 0, 10000, "Wind Direction: ");
windDirectionSlider.SetSize(XMFLOAT2(100, hei));
windDirectionSlider.SetPos(XMFLOAT2(x, y += step));
- windDirectionSlider.OnSlide([&](wiEventArgs args) {
+ windDirectionSlider.OnSlide([&](wi::gui::EventArgs args) {
UpdateWind();
});
AddWidget(&windDirectionSlider);
@@ -117,7 +117,7 @@ void WeatherWindow::Create(EditorComponent* editor)
windWaveSizeSlider.Create(0, 1, 0, 10000, "Wind Wave Size: ");
windWaveSizeSlider.SetSize(XMFLOAT2(100, hei));
windWaveSizeSlider.SetPos(XMFLOAT2(x, y += step));
- windWaveSizeSlider.OnSlide([&](wiEventArgs args) {
+ windWaveSizeSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().windWaveSize = args.fValue;
});
AddWidget(&windWaveSizeSlider);
@@ -125,7 +125,7 @@ void WeatherWindow::Create(EditorComponent* editor)
windRandomnessSlider.Create(0, 10, 5, 10000, "Wind Randomness: ");
windRandomnessSlider.SetSize(XMFLOAT2(100, hei));
windRandomnessSlider.SetPos(XMFLOAT2(x, y += step));
- windRandomnessSlider.OnSlide([&](wiEventArgs args) {
+ windRandomnessSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().windRandomness = args.fValue;
});
AddWidget(&windRandomnessSlider);
@@ -133,7 +133,7 @@ void WeatherWindow::Create(EditorComponent* editor)
skyExposureSlider.Create(0, 4, 1, 10000, "Sky Exposure: ");
skyExposureSlider.SetSize(XMFLOAT2(100, hei));
skyExposureSlider.SetPos(XMFLOAT2(x, y += step));
- skyExposureSlider.OnSlide([&](wiEventArgs args) {
+ skyExposureSlider.OnSlide([&](wi::gui::EventArgs args) {
GetWeather().skyExposure = args.fValue;
});
AddWidget(&skyExposureSlider);
@@ -142,7 +142,7 @@ void WeatherWindow::Create(EditorComponent* editor)
simpleskyCheckBox.SetTooltip("Simple sky will simply blend horizon and zenith color from bottom to top.");
simpleskyCheckBox.SetSize(XMFLOAT2(hei, hei));
simpleskyCheckBox.SetPos(XMFLOAT2(x, y += step));
- simpleskyCheckBox.OnClick([&](wiEventArgs args) {
+ simpleskyCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.SetSimpleSky(args.bValue);
if (args.bValue)
@@ -156,7 +156,7 @@ void WeatherWindow::Create(EditorComponent* editor)
realisticskyCheckBox.SetTooltip("Physically based sky rendering model.");
realisticskyCheckBox.SetSize(XMFLOAT2(hei, hei));
realisticskyCheckBox.SetPos(XMFLOAT2(x + 120, y));
- realisticskyCheckBox.OnClick([&](wiEventArgs args) {
+ realisticskyCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.SetRealisticSky(args.bValue);
if (args.bValue)
@@ -170,27 +170,27 @@ void WeatherWindow::Create(EditorComponent* editor)
skyButton.SetTooltip("Load a skybox cubemap texture...");
skyButton.SetSize(XMFLOAT2(240, hei));
skyButton.SetPos(XMFLOAT2(x-100, y += step));
- skyButton.OnClick([=](wiEventArgs args) {
+ skyButton.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
- if (weather.skyMap == nullptr)
+ if (!weather.skyMap.IsValid())
{
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Cubemap texture";
params.extensions.push_back("dds");
- wiHelper::FileDialog(params, [=](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ wi::helper::FileDialog(params, [=](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
auto& weather = GetWeather();
weather.skyMapName = fileName;
- weather.skyMap = wiResourceManager::Load(fileName, wiResourceManager::IMPORT_RETAIN_FILEDATA);
- skyButton.SetText(wiHelper::GetFileNameFromPath(fileName));
+ weather.skyMap = wi::resourcemanager::Load(fileName, wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA);
+ skyButton.SetText(wi::helper::GetFileNameFromPath(fileName));
});
});
}
else
{
- weather.skyMap.reset();
+ weather.skyMap = {};
weather.skyMapName.clear();
skyButton.SetText("Load Sky");
}
@@ -205,27 +205,27 @@ void WeatherWindow::Create(EditorComponent* editor)
colorgradingButton.SetTooltip("Load a color grading lookup texture. It must be a 256x16 RGBA image!");
colorgradingButton.SetSize(XMFLOAT2(240, hei));
colorgradingButton.SetPos(XMFLOAT2(x - 100, y += step));
- colorgradingButton.OnClick([=](wiEventArgs args) {
+ colorgradingButton.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
- if (weather.colorGradingMap == nullptr)
+ if (!weather.colorGradingMap.IsValid())
{
- wiHelper::FileDialogParams params;
- params.type = wiHelper::FileDialogParams::OPEN;
+ wi::helper::FileDialogParams params;
+ params.type = wi::helper::FileDialogParams::OPEN;
params.description = "Texture";
- params.extensions = wiResourceManager::GetSupportedImageExtensions();
- wiHelper::FileDialog(params, [=](std::string fileName) {
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
+ params.extensions = wi::resourcemanager::GetSupportedImageExtensions();
+ wi::helper::FileDialog(params, [=](std::string fileName) {
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
auto& weather = GetWeather();
weather.colorGradingMapName = fileName;
- weather.colorGradingMap = wiResourceManager::Load(fileName, wiResourceManager::IMPORT_COLORGRADINGLUT | wiResourceManager::IMPORT_RETAIN_FILEDATA);
- colorgradingButton.SetText(wiHelper::GetFileNameFromPath(fileName));
+ weather.colorGradingMap = wi::resourcemanager::Load(fileName, wi::resourcemanager::Flags::IMPORT_COLORGRADINGLUT | wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA);
+ colorgradingButton.SetText(wi::helper::GetFileNameFromPath(fileName));
});
});
}
else
{
- weather.colorGradingMap.reset();
+ weather.colorGradingMap = {};
weather.colorGradingMapName.clear();
colorgradingButton.SetText("Load Color Grading LUT");
}
@@ -239,7 +239,7 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_enabledCheckBox.Create("Ocean simulation enabled: ");
ocean_enabledCheckBox.SetSize(XMFLOAT2(hei, hei));
ocean_enabledCheckBox.SetPos(XMFLOAT2(x + 100, y += step));
- ocean_enabledCheckBox.OnClick([&](wiEventArgs args) {
+ ocean_enabledCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.SetOceanEnabled(args.bValue);
if (!weather.IsOceanEnabled())
@@ -253,9 +253,9 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_patchSizeSlider.Create(1, 1000, 1000, 100000, "Patch size: ");
ocean_patchSizeSlider.SetSize(XMFLOAT2(100, hei));
ocean_patchSizeSlider.SetPos(XMFLOAT2(x, y += step));
- ocean_patchSizeSlider.SetValue(wiScene::GetScene().weather.oceanParameters.patch_length);
+ ocean_patchSizeSlider.SetValue(wi::scene::GetScene().weather.oceanParameters.patch_length);
ocean_patchSizeSlider.SetTooltip("Adjust water tiling patch size");
- ocean_patchSizeSlider.OnSlide([&](wiEventArgs args) {
+ ocean_patchSizeSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.patch_length = args.fValue;
GetScene().ocean = {};
@@ -265,9 +265,9 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_waveAmplitudeSlider.Create(0, 1000, 1000, 100000, "Wave amplitude: ");
ocean_waveAmplitudeSlider.SetSize(XMFLOAT2(100, hei));
ocean_waveAmplitudeSlider.SetPos(XMFLOAT2(x, y += step));
- ocean_waveAmplitudeSlider.SetValue(wiScene::GetScene().weather.oceanParameters.wave_amplitude);
+ ocean_waveAmplitudeSlider.SetValue(wi::scene::GetScene().weather.oceanParameters.wave_amplitude);
ocean_waveAmplitudeSlider.SetTooltip("Adjust wave size");
- ocean_waveAmplitudeSlider.OnSlide([&](wiEventArgs args) {
+ ocean_waveAmplitudeSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.wave_amplitude = args.fValue;
GetScene().ocean = {};
@@ -277,9 +277,9 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_choppyScaleSlider.Create(0, 10, 1000, 100000, "Choppiness: ");
ocean_choppyScaleSlider.SetSize(XMFLOAT2(100, hei));
ocean_choppyScaleSlider.SetPos(XMFLOAT2(x, y += step));
- ocean_choppyScaleSlider.SetValue(wiScene::GetScene().weather.oceanParameters.choppy_scale);
+ ocean_choppyScaleSlider.SetValue(wi::scene::GetScene().weather.oceanParameters.choppy_scale);
ocean_choppyScaleSlider.SetTooltip("Adjust wave choppiness");
- ocean_choppyScaleSlider.OnSlide([&](wiEventArgs args) {
+ ocean_choppyScaleSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.choppy_scale = args.fValue;
});
@@ -288,9 +288,9 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_windDependencySlider.Create(0, 1, 1000, 100000, "Wind dependency: ");
ocean_windDependencySlider.SetSize(XMFLOAT2(100, hei));
ocean_windDependencySlider.SetPos(XMFLOAT2(x, y += step));
- ocean_windDependencySlider.SetValue(wiScene::GetScene().weather.oceanParameters.wind_dependency);
+ ocean_windDependencySlider.SetValue(wi::scene::GetScene().weather.oceanParameters.wind_dependency);
ocean_windDependencySlider.SetTooltip("Adjust wind contribution");
- ocean_windDependencySlider.OnSlide([&](wiEventArgs args) {
+ ocean_windDependencySlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.wind_dependency = args.fValue;
GetScene().ocean = {};
@@ -300,9 +300,9 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_timeScaleSlider.Create(0, 4, 1000, 100000, "Time scale: ");
ocean_timeScaleSlider.SetSize(XMFLOAT2(100, hei));
ocean_timeScaleSlider.SetPos(XMFLOAT2(x, y += step));
- ocean_timeScaleSlider.SetValue(wiScene::GetScene().weather.oceanParameters.time_scale);
+ ocean_timeScaleSlider.SetValue(wi::scene::GetScene().weather.oceanParameters.time_scale);
ocean_timeScaleSlider.SetTooltip("Adjust simulation speed");
- ocean_timeScaleSlider.OnSlide([&](wiEventArgs args) {
+ ocean_timeScaleSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.time_scale = args.fValue;
});
@@ -313,7 +313,7 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_heightSlider.SetPos(XMFLOAT2(x, y += step));
ocean_heightSlider.SetValue(0);
ocean_heightSlider.SetTooltip("Adjust water level");
- ocean_heightSlider.OnSlide([&](wiEventArgs args) {
+ ocean_heightSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.waterHeight = args.fValue;
});
@@ -324,7 +324,7 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_detailSlider.SetPos(XMFLOAT2(x, y += step));
ocean_detailSlider.SetValue(4);
ocean_detailSlider.SetTooltip("Adjust surface tessellation resolution. High values can decrease performance.");
- ocean_detailSlider.OnSlide([&](wiEventArgs args) {
+ ocean_detailSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.surfaceDetail = (uint32_t)args.iValue;
});
@@ -335,7 +335,7 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_toleranceSlider.SetPos(XMFLOAT2(x, y += step));
ocean_toleranceSlider.SetValue(2);
ocean_toleranceSlider.SetTooltip("Big waves can introduce glitches on screen borders, this can fix that but surface detail will decrease.");
- ocean_toleranceSlider.OnSlide([&](wiEventArgs args) {
+ ocean_toleranceSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.oceanParameters.surfaceDisplacementTolerance = args.fValue;
});
@@ -346,9 +346,9 @@ void WeatherWindow::Create(EditorComponent* editor)
ocean_resetButton.SetTooltip("Reset ocean to default values.");
ocean_resetButton.SetSize(XMFLOAT2(240, hei));
ocean_resetButton.SetPos(XMFLOAT2(x - 100, y += step));
- ocean_resetButton.OnClick([=](wiEventArgs args) {
+ ocean_resetButton.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
- weather.oceanParameters = wiOcean::OceanParameters();
+ weather.oceanParameters = wi::Ocean::OceanParameters();
GetScene().ocean = {};
});
AddWidget(&ocean_resetButton);
@@ -382,7 +382,7 @@ void WeatherWindow::Create(EditorComponent* editor)
colorPicker.SetPos(XMFLOAT2(x, y += step));
colorPicker.SetVisible(false);
colorPicker.SetEnabled(true);
- colorPicker.OnColorChanged([&](wiEventArgs args) {
+ colorPicker.OnColorChanged([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
switch (colorComboBox.GetSelected())
{
@@ -413,7 +413,7 @@ void WeatherWindow::Create(EditorComponent* editor)
volumetricCloudsCheckBox.SetTooltip("Enable volumetric cloud rendering, which is separate from the simple cloud parameters.");
volumetricCloudsCheckBox.SetSize(XMFLOAT2(hei, hei));
volumetricCloudsCheckBox.SetPos(XMFLOAT2(x + 280, y += step));
- volumetricCloudsCheckBox.OnClick([&](wiEventArgs args) {
+ volumetricCloudsCheckBox.OnClick([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.SetVolumetricClouds(args.bValue);
});
@@ -422,7 +422,7 @@ void WeatherWindow::Create(EditorComponent* editor)
coverageAmountSlider.Create(0, 10, 0, 1000, "Coverage amount: ");
coverageAmountSlider.SetSize(XMFLOAT2(100, hei));
coverageAmountSlider.SetPos(XMFLOAT2(x + 150, y += step));
- coverageAmountSlider.OnSlide([&](wiEventArgs args) {
+ coverageAmountSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.volumetricCloudParameters.CoverageAmount = args.fValue;
});
@@ -431,7 +431,7 @@ void WeatherWindow::Create(EditorComponent* editor)
coverageMinimumSlider.Create(1, 2, 1, 1000, "Coverage minimmum: ");
coverageMinimumSlider.SetSize(XMFLOAT2(100, hei));
coverageMinimumSlider.SetPos(XMFLOAT2(x + 150, y += step));
- coverageMinimumSlider.OnSlide([&](wiEventArgs args) {
+ coverageMinimumSlider.OnSlide([&](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.volumetricCloudParameters.CoverageMinimum = args.fValue;
});
@@ -442,9 +442,9 @@ void WeatherWindow::Create(EditorComponent* editor)
preset0Button.SetTooltip("Apply this weather preset to the world.");
preset0Button.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
preset0Button.SetPos(XMFLOAT2(x, y += step));
- preset0Button.OnClick([=](wiEventArgs args) {
+ preset0Button.OnClick([=](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
scene.weathers.Clear();
scene.weather = WeatherComponent();
@@ -457,7 +457,7 @@ void WeatherWindow::Create(EditorComponent* editor)
preset1Button.SetTooltip("Apply this weather preset to the world.");
preset1Button.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
preset1Button.SetPos(XMFLOAT2(x, y += step));
- preset1Button.OnClick([=](wiEventArgs args) {
+ preset1Button.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.ambient = XMFLOAT3(33.0f / 255.0f, 47.0f / 255.0f, 127.0f / 255.0f);
@@ -477,7 +477,7 @@ void WeatherWindow::Create(EditorComponent* editor)
preset2Button.SetTooltip("Apply this weather preset to the world.");
preset2Button.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
preset2Button.SetPos(XMFLOAT2(x, y += step));
- preset2Button.OnClick([=](wiEventArgs args) {
+ preset2Button.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.ambient = XMFLOAT3(86.0f / 255.0f, 29.0f / 255.0f, 29.0f / 255.0f);
@@ -497,7 +497,7 @@ void WeatherWindow::Create(EditorComponent* editor)
preset3Button.SetTooltip("Apply this weather preset to the world.");
preset3Button.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
preset3Button.SetPos(XMFLOAT2(x, y += step));
- preset3Button.OnClick([=](wiEventArgs args) {
+ preset3Button.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.ambient = XMFLOAT3(0.1f, 0.1f, 0.1f);
@@ -517,7 +517,7 @@ void WeatherWindow::Create(EditorComponent* editor)
preset4Button.SetTooltip("Apply this weather preset to the world.");
preset4Button.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
preset4Button.SetPos(XMFLOAT2(x, y += step));
- preset4Button.OnClick([=](wiEventArgs args) {
+ preset4Button.OnClick([=](wi::gui::EventArgs args) {
auto& weather = GetWeather();
weather.ambient = XMFLOAT3(12.0f / 255.0f, 21.0f / 255.0f, 77.0f / 255.0f);
@@ -538,9 +538,9 @@ void WeatherWindow::Create(EditorComponent* editor)
eliminateCoarseCascadesButton.SetTooltip("Eliminate the coarse cascade mask for every object in the scene.");
eliminateCoarseCascadesButton.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
eliminateCoarseCascadesButton.SetPos(XMFLOAT2(x, y += step * 2));
- eliminateCoarseCascadesButton.OnClick([=](wiEventArgs args) {
+ eliminateCoarseCascadesButton.OnClick([=](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
for (size_t i = 0; i < scene.objects.GetCount(); ++i)
{
scene.objects[i].cascadeMask = 1;
@@ -554,11 +554,11 @@ void WeatherWindow::Create(EditorComponent* editor)
ktxConvButton.SetTooltip("All material textures in the scene will be cinverted to KTX2 format.\nTHIS MIGHT TAKE LONG, SO GET YOURSELF A COFFEE OR TEA!");
ktxConvButton.SetSize(XMFLOAT2(colorPicker.GetScale().x, hei));
ktxConvButton.SetPos(XMFLOAT2(x, y += step));
- ktxConvButton.OnClick([=](wiEventArgs args) {
+ ktxConvButton.OnClick([=](wi::gui::EventArgs args) {
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
- wi::unordered_map> conv;
+ wi::unordered_map conv;
for (uint32_t i = 0; i < scene.materials.GetCount(); ++i)
{
MaterialComponent& material = scene.materials[i];
@@ -566,29 +566,31 @@ void WeatherWindow::Create(EditorComponent* editor)
{
if (x.GetGPUResource() == nullptr)
continue;
- if (wiHelper::GetExtensionFromFileName(x.name).compare("KTX2"))
+ if (wi::helper::GetExtensionFromFileName(x.name).compare("KTX2"))
{
- x.name = wiHelper::ReplaceExtension(x.name, "KTX2");
+ x.name = wi::helper::ReplaceExtension(x.name, "KTX2");
conv[x.name] = x.resource;
}
}
}
- wiJobSystem::context ctx;
+ wi::jobsystem::context ctx;
for (auto& x : conv)
{
- if (wiHelper::saveTextureToMemory(x.second->texture, x.second->filedata))
+ std::vector filedata;
+ if (wi::helper::saveTextureToMemory(x.second.GetTexture(), filedata))
{
- wiJobSystem::Execute(ctx, [&](wiJobArgs args) {
+ x.second.SetFileData(std::move(filedata));
+ wi::jobsystem::Execute(ctx, [&](wi::jobsystem::JobArgs args) {
wi::vector filedata_ktx2;
- if (wiHelper::saveTextureToMemoryFile(x.second->filedata, x.second->texture.desc, "KTX2", filedata_ktx2))
+ if (wi::helper::saveTextureToMemoryFile(x.second.GetFileData(), x.second.GetTexture().desc, "KTX2", filedata_ktx2))
{
- x.second = wiResourceManager::Load(x.first, wiResourceManager::IMPORT_RETAIN_FILEDATA, filedata_ktx2.data(), filedata_ktx2.size());
+ x.second = wi::resourcemanager::Load(x.first, wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA, filedata_ktx2.data(), filedata_ktx2.size());
}
});
}
}
- wiJobSystem::Wait(ctx);
+ wi::jobsystem::Wait(ctx);
for (uint32_t i = 0; i < scene.materials.GetCount(); ++i)
{
@@ -608,19 +610,19 @@ void WeatherWindow::Create(EditorComponent* editor)
void WeatherWindow::Update()
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
if (scene.weathers.GetCount() > 0)
{
auto& weather = scene.weathers[0];
if (!weather.skyMapName.empty())
{
- skyButton.SetText(wiHelper::GetFileNameFromPath(weather.skyMapName));
+ skyButton.SetText(wi::helper::GetFileNameFromPath(weather.skyMapName));
}
if (!weather.colorGradingMapName.empty())
{
- colorgradingButton.SetText(wiHelper::GetFileNameFromPath(weather.colorGradingMapName));
+ colorgradingButton.SetText(wi::helper::GetFileNameFromPath(weather.colorGradingMapName));
}
heightFogCheckBox.SetCheck(weather.IsHeightFog());
@@ -642,19 +644,19 @@ void WeatherWindow::Update()
{
default:
case 0:
- colorPicker.SetPickColor(wiColor::fromFloat3(weather.ambient));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(weather.ambient));
break;
case 1:
- colorPicker.SetPickColor(wiColor::fromFloat3(weather.horizon));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(weather.horizon));
break;
case 2:
- colorPicker.SetPickColor(wiColor::fromFloat3(weather.zenith));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(weather.zenith));
break;
case 3:
- colorPicker.SetPickColor(wiColor::fromFloat4(weather.oceanParameters.waterColor));
+ colorPicker.SetPickColor(wi::Color::fromFloat4(weather.oceanParameters.waterColor));
break;
case 4:
- colorPicker.SetPickColor(wiColor::fromFloat3(weather.volumetricCloudParameters.Albedo));
+ colorPicker.SetPickColor(wi::Color::fromFloat3(weather.volumetricCloudParameters.Albedo));
break;
}
@@ -679,7 +681,7 @@ void WeatherWindow::Update()
WeatherComponent& WeatherWindow::GetWeather() const
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
if (scene.weathers.GetCount() == 0)
{
scene.weathers.Create(CreateEntity());
@@ -689,7 +691,7 @@ WeatherComponent& WeatherWindow::GetWeather() const
void WeatherWindow::InvalidateProbes() const
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
// Also, we invalidate all environment probes to reflect the sky changes.
for (size_t i = 0; i < scene.probes.GetCount(); ++i)
diff --git a/Editor/WeatherWindow.h b/Editor/WeatherWindow.h
index 3fc3a6e55..42b31c39a 100644
--- a/Editor/WeatherWindow.h
+++ b/Editor/WeatherWindow.h
@@ -3,7 +3,7 @@
class EditorComponent;
-class WeatherWindow : public wiWindow
+class WeatherWindow : public wi::gui::Window
{
void UpdateWind();
public:
@@ -11,55 +11,55 @@ public:
void Update();
- wiScene::WeatherComponent& GetWeather() const;
+ wi::scene::WeatherComponent& GetWeather() const;
void InvalidateProbes() const;
- wiCheckBox heightFogCheckBox;
- wiSlider fogStartSlider;
- wiSlider fogEndSlider;
- wiSlider fogHeightStartSlider;
- wiSlider fogHeightEndSlider;
- wiSlider fogHeightSkySlider;
- wiSlider cloudinessSlider;
- wiSlider cloudScaleSlider;
- wiSlider cloudSpeedSlider;
- wiSlider windSpeedSlider;
- wiSlider windMagnitudeSlider;
- wiSlider windDirectionSlider;
- wiSlider windWaveSizeSlider;
- wiSlider windRandomnessSlider;
- wiSlider skyExposureSlider;
- wiCheckBox simpleskyCheckBox;
- wiCheckBox realisticskyCheckBox;
- wiButton skyButton;
- wiButton colorgradingButton;
+ wi::gui::CheckBox heightFogCheckBox;
+ wi::gui::Slider fogStartSlider;
+ wi::gui::Slider fogEndSlider;
+ wi::gui::Slider fogHeightStartSlider;
+ wi::gui::Slider fogHeightEndSlider;
+ wi::gui::Slider fogHeightSkySlider;
+ wi::gui::Slider cloudinessSlider;
+ wi::gui::Slider cloudScaleSlider;
+ wi::gui::Slider cloudSpeedSlider;
+ wi::gui::Slider windSpeedSlider;
+ wi::gui::Slider windMagnitudeSlider;
+ wi::gui::Slider windDirectionSlider;
+ wi::gui::Slider windWaveSizeSlider;
+ wi::gui::Slider windRandomnessSlider;
+ wi::gui::Slider skyExposureSlider;
+ wi::gui::CheckBox simpleskyCheckBox;
+ wi::gui::CheckBox realisticskyCheckBox;
+ wi::gui::Button skyButton;
+ wi::gui::Button colorgradingButton;
// ocean params:
- wiCheckBox ocean_enabledCheckBox;
- wiSlider ocean_patchSizeSlider;
- wiSlider ocean_waveAmplitudeSlider;
- wiSlider ocean_choppyScaleSlider;
- wiSlider ocean_windDependencySlider;
- wiSlider ocean_timeScaleSlider;
- wiSlider ocean_heightSlider;
- wiSlider ocean_detailSlider;
- wiSlider ocean_toleranceSlider;
- wiButton ocean_resetButton;
+ wi::gui::CheckBox ocean_enabledCheckBox;
+ wi::gui::Slider ocean_patchSizeSlider;
+ wi::gui::Slider ocean_waveAmplitudeSlider;
+ wi::gui::Slider ocean_choppyScaleSlider;
+ wi::gui::Slider ocean_windDependencySlider;
+ wi::gui::Slider ocean_timeScaleSlider;
+ wi::gui::Slider ocean_heightSlider;
+ wi::gui::Slider ocean_detailSlider;
+ wi::gui::Slider ocean_toleranceSlider;
+ wi::gui::Button ocean_resetButton;
- wiComboBox colorComboBox;
- wiColorPicker colorPicker;
+ wi::gui::ComboBox colorComboBox;
+ wi::gui::ColorPicker colorPicker;
// volumetric clouds:
- wiCheckBox volumetricCloudsCheckBox;
- wiSlider coverageAmountSlider;
- wiSlider coverageMinimumSlider;
+ wi::gui::CheckBox volumetricCloudsCheckBox;
+ wi::gui::Slider coverageAmountSlider;
+ wi::gui::Slider coverageMinimumSlider;
- wiButton preset0Button;
- wiButton preset1Button;
- wiButton preset2Button;
- wiButton preset3Button;
- wiButton preset4Button;
- wiButton eliminateCoarseCascadesButton;
- wiButton ktxConvButton;
+ wi::gui::Button preset0Button;
+ wi::gui::Button preset1Button;
+ wi::gui::Button preset2Button;
+ wi::gui::Button preset3Button;
+ wi::gui::Button preset4Button;
+ wi::gui::Button eliminateCoarseCascadesButton;
+ wi::gui::Button ktxConvButton;
};
diff --git a/Editor/main_SDL2.cpp b/Editor/main_SDL2.cpp
index 09df13dec..22b0f6d29 100644
--- a/Editor/main_SDL2.cpp
+++ b/Editor/main_SDL2.cpp
@@ -111,20 +111,20 @@ int sdl_loop(Editor &editor)
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
editor.is_window_active = true;
- if (wiShaderCompiler::GetRegisteredShaderCount() > 0)
+ if (wi::shadercompiler::GetRegisteredShaderCount() > 0)
{
std::thread([] {
- wiBackLog::post("[Shader check] Started checking " + std::to_string(wiShaderCompiler::GetRegisteredShaderCount()) + " registered shaders for changes...");
- if (wiShaderCompiler::CheckRegisteredShadersOutdated())
+ wi::backlog::post("[Shader check] Started checking " + std::to_string(wi::shadercompiler::GetRegisteredShaderCount()) + " registered shaders for changes...");
+ if (wi::shadercompiler::CheckRegisteredShadersOutdated())
{
- wiBackLog::post("[Shader check] Changes detected, initiating reload...");
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [](uint64_t userdata) {
- wiRenderer::ReloadShaders();
+ wi::backlog::post("[Shader check] Changes detected, initiating reload...");
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [](uint64_t userdata) {
+ wi::renderer::ReloadShaders();
});
}
else
{
- wiBackLog::post("[Shader check] All up to date");
+ wi::backlog::post("[Shader check] All up to date");
}
}).detach();
}
@@ -146,15 +146,15 @@ int sdl_loop(Editor &editor)
{
if(c == 127)
{
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
}
else if (c != -1)
{
- if (wiBackLog::isActive())
- wiBackLog::input(c);
- wiTextInputField::AddInput(c);
+ if (wi::backlog::isActive())
+ wi::backlog::input(c);
+ wi::gui::TextInputField::AddInput(c);
}
}
cbuf = c;
@@ -193,7 +193,7 @@ int main(int argc, char *argv[])
{
Editor editor;
- wiStartupArguments::Parse(argc, argv);
+ wi::arguments::Parse(argc, argv);
sdl2::sdlsystem_ptr_t system = sdl2::make_sdlsystem(SDL_INIT_EVERYTHING | SDL_INIT_EVENTS);
if (!system) {
diff --git a/Editor/main_Windows.cpp b/Editor/main_Windows.cpp
index 44bc47cbb..a99ef48d4 100644
--- a/Editor/main_Windows.cpp
+++ b/Editor/main_Windows.cpp
@@ -39,7 +39,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
BOOL dpi_success = SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
assert(dpi_success);
- wiStartupArguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
+ wi::arguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
// Initialize global strings
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
@@ -211,7 +211,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
case PRINTSCREEN:
{
- wiHelper::screenshot(editor.swapChain);
+ wi::helper::screenshot(editor.swapChain);
}
break;
default:
@@ -222,46 +222,46 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (wParam)
{
case VK_BACK:
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
break;
case VK_RETURN:
break;
default:
{
const char c = (const char)(TCHAR)wParam;
- if (wiBackLog::isActive())
+ if (wi::backlog::isActive())
{
- wiBackLog::input(c);
+ wi::backlog::input(c);
}
- wiTextInputField::AddInput(c);
+ wi::gui::TextInputField::AddInput(c);
}
break;
}
break;
case WM_INPUT:
- wiRawInput::ParseMessage((void*)lParam);
+ wi::input::rawinput::ParseMessage((void*)lParam);
break;
case WM_KILLFOCUS:
editor.is_window_active = false;
break;
case WM_SETFOCUS:
editor.is_window_active = true;
- if (wiShaderCompiler::GetRegisteredShaderCount() > 0)
+ if (wi::shadercompiler::GetRegisteredShaderCount() > 0)
{
std::thread([] {
- wiBackLog::post("[Shader check] Started checking " + std::to_string(wiShaderCompiler::GetRegisteredShaderCount()) + " registered shaders for changes...");
- if (wiShaderCompiler::CheckRegisteredShadersOutdated())
+ wi::backlog::post("[Shader check] Started checking " + std::to_string(wi::shadercompiler::GetRegisteredShaderCount()) + " registered shaders for changes...");
+ if (wi::shadercompiler::CheckRegisteredShadersOutdated())
{
- wiBackLog::post("[Shader check] Changes detected, initiating reload...");
- wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [](uint64_t userdata) {
- wiRenderer::ReloadShaders();
+ wi::backlog::post("[Shader check] Changes detected, initiating reload...");
+ wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [](uint64_t userdata) {
+ wi::renderer::ReloadShaders();
});
}
else
{
- wiBackLog::post("[Shader check] All up to date");
+ wi::backlog::post("[Shader check] All up to date");
}
}).detach();
}
diff --git a/Example_ImGui/Example_ImGui.cpp b/Example_ImGui/Example_ImGui.cpp
index 0b62e37a0..180ffd142 100644
--- a/Example_ImGui/Example_ImGui.cpp
+++ b/Example_ImGui/Example_ImGui.cpp
@@ -13,9 +13,9 @@
#include
#include
-using namespace wiECS;
-using namespace wiGraphics;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
+using namespace wi::graphics;
Shader imguiVS;
Shader imguiPS;
@@ -57,7 +57,7 @@ bool ImGui_Impl_CreateDeviceObjects()
textureData.row_pitch = width * GetFormatStride(textureDesc.format);
textureData.slice_pitch = textureData.row_pitch * height;
- wiGraphics::GetDevice()->CreateTexture(&textureDesc, &textureData, &fontTexture);
+ wi::graphics::GetDevice()->CreateTexture(&textureDesc, &textureData, &fontTexture);
// Store our identifier
io.Fonts->SetTexID((ImTextureID)&fontTexture);
@@ -74,11 +74,11 @@ bool ImGui_Impl_CreateDeviceObjects()
desc.vs = &imguiVS;
desc.ps = &imguiPS;
desc.il = &imguiInputLayout;
- desc.dss = wiRenderer::GetDepthStencilState(DSSTYPE_DEPTHREAD);
- desc.rs = wiRenderer::GetRasterizerState(RSTYPE_DOUBLESIDED);
- desc.bs = wiRenderer::GetBlendState(BSTYPE_TRANSPARENT);
+ desc.dss = wi::renderer::GetDepthStencilState(wi::enums::DSSTYPE_DEPTHREAD);
+ desc.rs = wi::renderer::GetRasterizerState(wi::enums::RSTYPE_DOUBLESIDED);
+ desc.bs = wi::renderer::GetBlendState(wi::enums::BSTYPE_TRANSPARENT);
desc.pt = PrimitiveTopology::TRIANGLELIST;
- wiGraphics::GetDevice()->CreatePipelineState(&desc, &imguiPSO);
+ wi::graphics::GetDevice()->CreatePipelineState(&desc, &imguiPSO);
return true;
}
@@ -99,15 +99,15 @@ void Example_ImGui::Initialize()
{
// Compile shaders
{
- wiShaderCompiler::Initialize();
+ wi::shadercompiler::Initialize();
- auto shaderPath = wiRenderer::GetShaderSourcePath();
- wiRenderer::SetShaderSourcePath(wiHelper::GetCurrentPath() + "/");
+ auto shaderPath = wi::renderer::GetShaderSourcePath();
+ wi::renderer::SetShaderSourcePath(wi::helper::GetCurrentPath() + "/");
- wiRenderer::LoadShader(ShaderStage::VS, imguiVS, "ImGuiVS.cso");
- wiRenderer::LoadShader(ShaderStage::PS, imguiPS, "ImGuiPS.cso");
+ wi::renderer::LoadShader(ShaderStage::VS, imguiVS, "ImGuiVS.cso");
+ wi::renderer::LoadShader(ShaderStage::PS, imguiPS, "ImGuiPS.cso");
- wiRenderer::SetShaderSourcePath(shaderPath);
+ wi::renderer::SetShaderSourcePath(shaderPath);
}
// Setup Dear ImGui context
@@ -135,7 +135,7 @@ void Example_ImGui::Initialize()
io.BackendRendererName = "Wicked";
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
- MainComponent::Initialize();
+ Application::Initialize();
infoDisplay.active = true;
infoDisplay.watermark = true;
@@ -149,9 +149,9 @@ void Example_ImGui::Initialize()
ActivatePath(&renderer);
}
-void Example_ImGui::Compose(wiGraphics::CommandList cmd)
+void Example_ImGui::Compose(wi::graphics::CommandList cmd)
{
- MainComponent::Compose(cmd);
+ Application::Compose(cmd);
// Rendering
ImGui::Render();
@@ -171,7 +171,7 @@ void Example_ImGui::Compose(wiGraphics::CommandList cmd)
auto* bd = ImGui_Impl_GetBackendData();
- GraphicsDevice* device = wiGraphics::GetDevice();
+ GraphicsDevice* device = wi::graphics::GetDevice();
// Get memory for vertex and index buffers
const uint64_t vbSize = sizeof(ImDrawVert) * drawData->TotalVtxCount;
@@ -321,30 +321,30 @@ void Example_ImGuiRenderer::Load()
label.Create("Label1");
label.SetText("Wicked Engine ImGui integration");
- label.font.params.h_align = WIFALIGN_CENTER;
+ label.font.params.h_align = wi::font::WIFALIGN_CENTER;
label.SetSize(XMFLOAT2(240, 20));
GetGUI().AddWidget(&label);
// Reset all state that tests might have modified:
- wiEvent::SetVSync(true);
- wiRenderer::SetToDrawGridHelper(false);
- wiRenderer::SetTemporalAAEnabled(true);
- wiRenderer::ClearWorld(wiScene::GetScene());
- wiScene::GetScene().weather = WeatherComponent();
+ wi::eventhandler::SetVSync(true);
+ wi::renderer::SetToDrawGridHelper(false);
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::renderer::ClearWorld(wi::scene::GetScene());
+ wi::scene::GetScene().weather = WeatherComponent();
this->ClearSprites();
this->ClearFonts();
- if (wiLua::GetLuaState() != nullptr) {
- wiLua::KillProcesses();
+ if (wi::lua::GetLuaState() != nullptr) {
+ wi::lua::KillProcesses();
}
// Reset camera position:
TransformComponent transform;
transform.Translate(XMFLOAT3(0, 2.f, -4.5f));
transform.UpdateTransform();
- wiScene::GetCamera().TransformCamera(transform);
+ wi::scene::GetCamera().TransformCamera(transform);
// Load model.
- wiScene::LoadModel("../Content/models/teapot.wiscene");
+ wi::scene::LoadModel("../Content/models/teapot.wiscene");
RenderPath3D::Load();
}
@@ -408,23 +408,23 @@ void Example_ImGuiRenderer::Update(float dt)
ImGui::End();
}
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
// teapot_material Base Base_mesh Top Top_mesh editorLight
- wiECS::Entity e_teapot_base = scene.Entity_FindByName("Base");
- wiECS::Entity e_teapot_top = scene.Entity_FindByName("Top");
- assert(e_teapot_base != wiECS::INVALID_ENTITY);
- assert(e_teapot_top != wiECS::INVALID_ENTITY);
+ wi::ecs::Entity e_teapot_base = scene.Entity_FindByName("Base");
+ wi::ecs::Entity e_teapot_top = scene.Entity_FindByName("Top");
+ assert(e_teapot_base != wi::ecs::INVALID_ENTITY);
+ assert(e_teapot_top != wi::ecs::INVALID_ENTITY);
TransformComponent* transform_base = scene.transforms.GetComponent(e_teapot_base);
TransformComponent* transform_top = scene.transforms.GetComponent(e_teapot_top);
assert(transform_base != nullptr);
assert(transform_top != nullptr);
float rotation = dt;
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_LEFT))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_LEFT))
{
transform_base->Rotate(XMVectorSet(0, rotation, 0, 1));
transform_top->Rotate(XMVectorSet(0, rotation, 0, 1));
}
- else if (wiInput::Down(wiInput::KEYBOARD_BUTTON_RIGHT))
+ else if (wi::input::Down(wi::input::KEYBOARD_BUTTON_RIGHT))
{
transform_base->Rotate(XMVectorSet(0, -rotation, 0, 1));
transform_top->Rotate(XMVectorSet(0, -rotation, 0, 1));
diff --git a/Example_ImGui/Example_ImGui.h b/Example_ImGui/Example_ImGui.h
index ac92da8bc..4a7ec26f1 100644
--- a/Example_ImGui/Example_ImGui.h
+++ b/Example_ImGui/Example_ImGui.h
@@ -2,9 +2,9 @@
#include "WickedEngine.h"
-class Example_ImGuiRenderer : public RenderPath3D
+class Example_ImGuiRenderer : public wi::RenderPath3D
{
- wiLabel label;
+ wi::gui::Label label;
public:
void Load() override;
void Update(float dt) override;
@@ -12,13 +12,13 @@ public:
void Render() const override;
};
-class Example_ImGui : public MainComponent
+class Example_ImGui : public wi::Application
{
Example_ImGuiRenderer renderer;
public:
~Example_ImGui() override;
void Initialize() override;
- void Compose(wiGraphics::CommandList cmd) override;
+ void Compose(wi::graphics::CommandList cmd) override;
};
diff --git a/Example_ImGui/main_SDL2.cpp b/Example_ImGui/main_SDL2.cpp
index b859d9928..b7f4c621a 100644
--- a/Example_ImGui/main_SDL2.cpp
+++ b/Example_ImGui/main_SDL2.cpp
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
Example_ImGui exampleImGui;
// TODO: Place code here.
- wiStartupArguments::Parse(argc, argv);
+ wi::arguments::Parse(argc, argv);
sdl2::sdlsystem_ptr_t system = sdl2::make_sdlsystem(SDL_INIT_EVERYTHING | SDL_INIT_EVENTS);
if (!system) {
diff --git a/Example_ImGui/main_Windows.cpp b/Example_ImGui/main_Windows.cpp
index 482bfdcf5..beefdf0f8 100644
--- a/Example_ImGui/main_Windows.cpp
+++ b/Example_ImGui/main_Windows.cpp
@@ -33,7 +33,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
BOOL dpi_success = SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
assert(dpi_success);
- wiStartupArguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
+ wi::arguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
// Initialize global strings
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
@@ -169,26 +169,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (wParam)
{
case VK_BACK:
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
break;
case VK_RETURN:
break;
default:
{
const char c = (const char)(TCHAR)wParam;
- if (wiBackLog::isActive())
+ if (wi::backlog::isActive())
{
- wiBackLog::input(c);
+ wi::backlog::input(c);
}
- wiTextInputField::AddInput(c);
+ wi::gui::TextInputField::AddInput(c);
}
break;
}
break;
case WM_INPUT:
- wiRawInput::ParseMessage((void*)lParam);
+ wi::input::rawinput::ParseMessage((void*)lParam);
break;
case WM_KILLFOCUS:
example_imgui.is_window_active = false;
diff --git a/README.md b/README.md
index 1aeb2b83b..477c2f78c 100644
--- a/README.md
+++ b/README.md
@@ -84,55 +84,55 @@ If you have questions or stuck, please use the `linux` communication channel on
// Include engine headers:
#include "WickedEngine.h"
-// Declare main component once per application:
-MainComponent main;
+// Create the Wicked Engine application:
+wi::Application application;
// Assign window that you will render to:
-main.SetWindow(hWnd);
+application.SetWindow(hWnd);
// Run the application:
while(true) {
- main.Run();
+ application.Run();
}
```
#### Basics (C++):
```cpp
-RenderPath3D myGame; // Declare a game screen component, aka "RenderPath" (you could also override its Update(), Render() etc. functions).
-main.ActivatePath(&myGame); // Register your game to the application. It will call Start(), Update(), Render(), etc. from now on...
+wi::RenderPath3D myGame; // Declare a game screen component, aka "RenderPath" (you could also override its Update(), Render() etc. functions).
+application.ActivatePath(&myGame); // Register your game to the application. It will call Start(), Update(), Render(), etc. from now on...
-wiScene::LoadModel("myModel.wiscene"); // Simply load a model into the current global scene
-wiScene::GetScene(); // Get the current global scene
+wi::scene::LoadModel("myModel.wiscene"); // Simply load a model into the current global scene
+wi::scene::GetScene(); // Get the current global scene
-wiScene::Scene scene2; // create a separate scene
-wiScene::LoadModel(scene2, "myModel2.wiscene"); // Load model into a separate scene
-wiScene::GetScene().Merge(scene2); // Combine separate scene with global scene
+wi::scene::Scene scene2; // create a separate scene
+wi::scene::LoadModel(scene2, "myModel2.wiscene"); // Load model into a separate scene
+wi::scene::GetScene().Merge(scene2); // Combine separate scene with global scene
myGame.setFXAAEnabled(true); // You can enable post process effects this way...
-RenderPath2D myMenuScreen; // This is an other render path, but now a simple 2D one. It can only render 2D graphics by default (like a menu for example)
-main.ActivatePath(&myMenuScreen); // activate the menu, the previous path (myGame) will be stopped
+wi::RenderPath2D myMenuScreen; // This is an other render path, but now a simple 2D one. It can only render 2D graphics by default (like a menu for example)
+application.ActivatePath(&myMenuScreen); // activate the menu, the previous path (myGame) will be stopped
-wiSprite mySprite("image.png"); // There are many utilities, such as a "sprite" helper class
+wi::Sprite mySprite("image.png"); // There are many utilities, such as a "sprite" helper class
myMenuScreen.AddSprite(&mySprite); // The 2D render path is ready to handle sprite and font rendering for you
-wiAudio::Sound mySound;
-wiAudio::CreateSound("explosion.wav", &mySound); // Loads a sound file
-wiAudio::SoundInstance mySoundInstance;
-wiAudio::CreateSoundInstance(&mySound, &mySoundInstance); // Instances the sound file, it can be played now
-wiAudio::Play(&mySoundInstance); // Play the sound instance
-wiAudio::SetVolume(0.6, &mySoundInstance); // Set the volume of this soundinstance
-wiAudio::SetVolume(0.2); // Set the master volume
+wi::audio::Sound mySound;
+wi::audio::CreateSound("explosion.wav", &mySound); // Loads a sound file
+wi::audio::SoundInstance mySoundInstance;
+wi::audio::CreateSoundInstance(&mySound, &mySoundInstance); // Instances the sound file, it can be played now
+wi::audio::Play(&mySoundInstance); // Play the sound instance
+wi::audio::SetVolume(0.6, &mySoundInstance); // Set the volume of this soundinstance
+wi::audio::SetVolume(0.2); // Set the master volume
-if (wiInput::Press(wiInput::KEYBOARD_BUTTON_SPACE)) { wiAudio::Stop(&mySoundInstance); } // You can check if a button is pressed or not (this only triggers once)
-if (wiInput::Down(wiInput::KEYBOARD_BUTTON_SPACE)) { wiAudio::Play(&mySoundInstance); } // You can check if a button is pushed down or not (this triggers repeatedly)
+if (wi::input::Press(wi::input::KEYBOARD_BUTTON_SPACE)) { wi::audio::Stop(&mySoundInstance); } // You can check if a button is pressed or not (this only triggers once)
+if (wi::input::Down(wi::input::KEYBOARD_BUTTON_SPACE)) { wi::audio::Play(&mySoundInstance); } // You can check if a button is pushed down or not (this triggers repeatedly)
```
#### Scripting (LUA):
```lua
--- Set a rendering path for the application main component
+-- Set a rendering path for the application
path = RenderPath3D;
-main.SetActivePath(path); -- "main" is created automatically
+application.SetActivePath(path); -- "application" is created automatically by wi::Application
-- Load a model entity into the global scene:
entity = LoadModel("myModel.wiscene");
@@ -152,9 +152,9 @@ transform = scene.Component_GetTransform(entity);
transform.Translate(Vector(2, 0, 0));
-- Print any WickedEngine class information to the backlog:
-getprops(main); -- prints the main component methods
-getprops(scene); -- prints the Scene class methods
-getprops(path); -- prints the deferred render path methods
+getprops(application); -- prints the application methods
+getprops(scene); -- prints the Scene class methods
+getprops(path); -- prints the deferred render path methods
-- Play a sound:
sound = Sound()
diff --git a/Template_UWP/Main.cpp b/Template_UWP/Main.cpp
index 530e013e3..616f0c75f 100644
--- a/Template_UWP/Main.cpp
+++ b/Template_UWP/Main.cpp
@@ -45,10 +45,10 @@ public:
CoreApplication::Resuming({ this, &ViewProvider::OnResuming });
- main.infoDisplay.active = true;
- main.infoDisplay.watermark = true;
- main.infoDisplay.resolution = true;
- main.infoDisplay.fpsinfo = true;
+ application.infoDisplay.active = true;
+ application.infoDisplay.watermark = true;
+ application.infoDisplay.resolution = true;
+ application.infoDisplay.fpsinfo = true;
}
void Uninitialize() noexcept
@@ -87,7 +87,7 @@ public:
m_logicalWidth = window.Bounds().Width;
m_logicalHeight = window.Bounds().Height;
- main.SetWindow(&window);
+ application.SetWindow(&window);
}
void Load(winrt::hstring const &) noexcept
@@ -100,7 +100,7 @@ public:
{
if (m_visible)
{
- main.Run();
+ application.Run();
CoreWindow::GetForCurrentThread().Dispatcher().ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
}
@@ -134,7 +134,7 @@ protected:
void OnWindowSizeChanged(CoreWindow const & sender, WindowSizeChangedEventArgs const & /*args*/)
{
- main.SetWindow(&sender);
+ application.SetWindow(&sender);
}
void OnVisibilityChanged(CoreWindow const & /*sender*/, VisibilityChangedEventArgs const & args)
@@ -166,15 +166,15 @@ protected:
if (c == '\b')
{
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
}
else
{
- if (wiBackLog::isActive())
- wiBackLog::input(c);
- wiTextInputField::AddInput(c);
+ if (wi::backlog::isActive())
+ wi::backlog::input(c);
+ wi::gui::TextInputField::AddInput(c);
}
}
@@ -182,7 +182,7 @@ protected:
void OnDpiChanged(DisplayInformation const & sender, IInspectable const & /*args*/)
{
- main.SetWindow(&CoreWindow::GetForCurrentThread());
+ application.SetWindow(&CoreWindow::GetForCurrentThread());
}
void OnDisplayContentsInvalidated(DisplayInformation const & /*sender*/, IInspectable const & /*args*/)
@@ -195,7 +195,7 @@ private:
float m_DPI = 96;
float m_logicalWidth = 800;
float m_logicalHeight = 600;
- MainComponent main;
+ wi::Application application;
inline int ConvertDipsToPixels(float dips) const noexcept
{
diff --git a/Template_Windows/main.cpp b/Template_Windows/main.cpp
index fe06ed7b3..98a99d372 100644
--- a/Template_Windows/main.cpp
+++ b/Template_Windows/main.cpp
@@ -10,7 +10,7 @@
HINSTANCE hInst; // current instance
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
-MainComponent main; // Wicked Engine Main Runtime Component
+wi::Application application; // Wicked Engine Application
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
@@ -31,7 +31,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
BOOL dpi_success = SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
assert(dpi_success);
- wiStartupArguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
+ wi::arguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
// Initialize global strings
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
@@ -47,10 +47,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TEMPLATEWINDOWS));
// just show some basic info:
- main.infoDisplay.active = true;
- main.infoDisplay.watermark = true;
- main.infoDisplay.resolution = true;
- main.infoDisplay.fpsinfo = true;
+ application.infoDisplay.active = true;
+ application.infoDisplay.watermark = true;
+ application.infoDisplay.resolution = true;
+ application.infoDisplay.fpsinfo = true;
MSG msg = { 0 };
while (msg.message != WM_QUIT)
@@ -61,7 +61,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
}
else {
- main.Run(); // run the update - render loop (mandatory)
+ application.Run(); // run the update - render loop (mandatory)
}
}
@@ -123,7 +123,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
UpdateWindow(hWnd);
- main.SetWindow(hWnd); // assign window handle (mandatory)
+ application.SetWindow(hWnd); // assign window handle (mandatory)
return TRUE;
@@ -162,36 +162,36 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_SIZE:
case WM_DPICHANGED:
- if (main.is_window_active)
- main.SetWindow(hWnd);
+ if (application.is_window_active)
+ application.SetWindow(hWnd);
break;
case WM_CHAR:
switch (wParam)
{
case VK_BACK:
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
break;
case VK_RETURN:
break;
default:
{
const char c = (const char)(TCHAR)wParam;
- if (wiBackLog::isActive())
+ if (wi::backlog::isActive())
{
- wiBackLog::input(c);
+ wi::backlog::input(c);
}
- wiTextInputField::AddInput(c);
+ wi::gui::TextInputField::AddInput(c);
}
break;
}
break;
case WM_KILLFOCUS:
- main.is_window_active = false;
+ application.is_window_active = false;
break;
case WM_SETFOCUS:
- main.is_window_active = true;
+ application.is_window_active = true;
break;
case WM_PAINT:
{
diff --git a/Tests/Tests.cpp b/Tests/Tests.cpp
index 7371633ed..07f175c8d 100644
--- a/Tests/Tests.cpp
+++ b/Tests/Tests.cpp
@@ -6,12 +6,12 @@
#include
#include
-using namespace wiECS;
-using namespace wiScene;
+using namespace wi::ecs;
+using namespace wi::scene;
void Tests::Initialize()
{
- MainComponent::Initialize();
+ wi::Application::Initialize();
infoDisplay.active = true;
infoDisplay.watermark = true;
@@ -41,37 +41,37 @@ void TestsRenderer::Load()
label.Create("Label1");
label.SetText("Wicked Engine Test Framework");
- label.font.params.h_align = WIFALIGN_CENTER;
+ label.font.params.h_align = wi::font::WIFALIGN_CENTER;
label.SetSize(XMFLOAT2(240,20));
GetGUI().AddWidget(&label);
- static wiAudio::Sound sound;
- static wiAudio::SoundInstance soundinstance;
+ static wi::audio::Sound sound;
+ static wi::audio::SoundInstance soundinstance;
- static wiButton audioTest;
+ static wi::gui::Button audioTest;
audioTest.Create("AudioTest");
audioTest.SetText("Play Test Audio");
audioTest.SetSize(XMFLOAT2(200, 20));
audioTest.SetPos(XMFLOAT2(10, 140));
- audioTest.SetColor(wiColor(255, 205, 43, 200), wiWidget::WIDGETSTATE::IDLE);
- audioTest.SetColor(wiColor(255, 235, 173, 255), wiWidget::WIDGETSTATE::FOCUS);
- audioTest.OnClick([&](wiEventArgs args) {
+ audioTest.SetColor(wi::Color(255, 205, 43, 200), wi::gui::IDLE);
+ audioTest.SetColor(wi::Color(255, 235, 173, 255), wi::gui::FOCUS);
+ audioTest.OnClick([&](wi::gui::EventArgs args) {
static bool playing = false;
if (!sound.IsValid())
{
- wiAudio::CreateSound("sound/music.wav", &sound);
- wiAudio::CreateSoundInstance(&sound, &soundinstance);
+ wi::audio::CreateSound("sound/music.wav", &sound);
+ wi::audio::CreateSoundInstance(&sound, &soundinstance);
}
if (playing)
{
- wiAudio::Stop(&soundinstance);
+ wi::audio::Stop(&soundinstance);
audioTest.SetText("Play Test Audio");
}
else
{
- wiAudio::Play(&soundinstance);
+ wi::audio::Play(&soundinstance);
audioTest.SetText("Stop Test Audio");
}
@@ -80,17 +80,17 @@ void TestsRenderer::Load()
GetGUI().AddWidget(&audioTest);
- static wiSlider volume;
+ static wi::gui::Slider volume;
volume.Create(0, 100, 50, 100, "Volume");
volume.SetText("Volume: ");
volume.SetSize(XMFLOAT2(100, 20));
volume.SetPos(XMFLOAT2(65, 170));
- volume.sprites_knob[wiWidget::WIDGETSTATE::IDLE].params.color = wiColor(255, 205, 43, 200);
- volume.sprites_knob[wiWidget::WIDGETSTATE::FOCUS].params.color = wiColor(255, 235, 173, 255);
- volume.sprites[wiWidget::WIDGETSTATE::IDLE].params.color = wiMath::Lerp(wiColor::Transparent(), volume.sprites_knob[wiWidget::WIDGETSTATE::IDLE].params.color, 0.5f);
- volume.sprites[wiWidget::WIDGETSTATE::FOCUS].params.color = wiMath::Lerp(wiColor::Transparent(), volume.sprites_knob[wiWidget::WIDGETSTATE::FOCUS].params.color, 0.5f);
- volume.OnSlide([](wiEventArgs args) {
- wiAudio::SetVolume(args.fValue / 100.0f, &soundinstance);
+ volume.sprites_knob[wi::gui::IDLE].params.color = wi::Color(255, 205, 43, 200);
+ volume.sprites_knob[wi::gui::FOCUS].params.color = wi::Color(255, 235, 173, 255);
+ volume.sprites[wi::gui::IDLE].params.color = wi::math::Lerp(wi::Color::Transparent(), volume.sprites_knob[wi::gui::WIDGETSTATE::IDLE].params.color, 0.5f);
+ volume.sprites[wi::gui::FOCUS].params.color = wi::math::Lerp(wi::Color::Transparent(), volume.sprites_knob[wi::gui::WIDGETSTATE::FOCUS].params.color, 0.5f);
+ volume.OnSlide([](wi::gui::EventArgs args) {
+ wi::audio::SetVolume(args.fValue / 100.0f, &soundinstance);
});
GetGUI().AddWidget(&volume);
@@ -99,8 +99,8 @@ void TestsRenderer::Load()
testSelector.SetText("Demo: ");
testSelector.SetSize(XMFLOAT2(140, 20));
testSelector.SetPos(XMFLOAT2(50, 200));
- testSelector.SetColor(wiColor(255, 205, 43, 200), wiWidget::WIDGETSTATE::IDLE);
- testSelector.SetColor(wiColor(255, 235, 173, 255), wiWidget::WIDGETSTATE::FOCUS);
+ testSelector.SetColor(wi::Color(255, 205, 43, 200), wi::gui::IDLE);
+ testSelector.SetColor(wi::Color(255, 235, 173, 255), wi::gui::FOCUS);
testSelector.AddItem("HelloWorld");
testSelector.AddItem("Model");
testSelector.AddItem("EmittedParticle 1");
@@ -122,25 +122,25 @@ void TestsRenderer::Load()
testSelector.AddItem("65k Instances");
testSelector.AddItem("unordered_map perf");
testSelector.SetMaxVisibleItemCount(10);
- testSelector.OnSelect([=](wiEventArgs args) {
+ testSelector.OnSelect([=](wi::gui::EventArgs args) {
// Reset all state that tests might have modified:
- wiEvent::SetVSync(true);
- wiRenderer::SetToDrawGridHelper(false);
- wiRenderer::SetTemporalAAEnabled(false);
- wiRenderer::ClearWorld(wiScene::GetScene());
- wiScene::GetScene().weather = WeatherComponent();
+ wi::eventhandler::SetVSync(true);
+ wi::renderer::SetToDrawGridHelper(false);
+ wi::renderer::SetTemporalAAEnabled(false);
+ wi::renderer::ClearWorld(wi::scene::GetScene());
+ wi::scene::GetScene().weather = WeatherComponent();
this->ClearSprites();
this->ClearFonts();
- if (wiLua::GetLuaState() != nullptr) {
- wiLua::KillProcesses();
+ if (wi::lua::GetLuaState() != nullptr) {
+ wi::lua::KillProcesses();
}
// Reset camera position:
TransformComponent transform;
transform.Translate(XMFLOAT3(0, 2.f, -4.5f));
transform.UpdateTransform();
- wiScene::GetCamera().TransformCamera(transform);
+ wi::scene::GetCamera().TransformCamera(transform);
float screenW = GetLogicalWidth();
float screenH = GetLogicalHeight();
@@ -154,8 +154,8 @@ void TestsRenderer::Load()
// The second texture is a static image of "hello world" written on it
// Then add some animations to the sprite to get a nice wobbly and color changing effect.
// You can learn more in the Sprite test in RunSpriteTest() function
- static wiSprite sprite;
- sprite = wiSprite("images/movingtex.png", "images/HelloWorld.png");
+ static wi::Sprite sprite;
+ sprite = wi::Sprite("images/movingtex.png", "images/HelloWorld.png");
sprite.params.pos = XMFLOAT3(screenW / 2, screenH / 2, 0);
sprite.params.siz = XMFLOAT2(200, 100);
sprite.params.pivot = XMFLOAT2(0.5f, 0.5f);
@@ -167,36 +167,36 @@ void TestsRenderer::Load()
break;
}
case 1:
- wiRenderer::SetTemporalAAEnabled(true);
- wiScene::LoadModel("../Content/models/teapot.wiscene");
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::scene::LoadModel("../Content/models/teapot.wiscene");
break;
case 2:
- wiScene::LoadModel("../Content/models/emitter_smoke.wiscene");
+ wi::scene::LoadModel("../Content/models/emitter_smoke.wiscene");
break;
case 3:
- wiScene::LoadModel("../Content/models/emitter_skinned.wiscene");
+ wi::scene::LoadModel("../Content/models/emitter_skinned.wiscene");
break;
case 4:
- wiScene::LoadModel("../Content/models/hairparticle_torus.wiscene", XMMatrixTranslation(0, 1, 0));
+ wi::scene::LoadModel("../Content/models/hairparticle_torus.wiscene", XMMatrixTranslation(0, 1, 0));
break;
case 5:
- wiRenderer::SetToDrawGridHelper(true);
- wiLua::RunFile("test_script.lua");
+ wi::renderer::SetToDrawGridHelper(true);
+ wi::lua::RunFile("test_script.lua");
break;
case 6:
- wiRenderer::SetTemporalAAEnabled(true);
- wiScene::LoadModel("../Content/models/water_test.wiscene", XMMatrixTranslation(0, 1, 0));
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::scene::LoadModel("../Content/models/water_test.wiscene", XMMatrixTranslation(0, 1, 0));
break;
case 7:
- wiRenderer::SetTemporalAAEnabled(true);
- wiScene::LoadModel("../Content/models/shadows_test.wiscene", XMMatrixTranslation(0, 1, 0));
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::scene::LoadModel("../Content/models/shadows_test.wiscene", XMMatrixTranslation(0, 1, 0));
break;
case 8:
- wiRenderer::SetTemporalAAEnabled(true);
- wiScene::LoadModel("../Content/models/physics_test.wiscene");
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::scene::LoadModel("../Content/models/physics_test.wiscene");
break;
case 9:
- wiScene::LoadModel("../Content/models/cloth_test.wiscene", XMMatrixTranslation(0, 3, 4));
+ wi::scene::LoadModel("../Content/models/cloth_test.wiscene", XMMatrixTranslation(0, 3, 4));
break;
case 10:
RunJobSystemTest();
@@ -205,34 +205,34 @@ void TestsRenderer::Load()
RunFontTest();
break;
case 12:
- wiRenderer::SetTemporalAAEnabled(true);
- wiScene::LoadModel("../Content/models/volumetric_test.wiscene", XMMatrixTranslation(0, 0, 4));
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::scene::LoadModel("../Content/models/volumetric_test.wiscene", XMMatrixTranslation(0, 0, 4));
break;
case 13:
RunSpriteTest();
break;
case 14:
- wiEvent::SetVSync(false); // turn off vsync if we can to accelerate the baking
- wiRenderer::SetTemporalAAEnabled(true);
- wiScene::LoadModel("../Content/models/lightmap_bake_test.wiscene", XMMatrixTranslation(0, 0, 4));
+ wi::eventhandler::SetVSync(false); // turn off vsync if we can to accelerate the baking
+ wi::renderer::SetTemporalAAEnabled(true);
+ wi::scene::LoadModel("../Content/models/lightmap_bake_test.wiscene", XMMatrixTranslation(0, 0, 4));
break;
case 15:
RunNetworkTest();
break;
case 16:
{
- static wiSpriteFont font("This test plays a vibration on the first controller's left motor (if device supports it) \n and changes the LED to a random color (if device supports it)");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_CENTER;
+ static wi::SpriteFont font("This test plays a vibration on the first controller's left motor (if device supports it) \n and changes the LED to a random color (if device supports it)");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_CENTER;
font.params.size = 20;
font.params.posX = screenW / 2;
font.params.posY = screenH / 2;
AddFont(&font);
- wiInput::ControllerFeedback feedback;
- feedback.led_color.rgba = wiRandom::getRandom(0xFFFFFF);
+ wi::input::ControllerFeedback feedback;
+ feedback.led_color.rgba = wi::random::GetRandom(0xFFFFFF);
feedback.vibration_left = 0.9f;
- wiInput::SetControllerFeedback(feedback, 0);
+ wi::input::SetControllerFeedback(feedback, 0);
}
break;
case 17:
@@ -265,15 +265,15 @@ void TestsRenderer::Load()
weather.zenith = XMFLOAT3(0.42f, 0.42f, 0.42f);
weather.cloudiness = 0.75f;
- wiScene::GetScene().Merge(scene); // add lodaded scene to global scene
+ wi::scene::GetScene().Merge(scene); // add lodaded scene to global scene
}
break;
case 18:
{
- wiScene::LoadModel("../Content/models/cube.wiscene");
- wiProfiler::SetEnabled(true);
- Scene& scene = wiScene::GetScene();
+ wi::scene::LoadModel("../Content/models/cube.wiscene");
+ wi::profiler::SetEnabled(true);
+ Scene& scene = wi::scene::GetScene();
scene.Entity_CreateLight("testlight", XMFLOAT3(0, 2, -4), XMFLOAT3(1, 1, 1), 4, 10);
Entity cubeentity = scene.Entity_FindByName("Cube");
const float scale = 0.06f;
@@ -315,23 +315,23 @@ void TestsRenderer::Update(float dt)
{
case 1:
{
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
// teapot_material Base Base_mesh Top Top_mesh editorLight
- wiECS::Entity e_teapot_base = scene.Entity_FindByName("Base");
- wiECS::Entity e_teapot_top = scene.Entity_FindByName("Top");
- assert(e_teapot_base != wiECS::INVALID_ENTITY);
- assert(e_teapot_top != wiECS::INVALID_ENTITY);
+ wi::ecs::Entity e_teapot_base = scene.Entity_FindByName("Base");
+ wi::ecs::Entity e_teapot_top = scene.Entity_FindByName("Top");
+ assert(e_teapot_base != wi::ecs::INVALID_ENTITY);
+ assert(e_teapot_top != wi::ecs::INVALID_ENTITY);
TransformComponent* transform_base = scene.transforms.GetComponent(e_teapot_base);
TransformComponent* transform_top = scene.transforms.GetComponent(e_teapot_top);
assert(transform_base != nullptr);
assert(transform_top != nullptr);
float rotation = dt;
- if (wiInput::Down(wiInput::KEYBOARD_BUTTON_LEFT))
+ if (wi::input::Down(wi::input::KEYBOARD_BUTTON_LEFT))
{
transform_base->Rotate(XMVectorSet(0,rotation,0,1));
transform_top->Rotate(XMVectorSet(0,rotation,0,1));
}
- else if (wiInput::Down(wiInput::KEYBOARD_BUTTON_RIGHT))
+ else if (wi::input::Down(wi::input::KEYBOARD_BUTTON_RIGHT))
{
transform_base->Rotate(XMVectorSet(0,-rotation,0,1));
transform_top->Rotate(XMVectorSet(0,-rotation,0,1));
@@ -343,12 +343,12 @@ void TestsRenderer::Update(float dt)
if (ik_entity != INVALID_ENTITY)
{
// Inverse kinematics test:
- Scene& scene = wiScene::GetScene();
+ Scene& scene = wi::scene::GetScene();
InverseKinematicsComponent& ik = *scene.inverse_kinematics.GetComponent(ik_entity);
TransformComponent& target = *scene.transforms.GetComponent(ik.target);
// place ik target on a plane intersected by mouse ray:
- RAY ray = wiRenderer::GetPickRay((long)wiInput::GetPointer().x, (long)wiInput::GetPointer().y, *this);
+ wi::primitive::Ray ray = wi::renderer::GetPickRay((long)wi::input::GetPointer().x, (long)wi::input::GetPointer().y, *this);
XMVECTOR plane = XMVectorSet(0, 0, 1, 0.2f);
XMVECTOR I = XMPlaneIntersectLine(plane, XMLoadFloat3(&ray.origin), XMLoadFloat3(&ray.origin) + XMLoadFloat3(&ray.direction) * 10000);
target.ClearTransform();
@@ -358,26 +358,26 @@ void TestsRenderer::Update(float dt)
target.UpdateTransform();
// draw debug ik target position:
- wiRenderer::RenderablePoint pp;
+ wi::renderer::RenderablePoint pp;
pp.position = target.GetPosition();
pp.color = XMFLOAT4(0, 1, 1, 1);
pp.size = 0.2f;
- wiRenderer::DrawPoint(pp);
+ wi::renderer::DrawPoint(pp);
pp.position = scene.transforms.GetComponent(ik_entity)->GetPosition();
pp.color = XMFLOAT4(1, 0, 0, 1);
pp.size = 0.1f;
- wiRenderer::DrawPoint(pp);
+ wi::renderer::DrawPoint(pp);
}
}
break;
case 18:
{
- static wiTimer timer;
+ static wi::Timer timer;
float sec = (float)timer.elapsed_seconds();
- wiJobSystem::context ctx;
- wiJobSystem::Dispatch(ctx, (uint32_t)scene->transforms.GetCount(), 1024, [&](wiJobArgs args) {
+ wi::jobsystem::context ctx;
+ wi::jobsystem::Dispatch(ctx, (uint32_t)scene->transforms.GetCount(), 1024, [&](wi::jobsystem::JobArgs args) {
TransformComponent& transform = scene->transforms[args.jobIndex];
XMStoreFloat4x4(
&transform.world,
@@ -385,12 +385,12 @@ void TestsRenderer::Update(float dt)
);
});
scene->materials[0].SetEmissiveColor(XMFLOAT4(1, 1, 1, 1));
- wiJobSystem::Dispatch(ctx, (uint32_t)scene->objects.GetCount(), 1024, [&](wiJobArgs args) {
+ wi::jobsystem::Dispatch(ctx, (uint32_t)scene->objects.GetCount(), 1024, [&](wi::jobsystem::JobArgs args) {
ObjectComponent& object = scene->objects[args.jobIndex];
float f = std::pow(std::sin(-sec * 2 + 4 * (float)args.jobIndex / (float)scene->objects.GetCount()) * 0.5f + 0.5f, 32.0f);
object.emissiveColor = XMFLOAT4(0, 0.25f, 1, f * 3);
});
- wiJobSystem::Wait(ctx);
+ wi::jobsystem::Wait(ctx);
}
break;
@@ -401,10 +401,10 @@ void TestsRenderer::Update(float dt)
void TestsRenderer::RunJobSystemTest()
{
- wiTimer timer;
+ wi::Timer timer;
// This is created to be able to wait on the workload independently from other workload:
- wiJobSystem::context ctx;
+ wi::jobsystem::context ctx;
// This will simulate going over a big dataset first in a simple loop, then with the Job System and compare timings
uint32_t itemCount = 1000000;
@@ -412,37 +412,37 @@ void TestsRenderer::RunJobSystemTest()
ss += "Job System performance test:\n";
ss += "You can find out more in Tests.cpp, RunJobSystemTest() function.\n\n";
- ss += "wiJobSystem was created with " + std::to_string(wiJobSystem::GetThreadCount()) + " worker threads.\n\n";
+ ss += "wi::jobsystem was created with " + std::to_string(wi::jobsystem::GetThreadCount()) + " worker threads.\n\n";
ss += "1) Execute() test:\n";
// Serial test
{
timer.record();
- wiHelper::Spin(100);
- wiHelper::Spin(100);
- wiHelper::Spin(100);
- wiHelper::Spin(100);
+ wi::helper::Spin(100);
+ wi::helper::Spin(100);
+ wi::helper::Spin(100);
+ wi::helper::Spin(100);
double time = timer.elapsed();
ss += "Serial took " + std::to_string(time) + " milliseconds\n";
}
// Execute test
{
timer.record();
- wiJobSystem::Execute(ctx, [](wiJobArgs args){ wiHelper::Spin(100); });
- wiJobSystem::Execute(ctx, [](wiJobArgs args){ wiHelper::Spin(100); });
- wiJobSystem::Execute(ctx, [](wiJobArgs args){ wiHelper::Spin(100); });
- wiJobSystem::Execute(ctx, [](wiJobArgs args){ wiHelper::Spin(100); });
- wiJobSystem::Wait(ctx);
+ wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args){ wi::helper::Spin(100); });
+ wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args){ wi::helper::Spin(100); });
+ wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args){ wi::helper::Spin(100); });
+ wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args){ wi::helper::Spin(100); });
+ wi::jobsystem::Wait(ctx);
double time = timer.elapsed();
- ss += "wiJobSystem::Execute() took " + std::to_string(time) + " milliseconds\n";
+ ss += "wi::jobsystem::Execute() took " + std::to_string(time) + " milliseconds\n";
}
ss += "\n2) Dispatch() test:\n";
// Simple loop test:
{
- wi::vector dataSet(itemCount);
+ wi::vector dataSet(itemCount);
timer.record();
for (uint32_t i = 0; i < itemCount; ++i)
{
@@ -454,39 +454,39 @@ void TestsRenderer::RunJobSystemTest()
// Dispatch test:
{
- wi::vector dataSet(itemCount);
+ wi::vector dataSet(itemCount);
timer.record();
- wiJobSystem::Dispatch(ctx, itemCount, 1000, [&](wiJobArgs args) {
+ wi::jobsystem::Dispatch(ctx, itemCount, 1000, [&](wi::jobsystem::JobArgs args) {
dataSet[args.jobIndex].UpdateCamera();
});
- wiJobSystem::Wait(ctx);
+ wi::jobsystem::Wait(ctx);
double time = timer.elapsed();
- ss += "wiJobSystem::Dispatch() took " + std::to_string(time) + " milliseconds\n";
+ ss += "wi::jobsystem::Dispatch() took " + std::to_string(time) + " milliseconds\n";
}
- static wiSpriteFont font;
- font = wiSpriteFont(ss);
+ static wi::SpriteFont font;
+ font = wi::SpriteFont(ss);
font.params.posX = GetLogicalWidth() / 2;
font.params.posY = GetLogicalHeight() / 2;
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_CENTER;
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_CENTER;
font.params.size = 24;
this->AddFont(&font);
}
void TestsRenderer::RunFontTest()
{
- static wiSpriteFont font;
- static wiSpriteFont font_upscaled;
+ static wi::SpriteFont font;
+ static wi::SpriteFont font_upscaled;
- font.SetText("This is Arial, size 32 wiFont");
- font_upscaled.SetText("This is Arial, size 14 wiFont, but upscaled to 32");
+ font.SetText("This is Arial, size 32 wi::font");
+ font_upscaled.SetText("This is Arial, size 14 wi::font, but upscaled to 32");
font.params.posX = GetLogicalWidth() / 2.0f;
font.params.posY = GetLogicalHeight() / 6.0f;
font.params.size = 32;
font_upscaled.params = font.params;
- font_upscaled.params.posY += font.textHeight();
+ font_upscaled.params.posY += font.TextHeight();
font.params.style = 0; // 0 = default font
font_upscaled.params.style = 0; // 0 = default font
@@ -496,20 +496,20 @@ void TestsRenderer::RunFontTest()
AddFont(&font);
AddFont(&font_upscaled);
- static wiSpriteFont font_aligned;
+ static wi::SpriteFont font_aligned;
font_aligned = font;
- font_aligned.params.posY += font.textHeight() * 2;
+ font_aligned.params.posY += font.TextHeight() * 2;
font_aligned.params.size = 38;
- font_aligned.params.shadowColor = wiColor::Red();
- font_aligned.params.h_align = WIFALIGN_CENTER;
+ font_aligned.params.shadowColor = wi::Color::Red();
+ font_aligned.params.h_align = wi::font::WIFALIGN_CENTER;
font_aligned.SetText("Center aligned, red shadow, bigger");
AddFont(&font_aligned);
- static wiSpriteFont font_aligned2;
+ static wi::SpriteFont font_aligned2;
font_aligned2 = font_aligned;
- font_aligned2.params.posY += font_aligned.textHeight();
- font_aligned2.params.shadowColor = wiColor::Purple();
- font_aligned2.params.h_align = WIFALIGN_RIGHT;
+ font_aligned2.params.posY += font_aligned.TextHeight();
+ font_aligned2.params.shadowColor = wi::Color::Purple();
+ font_aligned2.params.h_align = wi::font::WIFALIGN_RIGHT;
font_aligned2.SetText("Right aligned, purple shadow");
AddFont(&font_aligned2);
@@ -524,23 +524,23 @@ void TestsRenderer::RunFontTest()
ss += s + "\t";
}
}
- static wiSpriteFont font_japanese;
+ static wi::SpriteFont font_japanese;
font_japanese = font_aligned2;
- font_japanese.params.posY += font_aligned2.textHeight();
- font_japanese.params.style = wiFont::AddFontStyle("yumin.ttf");
- font_japanese.params.shadowColor = wiColor::Transparent();
- font_japanese.params.h_align = WIFALIGN_CENTER;
+ font_japanese.params.posY += font_aligned2.TextHeight();
+ font_japanese.params.style = wi::font::AddFontStyle("yumin.ttf");
+ font_japanese.params.shadowColor = wi::Color::Transparent();
+ font_japanese.params.h_align = wi::font::WIFALIGN_CENTER;
font_japanese.params.size = 34;
font_japanese.SetText(ss);
AddFont(&font_japanese);
- static wiSpriteFont font_colored;
- font_colored.params.color = wiColor::Cyan();
- font_colored.params.h_align = WIFALIGN_CENTER;
- font_colored.params.v_align = WIFALIGN_TOP;
+ static wi::SpriteFont font_colored;
+ font_colored.params.color = wi::Color::Cyan();
+ font_colored.params.h_align = wi::font::WIFALIGN_CENTER;
+ font_colored.params.v_align = wi::font::WIFALIGN_TOP;
font_colored.params.size = 26;
font_colored.params.posX = GetLogicalWidth() / 2;
- font_colored.params.posY = font_japanese.params.posY + font_japanese.textHeight();
+ font_colored.params.posY = font_japanese.params.posY + font_japanese.TextHeight();
font_colored.SetText("Colored font");
AddFont(&font_colored);
}
@@ -550,17 +550,17 @@ void TestsRenderer::RunSpriteTest()
const float screenW = GetLogicalWidth();
const float screenH = GetLogicalHeight();
const XMFLOAT3 startPos = XMFLOAT3(screenW * 0.3f, screenH * 0.2f, 0);
- wiImageParams params;
+ wi::image::Params params;
params.pos = startPos;
params.siz = XMFLOAT2(128, 128);
params.pivot = XMFLOAT2(0.5f, 0.5f);
- params.quality = QUALITY_LINEAR;
- params.sampleFlag = SAMPLEMODE_CLAMP;
- params.blendFlag = BLENDMODE_ALPHA;
+ params.quality = wi::image::QUALITY_LINEAR;
+ params.sampleFlag = wi::image::SAMPLEMODE_CLAMP;
+ params.blendFlag = wi::enums::BLENDMODE_ALPHA;
// Info:
{
- static wiSpriteFont font("For more information, please see \nTests.cpp, RunSpriteTest() function.");
+ static wi::SpriteFont font("For more information, please see \nTests.cpp, RunSpriteTest() function.");
font.params.posX = 10;
font.params.posY = screenH / 2;
AddFont(&font);
@@ -568,13 +568,13 @@ void TestsRenderer::RunSpriteTest()
// Simple sprite, no animation:
{
- static wiSprite sprite("../Content/logo_small.png");
+ static wi::Sprite sprite("../Content/logo_small.png");
sprite.params = params;
AddSprite(&sprite);
- static wiSpriteFont font("No animation: ");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("No animation: ");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -584,16 +584,16 @@ void TestsRenderer::RunSpriteTest()
// Simple sprite, fade animation:
{
- static wiSprite sprite("../Content/logo_small.png");
+ static wi::Sprite sprite("../Content/logo_small.png");
sprite.params = params;
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.fad = 1.2f; // (you can also do opacity animation with sprite.anim.opa)
sprite.anim.repeatable = true;
AddSprite(&sprite);
- static wiSpriteFont font("Fade animation: ");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("Fade animation: ");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -603,16 +603,16 @@ void TestsRenderer::RunSpriteTest()
// Simple sprite, wobble animation:
{
- static wiSprite sprite("../Content/logo_small.png");
+ static wi::Sprite sprite("../Content/logo_small.png");
sprite.params = params;
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.wobbleAnim.amount = XMFLOAT2(0.11f, 0.18f);
sprite.anim.wobbleAnim.speed = 1.4f;
AddSprite(&sprite);
- static wiSpriteFont font("Wobble animation: ");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("Wobble animation: ");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -622,16 +622,16 @@ void TestsRenderer::RunSpriteTest()
// Simple sprite, rotate animation:
{
- static wiSprite sprite("../Content/logo_small.png");
+ static wi::Sprite sprite("../Content/logo_small.png");
sprite.params = params;
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.rot = 2.8f;
sprite.anim.repeatable = true;
AddSprite(&sprite);
- static wiSpriteFont font("Rotate animation: ");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("Rotate animation: ");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -641,20 +641,20 @@ void TestsRenderer::RunSpriteTest()
// Simple sprite, movingtex:
{
- static wiSprite sprite("images/movingtex.png", "../Content/logo_small.png"); // first param is the texture we will display (and also scroll here). Second param is a mask texture
+ static wi::Sprite sprite("images/movingtex.png", "../Content/logo_small.png"); // first param is the texture we will display (and also scroll here). Second param is a mask texture
// Don't overwrite all params for this, because we want to keep the mask...
sprite.params.pos = params.pos;
sprite.params.siz = params.siz;
sprite.params.pivot = params.pivot;
sprite.params.color = XMFLOAT4(2, 2, 2, 1); // increase brightness a bit
- sprite.params.sampleFlag = SAMPLEMODE_MIRROR; // texcoords will be scrolled out of bounds, so set up a wrap mode other than clamp
+ sprite.params.sampleFlag = wi::image::SAMPLEMODE_MIRROR; // texcoords will be scrolled out of bounds, so set up a wrap mode other than clamp
sprite.anim.movingTexAnim.speedX = 0;
sprite.anim.movingTexAnim.speedY = 2; // scroll the texture vertically. This value is pixels/second. So because our texture here is 1x2 pixels, just scroll it once fully per second with a value of 2
AddSprite(&sprite);
- static wiSpriteFont font("MovingTex + mask: ");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("MovingTex + mask: ");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -668,13 +668,13 @@ void TestsRenderer::RunSpriteTest()
// Spritesheet, no anim:
{
- static wiSprite sprite("images/spritesheet_grid.png");
+ static wi::Sprite sprite("images/spritesheet_grid.png");
sprite.params = params; // nothing extra, just display the full spritesheet
AddSprite(&sprite);
- static wiSpriteFont font("Spritesheet: \n(without animation)");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("Spritesheet: \n(without animation)");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -684,18 +684,18 @@ void TestsRenderer::RunSpriteTest()
// Spritesheet, single line:
{
- static wiSprite sprite("images/spritesheet_grid.png");
+ static wi::Sprite sprite("images/spritesheet_grid.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 128, 128)); // drawrect cutout for a 0,0,128,128 pixel rect, this is also the first frame of animation
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.repeatable = true; // enable looping
sprite.anim.drawRectAnim.frameRate = 3; // 3 FPS, to be easily readable
sprite.anim.drawRectAnim.frameCount = 4; // animate only a single line horizontally
AddSprite(&sprite);
- static wiSpriteFont font("single line anim: \n(4 frames)");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("single line anim: \n(4 frames)");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -705,19 +705,19 @@ void TestsRenderer::RunSpriteTest()
// Spritesheet, single vertical line:
{
- static wiSprite sprite("images/spritesheet_grid.png");
+ static wi::Sprite sprite("images/spritesheet_grid.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 128, 128)); // drawrect cutout for a 0,0,128,128 pixel rect, this is also the first frame of animation
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.repeatable = true; // enable looping
sprite.anim.drawRectAnim.frameRate = 3; // 3 FPS, to be easily readable
sprite.anim.drawRectAnim.frameCount = 4; // again, specify 4 total frames to loop...
sprite.anim.drawRectAnim.horizontalFrameCount = 1; // ...but this time, limit the horizontal frame count. This way, we can get it to only animate vertically
AddSprite(&sprite);
- static wiSpriteFont font("single line: \n(4 vertical frames)");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("single line: \n(4 vertical frames)");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -727,19 +727,19 @@ void TestsRenderer::RunSpriteTest()
// Spritesheet, multiline:
{
- static wiSprite sprite("images/spritesheet_grid.png");
+ static wi::Sprite sprite("images/spritesheet_grid.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 128, 128)); // drawrect cutout for a 0,0,128,128 pixel rect, this is also the first frame of animation
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.repeatable = true; // enable looping
sprite.anim.drawRectAnim.frameRate = 3; // 3 FPS, to be easily readable
sprite.anim.drawRectAnim.frameCount = 16; // all frames
sprite.anim.drawRectAnim.horizontalFrameCount = 4; // all horizontal frames
AddSprite(&sprite);
- static wiSpriteFont font("multiline: \n(all 16 frames)");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("multiline: \n(all 16 frames)");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -749,19 +749,19 @@ void TestsRenderer::RunSpriteTest()
// Spritesheet, multiline, irregular:
{
- static wiSprite sprite("images/spritesheet_grid.png");
+ static wi::Sprite sprite("images/spritesheet_grid.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 128, 128)); // drawrect cutout for a 0,0,128,128 pixel rect, this is also the first frame of animation
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.repeatable = true; // enable looping
sprite.anim.drawRectAnim.frameRate = 3; // 3 FPS, to be easily readable
sprite.anim.drawRectAnim.frameCount = 14; // NOT all frames, which makes it irregular, so the last line will not contain all horizontal frames
sprite.anim.drawRectAnim.horizontalFrameCount = 4; // all horizontal frames
AddSprite(&sprite);
- static wiSpriteFont font("irregular multiline: \n(14 frames)");
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("irregular multiline: \n(14 frames)");
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -776,18 +776,18 @@ void TestsRenderer::RunSpriteTest()
// And the nice ones:
{
- static wiSprite sprite("images/fire_001.png");
+ static wi::Sprite sprite("images/fire_001.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 192, 192)); // set the draw rect (texture cutout). This will also be the first frame of the animation
- sprite.anim = wiSprite::Anim(); // reset animation state
+ sprite.anim = wi::Sprite::Anim(); // reset animation state
sprite.anim.drawRectAnim.frameCount = 20; // set the total frame count of the animation
sprite.anim.drawRectAnim.horizontalFrameCount = 5; // this is a multiline spritesheet, so also set how many maximum frames there are in a line
sprite.anim.drawRectAnim.frameRate = 40; // animation frames per second
sprite.anim.repeatable = true; // looping
AddSprite(&sprite);
- static wiSpriteFont font("For the following spritesheets, credits belong to: https://mrbubblewand.wordpress.com/download/");
- font.params.v_align = WIFALIGN_BOTTOM;
+ static wi::SpriteFont font("For the following spritesheets, credits belong to: https://mrbubblewand.wordpress.com/download/");
+ font.params.v_align = wi::font::WIFALIGN_BOTTOM;
font.params.posX = sprite.params.pos.x - sprite.params.siz.x * 0.5f;
font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
@@ -796,10 +796,10 @@ void TestsRenderer::RunSpriteTest()
}
{
- static wiSprite sprite("images/wind_002.png");
+ static wi::Sprite sprite("images/wind_002.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 192, 192));
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.drawRectAnim.frameCount = 30;
sprite.anim.drawRectAnim.horizontalFrameCount = 5;
sprite.anim.drawRectAnim.frameRate = 30;
@@ -810,10 +810,10 @@ void TestsRenderer::RunSpriteTest()
}
{
- static wiSprite sprite("images/water_003.png");
+ static wi::Sprite sprite("images/water_003.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 192, 192));
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.drawRectAnim.frameCount = 50;
sprite.anim.drawRectAnim.horizontalFrameCount = 5;
sprite.anim.drawRectAnim.frameRate = 27;
@@ -824,10 +824,10 @@ void TestsRenderer::RunSpriteTest()
}
{
- static wiSprite sprite("images/earth_001.png");
+ static wi::Sprite sprite("images/earth_001.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 192, 192));
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.drawRectAnim.frameCount = 20;
sprite.anim.drawRectAnim.horizontalFrameCount = 5;
sprite.anim.drawRectAnim.frameRate = 27;
@@ -838,10 +838,10 @@ void TestsRenderer::RunSpriteTest()
}
{
- static wiSprite sprite("images/special_001.png");
+ static wi::Sprite sprite("images/special_001.png");
sprite.params = params;
sprite.params.enableDrawRect(XMFLOAT4(0, 0, 192, 192));
- sprite.anim = wiSprite::Anim();
+ sprite.anim = wi::Sprite::Anim();
sprite.anim.drawRectAnim.frameCount = 40;
sprite.anim.drawRectAnim.horizontalFrameCount = 5;
sprite.anim.drawRectAnim.frameRate = 27;
@@ -854,53 +854,53 @@ void TestsRenderer::RunSpriteTest()
}
void TestsRenderer::RunNetworkTest()
{
- static wiSpriteFont font;
+ static wi::SpriteFont font;
- wiNetwork::Connection connection;
+ wi::network::Connection connection;
connection.ipaddress = { 127,0,0,1 }; // localhost
connection.port = 12345; // just any random port really
std::thread sender([&] {
// Create sender socket:
- wiNetwork::Socket sock;
- wiNetwork::CreateSocket(&sock);
+ wi::network::Socket sock;
+ wi::network::CreateSocket(&sock);
// Create a text message:
const char message[] = "Hi, this is a text message sent over the network!\nYou can find out more in Tests.cpp, RunNetworkTest() function.";
const size_t message_size = sizeof(message);
// First, send the text message size:
- wiNetwork::Send(&sock, &connection, &message_size, sizeof(message_size));
+ wi::network::Send(&sock, &connection, &message_size, sizeof(message_size));
// Then send the actual text message:
- wiNetwork::Send(&sock, &connection, message, message_size);
+ wi::network::Send(&sock, &connection, message, message_size);
});
std::thread receiver([&] {
// Create receiver socket:
- wiNetwork::Socket sock;
- wiNetwork::CreateSocket(&sock);
+ wi::network::Socket sock;
+ wi::network::CreateSocket(&sock);
// Listen on the port which the sender uses:
- wiNetwork::ListenPort(&sock, connection.port);
+ wi::network::ListenPort(&sock, connection.port);
// We can check for incoming messages with CanReceive(). A timeout value can be specified in microseconds
// to let the function block for some time, otherwise it returns imediately
- // It is not necessary to use this, but the wiNetwork::Receive() will block until there is a message
- if (wiNetwork::CanReceive(&sock, 1000000))
+ // It is not necessary to use this, but the wi::network::Receive() will block until there is a message
+ if (wi::network::CanReceive(&sock, 1000000))
{
// We know that we want a text message in this simple example, but we don't know the size.
// We also know that the sender sends the text size before the actual text, so first we will receive the text size:
size_t message_size;
- wiNetwork::Connection sender_connection; // this will be filled out with the sender's address
- wiNetwork::Receive(&sock, &sender_connection, &message_size, sizeof(message_size));
+ wi::network::Connection sender_connection; // this will be filled out with the sender's address
+ wi::network::Receive(&sock, &sender_connection, &message_size, sizeof(message_size));
- if (wiNetwork::CanReceive(&sock, 1000000))
+ if (wi::network::CanReceive(&sock, 1000000))
{
// Once we know the text message length, we can receive the message itself:
char* message = new char[message_size]; // allocate text buffer
- wiNetwork::Receive(&sock, &sender_connection, message, message_size);
+ wi::network::Receive(&sock, &sender_connection, message, message_size);
// Write the message to the screen:
font.SetText(message);
@@ -925,14 +925,14 @@ void TestsRenderer::RunNetworkTest()
font.params.posX = GetLogicalWidth() / 2;
font.params.posY = GetLogicalHeight() / 2;
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_CENTER;
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_CENTER;
font.params.size = 24;
AddFont(&font);
}
void TestsRenderer::RunUnorderedMapTest()
{
- wiTimer timer;
+ wi::Timer timer;
const size_t elements = 1000000;
#define shuffle(i) (i * 345734667877) % 98787546343
@@ -973,12 +973,12 @@ void TestsRenderer::RunUnorderedMapTest()
ss += "wi::unordered_map access: " + std::to_string(timer.elapsed_milliseconds()) + " ms";
}
- static wiSpriteFont font;
- font = wiSpriteFont(ss);
+ static wi::SpriteFont font;
+ font = wi::SpriteFont(ss);
font.params.posX = GetLogicalWidth() / 2;
font.params.posY = GetLogicalHeight() / 2;
- font.params.h_align = WIFALIGN_CENTER;
- font.params.v_align = WIFALIGN_CENTER;
+ font.params.h_align = wi::font::WIFALIGN_CENTER;
+ font.params.v_align = wi::font::WIFALIGN_CENTER;
font.params.size = 24;
this->AddFont(&font);
}
diff --git a/Tests/Tests.h b/Tests/Tests.h
index 61f1abe1a..dda7f9008 100644
--- a/Tests/Tests.h
+++ b/Tests/Tests.h
@@ -2,11 +2,11 @@
#include "WickedEngine.h"
-class TestsRenderer : public RenderPath3D
+class TestsRenderer : public wi::RenderPath3D
{
- wiLabel label;
- wiComboBox testSelector;
- wiECS::Entity ik_entity = wiECS::INVALID_ENTITY;
+ wi::gui::Label label;
+ wi::gui::ComboBox testSelector;
+ wi::ecs::Entity ik_entity = wi::ecs::INVALID_ENTITY;
public:
void Load() override;
void Update(float dt) override;
@@ -19,7 +19,7 @@ public:
void RunUnorderedMapTest();
};
-class Tests : public MainComponent
+class Tests : public wi::Application
{
TestsRenderer renderer;
public:
diff --git a/Tests/main_SDL2.cpp b/Tests/main_SDL2.cpp
index 43c7fb6ca..49807e44b 100644
--- a/Tests/main_SDL2.cpp
+++ b/Tests/main_SDL2.cpp
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
Tests tests;
// TODO: Place code here.
- wiStartupArguments::Parse(argc, argv);
+ wi::arguments::Parse(argc, argv);
sdl2::sdlsystem_ptr_t system = sdl2::make_sdlsystem(SDL_INIT_EVERYTHING | SDL_INIT_EVENTS);
if (!system) {
diff --git a/Tests/main_Windows.cpp b/Tests/main_Windows.cpp
index 23feb29d8..508b7d62c 100644
--- a/Tests/main_Windows.cpp
+++ b/Tests/main_Windows.cpp
@@ -31,7 +31,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
BOOL dpi_success = SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
assert(dpi_success);
- wiStartupArguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
+ wi::arguments::Parse(lpCmdLine); // if you wish to use command line arguments, here is a good place to parse them...
// Initialize global strings
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
@@ -162,26 +162,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (wParam)
{
case VK_BACK:
- if (wiBackLog::isActive())
- wiBackLog::deletefromInput();
- wiTextInputField::DeleteFromInput();
+ if (wi::backlog::isActive())
+ wi::backlog::deletefromInput();
+ wi::gui::TextInputField::DeleteFromInput();
break;
case VK_RETURN:
break;
default:
{
const char c = (const char)(TCHAR)wParam;
- if (wiBackLog::isActive())
+ if (wi::backlog::isActive())
{
- wiBackLog::input(c);
+ wi::backlog::input(c);
}
- wiTextInputField::AddInput(c);
+ wi::gui::TextInputField::AddInput(c);
}
break;
}
break;
case WM_INPUT:
- wiRawInput::ParseMessage((void*)lParam);
+ wi::input::rawinput::ParseMessage((void*)lParam);
break;
case WM_KILLFOCUS:
tests.is_window_active = false;
diff --git a/WickedEngine/ArchiveVersionHistory.txt b/WickedEngine/ArchiveVersionHistory.txt
index 1fcf52d03..655300f99 100644
--- a/WickedEngine/ArchiveVersionHistory.txt
+++ b/WickedEngine/ArchiveVersionHistory.txt
@@ -1,6 +1,6 @@
-This file contains changelog of wiArchive versions
+This file contains changelog of wi::Archive versions
-73: wiArchive no longer saves null terminator for strings
+73: wi::Archive no longer saves null terminator for strings
72: Scene::Entity_Serialize() recursive serialization
71: serialized WeatherComponent::fogHeightStart and fogHeightEnd
70: serialized VolumetricCloudParameters
@@ -10,7 +10,7 @@ This file contains changelog of wiArchive versions
66: serialized WeatherComponent::atmosphereParameters and skyExposure
65: serialized CameraComponent focal_length, aperture_size and aperture_shape
64: serialized per-emitter gravity, velocity, drag and random_color
-63: serialized wiResourceManager embedded resources
+63: serialized wi::resource_manager embedded resources
62: serialized WeatherComponent::colorGradingMapName property
61: serialized sheen and clearcoat material properties
60: serializer ObjectComponent::emissiveColor
diff --git a/WickedEngine/CMakeLists.txt b/WickedEngine/CMakeLists.txt
index 3da0ddfa1..79a259116 100644
--- a/WickedEngine/CMakeLists.txt
+++ b/WickedEngine/CMakeLists.txt
@@ -34,27 +34,26 @@ add_subdirectory(LUA)
add_subdirectory(Utility)
add_library(${TARGET_NAME} STATIC
- LoadingScreen.cpp
- LoadingScreen_BindLua.cpp
- MainComponent.cpp
- MainComponent_BindLua.cpp
- Matrix_BindLua.cpp
- RenderPath_BindLua.cpp
- RenderPath2D.cpp
- RenderPath2D_BindLua.cpp
- RenderPath3D.cpp
- RenderPath3D_BindLua.cpp
- RenderPath3D_PathTracing.cpp
- SpriteAnim_BindLua.cpp
- Texture_BindLua.cpp
- Vector_BindLua.cpp
+ wiLoadingScreen.cpp
+ wiLoadingScreen_BindLua.cpp
+ wiApplication.cpp
+ wiApplication_BindLua.cpp
+ wiRenderPath_BindLua.cpp
+ wiRenderPath2D.cpp
+ wiRenderPath2D_BindLua.cpp
+ wiRenderPath3D.cpp
+ wiRenderPath3D_BindLua.cpp
+ wiRenderPath3D_PathTracing.cpp
+ wiSpriteAnim_BindLua.cpp
+ wiTexture_BindLua.cpp
+ wiMath_BindLua.cpp
wiArchive.cpp
wiAudio.cpp
wiAudio_BindLua.cpp
- wiBackLog.cpp
- wiBackLog_BindLua.cpp
+ wiBacklog.cpp
+ wiBacklog_BindLua.cpp
wiEmittedParticle.cpp
- wiEvent.cpp
+ wiEventHandler.cpp
wiFadeManager.cpp
wiFFTGenerator.cpp
wiFont.cpp
@@ -70,8 +69,8 @@ add_library(${TARGET_NAME} STATIC
wiInitializer.cpp
wiInput.cpp
wiInput_BindLua.cpp
- wiIntersect.cpp
- wiIntersect_BindLua.cpp
+ wiPrimitive.cpp
+ wiPrimitive_BindLua.cpp
wiJobSystem.cpp
wiLua.cpp
wiMath.cpp
@@ -80,7 +79,7 @@ add_library(${TARGET_NAME} STATIC
wiNetwork_Windows.cpp
wiNetwork_UWP.cpp
wiOcean.cpp
- wiPhysicsEngine_Bullet.cpp
+ wiPhysics_Bullet.cpp
wiProfiler.cpp
wiRandom.cpp
wiRawInput.cpp
@@ -96,10 +95,9 @@ add_library(${TARGET_NAME} STATIC
wiSprite_BindLua.cpp
wiSpriteFont.cpp
wiSpriteFont_BindLua.cpp
- wiStartupArguments.cpp
+ wiArguments.cpp
wiTextureHelper.cpp
wiVersion.cpp
- wiWidget.cpp
wiXInput.cpp
wiShaderCompiler.cpp
)
diff --git a/WickedEngine/CommonInclude.h b/WickedEngine/CommonInclude.h
index 91cfb15c8..67db9d04e 100644
--- a/WickedEngine/CommonInclude.h
+++ b/WickedEngine/CommonInclude.h
@@ -52,6 +52,14 @@ constexpr typename std::enable_if::enable, E&>::type
return lhs;
}
template
+constexpr typename std::enable_if::enable, E>::type operator~(E rhs)
+{
+ typedef typename std::underlying_type::type underlying;
+ rhs = static_cast(
+ ~static_cast(rhs));
+ return rhs;
+}
+template
constexpr bool has_flag(E lhs, E rhs)
{
return (lhs & rhs) == rhs;
diff --git a/WickedEngine/LoadingScreen.cpp b/WickedEngine/LoadingScreen.cpp
deleted file mode 100644
index 1e1152192..000000000
--- a/WickedEngine/LoadingScreen.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "LoadingScreen.h"
-#include "MainComponent.h"
-
-#include
-
-bool LoadingScreen::isActive()
-{
- return wiJobSystem::IsBusy(ctx);
-}
-
-void LoadingScreen::addLoadingFunction(std::function loadingFunction)
-{
- if (loadingFunction != nullptr)
- {
- tasks.push_back(loadingFunction);
- }
-}
-
-void LoadingScreen::addLoadingComponent(RenderPath* component, MainComponent* main, float fadeSeconds, wiColor fadeColor)
-{
- addLoadingFunction([=](wiJobArgs args) {
- component->Load();
- });
- onFinished([=] {
- main->ActivatePath(component, fadeSeconds, fadeColor);
- });
-}
-
-void LoadingScreen::onFinished(std::function finishFunction)
-{
- if (finishFunction != nullptr)
- finish = finishFunction;
-}
-
-void LoadingScreen::Start()
-{
- for (auto& x : tasks)
- {
- wiJobSystem::Execute(ctx, x);
- }
- std::thread([this]() {
- wiJobSystem::Wait(ctx);
- finish();
- }).detach();
-
- RenderPath2D::Start();
-}
-
-void LoadingScreen::Stop()
-{
- tasks.clear();
- finish = nullptr;
-
- RenderPath2D::Stop();
-}
-
diff --git a/WickedEngine/LoadingScreen.h b/WickedEngine/LoadingScreen.h
deleted file mode 100644
index 08a6b5c5b..000000000
--- a/WickedEngine/LoadingScreen.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-#include "RenderPath2D.h"
-#include "wiColor.h"
-#include "wiJobSystem.h"
-#include "wiVector.h"
-
-#include
-
-class MainComponent;
-
-class LoadingScreen :
- public RenderPath2D
-{
-private:
- wiJobSystem::context ctx;
- wi::vector> tasks;
- std::function finish;
-public:
-
- //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(RenderPath* component, MainComponent* main, float fadeSeconds = 0, wiColor fadeColor = wiColor(0, 0, 0, 255));
- //Set a function that should be called when the loading finishes
- //use std::bind( YourFunctionPointer )
- void onFinished(std::function finishFunction);
- //See if the loading is currently running
- bool isActive();
-
- //Start Executing the tasks and mark the loading as active
- virtual void Start() override;
- //Clear all tasks
- virtual void Stop() override;
-};
-
diff --git a/WickedEngine/LoadingScreen_BindLua.cpp b/WickedEngine/LoadingScreen_BindLua.cpp
deleted file mode 100644
index 60f37ee12..000000000
--- a/WickedEngine/LoadingScreen_BindLua.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "LoadingScreen_BindLua.h"
-
-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(RenderPath_BindLua, GetLayerMask),
- lunamethod(RenderPath_BindLua, SetLayerMask),
-
- lunamethod(LoadingScreen_BindLua, AddLoadingTask),
- lunamethod(LoadingScreen_BindLua, OnFinished),
- { NULL, NULL }
-};
-Luna::PropertyType LoadingScreen_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-int LoadingScreen_BindLua::AddLoadingTask(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- std::string task = wiLua::SGetString(L, 1);
- LoadingScreen* loading = dynamic_cast(component);
- if (loading != nullptr)
- {
- loading->addLoadingFunction([=](wiJobArgs args) {
- wiLua::RunText(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)
- {
- std::string task = wiLua::SGetString(L, 1);
- LoadingScreen* loading = dynamic_cast(component);
- if (loading != nullptr)
- {
- loading->onFinished([=] {
- wiLua::RunText(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::GetLuaState());
- }
-}
diff --git a/WickedEngine/LoadingScreen_BindLua.h b/WickedEngine/LoadingScreen_BindLua.h
deleted file mode 100644
index a11aece1d..000000000
--- a/WickedEngine/LoadingScreen_BindLua.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#pragma once
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "LoadingScreen.h"
-#include "RenderPath2D_BindLua.h"
-
-class LoadingScreen_BindLua : public RenderPath2D_BindLua
-{
-private:
- LoadingScreen loadingscreen;
-public:
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- LoadingScreen_BindLua(LoadingScreen* component)
- {
- this->component = component;
- }
- LoadingScreen_BindLua(lua_State* L)
- {
- this->component = &loadingscreen;
- }
-
- int AddLoadingTask(lua_State* L);
- int OnFinished(lua_State* L);
-
- static void Bind();
-};
-
diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp
deleted file mode 100644
index 9d6511fe0..000000000
--- a/WickedEngine/MainComponent.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-#include "MainComponent.h"
-#include "RenderPath.h"
-#include "wiRenderer.h"
-#include "wiHelper.h"
-#include "wiTimer.h"
-#include "wiInput.h"
-#include "wiBackLog.h"
-#include "MainComponent_BindLua.h"
-#include "wiVersion.h"
-#include "wiEnums.h"
-#include "wiTextureHelper.h"
-#include "wiProfiler.h"
-#include "wiInitializer.h"
-#include "wiStartupArguments.h"
-#include "wiFont.h"
-#include "wiImage.h"
-#include "wiEvent.h"
-
-#include "wiGraphicsDevice_DX12.h"
-#include "wiGraphicsDevice_Vulkan.h"
-
-#include
-#include
-#include
-#include
-#include
-
-std::atomic number_of_heap_allocations{ 0 };
-std::atomic size_of_heap_allocations{ 0 };
-
-using namespace wiGraphics;
-
-void MainComponent::Initialize()
-{
- if (initialized)
- {
- return;
- }
- initialized = true;
-
- wiInitializer::InitializeComponentsAsync();
-}
-
-void MainComponent::ActivatePath(RenderPath* component, float fadeSeconds, wiColor fadeColor)
-{
- if (component != nullptr)
- {
- component->init(canvas);
- }
-
- // Fade manager will activate on fadeout
- fadeManager.Clear();
- fadeManager.Start(fadeSeconds, fadeColor, [this, component]() {
-
- if (GetActivePath() != nullptr)
- {
- GetActivePath()->Stop();
- }
-
- if (component != nullptr)
- {
- component->Start();
- }
- activePath = component;
- });
-
- fadeManager.Update(0); // If user calls ActivatePath without fadeout, it will be instant
-}
-
-void MainComponent::Run()
-{
-
- if (!initialized)
- {
- // Initialize in a lazy way, so the user application doesn't have to call this explicitly
- Initialize();
- initialized = true;
- }
- if (!wiInitializer::IsInitializeFinished())
- {
- // Until engine is not loaded, present initialization screen...
- CommandList cmd = graphicsDevice->BeginCommandList();
- graphicsDevice->RenderPassBegin(&swapChain, cmd);
- wiImage::SetCanvas(canvas, cmd);
- wiFont::SetCanvas(canvas, cmd);
- Viewport viewport;
- viewport.width = (float)swapChain.desc.width;
- viewport.height = (float)swapChain.desc.height;
- graphicsDevice->BindViewports(1, &viewport, cmd);
- wiFontParams params;
- params.posX = 5.f;
- params.posY = 5.f;
- std::string text = wiBackLog::getText();
- float textheight = wiFont::textHeight(text, params);
- float screenheight = canvas.GetLogicalHeight();
- if (textheight > screenheight)
- {
- params.posY = screenheight - textheight;
- }
- wiFont::Draw(text, params, cmd);
- graphicsDevice->RenderPassEnd(cmd);
- graphicsDevice->SubmitCommandLists();
- return;
- }
-
- static bool startup_script = false;
- if (!startup_script)
- {
- startup_script = true;
- wiLua::RegisterObject(MainComponent_BindLua::className, "main", new MainComponent_BindLua(this));
- wiLua::RunFile("startup.lua");
- }
-
- if (!is_window_active)
- {
- // If the application is not active, disable Update loops:
- deltaTimeAccumulator = 0;
- return;
- }
-
- wiProfiler::BeginFrame();
-
- deltaTime = float(std::max(0.0, timer.elapsed() / 1000.0));
- timer.record();
-
- // Wake up the events that need to be executed on the main thread, in thread safe manner:
- wiEvent::FireEvent(SYSTEM_EVENT_THREAD_SAFE_POINT, 0);
-
- const float dt = framerate_lock ? (1.0f / targetFrameRate) : deltaTime;
-
- fadeManager.Update(dt);
-
- ColorSpace colorspace = graphicsDevice->GetSwapChainColorSpace(&swapChain);
-
- if (GetActivePath() != nullptr)
- {
- GetActivePath()->colorspace = colorspace;
- GetActivePath()->init(canvas);
- GetActivePath()->PreUpdate();
- }
-
- // Fixed time update:
- auto range = wiProfiler::BeginRangeCPU("Fixed Update");
- {
- if (frameskip)
- {
- deltaTimeAccumulator += dt;
- if (deltaTimeAccumulator > 10)
- {
- // application probably lost control, fixed update would take too long
- deltaTimeAccumulator = 0;
- }
-
- const float targetFrameRateInv = 1.0f / targetFrameRate;
- while (deltaTimeAccumulator >= targetFrameRateInv)
- {
- FixedUpdate();
- deltaTimeAccumulator -= targetFrameRateInv;
- }
- }
- else
- {
- FixedUpdate();
- }
- }
- wiProfiler::EndRange(range); // Fixed Update
-
- // Variable-timed update:
- Update(dt);
-
- Render();
-
- wiInput::Update(window);
-
- // Begin final compositing:
- CommandList cmd = graphicsDevice->BeginCommandList();
- wiImage::SetCanvas(canvas, cmd);
- wiFont::SetCanvas(canvas, cmd);
- Viewport viewport;
- viewport.width = (float)swapChain.desc.width;
- viewport.height = (float)swapChain.desc.height;
- graphicsDevice->BindViewports(1, &viewport, cmd);
-
- bool colorspace_conversion_required = colorspace == ColorSpace::HDR10_ST2084;
- if (colorspace_conversion_required)
- {
- // In HDR10, we perform the compositing in a custom linear color space render target
- graphicsDevice->RenderPassBegin(&renderpass, cmd);
- }
- else
- {
- // If swapchain is SRGB or Linear HDR, it can be used for blending
- // - If it is SRGB, the render path will ensure tonemapping to SDR
- // - If it is Linear HDR, we can blend trivially in linear space
- graphicsDevice->RenderPassBegin(&swapChain, cmd);
- }
- Compose(cmd);
- graphicsDevice->RenderPassEnd(cmd);
-
- if (colorspace_conversion_required)
- {
- // In HDR10, we perform a final mapping from linear to HDR10, into the swapchain
- graphicsDevice->RenderPassBegin(&swapChain, cmd);
- wiImageParams fx;
- fx.enableFullScreen();
- fx.enableHDR10OutputMapping();
- wiImage::Draw(&rendertarget, fx, cmd);
- graphicsDevice->RenderPassEnd(cmd);
- }
-
- wiProfiler::EndFrame(cmd);
- graphicsDevice->SubmitCommandLists();
-}
-
-void MainComponent::Update(float dt)
-{
- auto range = wiProfiler::BeginRangeCPU("Update");
-
- wiLua::SetDeltaTime(double(dt));
- wiLua::Update();
-
- wiBackLog::Update(canvas, dt);
-
- if (GetActivePath() != nullptr)
- {
- GetActivePath()->Update(dt);
- GetActivePath()->PostUpdate();
- }
-
- wiProfiler::EndRange(range); // Update
-}
-
-void MainComponent::FixedUpdate()
-{
- wiLua::FixedUpdate();
-
- if (GetActivePath() != nullptr)
- {
- GetActivePath()->FixedUpdate();
- }
-}
-
-void MainComponent::Render()
-{
- auto range = wiProfiler::BeginRangeCPU("Render");
-
- wiLua::Render();
-
- if (GetActivePath() != nullptr)
- {
- GetActivePath()->Render();
- }
-
- wiProfiler::EndRange(range); // Render
-}
-
-void MainComponent::Compose(CommandList cmd)
-{
- auto range = wiProfiler::BeginRangeCPU("Compose");
-
- if (GetActivePath() != nullptr)
- {
- GetActivePath()->Compose(cmd);
- }
-
- if (fadeManager.IsActive())
- {
- // display fade rect
- static wiImageParams fx;
- fx.siz.x = canvas.GetLogicalWidth();
- fx.siz.y = canvas.GetLogicalHeight();
- fx.opacity = fadeManager.opacity;
- wiImage::Draw(wiTextureHelper::getColor(fadeManager.color), fx, cmd);
- }
-
- // Draw the information display
- if (infoDisplay.active)
- {
- infodisplay_str.clear();
- if (infoDisplay.watermark)
- {
- infodisplay_str += "Wicked Engine ";
- infodisplay_str += wiVersion::GetVersionString();
- infodisplay_str += " ";
-
-#if defined(_ARM)
- infodisplay_str += "[ARM]";
-#elif defined(_WIN64)
- infodisplay_str += "[64-bit]";
-#elif defined(_WIN32)
- infodisplay_str += "[32-bit]";
-#endif
-
-#ifdef PLATFORM_UWP
- infodisplay_str += "[UWP]";
-#endif
-
-#ifdef WICKEDENGINE_BUILD_DX12
- if (dynamic_cast(graphicsDevice.get()))
- {
- infodisplay_str += "[DX12]";
- }
-#endif
-#ifdef WICKEDENGINE_BUILD_VULKAN
- if (dynamic_cast(graphicsDevice.get()))
- {
- infodisplay_str += "[Vulkan]";
- }
-#endif
-
-#ifdef _DEBUG
- infodisplay_str += "[DEBUG]";
-#endif
- if (graphicsDevice->IsDebugDevice())
- {
- infodisplay_str += "[debugdevice]";
- }
- infodisplay_str += "\n";
- }
- if (infoDisplay.resolution)
- {
- infodisplay_str += "Resolution: " + std::to_string(canvas.GetPhysicalWidth()) + " x " + std::to_string(canvas.GetPhysicalHeight()) + " (" + std::to_string(int(canvas.GetDPI())) + " dpi)\n";
- }
- if (infoDisplay.logical_size)
- {
- infodisplay_str += "Logical Size: " + std::to_string(int(canvas.GetLogicalWidth())) + " x " + std::to_string(int(canvas.GetLogicalHeight())) + "\n";
- }
- if (infoDisplay.colorspace)
- {
- infodisplay_str += "Color Space: ";
- ColorSpace colorSpace = graphicsDevice->GetSwapChainColorSpace(&swapChain);
- switch (colorSpace)
- {
- default:
- case wiGraphics::ColorSpace::SRGB:
- infodisplay_str += "sRGB";
- break;
- case wiGraphics::ColorSpace::HDR10_ST2084:
- infodisplay_str += "ST.2084 (HDR10)";
- break;
- case wiGraphics::ColorSpace::HDR_LINEAR:
- infodisplay_str += "Linear (HDR)";
- break;
- }
- infodisplay_str += "\n";
- }
- if (infoDisplay.fpsinfo)
- {
- deltatimes[fps_avg_counter++ % arraysize(deltatimes)] = deltaTime;
- float displaydeltatime = deltaTime;
- if (fps_avg_counter > arraysize(deltatimes))
- {
- float avg_time = 0;
- for (int i = 0; i < arraysize(deltatimes); ++i)
- {
- avg_time += deltatimes[i];
- }
- displaydeltatime = avg_time / arraysize(deltatimes);
- }
-
- infodisplay_str += std::to_string(int(std::round(1.0f / displaydeltatime))) + " FPS\n";
- }
- if (infoDisplay.heap_allocation_counter)
- {
- infodisplay_str += "Heap allocations per frame: " + std::to_string(number_of_heap_allocations.load()) + " (" + std::to_string(size_of_heap_allocations.load()) + " bytes)\n";
- number_of_heap_allocations.store(0);
- size_of_heap_allocations.store(0);
- }
- if (infoDisplay.pipeline_count)
- {
- infodisplay_str += "Graphics pipelines active: " + std::to_string(graphicsDevice->GetActivePipelineCount()) + "\n";
- }
-
-#ifdef _DEBUG
- infodisplay_str += "Warning: This is a [DEBUG] build, performance will be slow!\n";
-#endif
- if (graphicsDevice->IsDebugDevice())
- {
- infodisplay_str += "Warning: Graphics is in [debugdevice] mode, performance will be slow!\n";
- }
-
- wiFont::Draw(infodisplay_str, wiFontParams(4, 4, infoDisplay.size, WIFALIGN_LEFT, WIFALIGN_TOP, wiColor(255,255,255,255), wiColor(0,0,0,255)), cmd);
-
- if (infoDisplay.colorgrading_helper)
- {
- wiImage::Draw(wiTextureHelper::getColorGradeDefault(), wiImageParams(0, 0, 256.0f / canvas.GetDPIScaling(), 16.0f / canvas.GetDPIScaling()), cmd);
- }
- }
-
- wiProfiler::DrawData(canvas, 4, 120, cmd);
-
- wiBackLog::Draw(canvas, cmd);
-
- wiProfiler::EndRange(range); // Compose
-}
-
-void MainComponent::SetWindow(wiPlatform::window_type window, bool fullscreen)
-{
- this->window = window;
-
- // User can also create a graphics device if custom logic is desired, but they must do before this function!
- if (graphicsDevice == nullptr)
- {
- bool debugdevice = wiStartupArguments::HasArgument("debugdevice");
- bool gpuvalidation = wiStartupArguments::HasArgument("gpuvalidation");
-
- bool use_dx12 = wiStartupArguments::HasArgument("dx12");
- bool use_vulkan = wiStartupArguments::HasArgument("vulkan");
-
-#ifndef WICKEDENGINE_BUILD_DX12
- if (use_dx12) {
- wiHelper::messageBox("The engine was built without DX12 support!", "Error");
- use_dx12 = false;
- }
-#endif
-#ifndef WICKEDENGINE_BUILD_VULKAN
- if (use_vulkan) {
- wiHelper::messageBox("The engine was built without Vulkan support!", "Error");
- use_vulkan = false;
- }
-#endif
-
- if (!use_dx12 && !use_vulkan)
- {
-#if defined(WICKEDENGINE_BUILD_DX12)
- use_dx12 = true;
-#elif defined(WICKEDENGINE_BUILD_VULKAN)
- use_vulkan = true;
-#else
- wiBackLog::post("No rendering backend is enabled! Please enable at least one so we can use it as default", wiBackLog::LogLevel::Error);
- assert(false);
-#endif
- }
- assert(use_dx12 || use_vulkan);
-
- if (use_vulkan)
- {
-#ifdef WICKEDENGINE_BUILD_VULKAN
- wiRenderer::SetShaderPath(wiRenderer::GetShaderPath() + "spirv/");
- graphicsDevice = std::make_unique(window, debugdevice);
-#endif
- }
- else if (use_dx12)
- {
-#ifdef WICKEDENGINE_BUILD_DX12
- wiRenderer::SetShaderPath(wiRenderer::GetShaderPath() + "hlsl6/");
- graphicsDevice = std::make_unique(debugdevice, gpuvalidation);
-#endif
- }
- }
- wiGraphics::GetDevice() = graphicsDevice.get();
- wiRenderer::InitializeCommonSamplers();
-
- canvas.init(window);
-
- SwapChainDesc desc;
- if (swapChain.IsValid())
- {
- // it will only resize, but keep format and other settings
- desc = swapChain.desc;
- }
- else
- {
- // initialize for the first time
- desc.buffer_count = 3;
- desc.format = Format::R10G10B10A2_UNORM;
- }
- desc.width = canvas.GetPhysicalWidth();
- desc.height = canvas.GetPhysicalHeight();
- desc.allow_hdr = allow_hdr;
- bool success = graphicsDevice->CreateSwapChain(&desc, window, &swapChain);
- assert(success);
-
- swapChainVsyncChangeEvent = wiEvent::Subscribe(SYSTEM_EVENT_SET_VSYNC, [this](uint64_t userdata) {
- SwapChainDesc desc = swapChain.desc;
- desc.vsync = userdata != 0;
- bool success = graphicsDevice->CreateSwapChain(&desc, nullptr, &swapChain);
- assert(success);
- });
-
- if (graphicsDevice->GetSwapChainColorSpace(&swapChain) == ColorSpace::HDR10_ST2084)
- {
- TextureDesc desc;
- desc.width = swapChain.desc.width;
- desc.height = swapChain.desc.height;
- desc.format = Format::R11G11B10_FLOAT;
- desc.bind_flags = BindFlag::RENDER_TARGET | BindFlag::SHADER_RESOURCE;
- bool success = graphicsDevice->CreateTexture(&desc, nullptr, &rendertarget);
- assert(success);
- graphicsDevice->SetName(&rendertarget, "MainComponent::rendertarget");
-
- RenderPassDesc renderpassdesc;
- renderpassdesc.attachments.push_back(RenderPassAttachment::RenderTarget(&rendertarget, RenderPassAttachment::LoadOp::CLEAR));
- success = graphicsDevice->CreateRenderPass(&renderpassdesc, &renderpass);
- assert(success);
- }
-}
-
-
-// Heap alloc replacements are used to count heap allocations:
-// It is good practice to reduce the amount of heap allocations that happen during the frame,
-// so keep an eye on the info display of the engine while MainComponent::InfoDisplayer::heap_allocation_counter is enabled
-
-void* operator new(std::size_t size) {
- number_of_heap_allocations.fetch_add(1);
- size_of_heap_allocations.fetch_add(size);
- void* p = malloc(size);
- if (!p) throw std::bad_alloc();
- return p;
-}
-void* operator new[](std::size_t size) {
- number_of_heap_allocations.fetch_add(1);
- size_of_heap_allocations.fetch_add(size);
- void* p = malloc(size);
- if (!p) throw std::bad_alloc();
- return p;
-}
-void* operator new[](std::size_t size, const std::nothrow_t&) throw() {
- number_of_heap_allocations.fetch_add(1);
- size_of_heap_allocations.fetch_add(size);
- return malloc(size);
-}
-void* operator new(std::size_t size, const std::nothrow_t&) throw() {
- number_of_heap_allocations.fetch_add(1);
- size_of_heap_allocations.fetch_add(size);
- return malloc(size);
-}
-void operator delete(void* ptr) throw() { free(ptr); }
-void operator delete (void* ptr, const std::nothrow_t&) throw() { free(ptr); }
-void operator delete[](void* ptr) throw() { free(ptr); }
-void operator delete[](void* ptr, const std::nothrow_t&) throw() { free(ptr); }
diff --git a/WickedEngine/MainComponent.h b/WickedEngine/MainComponent.h
deleted file mode 100644
index fc07d58ad..000000000
--- a/WickedEngine/MainComponent.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#pragma once
-#include "CommonInclude.h"
-#include "wiPlatform.h"
-#include "wiResourceManager.h"
-#include "wiColor.h"
-#include "wiFadeManager.h"
-#include "wiGraphics.h"
-#include "wiEvent.h"
-#include "wiCanvas.h"
-
-#include
-#include
-
-class RenderPath;
-
-class MainComponent
-{
-protected:
- std::unique_ptr graphicsDevice;
- wiEvent::Handle swapChainVsyncChangeEvent;
-
- RenderPath* activePath = nullptr;
- float targetFrameRate = 60;
- bool frameskip = true;
- bool framerate_lock = false;
- bool initialized = false;
-
- wiFadeManager fadeManager;
-
- float deltaTime = 0;
- float deltaTimeAccumulator = 0;
- wiTimer timer;
-
- float deltatimes[20] = {};
- int fps_avg_counter = 0;
-
- // These are used when HDR10 color space is active:
- // Because we want to blend in linear color space, but HDR10 is non-linear
- wiGraphics::Texture rendertarget;
- wiGraphics::RenderPass renderpass;
-
- std::string infodisplay_str;
-
-public:
- virtual ~MainComponent() = default;
-
- bool is_window_active = true;
- bool allow_hdr = true;
- wiGraphics::SwapChain swapChain;
- wiCanvas canvas;
- wiPlatform::window_type window;
-
- // Runs the main engine loop
- void Run();
-
- // 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 ActivatePath(RenderPath* component, float fadeSeconds = 0, wiColor fadeColor = wiColor(0,0,0,255));
- inline RenderPath* GetActivePath(){ return activePath; }
-
- // Set the desired target framerate for the FixedUpdate() loop (default = 60)
- void setTargetFrameRate(float value) { targetFrameRate = value; }
- // Get the desired target framerate for the FixedUpdate() loop
- float getTargetFrameRate() const { return targetFrameRate; }
- // Set the desired behaviour of the FixedUpdate() loop (default = true)
- // enabled : the FixedUpdate() loop will run at targetFrameRate frequency
- // disabled : the FixedUpdate() loop will run every frame only once.
- void setFrameSkip(bool enabled) { frameskip = enabled; }
- void setFrameRateLock(bool enabled) { framerate_lock = enabled; }
-
- // 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.
- // 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.
- // RenderPath::FixedUpdate is also called from here for the active component
- virtual void FixedUpdate();
- // This is where application-wide rendering happens to offscreen buffers.
- // 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). It must render to the provided command list.
- virtual void Compose(wiGraphics::CommandList cmd);
-
- // You need to call this before calling Run() or Initialize() if you want to render
- void SetWindow(wiPlatform::window_type, bool fullscreen = false);
-
-
- struct InfoDisplayer
- {
- // activate the whole display
- bool active = false;
- // display engine version number
- bool watermark = true;
- // display framerate
- bool fpsinfo = false;
- // display resolution info
- bool resolution = false;
- // window's size in logical (DPI scaled) units
- bool logical_size = false;
- // HDR status and color space
- bool colorspace = false;
- // display number of heap allocations per frame
- bool heap_allocation_counter = false;
- // display the active graphics pipeline count
- bool pipeline_count = false;
- // text size
- int size = 16;
- // display default color grading helper texture in top left corner of the screen
- bool colorgrading_helper = false;
- };
- // display all-time engine information text
- InfoDisplayer infoDisplay;
-
-};
-
diff --git a/WickedEngine/MainComponent_BindLua.cpp b/WickedEngine/MainComponent_BindLua.cpp
deleted file mode 100644
index dc27291dd..000000000
--- a/WickedEngine/MainComponent_BindLua.cpp
+++ /dev/null
@@ -1,412 +0,0 @@
-#include "MainComponent_BindLua.h"
-#include "RenderPath_BindLua.h"
-#include "RenderPath3D_BindLua.h"
-#include "RenderPath2D_BindLua.h"
-#include "LoadingScreen_BindLua.h"
-#include "wiProfiler.h"
-
-const char MainComponent_BindLua::className[] = "MainComponent";
-
-Luna::FunctionType MainComponent_BindLua::methods[] = {
- lunamethod(MainComponent_BindLua, GetActivePath),
- lunamethod(MainComponent_BindLua, SetActivePath),
- lunamethod(MainComponent_BindLua, SetFrameSkip),
- lunamethod(MainComponent_BindLua, SetTargetFrameRate),
- lunamethod(MainComponent_BindLua, SetFrameRateLock),
- lunamethod(MainComponent_BindLua, SetInfoDisplay),
- lunamethod(MainComponent_BindLua, SetWatermarkDisplay),
- lunamethod(MainComponent_BindLua, SetFPSDisplay),
- lunamethod(MainComponent_BindLua, SetResolutionDisplay),
- lunamethod(MainComponent_BindLua, SetLogicalSizeDisplay),
- lunamethod(MainComponent_BindLua, SetPipelineCountDisplay),
- lunamethod(MainComponent_BindLua, SetHeapAllocationCountDisplay),
- lunamethod(MainComponent_BindLua, GetCanvas),
- { NULL, NULL }
-};
-Luna::PropertyType MainComponent_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-MainComponent_BindLua::MainComponent_BindLua(MainComponent* component) :component(component)
-{
-}
-
-MainComponent_BindLua::MainComponent_BindLua(lua_State *L)
-{
- component = nullptr;
-}
-
-int MainComponent_BindLua::GetActivePath(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "GetActivePath() component is empty!");
- return 0;
- }
-
- //return 3d component if the active one is of that type
- RenderPath3D* comp3D = dynamic_cast(component->GetActivePath());
- if (comp3D != nullptr)
- {
- Luna::push(L, new RenderPath3D_BindLua(comp3D));
- return 1;
- }
-
- //return loading component if the active one is of that type
- LoadingScreen* compLoad = dynamic_cast(component->GetActivePath());
- if (compLoad != nullptr)
- {
- Luna::push(L, new LoadingScreen_BindLua(compLoad));
- return 1;
- }
-
- //return 2d component if the active one is of that type
- RenderPath2D* comp2D = dynamic_cast(component->GetActivePath());
- if (comp2D != nullptr)
- {
- Luna::push(L, new RenderPath2D_BindLua(comp2D));
- return 1;
- }
-
- //return component if the active one is of that type
- RenderPath* comp = dynamic_cast(component->GetActivePath());
- if (comp != nullptr)
- {
- Luna::push(L, new RenderPath_BindLua(comp));
- return 1;
- }
-
- wiLua::SError(L, "GetActivePath() Warning: type of active component not registered!");
- return 0;
-}
-int MainComponent_BindLua::SetActivePath(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetActivePath(RenderPath component) component is empty!");
- return 0;
- }
-
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- float fadeSeconds = 0;
- wiColor fadeColor = wiColor(0, 0, 0, 255);
- if (argc > 1)
- {
- fadeSeconds = wiLua::SGetFloat(L, 2);
- if (argc > 2)
- {
- fadeColor.setR((uint8_t)wiLua::SGetInt(L, 3));
- if (argc > 3)
- {
- fadeColor.setG((uint8_t)wiLua::SGetInt(L, 4));
- if (argc > 4)
- {
- fadeColor.setB((uint8_t)wiLua::SGetInt(L, 5));
- }
- }
- }
- }
-
- RenderPath3D_BindLua* comp3D = Luna::lightcheck(L, 1);
- if (comp3D != nullptr)
- {
- component->ActivatePath(comp3D->component, fadeSeconds, fadeColor);
- return 0;
- }
-
- LoadingScreen_BindLua* compLoad = Luna::lightcheck(L, 1);
- if (compLoad != nullptr)
- {
- component->ActivatePath(compLoad->component, fadeSeconds, fadeColor);
- return 0;
- }
-
- RenderPath2D_BindLua* comp2D = Luna::lightcheck(L, 1);
- if (comp2D != nullptr)
- {
- component->ActivatePath(comp2D->component, fadeSeconds, fadeColor);
- return 0;
- }
-
- RenderPath_BindLua* comp = Luna::lightcheck(L, 1);
- if (comp != nullptr)
- {
- component->ActivatePath(comp->component, fadeSeconds, fadeColor);
- return 0;
- }
- }
- else
- {
- wiLua::SError(L, "SetActivePath(RenderPath component, opt int fadeFrames,fadeColorR,fadeColorG,fadeColorB) not enought arguments!");
- return 0;
- }
- return 0;
-}
-int MainComponent_BindLua::SetFrameSkip(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetFrameSkip(bool enabled) component is empty!");
- return 0;
- }
-
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->setFrameSkip(wiLua::SGetBool(L, 1));
- }
- else
- wiLua::SError(L, "SetFrameSkip(bool enabled) not enought arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetTargetFrameRate(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetTargetFrameRate(float value) component is empty!");
- return 0;
- }
-
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->setTargetFrameRate(wiLua::SGetFloat(L, 1));
- }
- else
- wiLua::SError(L, "SetTargetFrameRate(float value) not enought arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetFrameRateLock(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetFrameRateLock(bool enabled) component is empty!");
- return 0;
- }
-
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->setFrameRateLock(wiLua::SGetBool(L, 1));
- }
- else
- wiLua::SError(L, "SetFrameRateLock(bool enabled) not enought arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetInfoDisplay(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetInfoDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.active = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetInfoDisplay(bool active) not enough arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetWatermarkDisplay(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetWatermarkDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.watermark = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetWatermarkDisplay(bool active) not enough arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetFPSDisplay(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetFPSDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.fpsinfo = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetFPSDisplay(bool active) not enough arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetResolutionDisplay(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetResolutionDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.resolution = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetResolutionDisplay(bool active) not enough arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetLogicalSizeDisplay(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetLogicalSizeDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.logical_size = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetLogicalSizeDisplay(bool active) not enough arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetPipelineCountDisplay(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetPipelineCountDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.pipeline_count = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetPipelineCountDisplay(bool active) not enough arguments!");
- return 0;
-}
-int MainComponent_BindLua::SetHeapAllocationCountDisplay(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetHeapAllocationCountDisplay() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- component->infoDisplay.heap_allocation_counter = wiLua::SGetBool(L, 1);
- }
- else
- wiLua::SError(L, "SetHeapAllocationCountDisplay(bool active) not enough arguments!");
- return 0;
-}
-
-int MainComponent_BindLua::GetCanvas(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "GetCanvas() component is empty!");
- return 0;
- }
- Luna::push(L, new Canvas_BindLua(component->canvas));
- return 1;
-}
-
-
-int SetProfilerEnabled(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiProfiler::SetEnabled(wiLua::SGetBool(L, 1));
- }
- else
- wiLua::SError(L, "SetProfilerEnabled(bool active) not enough arguments!");
-
- return 0;
-}
-
-void MainComponent_BindLua::Bind()
-{
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
- Luna::Register(wiLua::GetLuaState());
-
- wiLua::RegisterFunc("SetProfilerEnabled", SetProfilerEnabled);
- }
-}
-
-
-
-
-
-
-
-
-
-
-const char Canvas_BindLua::className[] = "Canvas";
-
-Luna::FunctionType Canvas_BindLua::methods[] = {
- lunamethod(Canvas_BindLua, GetDPI),
- lunamethod(Canvas_BindLua, GetDPIScaling),
- lunamethod(Canvas_BindLua, GetPhysicalWidth),
- lunamethod(Canvas_BindLua, GetPhysicalHeight),
- lunamethod(Canvas_BindLua, GetLogicalWidth),
- lunamethod(Canvas_BindLua, GetLogicalHeight),
- { NULL, NULL }
-};
-Luna::PropertyType Canvas_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-
-int Canvas_BindLua::GetDPI(lua_State* L)
-{
- wiLua::SSetFloat(L, canvas.GetDPI());
- return 1;
-}
-int Canvas_BindLua::GetDPIScaling(lua_State* L)
-{
- wiLua::SSetFloat(L, canvas.GetDPIScaling());
- return 1;
-}
-int Canvas_BindLua::GetPhysicalWidth(lua_State* L)
-{
- wiLua::SSetInt(L, canvas.GetPhysicalWidth());
- return 1;
-}
-int Canvas_BindLua::GetPhysicalHeight(lua_State* L)
-{
- wiLua::SSetInt(L, canvas.GetPhysicalHeight());
- return 1;
-}
-int Canvas_BindLua::GetLogicalWidth(lua_State* L)
-{
- wiLua::SSetFloat(L, canvas.GetLogicalWidth());
- return 1;
-}
-int Canvas_BindLua::GetLogicalHeight(lua_State* L)
-{
- wiLua::SSetFloat(L, canvas.GetLogicalHeight());
- return 1;
-}
-
-void Canvas_BindLua::Bind()
-{
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
- Luna::Register(wiLua::GetLuaState());
- }
-}
diff --git a/WickedEngine/MainComponent_BindLua.h b/WickedEngine/MainComponent_BindLua.h
deleted file mode 100644
index a64f862a2..000000000
--- a/WickedEngine/MainComponent_BindLua.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma once
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "MainComponent.h"
-
-class Canvas_BindLua
-{
-public:
- wiCanvas canvas;
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- Canvas_BindLua(const wiCanvas& canvas) : canvas(canvas) {}
- Canvas_BindLua(lua_State* L) {}
-
- int GetDPI(lua_State* L);
- int GetDPIScaling(lua_State* L);
- int GetPhysicalWidth(lua_State* L);
- int GetPhysicalHeight(lua_State* L);
- int GetLogicalWidth(lua_State* L);
- int GetLogicalHeight(lua_State* L);
-
- static void Bind();
-};
-
-class MainComponent_BindLua
-{
-private:
- MainComponent* component = nullptr;
-public:
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- MainComponent_BindLua(MainComponent* component = nullptr);
- MainComponent_BindLua(lua_State *L);
-
- int GetActivePath(lua_State *L);
- int SetActivePath(lua_State *L);
- int SetFrameSkip(lua_State *L);
- int SetTargetFrameRate(lua_State *L);
- int SetFrameRateLock(lua_State *L);
- int SetInfoDisplay(lua_State *L);
- int SetWatermarkDisplay(lua_State *L);
- int SetFPSDisplay(lua_State *L);
- int SetResolutionDisplay(lua_State* L);
- int SetLogicalSizeDisplay(lua_State *L);
- int SetPipelineCountDisplay(lua_State* L);
- int SetHeapAllocationCountDisplay(lua_State* L);
-
- int GetCanvas(lua_State* L);
-
- static void Bind();
-};
-
diff --git a/WickedEngine/Matrix_BindLua.cpp b/WickedEngine/Matrix_BindLua.cpp
deleted file mode 100644
index 1e9e5fb4f..000000000
--- a/WickedEngine/Matrix_BindLua.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-#include "Matrix_BindLua.h"
-#include "Vector_BindLua.h"
-
-using namespace DirectX;
-
-
-const char Matrix_BindLua::className[] = "Matrix";
-
-Luna::FunctionType Matrix_BindLua::methods[] = {
- lunamethod(Matrix_BindLua, GetRow),
- lunamethod(Matrix_BindLua, Translation),
- lunamethod(Matrix_BindLua, Rotation),
- lunamethod(Matrix_BindLua, RotationX),
- lunamethod(Matrix_BindLua, RotationY),
- lunamethod(Matrix_BindLua, RotationZ),
- lunamethod(Matrix_BindLua, RotationQuaternion),
- lunamethod(Matrix_BindLua, Scale),
- lunamethod(Matrix_BindLua, LookTo),
- lunamethod(Matrix_BindLua, LookAt),
-
- lunamethod(Matrix_BindLua, Add),
- lunamethod(Matrix_BindLua, Multiply),
- lunamethod(Matrix_BindLua, Transpose),
- lunamethod(Matrix_BindLua, Inverse),
- { NULL, NULL }
-};
-Luna::PropertyType Matrix_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-Matrix_BindLua::Matrix_BindLua()
-{
- std::memcpy(this, &IDENTITYMATRIX, sizeof(IDENTITYMATRIX));
-}
-Matrix_BindLua::Matrix_BindLua(const XMFLOAT4X4& matrix)
-{
- std::memcpy(this, &matrix, sizeof(matrix));
-}
-Matrix_BindLua::Matrix_BindLua(const XMMATRIX& matrix)
-{
- XMStoreFloat4x4(this, matrix);
-}
-Matrix_BindLua::Matrix_BindLua(lua_State* L)
-{
- std::memcpy(this, &IDENTITYMATRIX, sizeof(IDENTITYMATRIX));
-
- int argc = wiLua::SGetArgCount(L);
-
- // fill out all the four rows of the matrix
- for (int i = 0; i < 4; ++i)
- {
- float x = 0.f, y = 0.f, z = 0.f, w = 0.f;
- if (argc > i * 4)
- {
- x = wiLua::SGetFloat(L, i * 4 + 1);
- if (argc > i * 4 + 1)
- {
- y = wiLua::SGetFloat(L, i * 4 + 2);
- if (argc > i * 4 + 2)
- {
- z = wiLua::SGetFloat(L, i * 4 + 3);
- if (argc > i * 4 + 3)
- {
- w = wiLua::SGetFloat(L, i * 4 + 4);
- }
- }
- }
- }
- this->m[i][0] = x;
- this->m[i][1] = x;
- this->m[i][2] = x;
- this->m[i][3] = x;
- }
-
-}
-
-int Matrix_BindLua::GetRow(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- int row = 0;
- if (argc > 1)
- {
- row = wiLua::SGetInt(L, 2);
- if (row < 0 || row > 3)
- row = 0;
- }
- XMFLOAT4 r = XMFLOAT4(m[row][0], m[row][1], m[row][2], m[row][3]);
- Luna::push(L, new Vector_BindLua(r));
- return 1;
-}
-
-
-
-int Matrix_BindLua::Translation(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- Vector_BindLua* vector = Luna::lightcheck(L, 1);
- if (vector != nullptr)
- {
- mat = XMMatrixTranslationFromVector(XMLoadFloat4(vector));
- }
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::Rotation(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- Vector_BindLua* vector = Luna::lightcheck(L, 1);
- if (vector != nullptr)
- {
- mat = XMMatrixRotationRollPitchYawFromVector(XMLoadFloat4(vector));
- }
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::RotationX(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- mat = XMMatrixRotationX(wiLua::SGetFloat(L, 1));
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::RotationY(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- mat = XMMatrixRotationY(wiLua::SGetFloat(L, 1));
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::RotationZ(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- mat = XMMatrixRotationZ(wiLua::SGetFloat(L, 1));
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::RotationQuaternion(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- Vector_BindLua* vector = Luna::lightcheck(L, 1);
- if (vector != nullptr)
- {
- mat = XMMatrixRotationQuaternion(XMLoadFloat4(vector));
- }
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::Scale(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- XMMATRIX mat = XMMatrixIdentity();
- if (argc > 0)
- {
- Vector_BindLua* vector = Luna::lightcheck(L, 1);
- if (vector != nullptr)
- {
- mat = XMMatrixScalingFromVector(XMLoadFloat4(vector));
- }
- }
- Luna::push(L, new Matrix_BindLua(mat));
- return 1;
-}
-
-int Matrix_BindLua::LookTo(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- Vector_BindLua* pos = Luna::lightcheck(L, 1);
- Vector_BindLua* dir = Luna::lightcheck(L, 2);
- if (pos != nullptr && dir != nullptr)
- {
- XMVECTOR Up;
- if (argc > 3)
- {
- Vector_BindLua* up = Luna::lightcheck(L, 3);
- Up = XMLoadFloat4(up);
- }
- else
- Up = XMVectorSet(0, 1, 0, 0);
- Luna::push(L, new Matrix_BindLua(XMMatrixLookToLH(XMLoadFloat4(pos), XMLoadFloat4(dir), Up)));
- }
- else
- wiLua::SError(L, "LookTo(Vector eye, Vector direction, opt Vector up) argument is not a Vector!");
- }
- else
- wiLua::SError(L, "LookTo(Vector eye, Vector direction, opt Vector up) not enough arguments!");
- return 1;
-}
-
-int Matrix_BindLua::LookAt(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- Vector_BindLua* pos = Luna::lightcheck(L, 1);
- Vector_BindLua* dir = Luna::lightcheck(L, 2);
- if (dir != nullptr)
- {
- XMVECTOR Up;
- if (argc > 3)
- {
- Vector_BindLua* up = Luna::lightcheck(L, 3);
- Up = XMLoadFloat4(up);
- }
- else
- Up = XMVectorSet(0, 1, 0, 0);
- Luna::push(L, new Matrix_BindLua(XMMatrixLookAtLH(XMLoadFloat4(pos), XMLoadFloat4(dir), Up)));
- }
- else
- wiLua::SError(L, "LookAt(Vector eye, Vector focusPos, opt Vector up) argument is not a Vector!");
- }
- else
- wiLua::SError(L, "LookAt(Vector eye, Vector focusPos, opt Vector up) not enough arguments!");
- return 1;
-}
-
-int Matrix_BindLua::Multiply(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- Matrix_BindLua* m1 = Luna::lightcheck(L, 1);
- Matrix_BindLua* m2 = Luna::lightcheck(L, 2);
- if (m1 && m2)
- {
- Luna::push(L, new Matrix_BindLua(XMMatrixMultiply(XMLoadFloat4x4(m1), XMLoadFloat4x4(m2))));
- return 1;
- }
- }
- wiLua::SError(L, "Multiply(Matrix m1,m2) not enough arguments!");
- return 0;
-}
-int Matrix_BindLua::Add(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- Matrix_BindLua* m1 = Luna::lightcheck(L, 1);
- Matrix_BindLua* m2 = Luna::lightcheck(L, 2);
- if (m1 && m2)
- {
- Luna::push(L, new Matrix_BindLua(XMLoadFloat4x4(m1) + XMLoadFloat4x4(m2)));
- return 1;
- }
- }
- wiLua::SError(L, "Add(Matrix m1,m2) not enough arguments!");
- return 0;
-}
-int Matrix_BindLua::Transpose(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- Matrix_BindLua* m1 = Luna::lightcheck(L, 1);
- if (m1)
- {
- Luna::push(L, new Matrix_BindLua(XMMatrixTranspose(XMLoadFloat4x4(m1))));
- return 1;
- }
- }
- wiLua::SError(L, "Transpose(Matrix m) not enough arguments!");
- return 0;
-}
-int Matrix_BindLua::Inverse(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- Matrix_BindLua* m1 = Luna::lightcheck(L, 1);
- if (m1)
- {
- XMVECTOR det;
- Luna::push(L, new Matrix_BindLua(XMMatrixInverse(&det, XMLoadFloat4x4(m1))));
- wiLua::SSetFloat(L, XMVectorGetX(det));
- return 2;
- }
- }
- wiLua::SError(L, "Inverse(Matrix m) not enough arguments!");
- return 0;
-}
-
-
-void Matrix_BindLua::Bind()
-{
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
- Luna::Register(wiLua::GetLuaState());
- wiLua::RunText("matrix = Matrix()");
- }
-}
diff --git a/WickedEngine/Matrix_BindLua.h b/WickedEngine/Matrix_BindLua.h
deleted file mode 100644
index 0952d8032..000000000
--- a/WickedEngine/Matrix_BindLua.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-#include "CommonInclude.h"
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "wiMath.h"
-
-class Matrix_BindLua : public XMFLOAT4X4
-{
-public:
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- Matrix_BindLua();
- Matrix_BindLua(const XMMATRIX& matrix);
- Matrix_BindLua(const XMFLOAT4X4& matrix);
- Matrix_BindLua(lua_State* L);
-
- int GetRow(lua_State* L);
-
- int Translation(lua_State* L);
- int Rotation(lua_State* L);
- int RotationX(lua_State* L);
- int RotationY(lua_State* L);
- int RotationZ(lua_State* L);
- int RotationQuaternion(lua_State* L);
- int Scale(lua_State* L);
- int LookTo(lua_State* L);
- int LookAt(lua_State* L);
-
- int Multiply(lua_State* L);
- int Add(lua_State* L);
- int Transpose(lua_State* L);
- int Inverse(lua_State* L);
-
- static void Bind();
-};
-
diff --git a/WickedEngine/RenderPath.h b/WickedEngine/RenderPath.h
deleted file mode 100644
index 9901fb318..000000000
--- a/WickedEngine/RenderPath.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#pragma once
-#include "CommonInclude.h"
-#include "wiGraphicsDevice.h"
-#include "wiCanvas.h"
-
-class RenderPath : public wiCanvas
-{
-private:
- uint32_t layerMask = 0xFFFFFFFF;
-
-public:
- virtual ~RenderPath() = default;
-
- // load resources in background (for example behind loading screen)
- virtual void Load() {}
- // called when RenderPath gets activated
- virtual void Start() {}
- // called when RenderPath gets deactivated (for example when switching to an other RenderPath)
- virtual void Stop() {}
- // executed before Update()
- virtual void PreUpdate() {}
- // update with fixed frequency
- virtual void FixedUpdate() {}
- // update once per frame
- // dt : elapsed time since last call in seconds
- virtual void Update(float dt) {}
- // executed after Update()
- virtual void PostUpdate() {}
- // Render to layers, rendertargets, etc
- // This will be rendered offscreen
- virtual void Render() const {}
- // Compose the rendered layers (for example blend the layers together as Images)
- // This will be rendered to the backbuffer
- virtual void Compose(wiGraphics::CommandList cmd) const {}
-
- inline uint32_t getLayerMask() const { return layerMask; }
- inline void setlayerMask(uint32_t value) { layerMask = value; }
-
- wiGraphics::ColorSpace colorspace = wiGraphics::ColorSpace::SRGB;
-};
-
diff --git a/WickedEngine/RenderPath2D.cpp b/WickedEngine/RenderPath2D.cpp
deleted file mode 100644
index e3a6df56b..000000000
--- a/WickedEngine/RenderPath2D.cpp
+++ /dev/null
@@ -1,550 +0,0 @@
-#include "RenderPath2D.h"
-#include "wiResourceManager.h"
-#include "wiSprite.h"
-#include "wiSpriteFont.h"
-#include "wiRenderer.h"
-
-using namespace wiGraphics;
-
-
-void RenderPath2D::ResizeBuffers()
-{
- current_buffersize = GetInternalResolution();
- current_layoutscale = 0; // invalidate layout
-
- GraphicsDevice* device = wiGraphics::GetDevice();
-
- const Texture* dsv = GetDepthStencil();
- if(dsv != nullptr && (resolutionScale != 1.0f || dsv->GetDesc().sample_count > 1))
- {
- TextureDesc desc = GetDepthStencil()->GetDesc();
- desc.layout = ResourceState::SHADER_RESOURCE;
- desc.bind_flags = BindFlag::RENDER_TARGET | BindFlag::SHADER_RESOURCE;
- desc.format = Format::R8G8B8A8_UNORM;
- device->CreateTexture(&desc, nullptr, &rtStenciled);
- device->SetName(&rtStenciled, "rtStenciled");
-
- if (desc.sample_count > 1)
- {
- desc.sample_count = 1;
- device->CreateTexture(&desc, nullptr, &rtStenciled_resolved);
- device->SetName(&rtStenciled_resolved, "rtStenciled_resolved");
- }
- }
- else
- {
- rtStenciled = Texture(); // this will be deleted here
- }
-
- {
- TextureDesc desc;
- desc.bind_flags = BindFlag::RENDER_TARGET | BindFlag::SHADER_RESOURCE;
- desc.format = Format::R8G8B8A8_UNORM;
- desc.width = GetPhysicalWidth();
- desc.height = GetPhysicalHeight();
- device->CreateTexture(&desc, nullptr, &rtFinal);
- device->SetName(&rtFinal, "rtFinal");
- }
-
- if (rtStenciled.IsValid())
- {
- RenderPassDesc desc;
- desc.attachments.push_back(RenderPassAttachment::RenderTarget(&rtStenciled, RenderPassAttachment::LoadOp::CLEAR));
- desc.attachments.push_back(
- RenderPassAttachment::DepthStencil(
- dsv,
- RenderPassAttachment::LoadOp::LOAD,
- RenderPassAttachment::StoreOp::STORE,
- ResourceState::DEPTHSTENCIL_READONLY,
- ResourceState::DEPTHSTENCIL_READONLY,
- ResourceState::DEPTHSTENCIL_READONLY
- )
- );
-
- if (rtStenciled.GetDesc().sample_count > 1)
- {
- desc.attachments.push_back(RenderPassAttachment::Resolve(&rtStenciled_resolved));
- }
-
- device->CreateRenderPass(&desc, &renderpass_stenciled);
-
- dsv = nullptr;
- }
- {
- RenderPassDesc desc;
- desc.attachments.push_back(RenderPassAttachment::RenderTarget(&rtFinal, RenderPassAttachment::LoadOp::CLEAR));
-
- if(dsv != nullptr && !rtStenciled.IsValid())
- {
- desc.attachments.push_back(
- RenderPassAttachment::DepthStencil(
- dsv,
- RenderPassAttachment::LoadOp::LOAD,
- RenderPassAttachment::StoreOp::STORE,
- ResourceState::DEPTHSTENCIL_READONLY,
- ResourceState::DEPTHSTENCIL_READONLY,
- ResourceState::DEPTHSTENCIL_READONLY
- )
- );
- }
-
- device->CreateRenderPass(&desc, &renderpass_final);
- }
-
-}
-void RenderPath2D::ResizeLayout()
-{
- current_layoutscale = GetDPIScaling();
-}
-
-void RenderPath2D::Update(float dt)
-{
- XMUINT2 internalResolution = GetInternalResolution();
-
- if (current_buffersize.x != internalResolution.x || current_buffersize.y != internalResolution.y)
- {
- ResizeBuffers();
- }
- if (current_layoutscale != GetDPIScaling())
- {
- ResizeLayout();
- }
-
- GetGUI().Update(*this, dt);
-
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- switch (y.type)
- {
- default:
- case RenderItem2D::SPRITE:
- if (y.sprite != nullptr)
- {
- y.sprite->Update(dt);
- }
- break;
- case RenderItem2D::FONT:
- if (y.font != nullptr)
- {
- y.font->Update(dt);
- }
- break;
- }
- }
- }
-
- if (colorspace != ColorSpace::SRGB && (rtLinearColorSpace.desc.width != rtFinal.desc.width || rtLinearColorSpace.desc.height != rtFinal.desc.height))
- {
- TextureDesc desc = rtFinal.desc;
- desc.format = Format::R16G16B16A16_FLOAT;
- bool success = wiGraphics::GetDevice()->CreateTexture(&desc, nullptr, &rtLinearColorSpace);
- assert(success);
- wiGraphics::GetDevice()->SetName(&rtLinearColorSpace, "rtLinearColorSpace");
-
- RenderPassDesc renderpassdesc;
- renderpassdesc.attachments.push_back(RenderPassAttachment::RenderTarget(&rtLinearColorSpace, RenderPassAttachment::LoadOp::CLEAR));
- success = wiGraphics::GetDevice()->CreateRenderPass(&renderpassdesc, &renderpass_linearize);
- assert(success);
- }
-
- RenderPath::Update(dt);
-}
-void RenderPath2D::FixedUpdate()
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- switch (y.type)
- {
- default:
- case RenderItem2D::SPRITE:
- if (y.sprite != nullptr)
- {
- y.sprite->FixedUpdate();
- }
- break;
- case RenderItem2D::FONT:
- if (y.font != nullptr)
- {
- y.font->FixedUpdate();
- }
- break;
- }
- }
- }
-
- RenderPath::FixedUpdate();
-}
-void RenderPath2D::Render() const
-{
- GraphicsDevice* device = wiGraphics::GetDevice();
- CommandList cmd = device->BeginCommandList();
- wiImage::SetCanvas(*this, cmd);
- wiFont::SetCanvas(*this, cmd);
-
- wiRenderer::ProcessDeferredMipGenRequests(cmd);
-
- if (GetGUIBlurredBackground() != nullptr)
- {
- wiImage::SetBackground(*GetGUIBlurredBackground(), cmd);
- }
-
- // Special care for internal resolution, because stencil buffer is of internal resolution,
- // so we might need to render stencil sprites to separate render target that matches internal resolution!
- if (rtStenciled.IsValid())
- {
- device->RenderPassBegin(&renderpass_stenciled, cmd);
-
- Viewport vp;
- vp.width = (float)rtStenciled.GetDesc().width;
- vp.height = (float)rtStenciled.GetDesc().height;
- device->BindViewports(1, &vp, cmd);
-
- device->EventBegin("STENCIL Sprite Layers", cmd);
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::SPRITE &&
- y.sprite != nullptr &&
- y.sprite->params.stencilComp != STENCILMODE_DISABLED)
- {
- y.sprite->Draw(cmd);
- }
- }
- }
- device->EventEnd(cmd);
-
- device->RenderPassEnd(cmd);
- }
-
- device->RenderPassBegin(&renderpass_final, cmd);
-
- Viewport vp;
- vp.width = (float)rtFinal.GetDesc().width;
- vp.height = (float)rtFinal.GetDesc().height;
- device->BindViewports(1, &vp, cmd);
-
- if (GetDepthStencil() != nullptr)
- {
- if (rtStenciled.IsValid())
- {
- device->EventBegin("Copy STENCIL Sprite Layers", cmd);
- wiImageParams fx;
- fx.enableFullScreen();
- if (rtStenciled.GetDesc().sample_count > 1)
- {
- wiImage::Draw(&rtStenciled_resolved, fx, cmd);
- }
- else
- {
- wiImage::Draw(&rtStenciled, fx, cmd);
- }
- device->EventEnd(cmd);
- }
- else
- {
- device->EventBegin("STENCIL Sprite Layers", cmd);
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::SPRITE &&
- y.sprite != nullptr &&
- y.sprite->params.stencilComp != STENCILMODE_DISABLED)
- {
- y.sprite->Draw(cmd);
- }
- }
- }
- device->EventEnd(cmd);
- }
- }
-
- device->EventBegin("Sprite Layers", cmd);
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- switch (y.type)
- {
- default:
- case RenderItem2D::SPRITE:
- if (y.sprite != nullptr && y.sprite->params.stencilComp == STENCILMODE_DISABLED)
- {
- y.sprite->Draw(cmd);
- }
- break;
- case RenderItem2D::FONT:
- if (y.font != nullptr)
- {
- y.font->Draw(cmd);
- }
- break;
- }
- }
- }
- device->EventEnd(cmd);
-
- GetGUI().Render(*this, cmd);
-
- device->RenderPassEnd(cmd);
-
- if (colorspace != ColorSpace::SRGB)
- {
- // Convert the regular SRGB result of the render path to linear space for HDR compositing:
- device->RenderPassBegin(&renderpass_linearize, cmd);
- wiImageParams fx;
- fx.enableFullScreen();
- fx.enableLinearOutputMapping(hdr_scaling);
- wiImage::Draw(&rtFinal, fx, cmd);
- device->RenderPassEnd(cmd);
- render_result = rtLinearColorSpace;
- }
- else
- {
- render_result = rtFinal;
- }
-
- RenderPath::Render();
-}
-void RenderPath2D::Compose(CommandList cmd) const
-{
- wiImageParams fx;
- fx.enableFullScreen();
- fx.blendFlag = BLENDMODE_PREMULTIPLIED;
- wiImage::Draw(&render_result, fx, cmd);
-
- RenderPath::Compose(cmd);
-}
-
-
-void RenderPath2D::AddSprite(wiSprite* sprite, const std::string& layer)
-{
- for (auto& x : layers)
- {
- if (!x.name.compare(layer))
- {
- x.items.push_back(RenderItem2D());
- x.items.back().type = RenderItem2D::SPRITE;
- x.items.back().sprite = sprite;
- }
- }
- SortLayers();
-}
-void RenderPath2D::RemoveSprite(wiSprite* sprite)
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::SPRITE && y.sprite == sprite)
- {
- y.sprite = nullptr;
- }
- }
- }
- CleanLayers();
-}
-void RenderPath2D::ClearSprites()
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::SPRITE)
- {
- y.sprite = nullptr;
- }
- }
- }
- CleanLayers();
-}
-int RenderPath2D::GetSpriteOrder(wiSprite* sprite)
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.sprite == sprite)
- {
- return y.order;
- }
- }
- }
- return 0;
-}
-
-void RenderPath2D::AddFont(wiSpriteFont* font, const std::string& layer)
-{
- for (auto& x : layers)
- {
- if (!x.name.compare(layer))
- {
- x.items.push_back(RenderItem2D());
- x.items.back().type = RenderItem2D::FONT;
- x.items.back().font = font;
- }
- }
- SortLayers();
-}
-void RenderPath2D::RemoveFont(wiSpriteFont* font)
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::FONT && y.font == font)
- {
- y.font = nullptr;
- }
- }
- }
- CleanLayers();
-}
-void RenderPath2D::ClearFonts()
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::FONT)
- {
- y.font = nullptr;
- }
- }
- }
- CleanLayers();
-}
-int RenderPath2D::GetFontOrder(wiSpriteFont* font)
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.font == font)
- {
- return y.order;
- }
- }
- }
- return 0;
-}
-
-
-void RenderPath2D::AddLayer(const std::string& name)
-{
- for (auto& x : layers)
- {
- if (!x.name.compare(name))
- return;
- }
- RenderLayer2D layer;
- layer.name = name;
- layer.order = (int)layers.size();
- layers.push_back(layer);
- layers.back().items.clear();
-}
-void RenderPath2D::SetLayerOrder(const std::string& name, int order)
-{
- for (auto& x : layers)
- {
- if (!x.name.compare(name))
- {
- x.order = order;
- break;
- }
- }
- SortLayers();
-}
-void RenderPath2D::SetSpriteOrder(wiSprite* sprite, int order)
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::SPRITE && y.sprite == sprite)
- {
- y.order = order;
- }
- }
- }
- SortLayers();
-}
-void RenderPath2D::SetFontOrder(wiSpriteFont* font, int order)
-{
- for (auto& x : layers)
- {
- for (auto& y : x.items)
- {
- if (y.type == RenderItem2D::FONT && y.font == font)
- {
- y.order = order;
- }
- }
- }
- SortLayers();
-}
-void RenderPath2D::SortLayers()
-{
- if (layers.empty())
- {
- return;
- }
-
- for (size_t i = 0; i < layers.size() - 1; ++i)
- {
- for (size_t j = i + 1; j < layers.size(); ++j)
- {
- if (layers[i].order > layers[j].order)
- {
- RenderLayer2D swap = layers[i];
- layers[i] = layers[j];
- layers[j] = swap;
- }
- }
- }
- for (auto& x : layers)
- {
- if (x.items.empty())
- {
- continue;
- }
- for (size_t i = 0; i < x.items.size() - 1; ++i)
- {
- for (size_t j = i + 1; j < x.items.size(); ++j)
- {
- if (x.items[i].order > x.items[j].order)
- {
- RenderItem2D swap = x.items[i];
- x.items[i] = x.items[j];
- x.items[j] = swap;
- }
- }
- }
- }
-}
-
-void RenderPath2D::CleanLayers()
-{
- for (auto& x : layers)
- {
- if (x.items.empty())
- {
- continue;
- }
- wi::vector itemsToRetain(0);
- for (auto& y : x.items)
- {
- if (y.sprite != nullptr || y.font!=nullptr)
- {
- itemsToRetain.push_back(y);
- }
- }
- x.items.clear();
- x.items = itemsToRetain;
- }
-}
diff --git a/WickedEngine/RenderPath2D.h b/WickedEngine/RenderPath2D.h
deleted file mode 100644
index 728dd82ec..000000000
--- a/WickedEngine/RenderPath2D.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#pragma once
-#include "RenderPath.h"
-#include "wiGUI.h"
-#include "wiVector.h"
-
-#include
-
-class wiSprite;
-class wiSpriteFont;
-
-struct RenderItem2D
-{
- enum TYPE
- {
- SPRITE,
- FONT,
- } type = SPRITE;
- union
- {
- wiSprite* sprite = nullptr;
- wiSpriteFont* font;
- };
- int order = 0;
-};
-struct RenderLayer2D
-{
- wi::vector items;
- std::string name;
- int order = 0;
-};
-
-class RenderPath2D :
- public RenderPath
-{
-private:
- wiGraphics::Texture rtStenciled;
- wiGraphics::Texture rtStenciled_resolved;
- wiGraphics::Texture rtFinal;
-
- wiGraphics::RenderPass renderpass_stenciled;
- wiGraphics::RenderPass renderpass_final;
-
- wiGraphics::Texture rtLinearColorSpace;
- wiGraphics::RenderPass renderpass_linearize;
-
- wiGUI GUI;
-
- XMUINT2 current_buffersize{};
- float current_layoutscale{};
-
- mutable wiGraphics::Texture render_result = rtFinal;
-
- float hdr_scaling = 9.0f;
-
-public:
- // create resolution dependent resources, such as render targets
- virtual void ResizeBuffers();
- // update DPI dependent elements, such as GUI elements, sprites
- virtual void ResizeLayout();
-
- void Update(float dt) override;
- void FixedUpdate() override;
- void Render() const override;
- void Compose(wiGraphics::CommandList cmd) const override;
-
- const wiGraphics::Texture& GetRenderResult() const { return render_result; }
- virtual const wiGraphics::Texture* GetDepthStencil() const { return nullptr; }
- virtual const wiGraphics::Texture* GetGUIBlurredBackground() const { return nullptr; }
-
- void AddSprite(wiSprite* sprite, const std::string& layer = "");
- void RemoveSprite(wiSprite* sprite);
- void ClearSprites();
- int GetSpriteOrder(wiSprite* sprite);
-
- void AddFont(wiSpriteFont* font, const std::string& layer = "");
- void RemoveFont(wiSpriteFont* font);
- void ClearFonts();
- int GetFontOrder(wiSpriteFont* font);
-
- wi::vector layers{ 1 };
- void AddLayer(const std::string& name);
- void SetLayerOrder(const std::string& name, int order);
- void SetSpriteOrder(wiSprite* sprite, int order);
- void SetFontOrder(wiSpriteFont* font, int order);
- void SortLayers();
- void CleanLayers();
-
- const wiGUI& GetGUI() const { return GUI; }
- wiGUI& GetGUI() { return GUI; }
-
- float resolutionScale = 1.0f;
- XMUINT2 GetInternalResolution() const
- {
- return XMUINT2(
- uint32_t((float)GetPhysicalWidth() * resolutionScale),
- uint32_t((float)GetPhysicalHeight() * resolutionScale)
- );
- }
-
- float GetHDRScaling() const { return hdr_scaling; }
- void SetHDRScaling(float value) { hdr_scaling = value; }
-};
-
diff --git a/WickedEngine/RenderPath2D_BindLua.cpp b/WickedEngine/RenderPath2D_BindLua.cpp
deleted file mode 100644
index 4508043ca..000000000
--- a/WickedEngine/RenderPath2D_BindLua.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-#include "RenderPath2D_BindLua.h"
-#include "wiSprite_BindLua.h"
-#include "wiSpriteFont_BindLua.h"
-
-#include
-
-const char RenderPath2D_BindLua::className[] = "RenderPath2D";
-
-Luna::FunctionType RenderPath2D_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, GetLayerMask),
- lunamethod(RenderPath_BindLua, SetLayerMask),
- { NULL, NULL }
-};
-Luna::PropertyType RenderPath2D_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-int RenderPath2D_BindLua::AddSprite(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "AddSprite() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiSprite_BindLua* sprite = Luna::lightcheck(L, 1);
- if (sprite != nullptr)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- if(argc>1)
- ccomp->AddSprite(&sprite->sprite, wiLua::SGetString(L,2));
- else
- ccomp->AddSprite(&sprite->sprite);
- }
- else
- {
- wiLua::SError(L, "AddSprite(Sprite sprite, opt string layer) not a RenderPath2D!");
- }
- }
- else
- wiLua::SError(L, "AddSprite(Sprite sprite, opt string layer) argument is not a Sprite!");
- }
- else
- {
- wiLua::SError(L, "AddSprite(Sprite sprite, opt string layer) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::AddFont(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "AddFont() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiSpriteFont_BindLua* font = Luna::lightcheck(L, 1);
- if (font != nullptr)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- if (argc > 1)
- ccomp->AddFont(&font->font, wiLua::SGetString(L, 2));
- else
- ccomp->AddFont(&font->font);
- }
- else
- {
- wiLua::SError(L, "AddFont(Font font, opt string layer) not a RenderPath2D!");
- }
- }
- else
- wiLua::SError(L, "AddFont(Font font, opt string layer) argument is not a Font!");
- }
- else
- {
- wiLua::SError(L, "AddFont(Font font, opt string layer) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::RemoveSprite(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "RemoveSprite() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiSprite_BindLua* sprite = Luna::lightcheck(L, 1);
- if (sprite != nullptr)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- ccomp->RemoveSprite(&sprite->sprite);
- }
- else
- {
- wiLua::SError(L, "RemoveSprite(Sprite sprite) not a RenderPath2D!");
- }
- }
- else
- wiLua::SError(L, "RemoveSprite(Sprite sprite) argument is not a Sprite!");
- }
- else
- {
- wiLua::SError(L, "RemoveSprite(Sprite sprite) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::RemoveFont(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "RemoveFont() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiSpriteFont_BindLua* font = Luna::lightcheck(L, 1);
- if (font != nullptr)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- ccomp->RemoveFont(&font->font);
- }
- else
- {
- wiLua::SError(L, "RemoveFont(Font font) not a RenderPath2D!");
- }
- }
- else
- wiLua::SError(L, "RemoveFont(Font font) argument is not a Font!");
- }
- else
- {
- wiLua::SError(L, "RemoveFont(Font font) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::ClearSprites(lua_State *L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "ClearSprites() component is empty!");
- return 0;
- }
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- ccomp->ClearSprites();
- }
- else
- {
- wiLua::SError(L, "ClearSprites() not a RenderPath2D!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::ClearFonts(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "ClearFonts() component is empty!");
- return 0;
- }
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- ccomp->ClearFonts();
- }
- else
- {
- wiLua::SError(L, "ClearFonts() not a RenderPath2D!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::GetSpriteOrder(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "GetSpriteOrder() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiSprite_BindLua* sprite = Luna::lightcheck(L, 1);
- if (sprite != nullptr)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- wiLua::SSetInt(L, ccomp->GetSpriteOrder(&sprite->sprite));
- return 1;
- }
- else
- {
- wiLua::SError(L, "GetSpriteOrder(Sprite sprite) not a RenderPath2D!");
- }
- }
- else
- wiLua::SError(L, "GetSpriteOrder(Sprite sprite) argument is not a Sprite!");
- }
- else
- {
- wiLua::SError(L, "GetSpriteOrder(Sprite sprite) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::GetFontOrder(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "GetFontOrder() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- wiSpriteFont_BindLua* font = Luna::lightcheck(L, 1);
- if (font != nullptr)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- wiLua::SSetInt(L, ccomp->GetFontOrder(&font->font));
- return 1;
- }
- else
- {
- wiLua::SError(L, "GetFontOrder(Font font) not a RenderPath2D!");
- }
- }
- else
- wiLua::SError(L, "GetFontOrder(Font font) argument is not a Sprite!");
- }
- else
- {
- wiLua::SError(L, "GetFontOrder(Font font) not enough arguments!");
- }
- return 0;
-}
-
-int RenderPath2D_BindLua::AddLayer(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "AddLayer() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- ccomp->AddLayer(wiLua::SGetString(L, 1));
- }
- else
- {
- wiLua::SError(L, "AddLayer(string name) not a RenderPath2D!");
- }
- }
- else
- {
- wiLua::SError(L, "AddLayer(string name) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::GetLayers(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "GetLayers() component is empty!");
- return 0;
- }
-
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- std::string ss;
- for (auto& x : ccomp->layers)
- {
- ss += x.name + "\n";
- }
- wiLua::SSetString(L, ss);
- return 1;
- }
- else
- {
- wiLua::SError(L, "GetLayers() not a RenderPath2D!");
- }
-
- return 0;
-}
-int RenderPath2D_BindLua::SetLayerOrder(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetLayerOrder() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- 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 RenderPath2D!");
- }
- }
- else
- {
- wiLua::SError(L, "SetLayerOrder(string name, int order) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::SetSpriteOrder(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetSpriteOrder() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- wiSprite_BindLua* sprite = Luna::lightcheck(L, 1);
- if (sprite != nullptr)
- {
- ccomp->SetSpriteOrder(&sprite->sprite, wiLua::SGetInt(L, 2));
- }
- else
- {
- wiLua::SError(L, "SetSpriteOrder(Sprite sprite, int order) argument is not a Sprite!");
- }
- }
- else
- {
- wiLua::SError(L, "SetSpriteOrder(Sprite sprite, int order) not a RenderPath2D!");
- }
- }
- else
- {
- wiLua::SError(L, "SetSpriteOrder(Sprite sprite, int order) not enough arguments!");
- }
- return 0;
-}
-int RenderPath2D_BindLua::SetFontOrder(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetFontOrder() component is empty!");
- return 0;
- }
- int argc = wiLua::SGetArgCount(L);
- if (argc > 1)
- {
- RenderPath2D* ccomp = dynamic_cast(component);
- if (ccomp != nullptr)
- {
- wiSpriteFont_BindLua* font = Luna::lightcheck(L, 1);
- if (font != nullptr)
- {
- ccomp->SetFontOrder(&font->font, wiLua::SGetInt(L, 2));
- }
- else
- {
- wiLua::SError(L, "SetFontOrder(Font font, int order) argument is not a Font!");
- }
- }
- else
- {
- wiLua::SError(L, "SetFontOrder(Font font, int order) not a RenderPath2D!");
- }
- }
- else
- {
- wiLua::SError(L, "SetFontOrder(Font font, int order) not enough arguments!");
- }
- return 0;
-}
-
-void RenderPath2D_BindLua::Bind()
-{
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
- Luna::Register(wiLua::GetLuaState());
- }
-}
diff --git a/WickedEngine/RenderPath2D_BindLua.h b/WickedEngine/RenderPath2D_BindLua.h
deleted file mode 100644
index 8462c8539..000000000
--- a/WickedEngine/RenderPath2D_BindLua.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#pragma once
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "RenderPath2D.h"
-#include "RenderPath_BindLua.h"
-
-class RenderPath2D_BindLua : public RenderPath_BindLua
-{
-private:
- RenderPath2D renderpath;
-public:
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- RenderPath2D_BindLua() = default;
- RenderPath2D_BindLua(RenderPath2D* component)
- {
- this->component = component;
- }
- RenderPath2D_BindLua(lua_State* L)
- {
- this->component = &renderpath;
- }
-
- int AddSprite(lua_State *L);
- int AddFont(lua_State* L);
- int RemoveSprite(lua_State *L);
- int RemoveFont(lua_State* L);
- int ClearSprites(lua_State *L);
- int ClearFonts(lua_State* L);
- int GetSpriteOrder(lua_State* L);
- int GetFontOrder(lua_State* L);
-
- int AddLayer(lua_State* L);
- int GetLayers(lua_State* L);
- int SetLayerOrder(lua_State* L);
- int SetSpriteOrder(lua_State* L);
- int SetFontOrder(lua_State* L);
-
- static void Bind();
-};
-
diff --git a/WickedEngine/RenderPath3D.h b/WickedEngine/RenderPath3D.h
deleted file mode 100644
index f86a2e4d3..000000000
--- a/WickedEngine/RenderPath3D.h
+++ /dev/null
@@ -1,249 +0,0 @@
-#pragma once
-#include "RenderPath2D.h"
-#include "wiRenderer.h"
-#include "wiGraphicsDevice.h"
-#include "wiResourceManager.h"
-#include "wiScene.h"
-
-#include
-
-class RenderPath3D :
- public RenderPath2D
-{
-public:
- enum AO
- {
- AO_DISABLED, // no ambient occlusion
- AO_SSAO, // simple brute force screen space ambient occlusion
- AO_HBAO, // horizon based screen space ambient occlusion
- AO_MSAO, // multi scale screen space ambient occlusion
- AO_RTAO, // ray traced ambient occlusion
- // Don't alter order! (bound to lua manually)
- };
-private:
- float exposure = 1.0f;
- float bloomThreshold = 1.0f;
- float motionBlurStrength = 100.0f;
- float dofStrength = 10.0f;
- float sharpenFilterAmount = 0.28f;
- float outlineThreshold = 0.2f;
- float outlineThickness = 1.0f;
- XMFLOAT4 outlineColor = XMFLOAT4(0, 0, 0, 1);
- float aoRange = 1.0f;
- uint32_t aoSampleCount = 16;
- float aoPower = 1.0f;
- float chromaticAberrationAmount = 2.0f;
- uint32_t screenSpaceShadowSampleCount = 16;
- float screenSpaceShadowRange = 1;
- float eyeadaptionKey = 0.115f;
- float eyeadaptionRate = 1;
- float fsrSharpness = 1.0f;
-
- AO ao = AO_DISABLED;
- bool fxaaEnabled = false;
- bool ssrEnabled = false;
- bool raytracedReflectionsEnabled = false;
- bool reflectionsEnabled = true;
- bool shadowsEnabled = true;
- bool bloomEnabled = true;
- bool colorGradingEnabled = true;
- bool volumeLightsEnabled = true;
- bool lightShaftsEnabled = false;
- bool lensFlareEnabled = true;
- bool motionBlurEnabled = false;
- bool depthOfFieldEnabled = true;
- bool eyeAdaptionEnabled = false;
- bool sharpenFilterEnabled = false;
- bool outlineEnabled = false;
- bool chromaticAberrationEnabled = false;
- bool ditherEnabled = true;
- bool occlusionCullingEnabled = true;
- bool sceneUpdateEnabled = true;
- bool fsrEnabled = true;
-
- uint32_t msaaSampleCount = 1;
-
-public:
- wiGraphics::Texture rtMain;
- wiGraphics::Texture rtMain_render; // can be MSAA
- wiGraphics::Texture rtGbuffer[GBUFFER_COUNT];
- wiGraphics::Texture rtPrimitiveID_render; // can be MSAA
- wiGraphics::Texture rtReflection; // contains the scene rendered for planar reflections
- wiGraphics::Texture rtSSR; // standard screen-space reflection results
- wiGraphics::Texture rtSceneCopy; // contains the rendered scene that can be fed into transparent pass for distortion effect
- wiGraphics::Texture rtSceneCopy_tmp; // temporary for gaussian mipchain
- wiGraphics::Texture rtWaterRipple; // water ripple sprite normal maps are rendered into this
- wiGraphics::Texture rtParticleDistortion; // contains distortive particles
- wiGraphics::Texture rtParticleDistortion_Resolved; // contains distortive particles
- wiGraphics::Texture rtVolumetricLights[2]; // contains the volumetric light results
- wiGraphics::Texture rtTemporalAA[2]; // temporal AA history buffer
- wiGraphics::Texture rtBloom; // contains the bright parts of the image + mipchain
- wiGraphics::Texture rtBloom_tmp; // temporary for bloom downsampling
- wiGraphics::Texture rtAO; // full res AO
- wiGraphics::Texture rtShadow; // raytraced shadows mask
- wiGraphics::Texture rtSun[2]; // 0: sun render target used for lightshafts (can be MSAA), 1: radial blurred lightshafts
- wiGraphics::Texture rtSun_resolved; // sun render target, but the resolved version if MSAA is enabled
- wiGraphics::Texture rtGUIBlurredBackground[3]; // downsampled, gaussian blurred scene for GUI
- wiGraphics::Texture rtShadingRate; // UINT8 shading rate per tile
- wiGraphics::Texture rtFSR[2]; // FSR upscaling result (full resolution LDR)
-
- wiGraphics::Texture rtPostprocess; // ping-pong with main scene RT in post-process chain
-
- wiGraphics::Texture depthBuffer_Main; // used for depth-testing, can be MSAA
- wiGraphics::Texture depthBuffer_Copy; // used for shader resource, single sample
- wiGraphics::Texture depthBuffer_Copy1; // used for disocclusion check
- wiGraphics::Texture depthBuffer_Reflection; // used for reflection, single sample
- wiGraphics::Texture rtLinearDepth; // linear depth result + mipchain (max filter)
-
- wiGraphics::RenderPass renderpass_depthprepass;
- wiGraphics::RenderPass renderpass_main;
- wiGraphics::RenderPass renderpass_transparent;
- wiGraphics::RenderPass renderpass_reflection_depthprepass;
- wiGraphics::RenderPass renderpass_reflection;
- wiGraphics::RenderPass renderpass_downsamplescene;
- wiGraphics::RenderPass renderpass_lightshafts;
- wiGraphics::RenderPass renderpass_volumetriclight;
- wiGraphics::RenderPass renderpass_particledistortion;
- wiGraphics::RenderPass renderpass_waterripples;
-
- wiGraphics::Texture debugUAV; // debug UAV can be used by some shaders...
- wiRenderer::TiledLightResources tiledLightResources;
- wiRenderer::TiledLightResources tiledLightResources_planarReflection;
- wiRenderer::LuminanceResources luminanceResources;
- wiRenderer::SSAOResources ssaoResources;
- wiRenderer::MSAOResources msaoResources;
- wiRenderer::RTAOResources rtaoResources;
- wiRenderer::RTReflectionResources rtreflectionResources;
- wiRenderer::SSRResources ssrResources;
- wiRenderer::RTShadowResources rtshadowResources;
- wiRenderer::ScreenSpaceShadowResources screenspaceshadowResources;
- wiRenderer::DepthOfFieldResources depthoffieldResources;
- wiRenderer::MotionBlurResources motionblurResources;
- wiRenderer::VolumetricCloudResources volumetriccloudResources;
- wiRenderer::VolumetricCloudResources volumetriccloudResources_reflection;
- wiRenderer::BloomResources bloomResources;
- wiRenderer::SurfelGIResources surfelGIResources;
-
- mutable const wiGraphics::Texture* lastPostprocessRT = &rtPostprocess;
- // Post-processes are ping-ponged, this function helps to obtain the last postprocess render target that was written
- const wiGraphics::Texture* GetLastPostprocessRT() const
- {
- return lastPostprocessRT;
- }
-
- virtual void RenderAO(wiGraphics::CommandList cmd) const;
- virtual void RenderSSR(wiGraphics::CommandList cmd) const;
- virtual void RenderOutline(wiGraphics::CommandList cmd) const;
- virtual void RenderLightShafts(wiGraphics::CommandList cmd) const;
- virtual void RenderVolumetrics(wiGraphics::CommandList cmd) const;
- virtual void RenderSceneMIPChain(wiGraphics::CommandList cmd) const;
- virtual void RenderTransparents(wiGraphics::CommandList cmd) const;
- virtual void RenderPostprocessChain(wiGraphics::CommandList cmd) const;
-
- void ResizeBuffers() override;
-
- wiScene::CameraComponent* camera = &wiScene::GetCamera();
- wiScene::CameraComponent camera_previous;
- wiScene::CameraComponent camera_reflection;
- wiScene::CameraComponent camera_reflection_previous;
-
- wiScene::Scene* scene = &wiScene::GetScene();
- wiRenderer::Visibility visibility_main;
- wiRenderer::Visibility visibility_reflection;
-
- FrameCB frameCB = {};
-
- const wiGraphics::Texture* GetDepthStencil() const override { return &depthBuffer_Main; }
- const wiGraphics::Texture* GetGUIBlurredBackground() const override { return &rtGUIBlurredBackground[2]; }
-
- constexpr float getExposure() const { return exposure; }
- constexpr float getBloomThreshold() const { return bloomThreshold; }
- constexpr float getMotionBlurStrength() const { return motionBlurStrength; }
- constexpr float getDepthOfFieldStrength() const { return dofStrength; }
- constexpr float getSharpenFilterAmount() const { return sharpenFilterAmount; }
- constexpr float getOutlineThreshold() const { return outlineThreshold; }
- constexpr float getOutlineThickness() const { return outlineThickness; }
- constexpr XMFLOAT4 getOutlineColor() const { return outlineColor; }
- constexpr float getAORange() const { return aoRange; }
- constexpr uint32_t getAOSampleCount() const { return aoSampleCount; }
- constexpr float getAOPower() const { return aoPower; }
- constexpr float getChromaticAberrationAmount() const { return chromaticAberrationAmount; }
- constexpr uint32_t getScreenSpaceShadowSampleCount() const { return screenSpaceShadowSampleCount; }
- constexpr float getScreenSpaceShadowRange() const { return screenSpaceShadowRange; }
- constexpr float getEyeAdaptionKey() const { return eyeadaptionKey; }
- constexpr float getEyeAdaptionRate() const { return eyeadaptionRate; }
- constexpr float getFSRSharpness() const { return fsrSharpness; }
-
- constexpr bool getAOEnabled() const { return ao != AO_DISABLED; }
- constexpr AO getAO() const { return ao; }
- constexpr bool getSSREnabled() const { return ssrEnabled; }
- constexpr bool getRaytracedReflectionEnabled() const { return raytracedReflectionsEnabled; }
- constexpr bool getShadowsEnabled() const { return shadowsEnabled; }
- constexpr bool getReflectionsEnabled() const { return reflectionsEnabled; }
- constexpr bool getFXAAEnabled() const { return fxaaEnabled; }
- constexpr bool getBloomEnabled() const { return bloomEnabled; }
- constexpr bool getColorGradingEnabled() const { return colorGradingEnabled; }
- constexpr bool getVolumeLightsEnabled() const { return volumeLightsEnabled; }
- constexpr bool getLightShaftsEnabled() const { return lightShaftsEnabled; }
- constexpr bool getLensFlareEnabled() const { return lensFlareEnabled; }
- constexpr bool getMotionBlurEnabled() const { return motionBlurEnabled; }
- constexpr bool getDepthOfFieldEnabled() const { return depthOfFieldEnabled; }
- constexpr bool getEyeAdaptionEnabled() const { return eyeAdaptionEnabled; }
- constexpr bool getSharpenFilterEnabled() const { return sharpenFilterEnabled && getSharpenFilterAmount() > 0; }
- constexpr bool getOutlineEnabled() const { return outlineEnabled; }
- constexpr bool getChromaticAberrationEnabled() const { return chromaticAberrationEnabled; }
- constexpr bool getDitherEnabled() const { return ditherEnabled; }
- constexpr bool getOcclusionCullingEnabled() const { return occlusionCullingEnabled; }
- constexpr bool getSceneUpdateEnabled() const { return sceneUpdateEnabled; }
- constexpr bool getFSREnabled() const { return fsrEnabled; }
-
- constexpr uint32_t getMSAASampleCount() const { return msaaSampleCount; }
-
- constexpr void setExposure(float value) { exposure = value; }
- constexpr void setBloomThreshold(float value){ bloomThreshold = value; }
- constexpr void setMotionBlurStrength(float value) { motionBlurStrength = value; }
- constexpr void setDepthOfFieldStrength(float value) { dofStrength = value; }
- constexpr void setSharpenFilterAmount(float value) { sharpenFilterAmount = value; }
- constexpr void setOutlineThreshold(float value) { outlineThreshold = value; }
- constexpr void setOutlineThickness(float value) { outlineThickness = value; }
- constexpr void setOutlineColor(const XMFLOAT4& value) { outlineColor = value; }
- constexpr void setAORange(float value) { aoRange = value; }
- constexpr void setAOSampleCount(uint32_t value) { aoSampleCount = value; }
- constexpr void setAOPower(float value) { aoPower = value; }
- constexpr void setChromaticAberrationAmount(float value) { chromaticAberrationAmount = value; }
- constexpr void setScreenSpaceShadowSampleCount(uint32_t value) { screenSpaceShadowSampleCount = value; }
- constexpr void setScreenSpaceShadowRange(float value) { screenSpaceShadowRange = value; }
- constexpr void setEyeAdaptionKey(float value) { eyeadaptionKey = value; }
- constexpr void setEyeAdaptionRate(float value) { eyeadaptionRate = value; }
- constexpr void setFSRSharpness(float value) { fsrSharpness = value; }
-
- void setAO(AO value);
- void setSSREnabled(bool value);
- void setRaytracedReflectionsEnabled(bool value);
- constexpr void setShadowsEnabled(bool value){ shadowsEnabled = value; }
- constexpr void setReflectionsEnabled(bool value){ reflectionsEnabled = value; }
- constexpr void setFXAAEnabled(bool value){ fxaaEnabled = value; }
- constexpr void setBloomEnabled(bool value){ bloomEnabled = value; }
- constexpr void setColorGradingEnabled(bool value){ colorGradingEnabled = value; }
- constexpr void setVolumeLightsEnabled(bool value){ volumeLightsEnabled = value; }
- constexpr void setLightShaftsEnabled(bool value){ lightShaftsEnabled = value; }
- constexpr void setLensFlareEnabled(bool value){ lensFlareEnabled = value; }
- constexpr void setMotionBlurEnabled(bool value){ motionBlurEnabled = value; }
- constexpr void setDepthOfFieldEnabled(bool value){ depthOfFieldEnabled = value; }
- constexpr void setEyeAdaptionEnabled(bool value) { eyeAdaptionEnabled = value; }
- constexpr void setSharpenFilterEnabled(bool value) { sharpenFilterEnabled = value; }
- constexpr void setOutlineEnabled(bool value) { outlineEnabled = value; }
- constexpr void setChromaticAberrationEnabled(bool value) { chromaticAberrationEnabled = value; }
- constexpr void setDitherEnabled(bool value) { ditherEnabled = value; }
- constexpr void setOcclusionCullingEnabled(bool value) { occlusionCullingEnabled = value; }
- constexpr void setSceneUpdateEnabled(bool value) { sceneUpdateEnabled = value; }
- void setFSREnabled(bool value);
-
- virtual void setMSAASampleCount(uint32_t value) { msaaSampleCount = value; }
-
- void PreUpdate() override;
- void Update(float dt) override;
- void Render() const override;
- void Compose(wiGraphics::CommandList cmd) const override;
-};
-
diff --git a/WickedEngine/RenderPath3D_BindLua.cpp b/WickedEngine/RenderPath3D_BindLua.cpp
deleted file mode 100644
index 74d4c5b87..000000000
--- a/WickedEngine/RenderPath3D_BindLua.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-#include "RenderPath3D_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(RenderPath_BindLua, GetLayerMask),
- lunamethod(RenderPath_BindLua, SetLayerMask),
-
- lunamethod(RenderPath3D_BindLua, SetAO),
- lunamethod(RenderPath3D_BindLua, SetSSREnabled),
- lunamethod(RenderPath3D_BindLua, SetRaytracedReflectionsEnabled),
- lunamethod(RenderPath3D_BindLua, SetShadowsEnabled),
- lunamethod(RenderPath3D_BindLua, SetReflectionsEnabled),
- lunamethod(RenderPath3D_BindLua, SetFXAAEnabled),
- lunamethod(RenderPath3D_BindLua, SetBloomEnabled),
- lunamethod(RenderPath3D_BindLua, SetBloomThreshold),
- lunamethod(RenderPath3D_BindLua, SetColorGradingEnabled),
- lunamethod(RenderPath3D_BindLua, SetVolumeLightsEnabled),
- lunamethod(RenderPath3D_BindLua, SetLightShaftsEnabled),
- lunamethod(RenderPath3D_BindLua, SetLensFlareEnabled),
- lunamethod(RenderPath3D_BindLua, SetMotionBlurEnabled),
- lunamethod(RenderPath3D_BindLua, SetDitherEnabled),
- lunamethod(RenderPath3D_BindLua, SetDepthOfFieldEnabled),
- lunamethod(RenderPath3D_BindLua, SetEyeAdaptionEnabled),
- lunamethod(RenderPath3D_BindLua, SetMSAASampleCount),
- lunamethod(RenderPath3D_BindLua, SetSharpenFilterEnabled),
- lunamethod(RenderPath3D_BindLua, SetSharpenFilterAmount),
- lunamethod(RenderPath3D_BindLua, SetExposure),
- lunamethod(RenderPath3D_BindLua, SetMotionBlurStrength),
- lunamethod(RenderPath3D_BindLua, SetDepthOfFieldStrength),
- { NULL, NULL }
-};
-Luna::PropertyType RenderPath3D_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-
-int RenderPath3D_BindLua::SetAO(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetAO(AO value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- {
- int value = wiLua::SGetInt(L, 1);
- RenderPath3D::AO ao = (RenderPath3D::AO)value;
- ((RenderPath3D*)component)->setAO(ao);
- }
- else
- wiLua::SError(L, "SetAO(AO 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::SetRaytracedReflectionsEnabled(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetRaytracedReflectionsEnabled(bool value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- ((RenderPath3D*)component)->setRaytracedReflectionsEnabled(wiLua::SGetBool(L, 1));
- else
- wiLua::SError(L, "SetRaytracedReflectionsEnabled(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::SetBloomThreshold(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetBloomThreshold(float value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- {
- ((RenderPath3D*)component)->setBloomThreshold(wiLua::SGetFloat(L, 1));
- }
- else
- wiLua::SError(L, "SetBloomThreshold(float 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::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::SetDitherEnabled(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetDitherEnabled(bool value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- ((RenderPath3D*)component)->setDitherEnabled(wiLua::SGetBool(L, 1));
- else
- wiLua::SError(L, "SetDitherEnabled(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::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::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((uint32_t)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(float value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- {
- ((RenderPath3D*)component)->setSharpenFilterAmount(wiLua::SGetFloat(L, 1));
- }
- else
- wiLua::SError(L, "SetSharpenFilterAmount(float value) not enough arguments!");
- return 0;
-}
-int RenderPath3D_BindLua::SetExposure(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetExposure(float value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- {
- ((RenderPath3D*)component)->setExposure(wiLua::SGetFloat(L, 1));
- }
- else
- wiLua::SError(L, "SetExposure(float value) not enough arguments!");
- return 0;
-}
-
-
-int RenderPath3D_BindLua::SetMotionBlurStrength(lua_State* L)
-{
- if (component == nullptr)
- {
- wiLua::SError(L, "SetMotionBlurStrength(float value) component is null!");
- return 0;
- }
- if (wiLua::SGetArgCount(L) > 0)
- {
- ((RenderPath3D*)component)->setMotionBlurStrength(wiLua::SGetFloat(L, 1));
- }
- else
- wiLua::SError(L, "SetMotionBlurStrength(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::GetLuaState());
-
- wiLua::RunText("AO_DISABLED = 0");
- wiLua::RunText("AO_SSAO = 1");
- wiLua::RunText("AO_HBAO = 2");
- wiLua::RunText("AO_MSAO = 3");
- wiLua::RunText("AO_RTAO = 4");
- }
-}
diff --git a/WickedEngine/RenderPath3D_BindLua.h b/WickedEngine/RenderPath3D_BindLua.h
deleted file mode 100644
index f1a4e97ba..000000000
--- a/WickedEngine/RenderPath3D_BindLua.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#pragma once
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "RenderPath3D.h"
-#include "RenderPath2D_BindLua.h"
-
-class RenderPath3D_BindLua : public RenderPath2D_BindLua
-{
-private:
- RenderPath3D renderpath;
-public:
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- RenderPath3D_BindLua() = default;
- RenderPath3D_BindLua(RenderPath3D* component)
- {
- this->component = component;
- }
- RenderPath3D_BindLua(lua_State* L)
- {
- this->component = &renderpath;
- }
-
- int SetAO(lua_State* L);
- int SetSSREnabled(lua_State* L);
- int SetRaytracedReflectionsEnabled(lua_State* L);
- int SetShadowsEnabled(lua_State* L);
- int SetReflectionsEnabled(lua_State* L);
- int SetFXAAEnabled(lua_State* L);
- int SetBloomEnabled(lua_State* L);
- int SetBloomThreshold(lua_State* L);
- int SetColorGradingEnabled(lua_State* L);
- int SetVolumeLightsEnabled(lua_State* L);
- int SetLightShaftsEnabled(lua_State* L);
- int SetLensFlareEnabled(lua_State* L);
- int SetMotionBlurEnabled(lua_State* L);
- int SetDitherEnabled(lua_State* L);
- int SetDepthOfFieldEnabled(lua_State* L);
- int SetEyeAdaptionEnabled(lua_State* L);
- int SetMSAASampleCount(lua_State* L);
- int SetSharpenFilterEnabled(lua_State* L);
- int SetSharpenFilterAmount(lua_State* L);
- int SetExposure(lua_State* L);
- int SetMotionBlurStrength(lua_State* L);
- int SetDepthOfFieldStrength(lua_State* L);
-
- static void Bind();
-};
-
diff --git a/WickedEngine/RenderPath3D_PathTracing.cpp b/WickedEngine/RenderPath3D_PathTracing.cpp
deleted file mode 100644
index 477524468..000000000
--- a/WickedEngine/RenderPath3D_PathTracing.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-#include "RenderPath3D_PathTracing.h"
-#include "wiRenderer.h"
-#include "wiImage.h"
-#include "wiHelper.h"
-#include "wiTextureHelper.h"
-#include "wiSprite.h"
-#include "wiProfiler.h"
-#include "wiScene.h"
-#include "wiBackLog.h"
-
-#if __has_include("OpenImageDenoise/oidn.hpp")
-#define OPEN_IMAGE_DENOISE
-#include "OpenImageDenoise/oidn.hpp"
-#pragma comment(lib,"OpenImageDenoise.lib")
-#pragma comment(lib,"tbb.lib")
-// Also provide OpenImageDenoise.dll and tbb.dll near the exe!
-bool DenoiserCallback(void* userPtr, double n)
-{
- auto renderpath = (RenderPath3D_PathTracing*)userPtr;
- if (renderpath->getProgress() < 1)
- {
- renderpath->denoiserProgress = 0;
- return false;
- }
- renderpath->denoiserProgress = (float)n;
- return true;
-}
-bool RenderPath3D_PathTracing::isDenoiserAvailable() const { return true; }
-#else
-bool RenderPath3D_PathTracing::isDenoiserAvailable() const { return false; }
-#endif
-
-
-using namespace wiGraphics;
-using namespace wiScene;
-
-
-void RenderPath3D_PathTracing::ResizeBuffers()
-{
- RenderPath2D::ResizeBuffers(); // we don't need to use any buffers from RenderPath3D, so skip those
-
- GraphicsDevice* device = wiGraphics::GetDevice();
-
- XMUINT2 internalResolution = GetInternalResolution();
-
- {
- TextureDesc desc;
- desc.bind_flags = BindFlag::UNORDERED_ACCESS | BindFlag::SHADER_RESOURCE | BindFlag::RENDER_TARGET;
- desc.format = Format::R32G32B32A32_FLOAT;
- desc.width = internalResolution.x;
- desc.height = internalResolution.y;
- device->CreateTexture(&desc, nullptr, &traceResult);
- device->SetName(&traceResult, "traceResult");
-
-#ifdef OPEN_IMAGE_DENOISE
- desc.bind_flags = BindFlag::UNORDERED_ACCESS;
- desc.layout = ResourceState::UNORDERED_ACCESS;
- device->CreateTexture(&desc, nullptr, &denoiserAlbedo);
- device->SetName(&denoiserAlbedo, "denoiserAlbedo");
- device->CreateTexture(&desc, nullptr, &denoiserNormal);
- device->SetName(&denoiserNormal, "denoiserNormal");
-#endif // OPEN_IMAGE_DENOISE
- }
- {
- TextureDesc desc;
- desc.bind_flags = BindFlag::SHADER_RESOURCE | BindFlag::UNORDERED_ACCESS;
- desc.format = Format::R11G11B10_FLOAT;
- desc.width = internalResolution.x;
- desc.height = internalResolution.y;
- device->CreateTexture(&desc, nullptr, &rtPostprocess);
- device->SetName(&rtPostprocess, "rtPostprocess");
-
-
- desc.width /= 4;
- desc.height /= 4;
- desc.bind_flags = BindFlag::UNORDERED_ACCESS | BindFlag::SHADER_RESOURCE;
- device->CreateTexture(&desc, nullptr, &rtGUIBlurredBackground[0]);
- device->SetName(&rtGUIBlurredBackground[0], "rtGUIBlurredBackground[0]");
-
- desc.width /= 4;
- desc.height /= 4;
- device->CreateTexture(&desc, nullptr, &rtGUIBlurredBackground[1]);
- device->SetName(&rtGUIBlurredBackground[1], "rtGUIBlurredBackground[1]");
- device->CreateTexture(&desc, nullptr, &rtGUIBlurredBackground[2]);
- device->SetName(&rtGUIBlurredBackground[2], "rtGUIBlurredBackground[2]");
- }
-
- {
- RenderPassDesc desc;
- desc.attachments.push_back(RenderPassAttachment::RenderTarget(&traceResult, RenderPassAttachment::LoadOp::CLEAR));
-
- device->CreateRenderPass(&desc, &renderpass_debugbvh);
- }
-
- wiRenderer::CreateLuminanceResources(luminanceResources, internalResolution);
- wiRenderer::CreateBloomResources(bloomResources, internalResolution);
-
- // also reset accumulation buffer state:
- sam = -1;
-}
-
-void RenderPath3D_PathTracing::Update(float dt)
-{
- setOcclusionCullingEnabled(false);
-
- if (camera->IsDirty())
- {
- camera->SetDirty(false);
- sam = -1;
- }
- else
- {
- for (size_t i = 0; i < scene->transforms.GetCount(); ++i)
- {
- const TransformComponent& transform = scene->transforms[i];
-
- if (transform.IsDirty())
- {
- sam = -1;
- break;
- }
- }
-
- if (sam >= 0)
- {
- for (size_t i = 0; i < scene->materials.GetCount(); ++i)
- {
- const MaterialComponent& material = scene->materials[i];
-
- if (material.IsDirty())
- {
- sam = -1;
- break;
- }
- }
- }
- }
- sam++;
-
- if (sam > target)
- {
- sam = target;
- }
- if (target < sam)
- {
- resetProgress();
- }
-
- scene->SetAccelerationStructureUpdateRequested(sam == 0);
- setSceneUpdateEnabled(sam == 0);
-
- RenderPath3D::Update(dt);
-
-
-#ifdef OPEN_IMAGE_DENOISE
- if (sam == target)
- {
- if (!denoiserResult.IsValid() && !wiJobSystem::IsBusy(denoiserContext))
- {
- //wiHelper::saveTextureToFile(denoiserAlbedo, "C:/PROJECTS/WickedEngine/Editor/_albedo.png");
- //wiHelper::saveTextureToFile(denoiserNormal, "C:/PROJECTS/WickedEngine/Editor/_normal.png");
-
- texturedata_src.clear();
- texturedata_dst.clear();
- texturedata_albedo.clear();
- texturedata_normal.clear();
-
- if (wiHelper::saveTextureToMemory(traceResult, texturedata_src))
- {
- wiHelper::saveTextureToMemory(denoiserAlbedo, texturedata_albedo);
- wiHelper::saveTextureToMemory(denoiserNormal, texturedata_normal);
-
- texturedata_dst.resize(texturedata_src.size());
-
- wiJobSystem::Execute(denoiserContext, [&](wiJobArgs args) {
-
- size_t width = (size_t)traceResult.desc.width;
- size_t height = (size_t)traceResult.desc.height;
- {
- // https://github.com/OpenImageDenoise/oidn#c11-api-example
-
- // Create an Intel Open Image Denoise device
- static oidn::DeviceRef device = oidn::newDevice();
- static bool init = false;
- if (!init)
- {
- device.commit();
- init = true;
- }
-
- // Create a denoising filter
- oidn::FilterRef filter = device.newFilter("RT"); // generic ray tracing filter
- filter.setImage("color", texturedata_src.data(), oidn::Format::Float3, width, height, 0, sizeof(XMFLOAT4));
- if (!texturedata_albedo.empty())
- {
- filter.setImage("albedo", texturedata_albedo.data(), oidn::Format::Float3, width, height, 0, sizeof(XMFLOAT4)); // optional
- }
- if (!texturedata_normal.empty())
- {
- filter.setImage("normal", texturedata_normal.data(), oidn::Format::Float3, width, height, 0, sizeof(XMFLOAT4)); // optional
- }
- filter.setImage("output", texturedata_dst.data(), oidn::Format::Float3, width, height, 0, sizeof(XMFLOAT4));
- filter.set("hdr", true); // image is HDR
- //filter.set("cleanAux", true);
- filter.commit();
-
- denoiserProgress = 0;
- filter.setProgressMonitorFunction(DenoiserCallback, this);
-
- // Filter the image
- filter.execute();
-
- // Check for errors
- const char* errorMessage;
- auto error = device.getError(errorMessage);
- if (error != oidn::Error::None && error != oidn::Error::Cancelled)
- {
- wiBackLog::post(std::string("[OpenImageDenoise error] ") + errorMessage);
- }
- }
-
- GraphicsDevice* device = wiGraphics::GetDevice();
-
- TextureDesc desc;
- desc.width = (uint32_t)width;
- desc.height = (uint32_t)height;
- desc.bind_flags = BindFlag::SHADER_RESOURCE;
- desc.format = Format::R32G32B32A32_FLOAT;
-
- SubresourceData initdata;
- initdata.data_ptr = texturedata_dst.data();
- initdata.row_pitch = uint32_t(sizeof(XMFLOAT4) * width);
- device->CreateTexture(&desc, &initdata, &denoiserResult);
-
- });
- }
- }
- }
- else
- {
- denoiserResult = Texture();
- denoiserProgress = 0;
- }
-#endif // OPEN_IMAGE_DENOISE
-}
-
-void RenderPath3D_PathTracing::Render() const
-{
- GraphicsDevice* device = wiGraphics::GetDevice();
- wiJobSystem::context ctx;
-
- if (sam < target)
- {
- // Setup:
- CommandList cmd = device->BeginCommandList();
- wiJobSystem::Execute(ctx, [this, cmd](wiJobArgs args) {
-
- wiRenderer::BindCameraCB(
- *camera,
- camera_previous,
- camera_reflection,
- cmd
- );
- wiRenderer::UpdateRenderData(visibility_main, frameCB, cmd);
- wiRenderer::UpdateRenderDataAsync(visibility_main, frameCB, cmd);
-
- if (scene->IsAccelerationStructureUpdateRequested())
- {
- wiRenderer::UpdateRaytracingAccelerationStructures(*scene, cmd);
- }
- });
-
- // Main scene:
- cmd = device->BeginCommandList();
- wiJobSystem::Execute(ctx, [this, cmd](wiJobArgs args) {
-
- GraphicsDevice* device = wiGraphics::GetDevice();
-
- wiRenderer::BindCameraCB(
- *camera,
- *camera,
- *camera,
- cmd
- );
- wiRenderer::BindCommonResources(cmd);
-
- if (wiRenderer::GetRaytraceDebugBVHVisualizerEnabled())
- {
- device->RenderPassBegin(&renderpass_debugbvh, cmd);
-
- Viewport vp;
- vp.width = (float)traceResult.GetDesc().width;
- vp.height = (float)traceResult.GetDesc().height;
- device->BindViewports(1, &vp, cmd);
-
- wiRenderer::RayTraceSceneBVH(*scene, cmd);
-
- device->RenderPassEnd(cmd);
- }
- else
- {
- auto range = wiProfiler::BeginRangeGPU("Traced Scene", cmd);
-
- wiRenderer::RayTraceScene(
- *scene,
- traceResult,
- sam,
- cmd,
- denoiserAlbedo.IsValid() ? &denoiserAlbedo : nullptr,
- denoiserNormal.IsValid() ? &denoiserNormal : nullptr
- );
-
-
- wiProfiler::EndRange(range); // Traced Scene
- }
-
- });
- }
-
- // Tonemap etc:
- CommandList cmd = device->BeginCommandList();
- wiJobSystem::Execute(ctx, [this, cmd](wiJobArgs args) {
-
- GraphicsDevice* device = wiGraphics::GetDevice();
-
- wiRenderer::BindCameraCB(
- *camera,
- *camera,
- *camera,
- cmd
- );
- wiRenderer::BindCommonResources(cmd);
-
- Texture srcTex = denoiserResult.IsValid() && !wiJobSystem::IsBusy(denoiserContext) ? denoiserResult : traceResult;
-
- if (getEyeAdaptionEnabled())
- {
- wiRenderer::ComputeLuminance(
- luminanceResources,
- srcTex,
- cmd,
- getEyeAdaptionRate(),
- getEyeAdaptionKey()
- );
- }
- if (getBloomEnabled())
- {
- wiRenderer::ComputeBloom(
- bloomResources,
- srcTex,
- cmd,
- getBloomThreshold(),
- getExposure(),
- getEyeAdaptionEnabled() ? &luminanceResources.luminance : nullptr
- );
- }
-
- wiRenderer::Postprocess_Tonemap(
- srcTex,
- rtPostprocess,
- cmd,
- getExposure(),
- getDitherEnabled(),
- getColorGradingEnabled() ? (scene->weather.colorGradingMap == nullptr ? nullptr : &scene->weather.colorGradingMap->texture) : nullptr,
- nullptr,
- getEyeAdaptionEnabled() ? &luminanceResources.luminance : nullptr,
- getBloomEnabled() ? &bloomResources.texture_bloom : nullptr,
- colorspace
- );
- lastPostprocessRT = &rtPostprocess;
-
- // GUI Background blurring:
- {
- auto range = wiProfiler::BeginRangeGPU("GUI Background Blur", cmd);
- device->EventBegin("GUI Background Blur", cmd);
- wiRenderer::Postprocess_Downsample4x(rtPostprocess, rtGUIBlurredBackground[0], cmd);
- wiRenderer::Postprocess_Downsample4x(rtGUIBlurredBackground[0], rtGUIBlurredBackground[2], cmd);
- wiRenderer::Postprocess_Blur_Gaussian(rtGUIBlurredBackground[2], rtGUIBlurredBackground[1], rtGUIBlurredBackground[2], cmd, -1, -1, true);
- device->EventEnd(cmd);
- wiProfiler::EndRange(range);
- }
- });
-
- RenderPath2D::Render();
-
- wiJobSystem::Wait(ctx);
-}
-
-void RenderPath3D_PathTracing::Compose(CommandList cmd) const
-{
- GraphicsDevice* device = wiGraphics::GetDevice();
-
- device->EventBegin("RenderPath3D_PathTracing::Compose", cmd);
-
- wiRenderer::BindCommonResources(cmd);
-
- wiImageParams fx;
- fx.enableFullScreen();
- fx.blendFlag = BLENDMODE_OPAQUE;
- fx.quality = QUALITY_LINEAR;
- wiImage::Draw(&rtPostprocess, fx, cmd);
-
- device->EventEnd(cmd);
-
- RenderPath2D::Compose(cmd);
-}
diff --git a/WickedEngine/RenderPath3D_PathTracing.h b/WickedEngine/RenderPath3D_PathTracing.h
deleted file mode 100644
index 7fe4c6223..000000000
--- a/WickedEngine/RenderPath3D_PathTracing.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#pragma once
-#include "RenderPath3D.h"
-#include "wiVector.h"
-
-class RenderPath3D_PathTracing :
- public RenderPath3D
-{
-protected:
- int sam = -1;
- int target = 1024;
- wiGraphics::Texture traceResult;
-
- wi::vector texturedata_src;
- wi::vector texturedata_dst;
- wi::vector texturedata_albedo;
- wi::vector texturedata_normal;
- wiGraphics::Texture denoiserAlbedo;
- wiGraphics::Texture denoiserNormal;
- wiGraphics::Texture denoiserResult;
- wiJobSystem::context denoiserContext;
-
- wiGraphics::RenderPass renderpass_debugbvh;
-
- void ResizeBuffers() override;
-
-public:
- const wiGraphics::Texture* GetDepthStencil() const override { return nullptr; };
-
- void Update(float dt) override;
- void Render() const override;
- void Compose(wiGraphics::CommandList cmd) const override;
-
- int getCurrentSampleCount() const { return sam; }
- void setTargetSampleCount(int value) { target = value; }
- float getProgress() const { return (float)sam / (float)target; }
-
- float denoiserProgress = 0;
- float getDenoiserProgress() const { return denoiserProgress; }
- bool isDenoiserAvailable() const;
-
- void resetProgress() { sam = -1; denoiserProgress = 0; }
-};
diff --git a/WickedEngine/RenderPath_BindLua.cpp b/WickedEngine/RenderPath_BindLua.cpp
deleted file mode 100644
index 5ba11788a..000000000
--- a/WickedEngine/RenderPath_BindLua.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "RenderPath_BindLua.h"
-
-const char RenderPath_BindLua::className[] = "RenderPath";
-
-Luna::FunctionType RenderPath_BindLua::methods[] = {
- lunamethod(RenderPath_BindLua, GetLayerMask),
- lunamethod(RenderPath_BindLua, SetLayerMask),
- { NULL, NULL }
-};
-Luna::PropertyType RenderPath_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-
-int RenderPath_BindLua::GetLayerMask(lua_State* L)
-{
- uint32_t mask = component->getLayerMask();
- wiLua::SSetInt(L, *reinterpret_cast(&mask));
- return 1;
-}
-int RenderPath_BindLua::SetLayerMask(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- int mask = wiLua::SGetInt(L, 1);
- component->setlayerMask(*reinterpret_cast(&mask));
- }
- else
- wiLua::SError(L, "SetLayerMask(uint mask) not enough arguments!");
- return 0;
-}
-
-void RenderPath_BindLua::Bind()
-{
-
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
- Luna::Register(wiLua::GetLuaState());
- }
-}
-
diff --git a/WickedEngine/RenderPath_BindLua.h b/WickedEngine/RenderPath_BindLua.h
deleted file mode 100644
index 890a5cc61..000000000
--- a/WickedEngine/RenderPath_BindLua.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "RenderPath.h"
-
-class RenderPath_BindLua
-{
-public:
- RenderPath* component = nullptr;
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- RenderPath_BindLua() = default;
- RenderPath_BindLua(RenderPath* component) :component(component) {}
- RenderPath_BindLua(lua_State* L) {}
-
- virtual int GetLayerMask(lua_State* L);
- virtual int SetLayerMask(lua_State* L);
-
- static void Bind();
-};
-
diff --git a/WickedEngine/SpriteAnim_BindLua.cpp b/WickedEngine/SpriteAnim_BindLua.cpp
deleted file mode 100644
index dd8f2d220..000000000
--- a/WickedEngine/SpriteAnim_BindLua.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-#include "SpriteAnim_BindLua.h"
-#include "Vector_BindLua.h"
-
-const char SpriteAnim_BindLua::className[] = "SpriteAnim";
-
-Luna::FunctionType SpriteAnim_BindLua::methods[] = {
- lunamethod(SpriteAnim_BindLua, SetRot),
- lunamethod(SpriteAnim_BindLua, SetRotation),
- lunamethod(SpriteAnim_BindLua, SetOpacity),
- lunamethod(SpriteAnim_BindLua, SetFade),
- lunamethod(SpriteAnim_BindLua, SetRepeatable),
- lunamethod(SpriteAnim_BindLua, SetVelocity),
- lunamethod(SpriteAnim_BindLua, SetScaleX),
- lunamethod(SpriteAnim_BindLua, SetScaleY),
- lunamethod(SpriteAnim_BindLua, SetMovingTexAnim),
- lunamethod(SpriteAnim_BindLua, SetDrawRecAnim),
-
- lunamethod(SpriteAnim_BindLua, GetRot),
- lunamethod(SpriteAnim_BindLua, GetRotation),
- lunamethod(SpriteAnim_BindLua, GetOpacity),
- lunamethod(SpriteAnim_BindLua, GetFade),
- lunamethod(SpriteAnim_BindLua, GetRepeatable),
- lunamethod(SpriteAnim_BindLua, GetVelocity),
- lunamethod(SpriteAnim_BindLua, GetScaleX),
- lunamethod(SpriteAnim_BindLua, GetScaleY),
- lunamethod(SpriteAnim_BindLua, GetMovingTexAnim),
- lunamethod(SpriteAnim_BindLua, GetDrawRecAnim),
- { NULL, NULL }
-};
-Luna::PropertyType SpriteAnim_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-SpriteAnim_BindLua::SpriteAnim_BindLua(const wiSprite::Anim& anim) :anim(anim)
-{
-}
-
-SpriteAnim_BindLua::SpriteAnim_BindLua(lua_State *L)
-{
- anim = wiSprite::Anim();
-}
-
-
-
-int SpriteAnim_BindLua::SetRot(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.rot = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetRot(float rot) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetRotation(lua_State *L)
-{
- return SetRot(L);
-}
-int SpriteAnim_BindLua::SetOpacity(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.opa = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetOpacity(float val) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetFade(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.fad = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetFade(float val) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetRepeatable(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.repeatable = wiLua::SGetBool(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetRepeatable(float val) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetVelocity(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- Vector_BindLua* vec = Luna::lightcheck(L, 1);
- if (vec != nullptr)
- {
- XMStoreFloat3(&anim.vel, XMLoadFloat4(vec));
- }
- else
- {
- wiLua::SError(L, "SetVelocity(Vector val) argument is not a Vector!");
- }
- }
- else
- {
- wiLua::SError(L, "SetVelocity(Vector val) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetScaleX(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.scaleX = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetScaleX(float val) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetScaleY(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.scaleY = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetScaleY(float val) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetMovingTexAnim(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- MovingTexAnim_BindLua* data = Luna::lightcheck(L, 1);
- if (data != nullptr)
- {
- anim.movingTexAnim = data->anim;
- }
- else
- {
- wiLua::SError(L, "SetMovingTexAnim(MovingTexAnim data) argument is not a MovingTexAnim!");
- }
- }
- else
- {
- wiLua::SError(L, "SetMovingTexAnim(MovingTexAnim data) not enough arguments!");
- }
- return 0;
-}
-int SpriteAnim_BindLua::SetDrawRecAnim(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- DrawRectAnim_BindLua* data = Luna::lightcheck(L, 1);
- if (data != nullptr)
- {
- anim.drawRectAnim = data->anim;
- }
- else
- {
- wiLua::SError(L, "SetDrawRecAnim(DrawRecAnim data) argument is not a DrawRecAnim!");
- }
- }
- else
- {
- wiLua::SError(L, "SetDrawRecAnim(DrawRecAnim data) not enough arguments!");
- }
- return 0;
-}
-
-int SpriteAnim_BindLua::GetRot(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.rot);
- return 1;
-}
-int SpriteAnim_BindLua::GetRotation(lua_State *L)
-{
- return GetRot(L);
-}
-int SpriteAnim_BindLua::GetOpacity(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.opa);
- return 1;
-}
-int SpriteAnim_BindLua::GetFade(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.fad);
- return 1;
-}
-int SpriteAnim_BindLua::GetRepeatable(lua_State *L)
-{
- wiLua::SSetBool(L, anim.repeatable);
- return 1;
-}
-int SpriteAnim_BindLua::GetVelocity(lua_State *L)
-{
- Luna::push(L, new Vector_BindLua(XMLoadFloat3(&anim.vel)));
- return 1;
-}
-int SpriteAnim_BindLua::GetScaleX(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.scaleX);
- return 1;
-}
-int SpriteAnim_BindLua::GetScaleY(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.scaleY);
- return 1;
-}
-int SpriteAnim_BindLua::GetMovingTexAnim(lua_State *L)
-{
- Luna::push(L, new MovingTexAnim_BindLua(anim.movingTexAnim));
- return 1;
-}
-int SpriteAnim_BindLua::GetDrawRecAnim(lua_State *L)
-{
- Luna::push(L, new DrawRectAnim_BindLua(anim.drawRectAnim));
- return 1;
-}
-
-void SpriteAnim_BindLua::Bind()
-{
- static bool initialized = false;
- if (!initialized)
- {
- initialized = true;
- Luna::Register(wiLua::GetLuaState());
- Luna::Register(wiLua::GetLuaState());
- Luna::Register(wiLua::GetLuaState());
- }
-}
-
-
-
-
-const char MovingTexAnim_BindLua::className[] = "MovingTexAnim";
-
-Luna::FunctionType MovingTexAnim_BindLua::methods[] = {
- lunamethod(MovingTexAnim_BindLua, SetSpeedX),
- lunamethod(MovingTexAnim_BindLua, SetSpeedY),
-
- lunamethod(MovingTexAnim_BindLua, GetSpeedX),
- lunamethod(MovingTexAnim_BindLua, GetSpeedY),
- { NULL, NULL }
-};
-Luna::PropertyType MovingTexAnim_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-MovingTexAnim_BindLua::MovingTexAnim_BindLua(const wiSprite::Anim::MovingTexAnim& anim) :anim(anim)
-{
-}
-
-MovingTexAnim_BindLua::MovingTexAnim_BindLua(lua_State *L)
-{
- anim = wiSprite::Anim::MovingTexAnim();
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.speedX = wiLua::SGetFloat(L, 1);
- if (argc > 1)
- {
- anim.speedY = wiLua::SGetFloat(L, 2);
- }
- }
-}
-
-MovingTexAnim_BindLua::~MovingTexAnim_BindLua()
-{
-}
-
-int MovingTexAnim_BindLua::SetSpeedX(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.speedX = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetSpeedX(float val) not enough arguments!");
- }
- return 0;
-}
-int MovingTexAnim_BindLua::SetSpeedY(lua_State *L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.speedY = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetSpeedY(float val) not enough arguments!");
- }
- return 0;
-}
-
-int MovingTexAnim_BindLua::GetSpeedX(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.speedX);
- return 1;
-}
-int MovingTexAnim_BindLua::GetSpeedY(lua_State *L)
-{
- wiLua::SSetFloat(L, anim.speedY);
- return 1;
-}
-
-
-
-const char DrawRectAnim_BindLua::className[] = "DrawRecAnim";
-
-Luna::FunctionType DrawRectAnim_BindLua::methods[] = {
- lunamethod(DrawRectAnim_BindLua, SetFrameRate),
- lunamethod(DrawRectAnim_BindLua, SetFrameCount),
- lunamethod(DrawRectAnim_BindLua, SetHorizontalFrameCount),
-
- lunamethod(DrawRectAnim_BindLua, GetFrameRate),
- lunamethod(DrawRectAnim_BindLua, GetFrameCount),
- lunamethod(DrawRectAnim_BindLua, GetHorizontalFrameCount),
- { NULL, NULL }
-};
-Luna::PropertyType DrawRectAnim_BindLua::properties[] = {
- { NULL, NULL }
-};
-
-DrawRectAnim_BindLua::DrawRectAnim_BindLua(const wiSprite::Anim::DrawRectAnim& data) :anim(anim)
-{
-}
-
-DrawRectAnim_BindLua::DrawRectAnim_BindLua(lua_State *L)
-{
- anim = wiSprite::Anim::DrawRectAnim();
-}
-
-DrawRectAnim_BindLua::~DrawRectAnim_BindLua()
-{
-}
-
-int DrawRectAnim_BindLua::SetFrameRate(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.frameRate = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetFrameRate(float val) not enough arguments!");
- }
- return 0;
-}
-int DrawRectAnim_BindLua::SetFrameCount(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.frameCount = wiLua::SGetInt(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetFrameCount(int val) not enough arguments!");
- }
- return 0;
-}
-int DrawRectAnim_BindLua::SetHorizontalFrameCount(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- anim.horizontalFrameCount = wiLua::SGetInt(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetHorizontalFrameCount(int val) not enough arguments!");
- }
- return 0;
-}
-
-int DrawRectAnim_BindLua::GetFrameRate(lua_State* L)
-{
- wiLua::SSetFloat(L, anim.frameRate);
- return 1;
-}
-int DrawRectAnim_BindLua::GetFrameCount(lua_State* L)
-{
- wiLua::SSetInt(L, anim.frameCount);
- return 1;
-}
-int DrawRectAnim_BindLua::GetHorizontalFrameCount(lua_State* L)
-{
- wiLua::SSetInt(L, anim.horizontalFrameCount);
- return 1;
-}
diff --git a/WickedEngine/SpriteAnim_BindLua.h b/WickedEngine/SpriteAnim_BindLua.h
deleted file mode 100644
index ded128b6e..000000000
--- a/WickedEngine/SpriteAnim_BindLua.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma once
-#include "wiLua.h"
-#include "wiLuna.h"
-#include "wiSprite.h"
-
-class SpriteAnim_BindLua
-{
-public:
- wiSprite::Anim anim;
-
- static const char className[];
- static Luna::FunctionType methods[];
- static Luna::PropertyType properties[];
-
- SpriteAnim_BindLua(const wiSprite::Anim& anim);
- SpriteAnim_BindLua(lua_State *L);
-
- int SetRot(lua_State *L);
- int SetRotation(lua_State *L);
- int SetOpacity(lua_State *L);
- int SetFade(lua_State *L);
- int SetRepeatable(lua_State *L);
- int SetVelocity(lua_State *L);
- int SetScaleX(lua_State *L);
- int SetScaleY(lua_State *L);
- int SetMovingTexAnim(lua_State *L);
- int SetDrawRecAnim(lua_State *L);
-
- int GetRot(lua_State *L);
- int GetRotation(lua_State *L);
- int GetOpacity(lua_State *L);
- int GetFade(lua_State *L);
- int GetRepeatable(lua_State *L);
- int GetVelocity(lua_State *L);
- int GetScaleX(lua_State *L);
- int GetScaleY(lua_State *L);
- int GetMovingTexAnim(lua_State *L);
- int GetDrawRecAnim(lua_State *L);
-
-
- static void Bind();
-};
-
-class MovingTexAnim_BindLua
-{
-public:
- wiSprite::Anim::MovingTexAnim anim;
-
- static const char className[];
- static Luna