diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 8aebc306b..339caec31 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include "Editor.h" -#include "wiInitializer.h" #include "wiRenderer.h" #include "MaterialWindow.h" #include "PostprocessWindow.h" @@ -39,7 +38,9 @@ Editor::~Editor() void Editor::Initialize() { - + // Call this before Maincomponent::Initialize if you want to load shaders from an other directory! + // otherwise, shaders will be loaded from the working directory + wiRenderer::SHADERPATH = "../WickedEngine/shaders/"; MainComponent::Initialize(); infoDisplay.active = true; @@ -48,16 +49,6 @@ void Editor::Initialize() infoDisplay.cpuinfo = false; infoDisplay.resolution = true; - wiRenderer::SHADERPATH = "../WickedEngine/shaders/"; - - wiInitializer::InitializeComponents( - wiInitializer::WICKEDENGINE_INITIALIZE_RENDERER - | wiInitializer::WICKEDENGINE_INITIALIZE_IMAGE - | wiInitializer::WICKEDENGINE_INITIALIZE_FONT - | wiInitializer::WICKEDENGINE_INITIALIZE_SOUND - | wiInitializer::WICKEDENGINE_INITIALIZE_MISC - ); - wiRenderer::GetDevice()->SetVSyncEnabled(true); wiRenderer::EMITTERSENABLED = true; wiRenderer::HAIRPARTICLEENABLED = true; diff --git a/Editor/main.cpp b/Editor/main.cpp index 8ea63155e..f5a1f8e3d 100644 --- a/Editor/main.cpp +++ b/Editor/main.cpp @@ -66,7 +66,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, } else { - editor.run(); + editor.Run(); } } @@ -161,7 +161,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) return FALSE; } - if (!editor.setWindow(hWnd, hInst)) + if (!editor.SetWindow(hWnd, hInst)) return false; diff --git a/Tests/Tests.cpp b/Tests/Tests.cpp index 4681b43b3..5c5597d47 100644 --- a/Tests/Tests.cpp +++ b/Tests/Tests.cpp @@ -12,9 +12,10 @@ Tests::~Tests() void Tests::Initialize() { - MainComponent::Initialize(); - + // Call this before Maincomponent::Initialize if you want to load shaders from an other directory! + // otherwise, shaders will be loaded from the working directory wiRenderer::SHADERPATH = "../WickedEngine/shaders/"; + MainComponent::Initialize(); infoDisplay.active = true; infoDisplay.watermark = true; @@ -22,11 +23,9 @@ void Tests::Initialize() infoDisplay.cpuinfo = false; infoDisplay.resolution = true; - wiProfiler::GetInstance().ENABLED = false; - - wiInitializer::InitializeComponents(); - activateComponent(new TestsRenderer); + + wiProfiler::GetInstance().ENABLED = false; } diff --git a/Tests/main.cpp b/Tests/main.cpp index d41fad425..cbe0451ac 100644 --- a/Tests/main.cpp +++ b/Tests/main.cpp @@ -57,7 +57,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, } else { - tests.run(); + tests.Run(); } } @@ -115,7 +115,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) return FALSE; } - if (!tests.setWindow(hWnd, hInst)) + if (!tests.SetWindow(hWnd, hInst)) { return FALSE; } diff --git a/WickedEngine/Include_DX11.h b/WickedEngine/Include_DX11.h index bcfa8c95e..e243cb1f1 100644 --- a/WickedEngine/Include_DX11.h +++ b/WickedEngine/Include_DX11.h @@ -1,4 +1,11 @@ -#pragma once +#ifndef _INCLUDE_DX11_H_ +#define _INCLUDE_DX11_H_ #include #include + +#pragma comment(lib,"d3d11.lib") +#pragma comment(lib,"Dxgi.lib") +#pragma comment(lib,"dxguid.lib") + +#endif // _INCLUDE_DX11_H_ diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp index b82934a97..6734c6138 100644 --- a/WickedEngine/MainComponent.cpp +++ b/WickedEngine/MainComponent.cpp @@ -12,6 +12,7 @@ #include "wiTextureHelper.h" #include "wiFrameRate.h" #include "wiProfiler.h" +#include "wiInitializer.h" using namespace std; @@ -47,6 +48,8 @@ MainComponent::~MainComponent() void MainComponent::Initialize() { + wiInitializer::InitializeComponents(); + wiLua::GetGlobal()->RegisterObject(MainComponent_BindLua::className, "main", new MainComponent_BindLua(this)); } @@ -80,7 +83,7 @@ void MainComponent::activateComponent(RenderableComponent* component, int fadeFr } } -void MainComponent::run() +void MainComponent::Run() { wiProfiler::GetInstance().BeginFrame(); wiProfiler::GetInstance().BeginRange("CPU Frame", wiProfiler::DOMAIN_CPU); @@ -234,7 +237,7 @@ void MainComponent::Compose() } #ifndef WINSTORE_SUPPORT -bool MainComponent::setWindow(wiWindowRegistration::window_type window, HINSTANCE hInst) +bool MainComponent::SetWindow(wiWindowRegistration::window_type window, HINSTANCE hInst) { this->window = window; this->instance = hInst; @@ -254,7 +257,7 @@ bool MainComponent::setWindow(wiWindowRegistration::window_type window, HINSTANC return true; } #else -bool MainComponent::setWindow(wiWindowRegistration::window_type window) +bool MainComponent::SetWindow(wiWindowRegistration::window_type window) { screenW = (int)window->Bounds.Width; screenH = (int)window->Bounds.Height; diff --git a/WickedEngine/MainComponent.h b/WickedEngine/MainComponent.h index c9390b953..ced094389 100644 --- a/WickedEngine/MainComponent.h +++ b/WickedEngine/MainComponent.h @@ -26,7 +26,8 @@ public: int screenW, screenH; bool fullscreen; - void run(); + // Runs the main engine loop + void Run(); void activateComponent(RenderableComponent* component, int fadeFrames = 0, const wiColor& fadeColor = wiColor(0,0,0,255)); RenderableComponent* getActiveComponent(){ return activeComponent; } @@ -40,6 +41,7 @@ public: int getTargetFrameRate(){ return targetFrameRate; } void setApplicationControlLostThreshold(int value){ applicationControlLostThreshold = value; } + // Initializes all engine components virtual void Initialize(); virtual void Update(float dt); virtual void FixedUpdate(); @@ -50,9 +52,9 @@ public: #ifndef WINSTORE_SUPPORT HINSTANCE instance; - bool setWindow(wiWindowRegistration::window_type window, HINSTANCE hInst); + bool SetWindow(wiWindowRegistration::window_type window, HINSTANCE hInst); #else - bool setWindow(wiWindowRegistration::window_type window); + bool SetWindow(wiWindowRegistration::window_type window); #endif diff --git a/WickedEngine/WickedEngine.h b/WickedEngine/WickedEngine.h index f253d5bf4..03e216d35 100644 --- a/WickedEngine/WickedEngine.h +++ b/WickedEngine/WickedEngine.h @@ -73,16 +73,8 @@ #pragma comment(lib,"WickedEngine_UWP.lib") #else #pragma comment(lib,"WickedEngine_Windows.lib") -#pragma comment(lib,"ws2_32.lib") -#pragma comment(lib,"winmm.lib") -#pragma comment(lib,"pdh.lib") #endif // WINSTORE_SUPPORT -#pragma comment(lib,"d3d11.lib") -#pragma comment(lib,"Dxgi.lib") -#pragma comment(lib,"comctl32.lib") -#pragma comment(lib,"dxguid.lib") - #endif // _WIN32 diff --git a/WickedEngine/wiCpuInfo.h b/WickedEngine/wiCpuInfo.h index a3fa3e1ec..1153c0482 100644 --- a/WickedEngine/wiCpuInfo.h +++ b/WickedEngine/wiCpuInfo.h @@ -3,6 +3,7 @@ #ifndef WINSTORE_SUPPORT #include +#pragma comment(lib,"pdh.lib") #endif class wiCpuInfo diff --git a/WickedEngine/wiInitializer.cpp b/WickedEngine/wiInitializer.cpp index 83902e380..217b72027 100644 --- a/WickedEngine/wiInitializer.cpp +++ b/WickedEngine/wiInitializer.cpp @@ -14,41 +14,25 @@ using namespace std; namespace wiInitializer { - void InitializeComponents(int requestedFeautures) + void InitializeComponents() { - if (requestedFeautures & WICKEDENGINE_INITIALIZE_MISC) - { - wiBackLog::Initialize(); - wiFrameRate::Initialize(); - wiCpuInfo::Initialize(); - } + wiBackLog::Initialize(); + wiFrameRate::Initialize(); + wiCpuInfo::Initialize(); - if (requestedFeautures & WICKEDENGINE_INITIALIZE_RENDERER) - { - wiRenderer::SetUpStaticComponents(); - wiLensFlare::Initialize(); - } + wiRenderer::SetUpStaticComponents(); + wiLensFlare::Initialize(); - if (requestedFeautures & WICKEDENGINE_INITIALIZE_IMAGE) - { - wiImage::Load(); - } + wiImage::Load(); - if (requestedFeautures & WICKEDENGINE_INITIALIZE_FONT) - { - wiFont::Initialize(); - wiFont::SetUpStaticComponents(); - } + wiFont::Initialize(); + wiFont::SetUpStaticComponents(); - if (requestedFeautures & WICKEDENGINE_INITIALIZE_SOUND) + if (FAILED(wiSoundEffect::Initialize()) || FAILED(wiMusic::Initialize())) { - if (FAILED(wiSoundEffect::Initialize()) || FAILED(wiMusic::Initialize())) - { - stringstream ss(""); - ss << "Failed to Initialize Audio Device!"; - wiHelper::messageBox(ss.str()); - } + stringstream ss(""); + ss << "Failed to Initialize Audio Device!"; + wiHelper::messageBox(ss.str()); } - } } \ No newline at end of file diff --git a/WickedEngine/wiInitializer.h b/WickedEngine/wiInitializer.h index ae2d2932f..f8fe57191 100644 --- a/WickedEngine/wiInitializer.h +++ b/WickedEngine/wiInitializer.h @@ -3,17 +3,7 @@ namespace wiInitializer { - enum WICKEDENGINE_INITIALIZER - { - WICKEDENGINE_INITIALIZE_RENDERER = 0x0000001, - WICKEDENGINE_INITIALIZE_IMAGE = 0x0000010, - WICKEDENGINE_INITIALIZE_FONT = 0x0000100, - WICKEDENGINE_INITIALIZE_SOUND = 0x0001000, - WICKEDENGINE_INITIALIZE_MISC = 0x0010000, - WICKEDENGINE_INITIALIZE_ALL = 0x1111111 - }; - - void InitializeComponents(int requestedFeautures = WICKEDENGINE_INITIALIZE_ALL); + void InitializeComponents(); } diff --git a/WickedEngine/wiNetwork.h b/WickedEngine/wiNetwork.h index cc63a7ee3..80b5fb266 100644 --- a/WickedEngine/wiNetwork.h +++ b/WickedEngine/wiNetwork.h @@ -8,7 +8,9 @@ #include #include - +#ifndef WINSTORE_SUPPORT +#pragma comment(lib,"ws2_32.lib") +#endif class wiNetwork { diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 2b3949219..88a8f2216 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -57,7 +57,7 @@ int wiRenderer::SHADOWRES_2D = 1024, wiRenderer::SHADOWRES_CUBE = 256, wiRendere bool wiRenderer::HAIRPARTICLEENABLED=true,wiRenderer::EMITTERSENABLED=true; bool wiRenderer::wireRender = false, wiRenderer::debugSpheres = false, wiRenderer::debugBoneLines = false, wiRenderer::debugPartitionTree = false, wiRenderer::debugEmitters = false , wiRenderer::debugEnvProbes = false, wiRenderer::gridHelper = false, wiRenderer::voxelHelper = false, wiRenderer::requestReflectionRendering = false, wiRenderer::advancedLightCulling = true -, wiRenderer::advancedRefractions = true; +, wiRenderer::advancedRefractions = false; float wiRenderer::SPECULARAA = 0.0f; float wiRenderer::renderTime = 0, wiRenderer::renderTime_Prev = 0, wiRenderer::deltaTime = 0; XMFLOAT2 wiRenderer::temporalAAJitter = XMFLOAT2(0, 0), wiRenderer::temporalAAJitterPrev = XMFLOAT2(0, 0); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index b8a50f249..20cffcf2a 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 13; // minor bug fixes, alterations, refactors, updates - const int revision = 19; + const int revision = 20; long GetVersion()