refactoring
This commit is contained in:
+3
-12
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
|
||||
|
||||
+5
-6
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
#pragma once
|
||||
#ifndef _INCLUDE_DX11_H_
|
||||
#define _INCLUDE_DX11_H_
|
||||
|
||||
#include <d3d11_3.h>
|
||||
#include <DXGI1_3.h>
|
||||
|
||||
#pragma comment(lib,"d3d11.lib")
|
||||
#pragma comment(lib,"Dxgi.lib")
|
||||
#pragma comment(lib,"dxguid.lib")
|
||||
|
||||
#endif // _INCLUDE_DX11_H_
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#ifndef WINSTORE_SUPPORT
|
||||
#include <Pdh.h>
|
||||
#pragma comment(lib,"pdh.lib")
|
||||
#endif
|
||||
|
||||
class wiCpuInfo
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
#ifndef WINSTORE_SUPPORT
|
||||
#pragma comment(lib,"ws2_32.lib")
|
||||
#endif
|
||||
|
||||
class wiNetwork
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user