diff --git a/Documentation/ScriptingAPI-Documentation.md b/Documentation/ScriptingAPI-Documentation.md
index fb26efe6d..9c601fd12 100644
--- a/Documentation/ScriptingAPI-Documentation.md
+++ b/Documentation/ScriptingAPI-Documentation.md
@@ -93,7 +93,7 @@ The scripting API provides some functions which manipulate the BackLog. These fu
- backlog_post(string params,,,) -- post a string to the backlog
- backlog_fontsize(int size) -- modify the fint size of the backlog
- backlog_isactive() : boolean result -- returns true if the backlog is active, false otherwise
-- backlog_fontrowspacing(int spacing) -- set a row spacing to the backlog
+- backlog_fontrowspacing(float spacing) -- set a row spacing to the backlog
### Renderer
This is the graphics renderer, which is also responsible for managing the scene graph which consists of keeping track of
diff --git a/Editor/AnimationWindow.cpp b/Editor/AnimationWindow.cpp
index 4a8af4bc9..65bfc3e3e 100644
--- a/Editor/AnimationWindow.cpp
+++ b/Editor/AnimationWindow.cpp
@@ -12,7 +12,7 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI(
assert(GUI && "Invalid GUI!");
animWindow = new wiWindow(GUI, "Animation Window");
- animWindow->SetSize(XMFLOAT2(600, 450));
+ animWindow->SetSize(XMFLOAT2(600, 300));
GUI->AddWidget(animWindow);
float x = 200;
diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp
index 4b36e831c..c81361efb 100644
--- a/Editor/CameraWindow.cpp
+++ b/Editor/CameraWindow.cpp
@@ -138,7 +138,7 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
SetEntity(INVALID_ENTITY);
- cameraWindow->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 720, 500, 0));
+ cameraWindow->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 720, 100, 0));
cameraWindow->SetVisible(false);
}
diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp
index 42f905964..619987d0e 100644
--- a/Editor/Editor.cpp
+++ b/Editor/Editor.cpp
@@ -63,7 +63,7 @@ void Editor::Initialize()
void EditorLoadingScreen::Load()
{
- font = wiSpriteFont("Loading...", wiFontParams((int)(wiRenderer::GetDevice()->GetScreenWidth()*0.5f), (int)(wiRenderer::GetDevice()->GetScreenHeight()*0.5f), 36,
+ font = wiSpriteFont("Loading...", wiFontParams(wiRenderer::GetDevice()->GetScreenWidth()*0.5f, wiRenderer::GetDevice()->GetScreenHeight()*0.5f, 36,
WIFALIGN_CENTER, WIFALIGN_CENTER));
AddFont(&font);
@@ -81,8 +81,8 @@ void EditorLoadingScreen::Load()
}
void EditorLoadingScreen::Update(float dt)
{
- font.params.posX = (int)(wiRenderer::GetDevice()->GetScreenWidth()*0.5f);
- font.params.posY = (int)(wiRenderer::GetDevice()->GetScreenHeight()*0.5f);
+ font.params.posX = wiRenderer::GetDevice()->GetScreenWidth()*0.5f;
+ font.params.posY = wiRenderer::GetDevice()->GetScreenHeight()*0.5f;
sprite.params.pos = XMFLOAT3(wiRenderer::GetDevice()->GetScreenWidth()*0.5f, wiRenderer::GetDevice()->GetScreenHeight()*0.5f - font.textHeight(), 0);
__super::Update(dt);
@@ -227,8 +227,8 @@ void EditorComponent::Load()
translator.enabled = false;
- float screenW = (float)wiRenderer::GetDevice()->GetScreenWidth();
- float screenH = (float)wiRenderer::GetDevice()->GetScreenHeight();
+ float screenW = wiRenderer::GetDevice()->GetScreenWidth();
+ float screenH = wiRenderer::GetDevice()->GetScreenHeight();
XMFLOAT2 option_size = XMFLOAT2(100, 34);
float x = screenW - option_size.x;
@@ -744,9 +744,12 @@ void EditorComponent::Load()
ss << endl << endl << "For questions, bug reports, feedback, requests, please open an issue at:" << endl;
ss << "https://github.com/turanszkij/WickedEngine" << endl;
+ float screenW = (float)wiRenderer::GetDevice()->GetScreenWidth();
+ float screenH = (float)wiRenderer::GetDevice()->GetScreenHeight();
+
helpLabel = new wiLabel("HelpLabel");
helpLabel->SetText(ss.str());
- helpLabel->SetSize(XMFLOAT2(screenW / 3.0f, screenH / 2.2f));
+ helpLabel->SetSize(XMFLOAT2(screenW / 2.0f, screenH / 1.5f));
helpLabel->SetPos(XMFLOAT2(screenW / 2.0f - helpLabel->scale.x / 2.0f, screenH / 2.0f - helpLabel->scale.y / 2.0f));
helpLabel->SetVisible(false);
GetGUI().AddWidget(helpLabel);
@@ -772,7 +775,7 @@ void EditorComponent::Load()
wiCheckBox* profilerEnabledCheckBox = new wiCheckBox("Profiler Enabled: ");
profilerEnabledCheckBox->SetSize(XMFLOAT2(20, 20));
profilerEnabledCheckBox->SetPos(XMFLOAT2(screenW - 520, 45));
- profilerEnabledCheckBox->SetTooltip("Toggle Profiler Engine On/Off");
+ profilerEnabledCheckBox->SetTooltip("Toggle Profiler On/Off");
profilerEnabledCheckBox->OnClick([&](wiEventArgs args) {
wiProfiler::SetEnabled(args.bValue);
});
@@ -996,7 +999,6 @@ void EditorComponent::Update(float dt)
renderPath->GetGUI().SetVisible(true);
}
GetGUI().SetVisible(true);
- wiProfiler::SetEnabled(true);
main->infoDisplay.active = true;
cinemaModeCheckBox->SetCheck(false);
diff --git a/Editor/EmitterWindow.cpp b/Editor/EmitterWindow.cpp
index e0d7024d6..046c36a28 100644
--- a/Editor/EmitterWindow.cpp
+++ b/Editor/EmitterWindow.cpp
@@ -13,17 +13,18 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
assert(GUI && "Invalid GUI!");
emitterWindow = new wiWindow(GUI, "Emitter Window");
- emitterWindow->SetSize(XMFLOAT2(800, 1100));
+ emitterWindow->SetSize(XMFLOAT2(700, 820));
GUI->AddWidget(emitterWindow);
float x = 200;
- float y = 20;
- float step = 35;
+ float y = 5;
+ float step = 25;
+ float itemheight = 20;
emitterNameField = new wiTextInputField("EmitterName");
emitterNameField->SetPos(XMFLOAT2(x, y += step));
- emitterNameField->SetSize(XMFLOAT2(300, 20));
+ emitterNameField->SetSize(XMFLOAT2(300, itemheight));
emitterNameField->OnInputAccepted([&](wiEventArgs args) {
NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
if (name != nullptr)
@@ -35,7 +36,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
addButton = new wiButton("Add Emitter");
addButton->SetPos(XMFLOAT2(x, y += step));
- addButton->SetSize(XMFLOAT2(150, 30));
+ addButton->SetSize(XMFLOAT2(150, itemheight));
addButton->OnClick([=](wiEventArgs args) {
Scene& scene = wiScene::GetScene();
Entity entity = scene.Entity_CreateEmitter("editorEmitter");
@@ -48,7 +49,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
restartButton = new wiButton("Restart Emitter");
restartButton->SetPos(XMFLOAT2(x + 160, y));
- restartButton->SetSize(XMFLOAT2(150, 30));
+ restartButton->SetSize(XMFLOAT2(150, itemheight));
restartButton->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -60,7 +61,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(restartButton);
meshComboBox = new wiComboBox("Mesh: ");
- meshComboBox->SetSize(XMFLOAT2(300, 25));
+ meshComboBox->SetSize(XMFLOAT2(300, itemheight));
meshComboBox->SetPos(XMFLOAT2(x, y += step));
meshComboBox->SetEnabled(false);
meshComboBox->OnSelect([&](wiEventArgs args) {
@@ -83,7 +84,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
shaderTypeComboBox = new wiComboBox("ShaderType: ");
shaderTypeComboBox->SetPos(XMFLOAT2(x, y += step));
- shaderTypeComboBox->SetSize(XMFLOAT2(300, 25));
+ shaderTypeComboBox->SetSize(XMFLOAT2(300, itemheight));
shaderTypeComboBox->AddItem("SOFT");
shaderTypeComboBox->AddItem("SOFT + DISTORTION");
shaderTypeComboBox->AddItem("SIMPLEST");
@@ -102,6 +103,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
sortCheckBox = new wiCheckBox("Sorting Enabled: ");
sortCheckBox->SetPos(XMFLOAT2(x, y += step));
+ sortCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
sortCheckBox->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -116,6 +118,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
depthCollisionsCheckBox = new wiCheckBox("Depth Buffer Collisions Enabled: ");
depthCollisionsCheckBox->SetPos(XMFLOAT2(x + 250, y));
+ depthCollisionsCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
depthCollisionsCheckBox->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -130,6 +133,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
sphCheckBox = new wiCheckBox("SPH - FluidSim: ");
sphCheckBox->SetPos(XMFLOAT2(x + 400, y));
+ sphCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
sphCheckBox->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -144,6 +148,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
pauseCheckBox = new wiCheckBox("PAUSE: ");
pauseCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pauseCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pauseCheckBox->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -158,6 +163,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
debugCheckBox = new wiCheckBox("DEBUG: ");
debugCheckBox->SetPos(XMFLOAT2(x + 120, y));
+ debugCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
debugCheckBox->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -172,6 +178,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
volumeCheckBox = new wiCheckBox("Volume: ");
volumeCheckBox->SetPos(XMFLOAT2(x + 250, y));
+ volumeCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
volumeCheckBox->OnClick([&](wiEventArgs args) {
auto emitter = GetEmitter();
if (emitter != nullptr)
@@ -192,7 +199,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
maxParticlesSlider = new wiSlider(100.0f, 1000000.0f, 10000, 100000, "Max particle count: ");
- maxParticlesSlider->SetSize(XMFLOAT2(360, 30));
+ maxParticlesSlider->SetSize(XMFLOAT2(360, itemheight));
maxParticlesSlider->SetPos(XMFLOAT2(x, y += step + 120));
maxParticlesSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -210,7 +217,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
//////////////////////////////////////////////////////////////////////////////////////////////////
emitCountSlider = new wiSlider(0.0f, 10000.0f, 1.0f, 100000, "Emit count per sec: ");
- emitCountSlider->SetSize(XMFLOAT2(360, 30));
+ emitCountSlider->SetSize(XMFLOAT2(360, itemheight));
emitCountSlider->SetPos(XMFLOAT2(x, y += step));
emitCountSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -224,7 +231,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitCountSlider);
emitSizeSlider = new wiSlider(0.01f, 10.0f, 1.0f, 100000, "Size: ");
- emitSizeSlider->SetSize(XMFLOAT2(360, 30));
+ emitSizeSlider->SetSize(XMFLOAT2(360, itemheight));
emitSizeSlider->SetPos(XMFLOAT2(x, y += step));
emitSizeSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -238,7 +245,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitSizeSlider);
emitRotationSlider = new wiSlider(0.0f, 1.0f, 0.0f, 100000, "Rotation: ");
- emitRotationSlider->SetSize(XMFLOAT2(360, 30));
+ emitRotationSlider->SetSize(XMFLOAT2(360, itemheight));
emitRotationSlider->SetPos(XMFLOAT2(x, y += step));
emitRotationSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -252,7 +259,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitRotationSlider);
emitNormalSlider = new wiSlider(0.0f, 100.0f, 1.0f, 100000, "Normal factor: ");
- emitNormalSlider->SetSize(XMFLOAT2(360, 30));
+ emitNormalSlider->SetSize(XMFLOAT2(360, itemheight));
emitNormalSlider->SetPos(XMFLOAT2(x, y += step));
emitNormalSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -266,7 +273,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitNormalSlider);
emitScalingSlider = new wiSlider(0.0f, 100.0f, 1.0f, 100000, "Scaling: ");
- emitScalingSlider->SetSize(XMFLOAT2(360, 30));
+ emitScalingSlider->SetSize(XMFLOAT2(360, itemheight));
emitScalingSlider->SetPos(XMFLOAT2(x, y += step));
emitScalingSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -280,7 +287,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitScalingSlider);
emitLifeSlider = new wiSlider(0.0f, 100.0f, 1.0f, 10000, "Life span: ");
- emitLifeSlider->SetSize(XMFLOAT2(360, 30));
+ emitLifeSlider->SetSize(XMFLOAT2(360, itemheight));
emitLifeSlider->SetPos(XMFLOAT2(x, y += step));
emitLifeSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -294,7 +301,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitLifeSlider);
emitRandomnessSlider = new wiSlider(0.0f, 1.0f, 1.0f, 100000, "Randomness: ");
- emitRandomnessSlider->SetSize(XMFLOAT2(360, 30));
+ emitRandomnessSlider->SetSize(XMFLOAT2(360, itemheight));
emitRandomnessSlider->SetPos(XMFLOAT2(x, y += step));
emitRandomnessSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -308,7 +315,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitRandomnessSlider);
emitLifeRandomnessSlider = new wiSlider(0.0f, 2.0f, 0.0f, 100000, "Life randomness: ");
- emitLifeRandomnessSlider->SetSize(XMFLOAT2(360, 30));
+ emitLifeRandomnessSlider->SetSize(XMFLOAT2(360, itemheight));
emitLifeRandomnessSlider->SetPos(XMFLOAT2(x, y += step));
emitLifeRandomnessSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -322,7 +329,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitLifeRandomnessSlider);
emitMotionBlurSlider = new wiSlider(0.0f, 1.0f, 1.0f, 100000, "Motion blur: ");
- emitMotionBlurSlider->SetSize(XMFLOAT2(360, 30));
+ emitMotionBlurSlider->SetSize(XMFLOAT2(360, itemheight));
emitMotionBlurSlider->SetPos(XMFLOAT2(x, y += step));
emitMotionBlurSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -336,7 +343,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(emitMotionBlurSlider);
emitMassSlider = new wiSlider(0.1f, 100.0f, 1.0f, 100000, "Mass: ");
- emitMassSlider->SetSize(XMFLOAT2(360, 30));
+ emitMassSlider->SetSize(XMFLOAT2(360, itemheight));
emitMassSlider->SetPos(XMFLOAT2(x, y += step));
emitMassSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -352,7 +359,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
timestepSlider = new wiSlider(-1, 0.016f, -1, 100000, "Timestep: ");
- timestepSlider->SetSize(XMFLOAT2(360, 30));
+ timestepSlider->SetSize(XMFLOAT2(360, itemheight));
timestepSlider->SetPos(XMFLOAT2(x, y += step*2));
timestepSlider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -374,7 +381,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
y += step;
sph_h_Slider = new wiSlider(0.1f, 100.0f, 1.0f, 100000, "SPH Smoothing Radius (h): ");
- sph_h_Slider->SetSize(XMFLOAT2(360, 30));
+ sph_h_Slider->SetSize(XMFLOAT2(360, itemheight));
sph_h_Slider->SetPos(XMFLOAT2(x, y += step));
sph_h_Slider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -388,7 +395,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(sph_h_Slider);
sph_K_Slider = new wiSlider(0.1f, 100.0f, 1.0f, 100000, "SPH Pressure Constant (K): ");
- sph_K_Slider->SetSize(XMFLOAT2(360, 30));
+ sph_K_Slider->SetSize(XMFLOAT2(360, itemheight));
sph_K_Slider->SetPos(XMFLOAT2(x, y += step));
sph_K_Slider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -402,7 +409,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(sph_K_Slider);
sph_p0_Slider = new wiSlider(0.1f, 100.0f, 1.0f, 100000, "SPH Reference Density (p0): ");
- sph_p0_Slider->SetSize(XMFLOAT2(360, 30));
+ sph_p0_Slider->SetSize(XMFLOAT2(360, itemheight));
sph_p0_Slider->SetPos(XMFLOAT2(x, y += step));
sph_p0_Slider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
@@ -416,7 +423,7 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
emitterWindow->AddWidget(sph_p0_Slider);
sph_e_Slider = new wiSlider(0.1f, 100.0f, 1.0f, 100000, "SPH Viscosity (e): ");
- sph_e_Slider->SetSize(XMFLOAT2(360, 30));
+ sph_e_Slider->SetSize(XMFLOAT2(360, itemheight));
sph_e_Slider->SetPos(XMFLOAT2(x, y += step));
sph_e_Slider->OnSlide([&](wiEventArgs args) {
auto emitter = GetEmitter();
diff --git a/Editor/EnvProbeWindow.cpp b/Editor/EnvProbeWindow.cpp
index cbb0bae1b..d79ed1de9 100644
--- a/Editor/EnvProbeWindow.cpp
+++ b/Editor/EnvProbeWindow.cpp
@@ -10,10 +10,10 @@ EnvProbeWindow::EnvProbeWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
assert(GUI && "Invalid GUI!");
envProbeWindow = new wiWindow(GUI, "Environment Probe Window");
- envProbeWindow->SetSize(XMFLOAT2(600, 400));
+ envProbeWindow->SetSize(XMFLOAT2(300, 200));
GUI->AddWidget(envProbeWindow);
- float x = 250, y = 0, step = 45;
+ float x = 100, y = 5, step = 35;
realTimeCheckBox = new wiCheckBox("RealTime: ");
realTimeCheckBox->SetPos(XMFLOAT2(x, y += step));
@@ -68,7 +68,7 @@ EnvProbeWindow::EnvProbeWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
- envProbeWindow->Translate(XMFLOAT3(30, 30, 0));
+ envProbeWindow->Translate(XMFLOAT3(100, 100, 0));
envProbeWindow->SetVisible(false);
SetEntity(INVALID_ENTITY);
diff --git a/Editor/PaintToolWindow.cpp b/Editor/PaintToolWindow.cpp
index 763531392..6905b0e3c 100644
--- a/Editor/PaintToolWindow.cpp
+++ b/Editor/PaintToolWindow.cpp
@@ -16,7 +16,7 @@ PaintToolWindow::PaintToolWindow(EditorComponent* editor) : editor(editor)
editor->GetGUI().AddWidget(window);
float x = 100;
- float y = 10;
+ float y = 5;
float step = 30;
modeComboBox = new wiComboBox("Mode: ");
diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp
index 02fed2305..2df261cb3 100644
--- a/Editor/PostprocessWindow.cpp
+++ b/Editor/PostprocessWindow.cpp
@@ -13,12 +13,12 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get
assert(GUI && "Invalid GUI!");
ppWindow = new wiWindow(GUI, "PostProcess Window");
- ppWindow->SetSize(XMFLOAT2(400, 700));
+ ppWindow->SetSize(XMFLOAT2(400, 550));
GUI->AddWidget(ppWindow);
float x = 150;
- float y = 10;
- float step = 30;
+ float y = 5;
+ float step = 25;
exposureSlider = new wiSlider(0.0f, 3.0f, 1, 10000, "Exposure: ");
exposureSlider->SetTooltip("Set the tonemap exposure value");
@@ -326,7 +326,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get
ppWindow->AddWidget(chromaticaberrationSlider);
- ppWindow->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 550, 50, 0));
+ ppWindow->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 500, 80, 0));
ppWindow->SetVisible(false);
}
diff --git a/Editor/RendererWindow.cpp b/Editor/RendererWindow.cpp
index ccd27e573..84029ed4f 100644
--- a/Editor/RendererWindow.cpp
+++ b/Editor/RendererWindow.cpp
@@ -16,12 +16,13 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
rendererWindow->SetSize(XMFLOAT2(640, 700));
GUI->AddWidget(rendererWindow);
- float x = 260, y = 0, step = 28, sliderheight = 26;
+ float x = 220, y = 5, step = 28, itemheight = 26;
vsyncCheckBox = new wiCheckBox("VSync: ");
vsyncCheckBox->SetTooltip("Toggle vertical sync");
vsyncCheckBox->SetScriptTip("SetVSyncEnabled(opt bool enabled)");
vsyncCheckBox->SetPos(XMFLOAT2(x, y += step));
+ vsyncCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
vsyncCheckBox->OnClick([](wiEventArgs args) {
wiRenderer::GetDevice()->SetVSyncEnabled(args.bValue);
});
@@ -32,6 +33,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
occlusionCullingCheckBox->SetTooltip("Toggle occlusion culling. This can boost framerate if many objects are occluded in the scene.");
occlusionCullingCheckBox->SetScriptTip("SetOcclusionCullingEnabled(bool enabled)");
occlusionCullingCheckBox->SetPos(XMFLOAT2(x, y += step));
+ occlusionCullingCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
occlusionCullingCheckBox->OnClick([](wiEventArgs args) {
wiRenderer::SetOcclusionCullingEnabled(args.bValue);
});
@@ -40,7 +42,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
resolutionScaleSlider = new wiSlider(0.25f, 2.0f, 1.0f, 7.0f, "Resolution Scale: ");
resolutionScaleSlider->SetTooltip("Adjust the internal rendering resolution.");
- resolutionScaleSlider->SetSize(XMFLOAT2(100, sliderheight));
+ resolutionScaleSlider->SetSize(XMFLOAT2(100, itemheight));
resolutionScaleSlider->SetPos(XMFLOAT2(x, y += step));
resolutionScaleSlider->SetValue(wiRenderer::GetResolutionScale());
resolutionScaleSlider->OnSlide([&](wiEventArgs args) {
@@ -50,7 +52,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
gammaSlider = new wiSlider(1.0f, 3.0f, 2.2f, 1000.0f, "Gamma: ");
gammaSlider->SetTooltip("Adjust the gamma correction for the display device.");
- gammaSlider->SetSize(XMFLOAT2(100, sliderheight));
+ gammaSlider->SetSize(XMFLOAT2(100, itemheight));
gammaSlider->SetPos(XMFLOAT2(x, y += step));
gammaSlider->SetValue(wiRenderer::GetGamma());
gammaSlider->OnSlide([&](wiEventArgs args) {
@@ -61,6 +63,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceCheckBox = new wiCheckBox("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);
});
@@ -70,6 +73,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceDebugCheckBox = new wiCheckBox("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);
});
@@ -79,6 +83,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceSecondaryBounceCheckBox = new wiCheckBox("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);
});
@@ -88,6 +93,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceReflectionsCheckBox = new wiCheckBox("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);
});
@@ -96,7 +102,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceVoxelSizeSlider = new wiSlider(0.25, 2, 1, 7, "Voxel GI Voxel Size: ");
voxelRadianceVoxelSizeSlider->SetTooltip("Adjust the voxel size for Voxel GI calculations.");
- voxelRadianceVoxelSizeSlider->SetSize(XMFLOAT2(100, sliderheight));
+ voxelRadianceVoxelSizeSlider->SetSize(XMFLOAT2(100, itemheight));
voxelRadianceVoxelSizeSlider->SetPos(XMFLOAT2(x, y += step));
voxelRadianceVoxelSizeSlider->SetValue(wiRenderer::GetVoxelRadianceVoxelSize());
voxelRadianceVoxelSizeSlider->OnSlide([&](wiEventArgs args) {
@@ -106,7 +112,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceConeTracingSlider = new wiSlider(1, 16, 8, 15, "Voxel GI NumCones: ");
voxelRadianceConeTracingSlider->SetTooltip("Adjust the number of cones sampled in the radiance gathering phase.");
- voxelRadianceConeTracingSlider->SetSize(XMFLOAT2(100, sliderheight));
+ voxelRadianceConeTracingSlider->SetSize(XMFLOAT2(100, itemheight));
voxelRadianceConeTracingSlider->SetPos(XMFLOAT2(x, y += step));
voxelRadianceConeTracingSlider->SetValue((float)wiRenderer::GetVoxelRadianceNumCones());
voxelRadianceConeTracingSlider->OnSlide([&](wiEventArgs args) {
@@ -116,7 +122,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceRayStepSizeSlider = new wiSlider(0.5f, 2.0f, 0.5f, 10000, "Voxel GI Ray Step Size: ");
voxelRadianceRayStepSizeSlider->SetTooltip("Adjust the precision of ray marching for cone tracing step. Lower values = more precision but slower performance.");
- voxelRadianceRayStepSizeSlider->SetSize(XMFLOAT2(100, sliderheight));
+ voxelRadianceRayStepSizeSlider->SetSize(XMFLOAT2(100, itemheight));
voxelRadianceRayStepSizeSlider->SetPos(XMFLOAT2(x, y += step));
voxelRadianceRayStepSizeSlider->SetValue(wiRenderer::GetVoxelRadianceRayStepSize());
voxelRadianceRayStepSizeSlider->OnSlide([&](wiEventArgs args) {
@@ -126,7 +132,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
voxelRadianceMaxDistanceSlider = new wiSlider(0, 100, 10, 10000, "Voxel GI Max Distance: ");
voxelRadianceMaxDistanceSlider->SetTooltip("Adjust max raymarching distance for voxel GI.");
- voxelRadianceMaxDistanceSlider->SetSize(XMFLOAT2(100, sliderheight));
+ voxelRadianceMaxDistanceSlider->SetSize(XMFLOAT2(100, itemheight));
voxelRadianceMaxDistanceSlider->SetPos(XMFLOAT2(x, y += step));
voxelRadianceMaxDistanceSlider->SetValue(wiRenderer::GetVoxelRadianceMaxDistance());
voxelRadianceMaxDistanceSlider->OnSlide([&](wiEventArgs args) {
@@ -137,6 +143,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
wireFrameCheckBox = new wiCheckBox("Render Wireframe: ");
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);
});
@@ -146,6 +153,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
advancedLightCullingCheckBox = new wiCheckBox("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);
});
@@ -155,6 +163,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
debugLightCullingCheckBox = new wiCheckBox("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);
});
@@ -164,6 +173,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
tessellationCheckBox = new wiCheckBox("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) {
editor->renderPath->setTessellationEnabled(args.bValue);
});
@@ -174,6 +184,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
alphaCompositionCheckBox = new wiCheckBox("Alpha Composition: ");
alphaCompositionCheckBox->SetTooltip("Enable Alpha Composition. Enables softer alpha blending on partly solid geometry (eg. vegetation) but rendering performance will be slower.");
alphaCompositionCheckBox->SetPos(XMFLOAT2(x, y += step));
+ alphaCompositionCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
alphaCompositionCheckBox->OnClick([=](wiEventArgs args) {
wiRenderer::SetAlphaCompositionEnabled(args.bValue);
});
@@ -182,7 +193,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
speedMultiplierSlider = new wiSlider(0, 4, 1, 100000, "Speed: ");
speedMultiplierSlider->SetTooltip("Adjust the global speed (time multiplier)");
- speedMultiplierSlider->SetSize(XMFLOAT2(100, sliderheight));
+ speedMultiplierSlider->SetSize(XMFLOAT2(100, itemheight));
speedMultiplierSlider->SetPos(XMFLOAT2(x, y += step));
speedMultiplierSlider->SetValue(wiRenderer::GetGameSpeed());
speedMultiplierSlider->OnSlide([&](wiEventArgs args) {
@@ -193,6 +204,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
transparentShadowsCheckBox = new wiCheckBox("Transparent Shadows: ");
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);
@@ -200,7 +212,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
rendererWindow->AddWidget(transparentShadowsCheckBox);
shadowProps2DComboBox = new wiComboBox("2D Shadowmap resolution: ");
- shadowProps2DComboBox->SetSize(XMFLOAT2(100, 20));
+ shadowProps2DComboBox->SetSize(XMFLOAT2(100, itemheight));
shadowProps2DComboBox->SetPos(XMFLOAT2(x, y += step));
shadowProps2DComboBox->AddItem("Off");
shadowProps2DComboBox->AddItem("128");
@@ -245,7 +257,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
rendererWindow->AddWidget(shadowProps2DComboBox);
shadowPropsCubeComboBox = new wiComboBox("Cube Shadowmap resolution: ");
- shadowPropsCubeComboBox->SetSize(XMFLOAT2(100, 20));
+ shadowPropsCubeComboBox->SetSize(XMFLOAT2(100, itemheight));
shadowPropsCubeComboBox->SetPos(XMFLOAT2(x, y += step));
shadowPropsCubeComboBox->AddItem("Off");
shadowPropsCubeComboBox->AddItem("128");
@@ -289,7 +301,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
rendererWindow->AddWidget(shadowPropsCubeComboBox);
MSAAComboBox = new wiComboBox("MSAA: ");
- MSAAComboBox->SetSize(XMFLOAT2(100, 20));
+ MSAAComboBox->SetSize(XMFLOAT2(100, itemheight));
MSAAComboBox->SetPos(XMFLOAT2(x, y += step));
MSAAComboBox->AddItem("Off");
MSAAComboBox->AddItem("2");
@@ -323,6 +335,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
temporalAACheckBox = new wiCheckBox("Temporal AA: ");
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);
});
@@ -333,6 +346,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
temporalAADebugCheckBox->SetText("DEBUG: ");
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);
});
@@ -340,7 +354,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
rendererWindow->AddWidget(temporalAADebugCheckBox);
textureQualityComboBox = new wiComboBox("Texture Quality: ");
- textureQualityComboBox->SetSize(XMFLOAT2(100, 20));
+ textureQualityComboBox->SetSize(XMFLOAT2(100, itemheight));
textureQualityComboBox->SetPos(XMFLOAT2(x, y += step));
textureQualityComboBox->AddItem("Nearest");
textureQualityComboBox->AddItem("Bilinear");
@@ -377,7 +391,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
mipLodBiasSlider = new wiSlider(-2, 2, 0, 100000, "MipLOD Bias: ");
mipLodBiasSlider->SetTooltip("Bias the rendered mip map level of the material textures.");
- mipLodBiasSlider->SetSize(XMFLOAT2(100, sliderheight));
+ mipLodBiasSlider->SetSize(XMFLOAT2(100, itemheight));
mipLodBiasSlider->SetPos(XMFLOAT2(x, y += step));
mipLodBiasSlider->OnSlide([&](wiEventArgs args) {
wiGraphics::SamplerDesc desc = wiRenderer::GetSampler(SSLOT_OBJECTSHADER)->GetDesc();
@@ -388,7 +402,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
raytraceBounceCountSlider = new wiSlider(1, 10, 1, 9, "Raytrace Bounces: ");
raytraceBounceCountSlider->SetTooltip("How many light bounces to compute when doing ray tracing.");
- raytraceBounceCountSlider->SetSize(XMFLOAT2(100, sliderheight));
+ raytraceBounceCountSlider->SetSize(XMFLOAT2(100, itemheight));
raytraceBounceCountSlider->SetPos(XMFLOAT2(x, y += step));
raytraceBounceCountSlider->SetValue((float)wiRenderer::GetRaytraceBounceCount());
raytraceBounceCountSlider->OnSlide([&](wiEventArgs args) {
@@ -399,12 +413,13 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
// Visualizer toggles:
- x = 600, y = 0;
+ x = 540, y = 5;
partitionBoxesCheckBox = new wiCheckBox("SPTree visualizer: ");
partitionBoxesCheckBox->SetTooltip("Visualize the world space partitioning tree as boxes");
partitionBoxesCheckBox->SetScriptTip("SetDebugPartitionTreeEnabled(bool enabled)");
partitionBoxesCheckBox->SetPos(XMFLOAT2(x, y += step));
+ partitionBoxesCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
partitionBoxesCheckBox->OnClick([](wiEventArgs args) {
wiRenderer::SetToDrawDebugPartitionTree(args.bValue);
});
@@ -416,6 +431,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
boneLinesCheckBox->SetTooltip("Visualize bones of armatures");
boneLinesCheckBox->SetScriptTip("SetDebugBonesEnabled(bool enabled)");
boneLinesCheckBox->SetPos(XMFLOAT2(x, y += step));
+ boneLinesCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
boneLinesCheckBox->OnClick([](wiEventArgs args) {
wiRenderer::SetToDrawDebugBoneLines(args.bValue);
});
@@ -426,6 +442,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
debugEmittersCheckBox->SetTooltip("Visualize emitters");
debugEmittersCheckBox->SetScriptTip("SetDebugEmittersEnabled(bool enabled)");
debugEmittersCheckBox->SetPos(XMFLOAT2(x, y += step));
+ debugEmittersCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
debugEmittersCheckBox->OnClick([](wiEventArgs args) {
wiRenderer::SetToDrawDebugEmitters(args.bValue);
});
@@ -436,6 +453,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
debugForceFieldsCheckBox->SetTooltip("Visualize force fields");
debugForceFieldsCheckBox->SetScriptTip("SetDebugForceFieldsEnabled(bool enabled)");
debugForceFieldsCheckBox->SetPos(XMFLOAT2(x, y += step));
+ debugForceFieldsCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
debugForceFieldsCheckBox->OnClick([](wiEventArgs args) {
wiRenderer::SetToDrawDebugForceFields(args.bValue);
});
@@ -445,6 +463,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
debugRaytraceBVHCheckBox = new wiCheckBox("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);
});
@@ -454,6 +473,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
envProbesCheckBox = new wiCheckBox("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);
});
@@ -463,6 +483,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
cameraVisCheckBox = new wiCheckBox("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);
});
@@ -472,6 +493,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
gridHelperCheckBox = new wiCheckBox("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);
});
@@ -482,60 +504,70 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
pickTypeObjectCheckBox = new wiCheckBox("Pick Objects: ");
pickTypeObjectCheckBox->SetTooltip("Enable if you want to pick objects with the pointer");
pickTypeObjectCheckBox->SetPos(XMFLOAT2(x, y += step * 2));
+ pickTypeObjectCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeObjectCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeObjectCheckBox);
pickTypeEnvProbeCheckBox = new wiCheckBox("Pick EnvProbes: ");
pickTypeEnvProbeCheckBox->SetTooltip("Enable if you want to pick environment probes with the pointer");
pickTypeEnvProbeCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeEnvProbeCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeEnvProbeCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeEnvProbeCheckBox);
pickTypeLightCheckBox = new wiCheckBox("Pick Lights: ");
pickTypeLightCheckBox->SetTooltip("Enable if you want to pick lights with the pointer");
pickTypeLightCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeLightCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeLightCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeLightCheckBox);
pickTypeDecalCheckBox = new wiCheckBox("Pick Decals: ");
pickTypeDecalCheckBox->SetTooltip("Enable if you want to pick decals with the pointer");
pickTypeDecalCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeDecalCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeDecalCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeDecalCheckBox);
pickTypeForceFieldCheckBox = new wiCheckBox("Pick Force Fields: ");
pickTypeForceFieldCheckBox->SetTooltip("Enable if you want to pick force fields with the pointer");
pickTypeForceFieldCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeForceFieldCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeForceFieldCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeForceFieldCheckBox);
pickTypeEmitterCheckBox = new wiCheckBox("Pick Emitters: ");
pickTypeEmitterCheckBox->SetTooltip("Enable if you want to pick emitters with the pointer");
pickTypeEmitterCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeEmitterCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeEmitterCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeEmitterCheckBox);
pickTypeHairCheckBox = new wiCheckBox("Pick Hairs: ");
pickTypeHairCheckBox->SetTooltip("Enable if you want to pick hairs with the pointer");
pickTypeHairCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeHairCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeHairCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeHairCheckBox);
pickTypeCameraCheckBox = new wiCheckBox("Pick Cameras: ");
pickTypeCameraCheckBox->SetTooltip("Enable if you want to pick cameras with the pointer");
pickTypeCameraCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeCameraCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeCameraCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeCameraCheckBox);
pickTypeArmatureCheckBox = new wiCheckBox("Pick Armatures: ");
pickTypeArmatureCheckBox->SetTooltip("Enable if you want to pick armatures with the pointer");
pickTypeArmatureCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeArmatureCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeArmatureCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeArmatureCheckBox);
pickTypeSoundCheckBox = new wiCheckBox("Pick Sounds: ");
pickTypeSoundCheckBox->SetTooltip("Enable if you want to pick sounds with the pointer");
pickTypeSoundCheckBox->SetPos(XMFLOAT2(x, y += step));
+ pickTypeSoundCheckBox->SetSize(XMFLOAT2(itemheight, itemheight));
pickTypeSoundCheckBox->SetCheck(true);
rendererWindow->AddWidget(pickTypeSoundCheckBox);
@@ -544,6 +576,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
freezeCullingCameraCheckBox = new wiCheckBox("Freeze culling camera: ");
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);
});
@@ -552,7 +585,7 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
- rendererWindow->Translate(XMFLOAT3(130, 20, 0));
+ rendererWindow->Translate(XMFLOAT3(100, 50, 0));
rendererWindow->SetVisible(false);
}
diff --git a/Tests/Tests.cpp b/Tests/Tests.cpp
index c0b89d7dd..55116a5ee 100644
--- a/Tests/Tests.cpp
+++ b/Tests/Tests.cpp
@@ -30,12 +30,13 @@ void TestsRenderer::Load()
setReflectionsEnabled(true);
setFXAAEnabled(false);
- float screenW = (float)wiRenderer::GetDevice()->GetScreenWidth();
- float screenH = (float)wiRenderer::GetDevice()->GetScreenHeight();
+ float screenW = wiRenderer::GetDevice()->GetScreenWidth();
+ float screenH = wiRenderer::GetDevice()->GetScreenHeight();
wiLabel* label = new wiLabel("Label1");
label->SetText("Wicked Engine Test Framework");
- label->SetSize(XMFLOAT2(200,15));
+ label->font.params.h_align = WIFALIGN_CENTER;
+ label->SetSize(XMFLOAT2(240,20));
label->SetPos(XMFLOAT2(screenW / 2.f - label->scale.x / 2.f, screenH*0.95f));
GetGUI().AddWidget(label);
@@ -45,7 +46,7 @@ void TestsRenderer::Load()
wiButton* audioTest = new wiButton("AudioTest");
audioTest->SetText("Play Test Audio");
audioTest->SetSize(XMFLOAT2(200, 20));
- audioTest->SetPos(XMFLOAT2(10, 80));
+ 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) {
@@ -76,7 +77,7 @@ void TestsRenderer::Load()
wiSlider* volume = new wiSlider(0, 100, 50, 100, "Volume");
volume->SetText("Volume: ");
volume->SetSize(XMFLOAT2(100, 20));
- volume->SetPos(XMFLOAT2(65, 110));
+ 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);
@@ -90,7 +91,7 @@ void TestsRenderer::Load()
testSelector = new wiComboBox("TestSelector");
testSelector->SetText("Demo: ");
testSelector->SetSize(XMFLOAT2(140, 20));
- testSelector->SetPos(XMFLOAT2(50, 140));
+ 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->AddItem("HelloWorld");
@@ -139,7 +140,7 @@ void TestsRenderer::Load()
// This will spawn a sprite with two textures. The first texture is a color texture and it will be animated.
// 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
+ // You can learn more in the Sprite test in RunSpriteTest() function
static wiSprite sprite;
sprite = wiSprite("images/movingtex.png", "images/HelloWorld.png");
sprite.params.pos = XMFLOAT3(screenW / 2, screenH / 2, 0);
@@ -211,8 +212,8 @@ void TestsRenderer::Load()
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_CENTER;
font.params.size = 20;
- font.params.posX = (int)screenW / 2;
- font.params.posY = (int)screenH / 2;
+ font.params.posX = screenW / 2;
+ font.params.posY = screenH / 2;
AddFont(&font);
wiInput::ControllerFeedback feedback;
@@ -414,8 +415,8 @@ void TestsRenderer::RunFontTest()
font.SetText("This is Arial, size 32 wiFont");
font_upscaled.SetText("This is Arial, size 14 wiFont, but upscaled to 32");
- font.params.posX = wiRenderer::GetDevice()->GetScreenWidth() / 2;
- font.params.posY = wiRenderer::GetDevice()->GetScreenHeight() / 6;
+ font.params.posX = wiRenderer::GetDevice()->GetScreenWidth() / 2.0f;
+ font.params.posY = wiRenderer::GetDevice()->GetScreenHeight() / 6.0f;
font.params.size = 32;
font_upscaled.params = font.params;
@@ -480,7 +481,9 @@ void TestsRenderer::RunFontTest()
void TestsRenderer::RunSpriteTest()
{
const float step = 30;
- const XMFLOAT3 startPos = XMFLOAT3(wiRenderer::GetDevice()->GetScreenWidth() * 0.3f, wiRenderer::GetDevice()->GetScreenHeight() * 0.2f, 0);
+ const float screenW = wiRenderer::GetDevice()->GetScreenWidth();
+ const float screenH = wiRenderer::GetDevice()->GetScreenHeight();
+ const XMFLOAT3 startPos = XMFLOAT3(screenW * 0.3f, screenH * 0.2f, 0);
wiImageParams params;
params.pos = startPos;
params.siz = XMFLOAT2(128, 128);
@@ -493,7 +496,7 @@ void TestsRenderer::RunSpriteTest()
{
static wiSpriteFont font("For more information, please see \nTests.cpp, RunSpriteTest() function.");
font.params.posX = 10;
- font.params.posY = 200;
+ font.params.posY = screenH / 2;
AddFont(&font);
}
@@ -506,8 +509,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("No animation: ");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -525,8 +528,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("Fade animation: ");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -544,8 +547,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("Wobble animation: ");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -563,8 +566,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("Rotate animation: ");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -586,8 +589,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("MovingTex + mask: ");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x = startPos.x;
@@ -606,8 +609,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("Spritesheet: \n(without animation)");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -627,8 +630,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("single line anim: \n(4 frames)");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -649,8 +652,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("single line: \n(4 vertical frames)");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -671,8 +674,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("multiline: \n(all 16 frames)");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x += sprite.params.siz.x + step;
@@ -693,8 +696,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("irregular multiline: \n(14 frames)");
font.params.h_align = WIFALIGN_CENTER;
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ font.params.posX = sprite.params.pos.x;
+ font.params.posY = sprite.params.pos.y - sprite.params.siz.y * 0.5f;
AddFont(&font);
params.pos.x = startPos.x;
@@ -719,8 +722,8 @@ void TestsRenderer::RunSpriteTest()
static wiSpriteFont font("For the following spritesheets, credits belong to: https://mrbubblewand.wordpress.com/download/");
font.params.v_align = WIFALIGN_BOTTOM;
- font.params.posX = int(sprite.params.pos.x - sprite.params.siz.x * 0.5f);
- font.params.posY = int(sprite.params.pos.y - sprite.params.siz.y * 0.5f);
+ 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);
params.pos.x += sprite.params.siz.x + step;
diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp
index b1f6609ca..7a1b7ab17 100644
--- a/WickedEngine/MainComponent.cpp
+++ b/WickedEngine/MainComponent.cpp
@@ -286,7 +286,7 @@ void MainComponent::Compose(CommandList cmd)
}
if (infoDisplay.resolution)
{
- ss << "Resolution: " << wiRenderer::GetDevice()->GetScreenWidth() << " x " << wiRenderer::GetDevice()->GetScreenHeight() << endl;
+ ss << "Resolution: " << wiRenderer::GetDevice()->GetResolutionWidth() << " x " << wiRenderer::GetDevice()->GetResolutionHeight() << " (" << wiPlatform::GetDPI() << " dpi)" << endl;
}
if (infoDisplay.fpsinfo)
{
@@ -320,7 +320,7 @@ void MainComponent::Compose(CommandList cmd)
}
ss.precision(2);
- wiFont::Draw(ss.str(), wiFontParams(4, 4, infoDisplay.size, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255,255,255,255), wiColor(0,0,0,255)), cmd);
+ wiFont::Draw(ss.str(), wiFontParams(4, 4, infoDisplay.size, WIFALIGN_LEFT, WIFALIGN_TOP, wiColor(255,255,255,255), wiColor(0,0,0,255)), cmd);
}
wiProfiler::DrawData(4, 120, cmd);
diff --git a/WickedEngine/RenderPath2D.cpp b/WickedEngine/RenderPath2D.cpp
index 713a6ec28..f425d2e39 100644
--- a/WickedEngine/RenderPath2D.cpp
+++ b/WickedEngine/RenderPath2D.cpp
@@ -34,8 +34,8 @@ void RenderPath2D::ResizeBuffers()
TextureDesc desc;
desc.BindFlags = BIND_RENDER_TARGET | BIND_SHADER_RESOURCE;
desc.Format = defaultTextureFormat;
- desc.Width = device->GetScreenWidth();
- desc.Height = device->GetScreenHeight();
+ desc.Width = device->GetResolutionWidth();
+ desc.Height = device->GetResolutionHeight();
device->CreateTexture(&desc, nullptr, &rtFinal);
device->SetName(&rtFinal, "rtFinal");
}
diff --git a/WickedEngine/RenderPath3D.cpp b/WickedEngine/RenderPath3D.cpp
index 31c75c214..19a9dac63 100644
--- a/WickedEngine/RenderPath3D.cpp
+++ b/WickedEngine/RenderPath3D.cpp
@@ -787,7 +787,7 @@ void RenderPath3D::RenderPostprocessChain(const Texture& srcSceneRT, const Textu
device->EventBegin("GUI Background Blur", cmd);
wiRenderer::Postprocess_Downsample4x(*rt_read, rtGUIBlurredBackground[0], cmd);
wiRenderer::Postprocess_Downsample4x(rtGUIBlurredBackground[0], rtGUIBlurredBackground[2], cmd);
- wiRenderer::Postprocess_Blur_Gaussian(rtGUIBlurredBackground[2], rtGUIBlurredBackground[1], rtGUIBlurredBackground[2], cmd);
+ wiRenderer::Postprocess_Blur_Gaussian(rtGUIBlurredBackground[2], rtGUIBlurredBackground[1], rtGUIBlurredBackground[2], cmd, -1,-1, true);
device->EventEnd(cmd);
wiProfiler::EndRange(range);
}
diff --git a/WickedEngine/ShaderInterop_Image.h b/WickedEngine/ShaderInterop_Image.h
index 3d18d32e3..8136282ed 100644
--- a/WickedEngine/ShaderInterop_Image.h
+++ b/WickedEngine/ShaderInterop_Image.h
@@ -8,11 +8,6 @@ CBUFFER(ImageCB, CBSLOT_IMAGE)
float4 xTexMulAdd;
float4 xTexMulAdd2;
float4 xColor;
-
- uint xMirror;
- float xMipLevel;
- float xMipLevel_Background;
- float padding_ImageCB;
};
diff --git a/WickedEngine/WickedEngine_SHADERS.vcxproj b/WickedEngine/WickedEngine_SHADERS.vcxproj
index 44c2150c5..433660ffc 100644
--- a/WickedEngine/WickedEngine_SHADERS.vcxproj
+++ b/WickedEngine/WickedEngine_SHADERS.vcxproj
@@ -261,35 +261,27 @@
Compute
5.0
-
+
Compute
5.0
-
+
Compute
5.0
-
+
Compute
5.0
-
+
Compute
5.0
-
+
Compute
5.0
-
- Compute
- 5.0
-
-
- Compute
- 5.0
-
-
+
Compute
5.0
@@ -385,11 +377,11 @@
Compute
-
+
Compute
5.0
-
+
Compute
5.0
@@ -413,23 +405,9 @@
Pixel
-
- Pixel
-
Pixel
-
- Pixel
-
-
- Pixel
- 5.0
-
-
- Pixel
- 5.0
-
Pixel
5.0
@@ -855,10 +833,6 @@
Pixel
-
- Pixel
- 5.0
-
Vertex
diff --git a/WickedEngine/WickedEngine_SHADERS.vcxproj.filters b/WickedEngine/WickedEngine_SHADERS.vcxproj.filters
index b626677ff..1c39b2785 100644
--- a/WickedEngine/WickedEngine_SHADERS.vcxproj.filters
+++ b/WickedEngine/WickedEngine_SHADERS.vcxproj.filters
@@ -600,30 +600,6 @@
CS
-
- CS
-
-
- CS
-
-
- CS
-
-
- CS
-
-
- CS
-
-
- CS
-
-
- CS
-
-
- CS
-
CS
@@ -669,30 +645,15 @@
CS
-
- CS
-
-
- CS
-
PS
PS
-
- PS
-
-
- PS
-
PS
-
- PS
-
PS
@@ -954,9 +915,6 @@
PS
-
- PS
-
CS
@@ -966,15 +924,36 @@
PS
-
- PS
-
CS
PS
+
+ CS
+
+
+ CS
+
+
+ CS
+
+
+ CS
+
+
+ CS
+
+
+ CS
+
+
+ CS
+
+
+ CS
+
diff --git a/WickedEngine/fontVS.hlsl b/WickedEngine/fontVS.hlsl
index adb110fed..88740cfd2 100644
--- a/WickedEngine/fontVS.hlsl
+++ b/WickedEngine/fontVS.hlsl
@@ -7,11 +7,11 @@ struct VertextoPixel
float2 tex : TEXCOORD0;
};
-VertextoPixel main(int2 inPos : POSITION, float2 inTex : TEXCOORD0)
+VertextoPixel main(float2 inPos : POSITION, float2 inTex : TEXCOORD0)
{
VertextoPixel Out;
- Out.pos = mul(g_xFont_Transform, float4(float2(inPos), 0, 1));
+ Out.pos = mul(g_xFont_Transform, float4(inPos, 0, 1));
Out.tex = inTex;
diff --git a/WickedEngine/generateMIPChain2D_float4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChain2DCS_float4.hlsl
similarity index 100%
rename from WickedEngine/generateMIPChain2D_float4_SimpleFilterCS.hlsl
rename to WickedEngine/generateMIPChain2DCS_float4.hlsl
diff --git a/WickedEngine/generateMIPChain2DCS_unorm4.hlsl b/WickedEngine/generateMIPChain2DCS_unorm4.hlsl
new file mode 100644
index 000000000..d73cbbc9e
--- /dev/null
+++ b/WickedEngine/generateMIPChain2DCS_unorm4.hlsl
@@ -0,0 +1,4 @@
+#define MIP_OUTPUT_FORMAT unorm float4
+
+#include "generateMIPChain2DCS_float4.hlsl"
+
diff --git a/WickedEngine/generateMIPChain2D_float4_BicubicCS.hlsl b/WickedEngine/generateMIPChain2D_float4_BicubicCS.hlsl
deleted file mode 100644
index 1bf5e45fc..000000000
--- a/WickedEngine/generateMIPChain2D_float4_BicubicCS.hlsl
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "globals.hlsli"
-#include "ShaderInterop_Utility.h"
-
-#ifndef MIP_OUTPUT_FORMAT
-#define MIP_OUTPUT_FORMAT float4
-#endif
-
-TEXTURE2D(input, float4, TEXSLOT_UNIQUE0);
-RWTEXTURE2D(output, MIP_OUTPUT_FORMAT, 0);
-
-[numthreads(GENERATEMIPCHAIN_2D_BLOCK_SIZE, GENERATEMIPCHAIN_2D_BLOCK_SIZE, 1)]
-void main(uint3 DTid : SV_DispatchThreadID)
-{
- if (DTid.x < outputResolution.x && DTid.y < outputResolution.y)
- {
- output[DTid.xy] = SampleTextureCatmullRom(input, ((float2)DTid.xy + 0.5f) * (float2)outputResolution_rcp.xy);
- }
-}
\ No newline at end of file
diff --git a/WickedEngine/generateMIPChain2D_unorm4_BicubicCS.hlsl b/WickedEngine/generateMIPChain2D_unorm4_BicubicCS.hlsl
deleted file mode 100644
index a21b61f6c..000000000
--- a/WickedEngine/generateMIPChain2D_unorm4_BicubicCS.hlsl
+++ /dev/null
@@ -1,3 +0,0 @@
-#define MIP_OUTPUT_FORMAT unorm float4
-
-#include "generateMIPChain2D_float4_BicubicCS.hlsl"
diff --git a/WickedEngine/generateMIPChain2D_unorm4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChain2D_unorm4_SimpleFilterCS.hlsl
deleted file mode 100644
index 578ad9692..000000000
--- a/WickedEngine/generateMIPChain2D_unorm4_SimpleFilterCS.hlsl
+++ /dev/null
@@ -1,4 +0,0 @@
-#define MIP_OUTPUT_FORMAT unorm float4
-
-#include "generateMIPChain2D_float4_SimpleFilterCS.hlsl"
-
diff --git a/WickedEngine/generateMIPChain3D_float4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChain3DCS_float4.hlsl
similarity index 100%
rename from WickedEngine/generateMIPChain3D_float4_SimpleFilterCS.hlsl
rename to WickedEngine/generateMIPChain3DCS_float4.hlsl
diff --git a/WickedEngine/generateMIPChain3DCS_unorm4.hlsl b/WickedEngine/generateMIPChain3DCS_unorm4.hlsl
new file mode 100644
index 000000000..44f05cd97
--- /dev/null
+++ b/WickedEngine/generateMIPChain3DCS_unorm4.hlsl
@@ -0,0 +1,4 @@
+#define MIP_OUTPUT_FORMAT unorm float4
+
+#include "generateMIPChain3DCS_float4.hlsl"
+
diff --git a/WickedEngine/generateMIPChain3D_unorm4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChain3D_unorm4_SimpleFilterCS.hlsl
deleted file mode 100644
index 489fbe53e..000000000
--- a/WickedEngine/generateMIPChain3D_unorm4_SimpleFilterCS.hlsl
+++ /dev/null
@@ -1,4 +0,0 @@
-#define MIP_OUTPUT_FORMAT unorm float4
-
-#include "generateMIPChain3D_float4_SimpleFilterCS.hlsl"
-
diff --git a/WickedEngine/generateMIPChainCubeArray_float4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChainCubeArrayCS_float4.hlsl
similarity index 100%
rename from WickedEngine/generateMIPChainCubeArray_float4_SimpleFilterCS.hlsl
rename to WickedEngine/generateMIPChainCubeArrayCS_float4.hlsl
diff --git a/WickedEngine/generateMIPChainCubeArrayCS_unorm4.hlsl b/WickedEngine/generateMIPChainCubeArrayCS_unorm4.hlsl
new file mode 100644
index 000000000..9c2b8d9a9
--- /dev/null
+++ b/WickedEngine/generateMIPChainCubeArrayCS_unorm4.hlsl
@@ -0,0 +1,4 @@
+#define MIP_OUTPUT_FORMAT unorm float4
+
+#include "generateMIPChainCubeArrayCS_float4.hlsl"
+
diff --git a/WickedEngine/generateMIPChainCubeArray_unorm4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChainCubeArray_unorm4_SimpleFilterCS.hlsl
deleted file mode 100644
index 433bed8d4..000000000
--- a/WickedEngine/generateMIPChainCubeArray_unorm4_SimpleFilterCS.hlsl
+++ /dev/null
@@ -1,4 +0,0 @@
-#define MIP_OUTPUT_FORMAT unorm float4
-
-#include "generateMIPChainCubeArray_float4_SimpleFilterCS.hlsl"
-
diff --git a/WickedEngine/generateMIPChainCube_float4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChainCubeCS_float4.hlsl
similarity index 100%
rename from WickedEngine/generateMIPChainCube_float4_SimpleFilterCS.hlsl
rename to WickedEngine/generateMIPChainCubeCS_float4.hlsl
diff --git a/WickedEngine/generateMIPChainCubeCS_unorm4.hlsl b/WickedEngine/generateMIPChainCubeCS_unorm4.hlsl
new file mode 100644
index 000000000..c8f1067e8
--- /dev/null
+++ b/WickedEngine/generateMIPChainCubeCS_unorm4.hlsl
@@ -0,0 +1,4 @@
+#define MIP_OUTPUT_FORMAT unorm float4
+
+#include "generateMIPChainCubeCS_float4.hlsl"
+
diff --git a/WickedEngine/generateMIPChainCube_unorm4_SimpleFilterCS.hlsl b/WickedEngine/generateMIPChainCube_unorm4_SimpleFilterCS.hlsl
deleted file mode 100644
index b5d66d737..000000000
--- a/WickedEngine/generateMIPChainCube_unorm4_SimpleFilterCS.hlsl
+++ /dev/null
@@ -1,4 +0,0 @@
-#define MIP_OUTPUT_FORMAT unorm float4
-
-#include "generateMIPChainCube_float4_SimpleFilterCS.hlsl"
-
diff --git a/WickedEngine/globals.hlsli b/WickedEngine/globals.hlsli
index f4303fa19..5fa940920 100644
--- a/WickedEngine/globals.hlsli
+++ b/WickedEngine/globals.hlsli
@@ -362,7 +362,7 @@ inline float3 UV_to_CubeMap(in float2 uv, in uint faceIndex)
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16. ( https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1#file-tex2dcatmullrom-hlsl )
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
-float4 SampleTextureCatmullRom(in Texture2D tex, in float2 uv, in float mipLevel = 0)
+float4 SampleTextureCatmullRom(in Texture2D tex, in SamplerState linearSampler, in float2 uv)
{
float2 texSize;
tex.GetDimensions(texSize.x, texSize.y);
@@ -400,17 +400,17 @@ float4 SampleTextureCatmullRom(in Texture2D tex, in float2 uv, in float
texPos12 /= texSize;
float4 result = 0.0f;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos0.x, texPos0.y), mipLevel) * w0.x * w0.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos12.x, texPos0.y), mipLevel) * w12.x * w0.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos3.x, texPos0.y), mipLevel) * w3.x * w0.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos0.x, texPos0.y), 0.0f) * w0.x * w0.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos12.x, texPos0.y), 0.0f) * w12.x * w0.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos3.x, texPos0.y), 0.0f) * w3.x * w0.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos0.x, texPos12.y), mipLevel) * w0.x * w12.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos12.x, texPos12.y), mipLevel) * w12.x * w12.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos3.x, texPos12.y), mipLevel) * w3.x * w12.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos0.x, texPos12.y), 0.0f) * w0.x * w12.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos12.x, texPos12.y), 0.0f) * w12.x * w12.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos3.x, texPos12.y), 0.0f) * w3.x * w12.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos0.x, texPos3.y), mipLevel) * w0.x * w3.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos12.x, texPos3.y), mipLevel) * w12.x * w3.y;
- result += tex.SampleLevel(sampler_linear_clamp, float2(texPos3.x, texPos3.y), mipLevel) * w3.x * w3.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos0.x, texPos3.y), 0.0f) * w0.x * w3.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos12.x, texPos3.y), 0.0f) * w12.x * w3.y;
+ result += tex.SampleLevel(linearSampler, float2(texPos3.x, texPos3.y), 0.0f) * w3.x * w3.y;
return result;
}
diff --git a/WickedEngine/imagePS.hlsl b/WickedEngine/imagePS.hlsl
index 94b5b11f7..1ac814624 100644
--- a/WickedEngine/imagePS.hlsl
+++ b/WickedEngine/imagePS.hlsl
@@ -2,7 +2,7 @@
float4 main(VertextoPixel input) : SV_TARGET
{
- float4 color = texture_base.SampleLevel(Sampler, input.uv0, xMipLevel) * xColor;
+ float4 color = texture_base.Sample(Sampler, input.uv0) * xColor;
return color;
}
\ No newline at end of file
diff --git a/WickedEngine/imagePS_backgroundblur.hlsl b/WickedEngine/imagePS_backgroundblur.hlsl
index d61ab0b19..008f5856b 100644
--- a/WickedEngine/imagePS_backgroundblur.hlsl
+++ b/WickedEngine/imagePS_backgroundblur.hlsl
@@ -2,8 +2,8 @@
float4 main(VertextoPixel input) : SV_TARGET
{
- float4 color = texture_base.SampleLevel(Sampler, input.uv0, xMipLevel) * xColor;
- float3 background = texture_background.SampleLevel(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w, xMipLevel_Background).rgb;
+ float4 color = texture_base.Sample(Sampler, input.uv0) * xColor;
+ float3 background = texture_background.Sample(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w).rgb;
return float4(lerp(background, color.rgb, color.a), 1);
}
diff --git a/WickedEngine/imagePS_backgroundblur_bicubic.hlsl b/WickedEngine/imagePS_backgroundblur_bicubic.hlsl
deleted file mode 100644
index 92dc388d0..000000000
--- a/WickedEngine/imagePS_backgroundblur_bicubic.hlsl
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "imageHF.hlsli"
-
-float4 main(VertextoPixel input) : SV_TARGET
-{
- float4 color = SampleTextureCatmullRom(texture_base, input.uv0, xMipLevel) * xColor;
- float3 background = texture_background.SampleLevel(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w, xMipLevel_Background).rgb;
-
- return float4(lerp(background, color.rgb, color.a), 1);
-}
diff --git a/WickedEngine/imagePS_backgroundblur_masked.hlsl b/WickedEngine/imagePS_backgroundblur_masked.hlsl
index 92177e57c..030df814d 100644
--- a/WickedEngine/imagePS_backgroundblur_masked.hlsl
+++ b/WickedEngine/imagePS_backgroundblur_masked.hlsl
@@ -2,9 +2,9 @@
float4 main(VertextoPixel input) : SV_TARGET
{
- float4 color = texture_base.SampleLevel(Sampler, input.uv0, xMipLevel) * xColor;
- float3 background = texture_background.SampleLevel(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w, xMipLevel_Background).rgb;
- float4 mask = texture_mask.SampleLevel(Sampler, input.uv1, xMipLevel);
+ float4 color = texture_base.Sample(Sampler, input.uv0) * xColor;
+ float3 background = texture_background.Sample(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w).rgb;
+ float4 mask = texture_mask.Sample(Sampler, input.uv1);
color *= mask;
return float4(lerp(background, color.rgb, color.a), mask.a);
diff --git a/WickedEngine/imagePS_backgroundblur_masked_bicubic.hlsl b/WickedEngine/imagePS_backgroundblur_masked_bicubic.hlsl
deleted file mode 100644
index a7db7d95a..000000000
--- a/WickedEngine/imagePS_backgroundblur_masked_bicubic.hlsl
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "imageHF.hlsli"
-
-float4 main(VertextoPixel input) : SV_TARGET
-{
- float4 color = SampleTextureCatmullRom(texture_base, input.uv0, xMipLevel) * xColor;
- float3 background = texture_background.SampleLevel(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w, xMipLevel_Background).rgb;
- float4 mask = texture_mask.SampleLevel(Sampler, input.uv1, xMipLevel);
- color *= mask;
-
- return float4(lerp(background, color.rgb, color.a), mask.a);
-}
diff --git a/WickedEngine/imagePS_bicubic.hlsl b/WickedEngine/imagePS_bicubic.hlsl
deleted file mode 100644
index f47328e7d..000000000
--- a/WickedEngine/imagePS_bicubic.hlsl
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "imageHF.hlsli"
-
-float4 main(VertextoPixel input) : SV_TARGET
-{
- float4 color = SampleTextureCatmullRom(texture_base, input.uv0, xMipLevel) * xColor;
-
- return color;
-}
\ No newline at end of file
diff --git a/WickedEngine/imagePS_masked.hlsl b/WickedEngine/imagePS_masked.hlsl
index 81663bf30..a89ac6317 100644
--- a/WickedEngine/imagePS_masked.hlsl
+++ b/WickedEngine/imagePS_masked.hlsl
@@ -2,9 +2,9 @@
float4 main(VertextoPixel input) : SV_TARGET
{
- float4 color = texture_base.SampleLevel(Sampler, input.uv0, xMipLevel) * xColor;
+ float4 color = texture_base.Sample(Sampler, input.uv0) * xColor;
- color *= texture_mask.SampleLevel(Sampler, input.uv1, xMipLevel);
+ color *= texture_mask.Sample(Sampler, input.uv1);
return color;
}
\ No newline at end of file
diff --git a/WickedEngine/imagePS_masked_bicubic.hlsl b/WickedEngine/imagePS_masked_bicubic.hlsl
deleted file mode 100644
index dce87757b..000000000
--- a/WickedEngine/imagePS_masked_bicubic.hlsl
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "imageHF.hlsli"
-
-float4 main(VertextoPixel input) : SV_TARGET
-{
- float4 color = SampleTextureCatmullRom(texture_base, input.uv0, xMipLevel) * xColor;
-
- color *= texture_mask.SampleLevel(Sampler, input.uv1, xMipLevel);
-
- return color;
-}
\ No newline at end of file
diff --git a/WickedEngine/imagePS_separatenormalmap.hlsl b/WickedEngine/imagePS_separatenormalmap.hlsl
index cbc6fbdb6..1f6a1b47b 100644
--- a/WickedEngine/imagePS_separatenormalmap.hlsl
+++ b/WickedEngine/imagePS_separatenormalmap.hlsl
@@ -2,7 +2,7 @@
float4 main(VertextoPixel input) : SV_TARGET
{
- float4 color = texture_base.SampleLevel(Sampler, input.uv0, xMipLevel);
+ float4 color = texture_base.Sample(Sampler, input.uv0);
color = 2 * color - 1;
diff --git a/WickedEngine/imagePS_separatenormalmap_bicubic.hlsl b/WickedEngine/imagePS_separatenormalmap_bicubic.hlsl
index 20a646b8b..086bf5e55 100644
--- a/WickedEngine/imagePS_separatenormalmap_bicubic.hlsl
+++ b/WickedEngine/imagePS_separatenormalmap_bicubic.hlsl
@@ -2,7 +2,7 @@
float4 main(VertextoPixel input) : SV_TARGET
{
- float4 color = SampleTextureCatmullRom(texture_base, input.uv0, xMipLevel);
+ float4 color = SampleTextureCatmullRom(texture_base, Sampler, input.uv0);
color = 2 * color - 1;
diff --git a/WickedEngine/imageVS.hlsl b/WickedEngine/imageVS.hlsl
index 668074d68..26ff64809 100644
--- a/WickedEngine/imageVS.hlsl
+++ b/WickedEngine/imageVS.hlsl
@@ -14,7 +14,6 @@ VertextoPixel main(uint vI : SV_VERTEXID)
Out.pos = xCorners[vI];
Out.uv0 = float2(vI % 2, vI % 4 / 2);
- Out.uv0.x = xMirror == 1 ? (1 - Out.uv0.x) : Out.uv0.x;
Out.uv1 = Out.uv0;
Out.uv0 = Out.uv0 * xTexMulAdd.xy + xTexMulAdd.zw;
Out.uv1 = Out.uv1 * xTexMulAdd2.xy + xTexMulAdd2.zw;
diff --git a/WickedEngine/objectHF.hlsli b/WickedEngine/objectHF.hlsli
index 615a1a2a2..dd6052fa1 100644
--- a/WickedEngine/objectHF.hlsli
+++ b/WickedEngine/objectHF.hlsli
@@ -135,7 +135,7 @@ inline void LightMapping(in float2 ATLAS, inout Lighting lighting)
if (any(ATLAS))
{
#ifdef LIGHTMAP_QUALITY_BICUBIC
- float4 lightmap = SampleTextureCatmullRom(texture_globallightmap, ATLAS);
+ float4 lightmap = SampleTextureCatmullRom(texture_globallightmap, sampler_linear_clamp, ATLAS);
#else
float4 lightmap = texture_globallightmap.SampleLevel(sampler_linear_clamp, ATLAS, 0);
#endif // LIGHTMAP_QUALITY_BICUBIC
diff --git a/WickedEngine/screenPS.hlsl b/WickedEngine/screenPS.hlsl
index e384d35ca..637979da4 100644
--- a/WickedEngine/screenPS.hlsl
+++ b/WickedEngine/screenPS.hlsl
@@ -2,5 +2,5 @@
float4 main(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_TARGET
{
- return texture_base.SampleLevel(Sampler, uv, xMipLevel) * xColor;
+ return texture_base.SampleLevel(Sampler, uv, 0) * xColor;
}
\ No newline at end of file
diff --git a/WickedEngine/screenPS_bicubic.hlsl b/WickedEngine/screenPS_bicubic.hlsl
deleted file mode 100644
index 8b17c9395..000000000
--- a/WickedEngine/screenPS_bicubic.hlsl
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "imageHF.hlsli"
-
-float4 main(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_TARGET
-{
- return SampleTextureCatmullRom(texture_base, uv, xMipLevel) * xColor;
-}
\ No newline at end of file
diff --git a/WickedEngine/wiBackLog.cpp b/WickedEngine/wiBackLog.cpp
index ce1479bc0..6f79d81e3 100644
--- a/WickedEngine/wiBackLog.cpp
+++ b/WickedEngine/wiBackLog.cpp
@@ -33,7 +33,7 @@ namespace wiBackLog
const float speed = 50.0f;
unsigned int deletefromline = 100;
float pos = -FLT_MAX;
- int scroll = 0;
+ float scroll = 0;
stringstream inputArea;
int historyPos = 0;
wiSpriteFont font;
@@ -97,7 +97,7 @@ namespace wiBackLog
wiImage::Draw(backgroundTex.get(), fx, cmd);
font.SetText(getText());
font.params.posX = 50;
- font.params.posY = (int)pos + (int)scroll;
+ font.params.posY = pos + scroll;
font.Draw(cmd);
wiFont::Draw(inputArea.str(), wiFontParams(10, wiRenderer::GetDevice()->GetScreenHeight() - 10, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_BOTTOM), cmd);
}
@@ -189,7 +189,7 @@ namespace wiBackLog
{
font.params.size = value;
}
- void setFontRowspacing(int value)
+ void setFontRowspacing(float value)
{
font.params.spacingY = value;
}
diff --git a/WickedEngine/wiBackLog.h b/WickedEngine/wiBackLog.h
index 1688b94e2..068e1959e 100644
--- a/WickedEngine/wiBackLog.h
+++ b/WickedEngine/wiBackLog.h
@@ -27,5 +27,5 @@ namespace wiBackLog
void setBackground(wiGraphics::Texture* texture);
void setFontSize(int value);
- void setFontRowspacing(int value);
+ void setFontRowspacing(float value);
};
diff --git a/WickedEngine/wiBackLog_BindLua.cpp b/WickedEngine/wiBackLog_BindLua.cpp
index ee4e74acd..162de8cfc 100644
--- a/WickedEngine/wiBackLog_BindLua.cpp
+++ b/WickedEngine/wiBackLog_BindLua.cpp
@@ -52,7 +52,7 @@ namespace wiBackLog_BindLua
int argc = wiLua::SGetArgCount(L);
if (argc > 0)
{
- wiBackLog::setFontRowspacing(wiLua::SGetInt(L, 1));
+ wiBackLog::setFontRowspacing(wiLua::SGetFloat(L, 1));
}
else
wiLua::SError(L, "backlog_fontrowspacing(int val) not enough arguments!");
diff --git a/WickedEngine/wiEnums.h b/WickedEngine/wiEnums.h
index 78e492cc9..254082dc0 100644
--- a/WickedEngine/wiEnums.h
+++ b/WickedEngine/wiEnums.h
@@ -275,16 +275,14 @@ enum CSTYPES
CSTYPE_VOXELSCENECOPYCLEAR_TEMPORALSMOOTHING,
CSTYPE_VOXELRADIANCESECONDARYBOUNCE,
CSTYPE_VOXELCLEARONLYNORMAL,
- CSTYPE_GENERATEMIPCHAIN2D_UNORM4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAIN2D_UNORM4_BICUBIC,
- CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_BICUBIC,
- CSTYPE_GENERATEMIPCHAIN3D_UNORM4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAIN3D_FLOAT4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAINCUBE_UNORM4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4_SIMPLEFILTER,
- CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4_SIMPLEFILTER,
+ CSTYPE_GENERATEMIPCHAIN2D_UNORM4,
+ CSTYPE_GENERATEMIPCHAIN2D_FLOAT4,
+ CSTYPE_GENERATEMIPCHAIN3D_UNORM4,
+ CSTYPE_GENERATEMIPCHAIN3D_FLOAT4,
+ CSTYPE_GENERATEMIPCHAINCUBE_UNORM4,
+ CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4,
+ CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4,
+ CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4,
CSTYPE_FILTERENVMAP,
CSTYPE_COPYTEXTURE2D_UNORM4,
CSTYPE_COPYTEXTURE2D_FLOAT4,
diff --git a/WickedEngine/wiFont.cpp b/WickedEngine/wiFont.cpp
index 06031298f..fb168be57 100644
--- a/WickedEngine/wiFont.cpp
+++ b/WickedEngine/wiFont.cpp
@@ -8,6 +8,7 @@
#include "wiTextureHelper.h"
#include "wiRectPacker.h"
#include "wiSpinLock.h"
+#include "wiPlatform.h"
#include "Utility/stb_truetype.h"
@@ -24,9 +25,9 @@ using namespace wiGraphics;
using namespace wiRectPacker;
#define MAX_TEXT 10000
-#define WHITESPACE_SIZE (int((params.size + params.spacingX) * params.scaling * 0.3f))
+#define WHITESPACE_SIZE ((float(params.size) + params.spacingX) * params.scaling * 0.25f)
#define TAB_SIZE (WHITESPACE_SIZE * 4)
-#define LINEBREAK_SIZE (int((params.size + params.spacingY) * params.scaling))
+#define LINEBREAK_SIZE ((float(params.size) + params.spacingY) * params.scaling)
namespace wiFont_Internal
{
@@ -38,7 +39,7 @@ namespace wiFont_Internal
DepthStencilState depthStencilState;
Sampler sampler;
- InputLayout inputLayout;
+ InputLayout inputLayout;
Shader vertexShader;
Shader pixelShader;
PipelineState PSO;
@@ -49,10 +50,10 @@ namespace wiFont_Internal
struct Glyph
{
- int16_t x;
- int16_t y;
- int16_t width;
- int16_t height;
+ float x;
+ float y;
+ float width;
+ float height;
uint16_t tc_left;
uint16_t tc_right;
uint16_t tc_top;
@@ -77,6 +78,7 @@ namespace wiFont_Internal
vector fontBuffer;
stbtt_fontinfo fontInfo;
int ascent, descent, lineGap;
+ float fontScaling;
void Create(const string& newName)
{
name = newName;
@@ -98,7 +100,7 @@ namespace wiFont_Internal
struct FontVertex
{
- XMSHORT2 Pos;
+ XMFLOAT2 Pos;
XMHALF2 Tex;
};
@@ -106,18 +108,18 @@ namespace wiFont_Internal
uint32_t WriteVertices(volatile FontVertex* vertexList, const T* text, wiFontParams params)
{
uint32_t quadCount = 0;
- int16_t line = 0;
- int16_t pos = 0;
- int16_t pos_last_letter = 0;
+ float line = 0;
+ float pos = 0;
+ float pos_last_letter = 0;
size_t last_word_begin = 0;
- bool start_new_word = true;
+ bool start_new_word = false;
auto word_wrap = [&] {
start_new_word = true;
- if (params.h_wrap >= 0 && pos >= params.h_wrap - 1)
+ if (last_word_begin > 0 && params.h_wrap >= 0 && pos >= params.h_wrap - 1)
{
// Word ended and wrap detected, push down last word by one line:
- int16_t word_offset = vertexList[last_word_begin].Pos.x;
+ float word_offset = vertexList[last_word_begin].Pos.x;
for (size_t i = last_word_begin; i < quadCount * 4; ++i)
{
vertexList[i].Pos.x -= word_offset;
@@ -128,6 +130,7 @@ namespace wiFont_Internal
}
};
+ int code_prev = 0;
size_t i = 0;
while(text[i] != 0)
{
@@ -148,26 +151,29 @@ namespace wiFont_Internal
word_wrap();
line += LINEBREAK_SIZE;
pos = 0;
+ code_prev = 0;
}
else if (code == ' ')
{
word_wrap();
pos += WHITESPACE_SIZE;
start_new_word = true;
+ code_prev = 0;
}
else if (code == '\t')
{
word_wrap();
pos += TAB_SIZE;
start_new_word = true;
+ code_prev = 0;
}
else
{
const Glyph& glyph = glyph_lookup.at(hash);
- const int16_t glyphWidth = int16_t(glyph.width * params.scaling);
- const int16_t glyphHeight = int16_t(glyph.height * params.scaling);
- const int16_t glyphOffsetX = int16_t(glyph.x * params.scaling);
- const int16_t glyphOffsetY = int16_t(glyph.y * params.scaling);
+ const float glyphWidth = glyph.width * params.scaling;
+ const float glyphHeight = glyph.height * params.scaling;
+ const float glyphOffsetX = glyph.x * params.scaling;
+ const float glyphOffsetY = glyph.y * params.scaling;
const size_t vertexID = size_t(quadCount) * 4;
@@ -177,10 +183,18 @@ namespace wiFont_Internal
}
start_new_word = false;
- const int16_t left = pos + glyphOffsetX;
- const int16_t right = left + glyphWidth;
- const int16_t top = line + glyphOffsetY;
- const int16_t bottom = top + glyphHeight;
+ if (code_prev != 0)
+ {
+ const wiFontStyle& style = fontStyles[params.style];
+ int kern = stbtt_GetCodepointKernAdvance(&style.fontInfo, code_prev, code);
+ pos += kern * style.fontScaling;
+ }
+ code_prev = code;
+
+ const float left = pos + glyphOffsetX;
+ const float right = left + glyphWidth;
+ const float top = line + glyphOffsetY;
+ const float bottom = top + glyphHeight;
vertexList[vertexID + 0].Pos.x = left;
vertexList[vertexID + 0].Pos.y = top;
@@ -200,7 +214,7 @@ namespace wiFont_Internal
vertexList[vertexID + 3].Tex.x = glyph.tc_right;
vertexList[vertexID + 3].Tex.y = glyph.tc_bottom;
- pos += int16_t((glyph.width + params.spacingX) * params.scaling);
+ pos += glyph.width * params.scaling + params.spacingX;
pos_last_letter = pos;
quadCount++;
@@ -326,7 +340,7 @@ void LoadShaders()
InputLayoutDesc layout[] =
{
- { "POSITION", 0, FORMAT_R16G16_SINT, 0, InputLayoutDesc::APPEND_ALIGNED_ELEMENT, INPUT_PER_VERTEX_DATA, 0 },
+ { "POSITION", 0, FORMAT_R32G32_FLOAT, 0, InputLayoutDesc::APPEND_ALIGNED_ELEMENT, INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, FORMAT_R16G16_FLOAT, 0, InputLayoutDesc::APPEND_ALIGNED_ELEMENT, INPUT_PER_VERTEX_DATA, 0 },
};
wiRenderer::LoadShader(VS, vertexShader, "fontVS.cso");
@@ -348,20 +362,40 @@ void LoadShaders()
void UpdatePendingGlyphs()
{
+ glyphLock.lock();
+
+ static uint32_t saved_dpi = wiPlatform::GetDPI();
+ uint32_t dpi = wiPlatform::GetDPI();
+ if (saved_dpi != dpi)
+ {
+ saved_dpi = dpi;
+
+ for (auto& x : glyph_lookup)
+ {
+ pendingGlyphs.insert(x.first);
+ }
+ glyph_lookup.clear();
+ rect_lookup.clear();
+ }
+
// If there are pending glyphs, render them and repack the atlas:
if (!pendingGlyphs.empty())
{
// Pad the glyph rects in the atlas to avoid bleeding from nearby texels:
const int borderPadding = 1;
+ // Font resolution is DPI upscaled:
+ const float dpiscaling = wiPlatform::GetDPIScaling();
+
for (int32_t hash : pendingGlyphs)
{
const int code = codefromhash(hash);
const int style = stylefromhash(hash);
- const int height = heightfromhash(hash);
+ const float height = (float)heightfromhash(hash) * dpiscaling;
wiFontStyle& fontStyle = fontStyles[style];
- float fontScaling = stbtt_ScaleForPixelHeight(&fontStyle.fontInfo, float(height));
+ float fontScaling = stbtt_ScaleForPixelHeight(&fontStyle.fontInfo, height);
+ fontStyle.fontScaling = fontScaling / dpiscaling;
// get bounding box for character (may be offset to account for chars that dip above or below the line
int left, top, right, bottom;
@@ -369,10 +403,16 @@ void UpdatePendingGlyphs()
// Glyph dimensions are calculated without padding:
Glyph& glyph = glyph_lookup[hash];
- glyph.x = left;
- glyph.y = top + int(fontStyle.ascent * fontScaling);
- glyph.width = right - left;
- glyph.height = bottom - top;
+ glyph.x = float(left);
+ glyph.y = float(top) + float(fontStyle.ascent) * fontScaling;
+ glyph.width = float(right - left);
+ glyph.height = float(bottom - top);
+
+ // Remove dpi upscaling:
+ glyph.x = glyph.x / dpiscaling;
+ glyph.y = glyph.y / dpiscaling;
+ glyph.width = glyph.width / dpiscaling;
+ glyph.height = glyph.height / dpiscaling;
// Add padding to the rectangle that will be packed in the atlas:
right += borderPadding * 2;
@@ -411,7 +451,7 @@ void UpdatePendingGlyphs()
const int32_t hash = it.first;
const wchar_t code = codefromhash(hash);
const int style = stylefromhash(hash);
- const int height = heightfromhash(hash);
+ const float height = (float)heightfromhash(hash) * dpiscaling;
wiFontStyle& fontStyle = fontStyles[style];
rect_xywh& rect = it.second;
Glyph& glyph = glyph_lookup[hash];
@@ -422,7 +462,7 @@ void UpdatePendingGlyphs()
rect.w -= borderPadding * 2;
rect.h -= borderPadding * 2;
- float fontScaling = stbtt_ScaleForPixelHeight(&fontStyle.fontInfo, float(height));
+ float fontScaling = stbtt_ScaleForPixelHeight(&fontStyle.fontInfo, height);
// Render the glyph inside the CPU-side atlas:
int byteOffset = rect.x + (rect.y * bitmapWidth);
@@ -443,13 +483,14 @@ void UpdatePendingGlyphs()
glyph.tc_right = XMConvertFloatToHalf(tc_right);
glyph.tc_top = XMConvertFloatToHalf(tc_top);
glyph.tc_bottom = XMConvertFloatToHalf(tc_bottom);
-
}
// Upload the CPU-side texture atlas bitmap to the GPU:
wiTextureHelper::CreateTexture(texture, bitmap.data(), bitmapWidth, bitmapHeight, FORMAT_R8_UNORM);
}
}
+
+ glyphLock.unlock();
}
const Texture* GetAtlas()
{
@@ -480,15 +521,15 @@ int AddFontStyle(const std::string& fontName)
template
-int textWidth_internal(const T* text, const wiFontParams& params)
+float textWidth_internal(const T* text, const wiFontParams& params)
{
if (params.style >= (int)fontStyles.size())
{
return 0;
}
- int maxWidth = 0;
- int currentLineWidth = 0;
+ float maxWidth = 0;
+ float currentLineWidth = 0;
size_t i = 0;
while (text[i] != 0)
{
@@ -516,7 +557,7 @@ int textWidth_internal(const T* text, const wiFontParams& params)
else
{
const Glyph& glyph = glyph_lookup.at(hash);
- currentLineWidth += int((glyph.width + params.spacingX) * params.scaling);
+ currentLineWidth += glyph.width + float(params.spacingX) * params.scaling;
}
maxWidth = std::max(maxWidth, currentLineWidth);
}
@@ -525,14 +566,14 @@ int textWidth_internal(const T* text, const wiFontParams& params)
}
template
-int textHeight_internal(const T* text, const wiFontParams& params)
+float textHeight_internal(const T* text, const wiFontParams& params)
{
if (params.style >= (int)fontStyles.size())
{
return 0;
}
- int height = LINEBREAK_SIZE;
+ float height = LINEBREAK_SIZE;
size_t i = 0;
while (text[i] != 0)
{
@@ -557,14 +598,13 @@ void Draw_internal(const T* text, size_t text_length, const wiFontParams& params
wiFontParams newProps = params;
if (params.h_align == WIFALIGN_CENTER)
- newProps.posX -= textWidth(text, params) / 2;
+ newProps.posX -= textWidth_internal(text, newProps) / 2;
else if (params.h_align == WIFALIGN_RIGHT)
- newProps.posX -= textWidth(text, params);
+ newProps.posX -= textWidth_internal(text, newProps);
if (params.v_align == WIFALIGN_CENTER)
- newProps.posY -= textHeight(text, params) / 2;
+ newProps.posY -= textHeight_internal(text, newProps) / 2;
else if (params.v_align == WIFALIGN_BOTTOM)
- newProps.posY -= textHeight(text, params);
-
+ newProps.posY -= textHeight_internal(text, newProps);
GraphicsDevice* device = wiRenderer::GetDevice();
@@ -601,12 +641,14 @@ void Draw_internal(const T* text, size_t text_length, const wiFontParams& params
FontCB cb;
+ XMMATRIX Projection = device->GetScreenProjection();
+
if (newProps.shadowColor.getA() > 0)
{
// font shadow render:
XMStoreFloat4x4(&cb.g_xFont_Transform,
XMMatrixTranslation((float)newProps.posX + 1, (float)newProps.posY + 1, 0)
- * device->GetScreenProjection()
+ * Projection
);
cb.g_xFont_Color = newProps.shadowColor.toFloat4();
device->UpdateBuffer(&constantBuffer, &cb, cmd);
@@ -617,7 +659,7 @@ void Draw_internal(const T* text, size_t text_length, const wiFontParams& params
// font base render:
XMStoreFloat4x4(&cb.g_xFont_Transform,
XMMatrixTranslation((float)newProps.posX, (float)newProps.posY, 0)
- * device->GetScreenProjection()
+ * Projection
);
cb.g_xFont_Color = newProps.color.toFloat4();
device->UpdateBuffer(&constantBuffer, &cb, cmd);
@@ -656,36 +698,36 @@ void Draw(const wstring& text, const wiFontParams& params, CommandList cmd)
Draw_internal(text.c_str(), text.length(), params, cmd);
}
-int textWidth(const char* text, const wiFontParams& params)
+float textWidth(const char* text, const wiFontParams& params)
{
return textWidth_internal(text, params);
}
-int textWidth(const wchar_t* text, const wiFontParams& params)
+float textWidth(const wchar_t* text, const wiFontParams& params)
{
return textWidth_internal(text, params);
}
-int textWidth(const string& text, const wiFontParams& params)
+float textWidth(const string& text, const wiFontParams& params)
{
return textWidth_internal(text.c_str(), params);
}
-int textWidth(const wstring& text, const wiFontParams& params)
+float textWidth(const wstring& text, const wiFontParams& params)
{
return textWidth_internal(text.c_str(), params);
}
-int textHeight(const char* text, const wiFontParams& params)
+float textHeight(const char* text, const wiFontParams& params)
{
return textHeight_internal(text, params);
}
-int textHeight(const wchar_t* text, const wiFontParams& params)
+float textHeight(const wchar_t* text, const wiFontParams& params)
{
return textHeight_internal(text, params);
}
-int textHeight(const string& text, const wiFontParams& params)
+float textHeight(const string& text, const wiFontParams& params)
{
return textHeight_internal(text.c_str(), params);
}
-int textHeight(const wstring& text, const wiFontParams& params)
+float textHeight(const wstring& text, const wiFontParams& params)
{
return textHeight_internal(text.c_str(), params);
}
diff --git a/WickedEngine/wiFont.h b/WickedEngine/wiFont.h
index c77b6b4e8..4f91fdf60 100644
--- a/WickedEngine/wiFont.h
+++ b/WickedEngine/wiFont.h
@@ -19,19 +19,19 @@ static const int WIFONTSIZE_DEFAULT = 16;
struct wiFontParams
{
- int posX, posY;
- int size = WIFONTSIZE_DEFAULT; // line height in pixels
+ float posX, posY;
+ int size = WIFONTSIZE_DEFAULT; // line height in DPI scaled units
float scaling = 1;
- int spacingX, spacingY;
+ float spacingX = 1, spacingY = 1; // minimum spacing between characters
wiFontAlign h_align, v_align;
wiColor color;
wiColor shadowColor;
- int h_wrap = -1; // wrap start in pixels (-1 default for no wrap)
+ float h_wrap = -1; // wrap start width (-1 default for no wrap)
int style = 0;
- wiFontParams(int posX = 0, int posY = 0, int size = WIFONTSIZE_DEFAULT, wiFontAlign h_align = WIFALIGN_LEFT, wiFontAlign v_align = WIFALIGN_TOP
- , int spacingX = 0, int spacingY = 0, wiColor color = wiColor(255, 255, 255, 255), wiColor shadowColor = wiColor(0,0,0,0))
- :posX(posX), posY(posY), size(size), h_align(h_align), v_align(v_align), spacingX(spacingX), spacingY(spacingY), color(color), shadowColor(shadowColor)
+ wiFontParams(float posX = 0, float posY = 0, int size = WIFONTSIZE_DEFAULT, wiFontAlign h_align = WIFALIGN_LEFT, wiFontAlign v_align = WIFALIGN_TOP
+ , wiColor color = wiColor(255, 255, 255, 255), wiColor shadowColor = wiColor(0,0,0,0))
+ :posX(posX), posY(posY), size(size), h_align(h_align), v_align(v_align), color(color), shadowColor(shadowColor)
{}
};
@@ -55,14 +55,14 @@ namespace wiFont
void Draw(const std::string& text, const wiFontParams& params, wiGraphics::CommandList cmd);
void Draw(const std::wstring& text, const wiFontParams& params, wiGraphics::CommandList cmd);
- int textWidth(const char* text, const wiFontParams& params);
- int textWidth(const wchar_t* text, const wiFontParams& params);
- int textWidth(const std::string& text, const wiFontParams& params);
- int textWidth(const std::wstring& text, const wiFontParams& params);
+ float textWidth(const char* text, const wiFontParams& params);
+ float textWidth(const wchar_t* text, const wiFontParams& params);
+ float textWidth(const std::string& text, const wiFontParams& params);
+ float textWidth(const std::wstring& text, const wiFontParams& params);
- int textHeight(const char* text, const wiFontParams& params);
- int textHeight(const wchar_t* text, const wiFontParams& params);
- int textHeight(const std::string& text, const wiFontParams& params);
- int textHeight(const std::wstring& text, const wiFontParams& params);
+ float textHeight(const char* text, const wiFontParams& params);
+ float textHeight(const wchar_t* text, const wiFontParams& params);
+ float textHeight(const std::string& text, const wiFontParams& params);
+ float textHeight(const std::wstring& text, const wiFontParams& params);
};
diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp
index 7096345b3..64775b108 100644
--- a/WickedEngine/wiGUI.cpp
+++ b/WickedEngine/wiGUI.cpp
@@ -49,7 +49,14 @@ void wiGUIElement::ApplyScissor(const Rect rect, CommandList cmd, bool constrain
scissor.top = scissor.bottom;
}
- wiRenderer::GetDevice()->BindScissorRects(1, &scissor, cmd);
+ GraphicsDevice* device = wiRenderer::GetDevice();
+ float scale_x = (float)device->GetResolutionWidth() / (float)device->GetScreenWidth();
+ float scale_y = (float)device->GetResolutionHeight() / (float)device->GetScreenHeight();
+ scissor.bottom = int32_t((float)scissor.bottom * scale_y);
+ scissor.top = int32_t((float)scissor.top * scale_y);
+ scissor.left = int32_t((float)scissor.left * scale_x);
+ scissor.right = int32_t((float)scissor.right * scale_x);
+ device->BindScissorRects(1, &scissor, cmd);
}
diff --git a/WickedEngine/wiGUI.h b/WickedEngine/wiGUI.h
index b76cc9973..8d316c8ff 100644
--- a/WickedEngine/wiGUI.h
+++ b/WickedEngine/wiGUI.h
@@ -52,9 +52,6 @@ public:
void SetVisible(bool value) { visible = value; }
bool IsVisible() { return visible; }
- void SetDesignSize(float width, float height) { size_design = XMFLOAT2(width, height); }
- const XMFLOAT2& GetDesignSize() const { return size_design; }
-
const XMFLOAT2& GetPointerPos() const
{
return pointerpos;
diff --git a/WickedEngine/wiGraphicsDevice.cpp b/WickedEngine/wiGraphicsDevice.cpp
index 1c6f46835..18b7755d8 100644
--- a/WickedEngine/wiGraphicsDevice.cpp
+++ b/WickedEngine/wiGraphicsDevice.cpp
@@ -1,4 +1,5 @@
#include "wiGraphicsDevice.h"
+#include "wiPlatform.h"
using namespace wiGraphics;
@@ -163,3 +164,11 @@ bool GraphicsDevice::IsFormatStencilSupport(FORMAT value) const
return false;
}
+float GraphicsDevice::GetScreenWidth() const
+{
+ return (float)GetResolutionWidth() / wiPlatform::GetDPIScaling();
+}
+float GraphicsDevice::GetScreenHeight() const
+{
+ return (float)GetResolutionHeight() / wiPlatform::GetDPIScaling();
+}
diff --git a/WickedEngine/wiGraphicsDevice.h b/WickedEngine/wiGraphicsDevice.h
index 5d5cd756e..d3f69c672 100644
--- a/WickedEngine/wiGraphicsDevice.h
+++ b/WickedEngine/wiGraphicsDevice.h
@@ -14,8 +14,8 @@ namespace wiGraphics
protected:
uint64_t FRAMECOUNT = 0;
bool VSYNC = true;
- int SCREENWIDTH = 0;
- int SCREENHEIGHT = 0;
+ int RESOLUTIONWIDTH = 0;
+ int RESOLUTIONHEIGHT = 0;
bool DEBUGDEVICE = false;
bool FULLSCREEN = false;
bool RESOLUTIONCHANGED = false;
@@ -59,10 +59,18 @@ namespace wiGraphics
inline void SetVSyncEnabled(bool value) { VSYNC = value; }
inline uint64_t GetFrameCount() const { return FRAMECOUNT; }
- inline int GetScreenWidth() const { return SCREENWIDTH; }
- inline int GetScreenHeight() const { return SCREENHEIGHT; }
+ // Returns native resolution width of back buffer in pixels:
+ inline int GetResolutionWidth() const { return RESOLUTIONWIDTH; }
+ // Returns native resolution height of back buffer in pixels:
+ inline int GetResolutionHeight() const { return RESOLUTIONHEIGHT; }
+ // Has the resolution changed since the last frame?
inline bool ResolutionChanged() const { return RESOLUTIONCHANGED; }
+ // Returns the width of the screen with DPI scaling applied (subpixel size):
+ float GetScreenWidth() const;
+ // Returns the height of the screen with DPI scaling applied (subpixel size):
+ float GetScreenHeight() const;
+
virtual void SetResolution(int width, int height) = 0;
diff --git a/WickedEngine/wiGraphicsDevice_DX11.cpp b/WickedEngine/wiGraphicsDevice_DX11.cpp
index 84f05d4db..368ec920a 100644
--- a/WickedEngine/wiGraphicsDevice_DX11.cpp
+++ b/WickedEngine/wiGraphicsDevice_DX11.cpp
@@ -1189,11 +1189,11 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiPlatform::window_type window, bool fu
#ifndef WINSTORE_SUPPORT
RECT rect = RECT();
GetClientRect(window, &rect);
- SCREENWIDTH = rect.right - rect.left;
- SCREENHEIGHT = rect.bottom - rect.top;
+ RESOLUTIONWIDTH = rect.right - rect.left;
+ RESOLUTIONHEIGHT = rect.bottom - rect.top;
#else WINSTORE_SUPPORT
- SCREENWIDTH = (int)window->Bounds.Width;
- SCREENHEIGHT = (int)window->Bounds.Height;
+ RESOLUTIONWIDTH = (int)window->Bounds.Width;
+ RESOLUTIONHEIGHT = (int)window->Bounds.Height;
#endif
HRESULT hr = E_FAIL;
@@ -1254,8 +1254,8 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiPlatform::window_type window, bool fu
DXGI_SWAP_CHAIN_DESC1 sd = { 0 };
- sd.Width = SCREENWIDTH;
- sd.Height = SCREENHEIGHT;
+ sd.Width = RESOLUTIONWIDTH;
+ sd.Height = RESOLUTIONHEIGHT;
sd.Format = _ConvertFormat(GetBackBufferFormat());
sd.Stereo = false;
sd.SampleDesc.Count = 1; // Don't use multi-sampling.
@@ -1352,10 +1352,10 @@ void GraphicsDevice_DX11::CreateBackBufferResources()
void GraphicsDevice_DX11::SetResolution(int width, int height)
{
- if ((width != SCREENWIDTH || height != SCREENHEIGHT) && width > 0 && height > 0)
+ if ((width != RESOLUTIONWIDTH || height != RESOLUTIONHEIGHT) && width > 0 && height > 0)
{
- SCREENWIDTH = width;
- SCREENHEIGHT = height;
+ RESOLUTIONWIDTH = width;
+ RESOLUTIONHEIGHT = height;
backBuffer.Reset();
renderTargetView.Reset();
@@ -2432,8 +2432,8 @@ CommandList GraphicsDevice_DX11::BeginCommandList()
BindComputeShader(nullptr, cmd);
D3D11_VIEWPORT vp = {};
- vp.Width = (float)SCREENWIDTH;
- vp.Height = (float)SCREENHEIGHT;
+ vp.Width = (float)RESOLUTIONWIDTH;
+ vp.Height = (float)RESOLUTIONHEIGHT;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
diff --git a/WickedEngine/wiGraphicsDevice_DX12.cpp b/WickedEngine/wiGraphicsDevice_DX12.cpp
index a9cb78aca..23e021b8e 100644
--- a/WickedEngine/wiGraphicsDevice_DX12.cpp
+++ b/WickedEngine/wiGraphicsDevice_DX12.cpp
@@ -1539,11 +1539,11 @@ using namespace DX12_Internal;
#ifndef WINSTORE_SUPPORT
RECT rect = RECT();
GetClientRect(window, &rect);
- SCREENWIDTH = rect.right - rect.left;
- SCREENHEIGHT = rect.bottom - rect.top;
+ RESOLUTIONWIDTH = rect.right - rect.left;
+ RESOLUTIONHEIGHT = rect.bottom - rect.top;
#else WINSTORE_SUPPORT
- SCREENWIDTH = (int)window->Bounds.Width;
- SCREENHEIGHT = (int)window->Bounds.Height;
+ RESOLUTIONWIDTH = (int)window->Bounds.Width;
+ RESOLUTIONHEIGHT = (int)window->Bounds.Height;
#endif
HRESULT hr = E_FAIL;
@@ -1613,8 +1613,8 @@ using namespace DX12_Internal;
ComPtr _swapChain;
DXGI_SWAP_CHAIN_DESC1 sd = {};
- sd.Width = SCREENWIDTH;
- sd.Height = SCREENHEIGHT;
+ sd.Width = RESOLUTIONWIDTH;
+ sd.Height = RESOLUTIONHEIGHT;
sd.Format = _ConvertFormat(GetBackBufferFormat());
sd.Stereo = false;
sd.SampleDesc.Count = 1; // Don't use multi-sampling.
@@ -2037,10 +2037,10 @@ using namespace DX12_Internal;
void GraphicsDevice_DX12::SetResolution(int width, int height)
{
- if ((width != SCREENWIDTH || height != SCREENHEIGHT) && width > 0 && height > 0)
+ if ((width != RESOLUTIONWIDTH || height != RESOLUTIONHEIGHT) && width > 0 && height > 0)
{
- SCREENWIDTH = width;
- SCREENHEIGHT = height;
+ RESOLUTIONWIDTH = width;
+ RESOLUTIONHEIGHT = height;
WaitForGPU();
@@ -3139,8 +3139,8 @@ using namespace DX12_Internal;
GetFrameResources().resourceBuffer[cmd].clear();
D3D12_VIEWPORT vp = {};
- vp.Width = (float)SCREENWIDTH;
- vp.Height = (float)SCREENHEIGHT;
+ vp.Width = (float)RESOLUTIONWIDTH;
+ vp.Height = (float)RESOLUTIONHEIGHT;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
diff --git a/WickedEngine/wiGraphicsDevice_Vulkan.cpp b/WickedEngine/wiGraphicsDevice_Vulkan.cpp
index 022b9b76b..76c5c3375 100644
--- a/WickedEngine/wiGraphicsDevice_Vulkan.cpp
+++ b/WickedEngine/wiGraphicsDevice_Vulkan.cpp
@@ -1619,8 +1619,8 @@ using namespace Vulkan_Internal;
RECT rect = RECT();
GetClientRect(window, &rect);
- SCREENWIDTH = rect.right - rect.left;
- SCREENHEIGHT = rect.bottom - rect.top;
+ RESOLUTIONWIDTH = rect.right - rect.left;
+ RESOLUTIONHEIGHT = rect.bottom - rect.top;
VkResult res;
@@ -2055,7 +2055,7 @@ using namespace Vulkan_Internal;
VkSurfaceFormatKHR surfaceFormat = chooseSwapSurfaceFormat(swapChainSupport.formats);
VkPresentModeKHR presentMode = chooseSwapPresentMode(swapChainSupport.presentModes);
- swapChainExtent = { static_cast(SCREENWIDTH), static_cast(SCREENHEIGHT) };
+ swapChainExtent = { static_cast(RESOLUTIONWIDTH), static_cast(RESOLUTIONHEIGHT) };
swapChainExtent.width = std::max(swapChainSupport.capabilities.minImageExtent.width, std::min(swapChainSupport.capabilities.maxImageExtent.width, swapChainExtent.width));
swapChainExtent.height = std::max(swapChainSupport.capabilities.minImageExtent.height, std::min(swapChainSupport.capabilities.maxImageExtent.height, swapChainExtent.height));
@@ -2454,10 +2454,10 @@ using namespace Vulkan_Internal;
void GraphicsDevice_Vulkan::SetResolution(int width, int height)
{
- if (width != SCREENWIDTH || height != SCREENHEIGHT)
+ if (width != RESOLUTIONWIDTH || height != RESOLUTIONHEIGHT)
{
- SCREENWIDTH = width;
- SCREENHEIGHT = height;
+ RESOLUTIONWIDTH = width;
+ RESOLUTIONHEIGHT = height;
//swapChain->ResizeBuffers(2, width, height, _ConvertFormat(GetBackBufferFormat()), 0);
RESOLUTIONCHANGED = true;
}
@@ -3911,8 +3911,8 @@ using namespace Vulkan_Internal;
{
viewports[i].x = 0;
viewports[i].y = 0;
- viewports[i].width = (float)SCREENWIDTH;
- viewports[i].height = (float)SCREENHEIGHT;
+ viewports[i].width = (float)RESOLUTIONWIDTH;
+ viewports[i].height = (float)RESOLUTIONHEIGHT;
viewports[i].minDepth = 0;
viewports[i].maxDepth = 1;
}
diff --git a/WickedEngine/wiImage.cpp b/WickedEngine/wiImage.cpp
index 18ec21307..7aa7ed3b0 100644
--- a/WickedEngine/wiImage.cpp
+++ b/WickedEngine/wiImage.cpp
@@ -26,21 +26,15 @@ namespace wiImage
IMAGE_SHADER_FULLSCREEN,
IMAGE_SHADER_COUNT
};
- enum IMAGE_SAMPLING
- {
- IMAGE_SAMPLING_SIMPLE,
- IMAGE_SAMPLING_BICUBIC,
- IMAGE_SAMPLING_COUNT,
- };
GPUBuffer constantBuffer;
Shader vertexShader;
Shader screenVS;
- Shader imagePS[IMAGE_SHADER_COUNT][IMAGE_SAMPLING_COUNT];
+ Shader imagePS[IMAGE_SHADER_COUNT];
BlendState blendStates[BLENDMODE_COUNT];
RasterizerState rasterizerState;
DepthStencilState depthStencilStates[STENCILMODE_COUNT][STENCILREFMODE_COUNT];
- PipelineState imagePSO[IMAGE_SHADER_COUNT][BLENDMODE_COUNT][STENCILMODE_COUNT][STENCILREFMODE_COUNT][IMAGE_SAMPLING_COUNT];
+ PipelineState imagePSO[IMAGE_SHADER_COUNT][BLENDMODE_COUNT][STENCILMODE_COUNT][STENCILREFMODE_COUNT];
std::atomic_bool initialized{ false };
@@ -64,8 +58,6 @@ namespace wiImage
}
device->BindStencilRef(stencilRef, cmd);
- IMAGE_SAMPLING sampling_type = params.quality == QUALITY_BICUBIC ? IMAGE_SAMPLING_BICUBIC : IMAGE_SAMPLING_SIMPLE;
-
if (params.quality == QUALITY_NEAREST)
{
if (params.sampleFlag == SAMPLEMODE_MIRROR)
@@ -101,13 +93,10 @@ namespace wiImage
cb.xColor.y *= darken;
cb.xColor.z *= darken;
cb.xColor.w *= params.opacity;
- cb.xMirror = params.isMirrorEnabled() ? 1 : 0;
- cb.xMipLevel = params.mipLevel;
- cb.xMipLevel_Background = params.mipLevel_Background;
if (params.isFullScreenEnabled())
{
- device->BindPipelineState(&imagePSO[IMAGE_SHADER_FULLSCREEN][params.blendFlag][params.stencilComp][params.stencilRefMode][sampling_type], cmd);
+ device->BindPipelineState(&imagePSO[IMAGE_SHADER_FULLSCREEN][params.blendFlag][params.stencilComp][params.stencilRefMode], cmd);
device->UpdateBuffer(&constantBuffer, &cb, cmd);
device->BindConstantBuffer(PS, &constantBuffer, CB_GETBINDSLOT(ImageCB), cmd);
device->Draw(3, 0, cmd);
@@ -166,6 +155,12 @@ namespace wiImage
XMStoreFloat4(&cb.xCorners[i], V);
}
+ if (params.isMirrorEnabled())
+ {
+ std::swap(cb.xCorners[0], cb.xCorners[1]);
+ std::swap(cb.xCorners[2], cb.xCorners[3]);
+ }
+
const TextureDesc& desc = texture->GetDesc();
const float inv_width = 1.0f / float(desc.Width);
const float inv_height = 1.0f / float(desc.Height);
@@ -235,7 +230,7 @@ namespace wiImage
}
}
- device->BindPipelineState(&imagePSO[targetShader][params.blendFlag][params.stencilComp][params.stencilRefMode][sampling_type], cmd);
+ device->BindPipelineState(&imagePSO[targetShader][params.blendFlag][params.stencilComp][params.stencilRefMode], cmd);
device->BindConstantBuffer(VS, &constantBuffer, CB_GETBINDSLOT(ImageCB), cmd);
device->BindConstantBuffer(PS, &constantBuffer, CB_GETBINDSLOT(ImageCB), cmd);
@@ -255,18 +250,12 @@ namespace wiImage
wiRenderer::LoadShader(VS, vertexShader, "imageVS.cso");
wiRenderer::LoadShader(VS, screenVS, "screenVS.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_STANDARD][IMAGE_SAMPLING_SIMPLE], "imagePS.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_SEPARATENORMALMAP][IMAGE_SAMPLING_SIMPLE], "imagePS_separatenormalmap.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_MASKED][IMAGE_SAMPLING_SIMPLE], "imagePS_masked.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR][IMAGE_SAMPLING_SIMPLE], "imagePS_backgroundblur.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR_MASKED][IMAGE_SAMPLING_SIMPLE], "imagePS_backgroundblur_masked.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_FULLSCREEN][IMAGE_SAMPLING_SIMPLE], "screenPS.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_STANDARD][IMAGE_SAMPLING_BICUBIC], "imagePS_bicubic.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_SEPARATENORMALMAP][IMAGE_SAMPLING_BICUBIC], "imagePS_separatenormalmap_bicubic.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_MASKED][IMAGE_SAMPLING_BICUBIC], "imagePS_masked_bicubic.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR][IMAGE_SAMPLING_BICUBIC], "imagePS_backgroundblur_bicubic.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR_MASKED][IMAGE_SAMPLING_BICUBIC], "imagePS_backgroundblur_masked_bicubic.cso");
- wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_FULLSCREEN][IMAGE_SAMPLING_BICUBIC], "screenPS_bicubic.cso");
+ wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_STANDARD], "imagePS.cso");
+ wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_SEPARATENORMALMAP], "imagePS_separatenormalmap.cso");
+ wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_MASKED], "imagePS_masked.cso");
+ wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR], "imagePS_backgroundblur.cso");
+ wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR_MASKED], "imagePS_backgroundblur_masked.cso");
+ wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_FULLSCREEN], "screenPS.cso");
GraphicsDevice* device = wiRenderer::GetDevice();
@@ -282,22 +271,19 @@ namespace wiImage
desc.rs = &rasterizerState;
desc.pt = TRIANGLESTRIP;
- for (int l = 0; l < IMAGE_SAMPLING_COUNT; ++l)
+ desc.ps = &imagePS[i];
+
+ for (int j = 0; j < BLENDMODE_COUNT; ++j)
{
- desc.ps = &imagePS[i][l];
-
- for (int j = 0; j < BLENDMODE_COUNT; ++j)
+ desc.bs = &blendStates[j];
+ for (int k = 0; k < STENCILMODE_COUNT; ++k)
{
- desc.bs = &blendStates[j];
- for (int k = 0; k < STENCILMODE_COUNT; ++k)
+ for (int m = 0; m < STENCILREFMODE_COUNT; ++m)
{
- for (int m = 0; m < STENCILREFMODE_COUNT; ++m)
- {
- desc.dss = &depthStencilStates[k][m];
+ desc.dss = &depthStencilStates[k][m];
- device->CreatePipelineState(&desc, &imagePSO[i][j][k][m][l]);
+ device->CreatePipelineState(&desc, &imagePSO[i][j][k][m]);
- }
}
}
}
diff --git a/WickedEngine/wiImage.h b/WickedEngine/wiImage.h
index f191d15fb..13bf04ee1 100644
--- a/WickedEngine/wiImage.h
+++ b/WickedEngine/wiImage.h
@@ -46,7 +46,6 @@ enum QUALITY
QUALITY_NEAREST,
QUALITY_LINEAR,
QUALITY_ANISOTROPIC,
- QUALITY_BICUBIC,
QUALITY_COUNT
};
enum ImageType
@@ -80,8 +79,6 @@ struct wiImageParams
XMFLOAT2 texOffset2;
XMFLOAT2 pivot; // (0,0) : upperleft, (0.5,0.5) : center, (1,1) : bottomright
float rotation;
- float mipLevel;
- float mipLevel_Background; // can blur background with this if > 0 and the background texture has mip levels
float fade;
float opacity;
XMFLOAT2 corners[4]; // you can deform the image by its corners (0: top left, 1: top right, 2: bottom left, 3: bottom right)
@@ -114,8 +111,6 @@ struct wiImageParams
fade = 0;
rotation = 0;
opacity = 1;
- mipLevel = 0;
- mipLevel_Background = 0;
stencilRef = 0;
stencilComp = STENCILMODE_DISABLED;
stencilRefMode = STENCILREFMODE_ALL;
@@ -149,7 +144,7 @@ struct wiImageParams
void enableFullScreen() { _flags |= FULLSCREEN; }
// enable background blur, which samples a background screen texture on a specified mip level on transparent areas instead of alpha blending
// the background tex should be bound to resource slot: TEXSLOT_IMAGE_BACKGROUND beforehand!
- void enableBackgroundBlur(float mip) { _flags |= BACKGROUND_BLUR; mipLevel_Background = mip; }
+ void enableBackgroundBlur() { _flags |= BACKGROUND_BLUR; }
// disable draw rectangle for base texture (whole texture will be drawn, no cutout)
void disableDrawRect() { _flags &= ~DRAWRECT; }
diff --git a/WickedEngine/wiImageParams_BindLua.cpp b/WickedEngine/wiImageParams_BindLua.cpp
index d51fed493..ab99766fa 100644
--- a/WickedEngine/wiImageParams_BindLua.cpp
+++ b/WickedEngine/wiImageParams_BindLua.cpp
@@ -11,7 +11,6 @@ Luna::FunctionType wiImageParams_BindLua::methods[] = {
lunamethod(wiImageParams_BindLua, GetOpacity),
lunamethod(wiImageParams_BindLua, GetFade),
lunamethod(wiImageParams_BindLua, GetRotation),
- lunamethod(wiImageParams_BindLua, GetMipLevel),
lunamethod(wiImageParams_BindLua, GetTexOffset),
lunamethod(wiImageParams_BindLua, GetTexOffset2),
lunamethod(wiImageParams_BindLua, GetDrawRect),
@@ -33,7 +32,6 @@ Luna::FunctionType wiImageParams_BindLua::methods[] = {
lunamethod(wiImageParams_BindLua, SetQuality),
lunamethod(wiImageParams_BindLua, SetSampleMode),
lunamethod(wiImageParams_BindLua, SetRotation),
- lunamethod(wiImageParams_BindLua, SetMipLevel),
lunamethod(wiImageParams_BindLua, SetTexOffset),
lunamethod(wiImageParams_BindLua, SetTexOffset2),
lunamethod(wiImageParams_BindLua, EnableDrawRect),
@@ -90,11 +88,6 @@ int wiImageParams_BindLua::GetRotation(lua_State* L)
wiLua::SSetFloat(L, params.rotation);
return 1;
}
-int wiImageParams_BindLua::GetMipLevel(lua_State* L)
-{
- wiLua::SSetFloat(L, params.mipLevel);
- return 1;
-}
int wiImageParams_BindLua::GetTexOffset(lua_State* L)
{
Luna::push(L, new Vector_BindLua(XMLoadFloat2(¶ms.texOffset)));
@@ -309,19 +302,6 @@ int wiImageParams_BindLua::SetRotation(lua_State* L)
}
return 0;
}
-int wiImageParams_BindLua::SetMipLevel(lua_State* L)
-{
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- params.mipLevel = wiLua::SGetFloat(L, 1);
- }
- else
- {
- wiLua::SError(L, "SetMipLevel(float x) not enough arguments!");
- }
- return 0;
-}
int wiImageParams_BindLua::SetTexOffset(lua_State* L)
{
int argc = wiLua::SGetArgCount(L);
@@ -416,13 +396,7 @@ int wiImageParams_BindLua::DisableMirror(lua_State* L)
}
int wiImageParams_BindLua::EnableBackgroundBlur(lua_State* L)
{
- float mip = 0;
- int argc = wiLua::SGetArgCount(L);
- if (argc > 0)
- {
- mip = wiLua::SGetFloat(L, 1);
- }
- params.enableBackgroundBlur(mip);
+ params.enableBackgroundBlur();
return 0;
}
int wiImageParams_BindLua::DisableBackgroundBlur(lua_State* L)
diff --git a/WickedEngine/wiImageParams_BindLua.h b/WickedEngine/wiImageParams_BindLua.h
index 721f45773..e95115095 100644
--- a/WickedEngine/wiImageParams_BindLua.h
+++ b/WickedEngine/wiImageParams_BindLua.h
@@ -22,7 +22,6 @@ public:
int GetOpacity(lua_State* L);
int GetFade(lua_State* L);
int GetRotation(lua_State* L);
- int GetMipLevel(lua_State* L);
int GetTexOffset(lua_State* L);
int GetTexOffset2(lua_State* L);
int GetDrawRect(lua_State* L);
@@ -44,7 +43,6 @@ public:
int SetQuality(lua_State* L);
int SetSampleMode(lua_State* L);
int SetRotation(lua_State* L);
- int SetMipLevel(lua_State* L);
int SetTexOffset(lua_State* L);
int SetTexOffset2(lua_State* L);
int EnableDrawRect(lua_State* L);
diff --git a/WickedEngine/wiInput.cpp b/WickedEngine/wiInput.cpp
index 5ebf59a50..1cf315d0e 100644
--- a/WickedEngine/wiInput.cpp
+++ b/WickedEngine/wiInput.cpp
@@ -85,6 +85,11 @@ namespace wiInput
wiRawInput::GetMouseState(&mouse); // currently only the relative data can be used from this
wiRawInput::GetKeyboardState(&keyboard); // it contains pressed buttons as "keyboard/typewriter" like, so no continuous presses
+ // aparently checking the mouse here instead of Down() avoids missing the button presses (review!)
+ mouse.left_button_press |= KEY_DOWN(VK_LBUTTON);
+ mouse.middle_button_press |= KEY_DOWN(VK_MBUTTON);
+ mouse.right_button_press |= KEY_DOWN(VK_RBUTTON);
+
// Check if low-level XINPUT controller is not registered for playerindex slot and register:
for (int i = 0; i < wiXInput::GetMaxControllerCount(); ++i)
{
@@ -240,17 +245,17 @@ namespace wiInput
case wiInput::MOUSE_BUTTON_LEFT:
if (mouse.left_button_press)
return true;
- keycode = VK_LBUTTON;
+ return false;
break;
case wiInput::MOUSE_BUTTON_RIGHT:
if (mouse.right_button_press)
return true;
- keycode = VK_RBUTTON;
+ return false;
break;
case wiInput::MOUSE_BUTTON_MIDDLE:
if (mouse.middle_button_press)
return true;
- keycode = VK_MBUTTON;
+ return false;
break;
case wiInput::KEYBOARD_BUTTON_UP:
keycode = VK_UP;
@@ -389,7 +394,8 @@ namespace wiInput
POINT p;
GetCursorPos(&p);
ScreenToClient(wiPlatform::GetWindow(), &p);
- return XMFLOAT4((float)p.x, (float)p.y, mouse.delta_wheel, 0);
+ const float dpiscaling = wiPlatform::GetDPIScaling();
+ return XMFLOAT4((float)p.x / dpiscaling, (float)p.y / dpiscaling, mouse.delta_wheel, 0);
#else
auto& p = Windows::UI::Core::CoreWindow::GetForCurrentThread()->PointerPosition;
return XMFLOAT4(p.X, p.Y, 0, 0);
@@ -398,9 +404,10 @@ namespace wiInput
void SetPointer(const XMFLOAT4& props)
{
#ifndef WINSTORE_SUPPORT
+ const float dpiscaling = wiPlatform::GetDPIScaling();
POINT p;
- p.x = (LONG)props.x;
- p.y = (LONG)props.y;
+ p.x = (LONG)(props.x * dpiscaling);
+ p.y = (LONG)(props.y * dpiscaling);
ClientToScreen(wiPlatform::GetWindow(), &p);
SetCursorPos(p.x, p.y);
#endif
diff --git a/WickedEngine/wiPlatform.h b/WickedEngine/wiPlatform.h
index 7b6146509..affa0216f 100644
--- a/WickedEngine/wiPlatform.h
+++ b/WickedEngine/wiPlatform.h
@@ -41,4 +41,20 @@ namespace wiPlatform
return true;
#endif // _WIN32
}
+ inline uint32_t GetDPI()
+ {
+#ifdef _WIN32
+#ifndef WINSTORE_SUPPORT
+ return GetDpiForWindow(GetWindow());
+#else
+ return 96;
+#endif // WINSTORE_SUPPORT
+#else
+ return 96;
+#endif // _WIN32
+ }
+ inline float GetDPIScaling()
+ {
+ return (float)GetDPI() / 96.0f;
+ }
}
diff --git a/WickedEngine/wiProfiler.cpp b/WickedEngine/wiProfiler.cpp
index 1d831d537..bf43b1766 100644
--- a/WickedEngine/wiProfiler.cpp
+++ b/WickedEngine/wiProfiler.cpp
@@ -198,7 +198,7 @@ namespace wiProfiler
lock.unlock();
}
- void DrawData(int x, int y, CommandList cmd)
+ void DrawData(float x, float y, CommandList cmd)
{
if (!ENABLED || !initialized)
return;
@@ -226,7 +226,7 @@ namespace wiProfiler
}
}
- wiFontParams params = wiFontParams(x, y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255, 255, 255, 255), wiColor(0, 0, 0, 255));
+ wiFontParams params = wiFontParams(x, y, WIFONTSIZE_DEFAULT - 4, WIFALIGN_LEFT, WIFALIGN_TOP, wiColor(255, 255, 255, 255), wiColor(0, 0, 0, 255));
wiImageParams fx;
fx.pos.x = (float)params.posX;
diff --git a/WickedEngine/wiProfiler.h b/WickedEngine/wiProfiler.h
index 96c0de037..55b383010 100644
--- a/WickedEngine/wiProfiler.h
+++ b/WickedEngine/wiProfiler.h
@@ -23,7 +23,7 @@ namespace wiProfiler
void EndRange(range_id id);
// Renders a basic text of the Profiling results to the (x,y) screen coordinate
- void DrawData(int x, int y, wiGraphics::CommandList cmd);
+ void DrawData(float x, float y, wiGraphics::CommandList cmd);
// Enable/disable profiling
void SetEnabled(bool value);
diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp
index 13c97db70..d05ff2fe2 100644
--- a/WickedEngine/wiRenderer.cpp
+++ b/WickedEngine/wiRenderer.cpp
@@ -1310,16 +1310,14 @@ void LoadShaders()
wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_VOXELSCENECOPYCLEAR_TEMPORALSMOOTHING], "voxelSceneCopyClear_TemporalSmoothing.cso"); });
wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_VOXELRADIANCESECONDARYBOUNCE], "voxelRadianceSecondaryBounceCS.cso"); });
wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_VOXELCLEARONLYNORMAL], "voxelClearOnlyNormalCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN2D_UNORM4_SIMPLEFILTER], "generateMIPChain2D_unorm4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_SIMPLEFILTER], "generateMIPChain2D_float4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN2D_UNORM4_BICUBIC], "generateMIPChain2D_unorm4_BicubicCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_BICUBIC], "generateMIPChain2D_float4_BicubicCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN3D_UNORM4_SIMPLEFILTER], "generateMIPChain3D_unorm4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN3D_FLOAT4_SIMPLEFILTER], "generateMIPChain3D_float4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBE_UNORM4_SIMPLEFILTER], "generateMIPChainCube_unorm4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4_SIMPLEFILTER], "generateMIPChainCube_float4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4_SIMPLEFILTER], "generateMIPChainCubeArray_unorm4_SimpleFilterCS.cso"); });
- wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4_SIMPLEFILTER], "generateMIPChainCubeArray_float4_SimpleFilterCS.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN2D_UNORM4], "generateMIPChain2DCS_unorm4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN2D_FLOAT4], "generateMIPChain2DCS_float4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN3D_UNORM4], "generateMIPChain3DCS_unorm4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAIN3D_FLOAT4], "generateMIPChain3DCS_float4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBE_UNORM4], "generateMIPChainCubeCS_unorm4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4], "generateMIPChainCubeCS_float4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4], "generateMIPChainCubeArrayCS_unorm4.cso"); });
+ wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4], "generateMIPChainCubeArrayCS_float4.cso"); });
wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_FILTERENVMAP], "filterEnvMapCS.cso"); });
wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_COPYTEXTURE2D_UNORM4], "copytexture2D_unorm4CS.cso"); });
wiJobSystem::Execute(ctx, [] { LoadShader(CS, computeShaders[CSTYPE_COPYTEXTURE2D_FLOAT4], "copytexture2D_float4CS.cso"); });
@@ -7685,12 +7683,12 @@ void GenerateMipChain(const Texture& texture, MIPGENFILTER filter, CommandList c
{
case MIPGENFILTER_POINT:
device->EventBegin("GenerateMipChain CubeArray - PointFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4 : CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_POINT_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
case MIPGENFILTER_LINEAR:
device->EventBegin("GenerateMipChain CubeArray - LinearFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBEARRAY_FLOAT4 : CSTYPE_GENERATEMIPCHAINCUBEARRAY_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_LINEAR_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
default:
@@ -7731,12 +7729,12 @@ void GenerateMipChain(const Texture& texture, MIPGENFILTER filter, CommandList c
{
case MIPGENFILTER_POINT:
device->EventBegin("GenerateMipChain Cube - PointFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAINCUBE_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4 : CSTYPE_GENERATEMIPCHAINCUBE_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_POINT_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
case MIPGENFILTER_LINEAR:
device->EventBegin("GenerateMipChain Cube - LinearFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAINCUBE_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAINCUBE_FLOAT4 : CSTYPE_GENERATEMIPCHAINCUBE_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_LINEAR_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
default:
@@ -7779,12 +7777,12 @@ void GenerateMipChain(const Texture& texture, MIPGENFILTER filter, CommandList c
{
case MIPGENFILTER_POINT:
device->EventBegin("GenerateMipChain 2D - PointFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAIN2D_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN2D_FLOAT4 : CSTYPE_GENERATEMIPCHAIN2D_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_POINT_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
case MIPGENFILTER_LINEAR:
device->EventBegin("GenerateMipChain 2D - LinearFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAIN2D_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN2D_FLOAT4 : CSTYPE_GENERATEMIPCHAIN2D_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_LINEAR_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
case MIPGENFILTER_GAUSSIAN:
@@ -7800,10 +7798,6 @@ void GenerateMipChain(const Texture& texture, MIPGENFILTER filter, CommandList c
return;
}
break;
- case MIPGENFILTER_BICUBIC:
- device->EventBegin("GenerateMipChain 2D - BicubicFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN2D_FLOAT4_BICUBIC : CSTYPE_GENERATEMIPCHAIN2D_UNORM4_BICUBIC], cmd);
- break;
default:
assert(0);
break;
@@ -7851,12 +7845,12 @@ void GenerateMipChain(const Texture& texture, MIPGENFILTER filter, CommandList c
{
case MIPGENFILTER_POINT:
device->EventBegin("GenerateMipChain 3D - PointFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN3D_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAIN3D_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN3D_FLOAT4 : CSTYPE_GENERATEMIPCHAIN3D_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_POINT_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
case MIPGENFILTER_LINEAR:
device->EventBegin("GenerateMipChain 3D - LinearFilter", cmd);
- device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN3D_FLOAT4_SIMPLEFILTER : CSTYPE_GENERATEMIPCHAIN3D_UNORM4_SIMPLEFILTER], cmd);
+ device->BindComputeShader(&computeShaders[hdr ? CSTYPE_GENERATEMIPCHAIN3D_FLOAT4 : CSTYPE_GENERATEMIPCHAIN3D_UNORM4], cmd);
device->BindSampler(CS, &samplers[SSLOT_LINEAR_CLAMP], SSLOT_ONDEMAND0, cmd);
break;
default:
@@ -11332,12 +11326,16 @@ const XMFLOAT4& GetWaterPlane()
RAY GetPickRay(long cursorX, long cursorY)
{
+ GraphicsDevice* device = GetDevice();
+ float screenW = device->GetScreenWidth();
+ float screenH = device->GetScreenHeight();
+
const CameraComponent& camera = GetCamera();
XMMATRIX V = camera.GetView();
XMMATRIX P = camera.GetProjection();
XMMATRIX W = XMMatrixIdentity();
- XMVECTOR& lineStart = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 1, 1), 0, 0, camera.width, camera.height, 0.0f, 1.0f, P, V, W);
- XMVECTOR& lineEnd = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 0, 1), 0, 0, camera.width, camera.height, 0.0f, 1.0f, P, V, W);
+ XMVECTOR& lineStart = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 1, 1), 0, 0, screenW, screenH, 0.0f, 1.0f, P, V, W);
+ XMVECTOR& lineEnd = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 0, 1), 0, 0, screenW, screenH, 0.0f, 1.0f, P, V, W);
XMVECTOR& rayDirection = XMVector3Normalize(XMVectorSubtract(lineEnd, lineStart));
return RAY(lineStart, rayDirection);
}
@@ -11398,7 +11396,7 @@ int GetShadowRes2D() { return SHADOWRES_2D; }
int GetShadowResCube() { return SHADOWRES_CUBE; }
void SetTransparentShadowsEnabled(float value) { TRANSPARENTSHADOWSENABLED = value; }
float GetTransparentShadowsEnabled() { return TRANSPARENTSHADOWSENABLED; }
-XMUINT2 GetInternalResolution() { return XMUINT2((uint32_t)ceilf(GetDevice()->GetScreenWidth()*GetResolutionScale()), (uint32_t)ceilf(GetDevice()->GetScreenHeight()*GetResolutionScale())); }
+XMUINT2 GetInternalResolution() { return XMUINT2((uint32_t)ceilf(GetDevice()->GetResolutionWidth()*GetResolutionScale()), (uint32_t)ceilf(GetDevice()->GetResolutionHeight()*GetResolutionScale())); }
bool ResolutionChanged()
{
//detect internal resolution change:
diff --git a/WickedEngine/wiRenderer.h b/WickedEngine/wiRenderer.h
index ffe235c51..5c6c50ea8 100644
--- a/WickedEngine/wiRenderer.h
+++ b/WickedEngine/wiRenderer.h
@@ -359,7 +359,6 @@ namespace wiRenderer
MIPGENFILTER_POINT,
MIPGENFILTER_LINEAR,
MIPGENFILTER_GAUSSIAN,
- MIPGENFILTER_BICUBIC,
};
struct MIPGEN_OPTIONS
{
diff --git a/WickedEngine/wiRenderer_BindLua.cpp b/WickedEngine/wiRenderer_BindLua.cpp
index a1cefdcdf..57ffe2020 100644
--- a/WickedEngine/wiRenderer_BindLua.cpp
+++ b/WickedEngine/wiRenderer_BindLua.cpp
@@ -66,12 +66,12 @@ namespace wiRenderer_BindLua
int GetScreenWidth(lua_State* L)
{
- wiLua::SSetInt(L, wiRenderer::GetDevice()->GetScreenWidth());
+ wiLua::SSetFloat(L, wiRenderer::GetDevice()->GetScreenWidth());
return 1;
}
int GetScreenHeight(lua_State* L)
{
- wiLua::SSetInt(L, wiRenderer::GetDevice()->GetScreenHeight());
+ wiLua::SSetFloat(L, wiRenderer::GetDevice()->GetScreenHeight());
return 1;
}
diff --git a/WickedEngine/wiSpriteFont.cpp b/WickedEngine/wiSpriteFont.cpp
index d42fa599d..5d4cea83c 100644
--- a/WickedEngine/wiSpriteFont.cpp
+++ b/WickedEngine/wiSpriteFont.cpp
@@ -18,11 +18,11 @@ void wiSpriteFont::Draw(CommandList cmd) const
wiFont::Draw(text, params, cmd);
}
-int wiSpriteFont::textWidth() const
+float wiSpriteFont::textWidth() const
{
return wiFont::textWidth(text, params);
}
-int wiSpriteFont::textHeight() const
+float wiSpriteFont::textHeight() const
{
return wiFont::textHeight(text, params);
}
diff --git a/WickedEngine/wiSpriteFont.h b/WickedEngine/wiSpriteFont.h
index 8b5a72e87..f02d97a51 100644
--- a/WickedEngine/wiSpriteFont.h
+++ b/WickedEngine/wiSpriteFont.h
@@ -20,8 +20,8 @@ public:
virtual void Update(float dt);
void Draw(wiGraphics::CommandList cmd) const;
- int textWidth() const;
- int textHeight() const;
+ float textWidth() const;
+ float textHeight() const;
void SetText(const std::string& value);
void SetText(const std::wstring& value);
diff --git a/WickedEngine/wiSpriteFont_BindLua.cpp b/WickedEngine/wiSpriteFont_BindLua.cpp
index ac568f426..cd2954f79 100644
--- a/WickedEngine/wiSpriteFont_BindLua.cpp
+++ b/WickedEngine/wiSpriteFont_BindLua.cpp
@@ -87,8 +87,8 @@ int wiSpriteFont_BindLua::SetPos(lua_State* L)
Vector_BindLua* param = Luna::lightcheck(L, 1);
if (param != nullptr)
{
- font.params.posX = (int)XMVectorGetX(param->vector);
- font.params.posY = (int)XMVectorGetY(param->vector);
+ font.params.posX = XMVectorGetX(param->vector);
+ font.params.posY = XMVectorGetY(param->vector);
}
else
wiLua::SError(L, "SetPos(Vector pos) argument is not a vector!");
@@ -105,8 +105,8 @@ int wiSpriteFont_BindLua::SetSpacing(lua_State* L)
Vector_BindLua* param = Luna::lightcheck(L, 1);
if (param != nullptr)
{
- font.params.spacingX = (int)XMVectorGetX(param->vector);
- font.params.spacingY = (int)XMVectorGetY(param->vector);
+ font.params.spacingX = XMVectorGetX(param->vector);
+ font.params.spacingY = XMVectorGetY(param->vector);
}
else
wiLua::SError(L, "SetSpacing(Vector spacing) argument is not a vector!");
diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp
index eb8506673..c2d99f1c6 100644
--- a/WickedEngine/wiVersion.cpp
+++ b/WickedEngine/wiVersion.cpp
@@ -7,9 +7,9 @@ namespace wiVersion
// main engine core
const int major = 0;
// minor features, major updates
- const int minor = 40;
+ const int minor = 41;
// minor bug fixes, alterations, refactors, updates
- const int revision = 9;
+ const int revision = 0;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
diff --git a/WickedEngine/wiWidget.cpp b/WickedEngine/wiWidget.cpp
index 15f904615..cda326484 100644
--- a/WickedEngine/wiWidget.cpp
+++ b/WickedEngine/wiWidget.cpp
@@ -30,7 +30,7 @@ wiWidget::wiWidget()
for (int i = IDLE; i < WIDGETSTATE_COUNT; ++i)
{
sprites[i].params.blendFlag = BLENDMODE_OPAQUE;
- sprites[i].params.enableBackgroundBlur(0); // enable gui background blur by default, use mip = 0
+ sprites[i].params.enableBackgroundBlur();
}
}
@@ -76,8 +76,8 @@ void wiWidget::Update(wiGUI* gui, float dt)
sprites[i].params.siz.y = scale.y;
sprites[i].params.fade = IsEnabled() ? 0.0f : 0.5f;
}
- font.params.posX = (int)translation.x;
- font.params.posY = (int)translation.y;
+ font.params.posX = translation.x;
+ font.params.posY = translation.y;
}
void wiWidget::RenderTooltip(const wiGUI* gui, CommandList cmd) const
{
@@ -99,7 +99,7 @@ void wiWidget::RenderTooltip(const wiGUI* gui, CommandList cmd) const
{
tooltipPos.y += 40;
}
- wiFontParams fontProps = wiFontParams((int)tooltipPos.x, (int)tooltipPos.y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP);
+ wiFontParams fontProps = wiFontParams(tooltipPos.x, tooltipPos.y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP);
fontProps.color = wiColor(25, 25, 25, 255);
wiSpriteFont tooltipFont = wiSpriteFont(tooltip, fontProps);
if (!scriptTip.empty())
@@ -107,11 +107,11 @@ void wiWidget::RenderTooltip(const wiGUI* gui, CommandList cmd) const
tooltipFont.SetText(tooltip + "\n" + scriptTip);
}
- int textWidth = tooltipFont.textWidth();
+ float textWidth = tooltipFont.textWidth();
if (tooltipPos.x > wiRenderer::GetDevice()->GetScreenWidth() - textWidth)
{
tooltipPos.x -= textWidth + 10;
- tooltipFont.params.posX = (int)tooltipPos.x;
+ tooltipFont.params.posX = tooltipPos.x;
}
static const float _border = 2;
@@ -357,27 +357,27 @@ void wiButton::Update(wiGUI* gui, float dt)
switch (font.params.h_align)
{
case WIFALIGN_LEFT:
- font.params.posX = (int)(translation.x + 2);
+ font.params.posX = translation.x + 2;
break;
case WIFALIGN_RIGHT:
- font.params.posX = (int)(translation.x + scale.x - 2);
+ font.params.posX = translation.x + scale.x - 2;
break;
case WIFALIGN_CENTER:
default:
- font.params.posX = (int)(translation.x + scale.x * 0.5f);
+ font.params.posX = translation.x + scale.x * 0.5f;
break;
}
switch (font.params.v_align)
{
case WIFALIGN_TOP:
- font.params.posY = (int)(translation.y + 2);
+ font.params.posY = translation.y + 2;
break;
case WIFALIGN_BOTTOM:
- font.params.posY = (int)(translation.y + scale.y - 2);
+ font.params.posY = translation.y + scale.y - 2;
break;
case WIFALIGN_CENTER:
default:
- font.params.posY = (int)(translation.y + scale.y * 0.5f);
+ font.params.posY = translation.y + scale.y * 0.5f;
break;
}
}
@@ -436,9 +436,34 @@ void wiLabel::Update(wiGUI* gui, float dt)
// ...
}
- font.params.posX = (int)translation.x + 2;
- font.params.posY = (int)translation.y + 2;
- font.params.h_wrap = (int)scale.x;
+ font.params.h_wrap = scale.x;
+
+ switch (font.params.h_align)
+ {
+ case WIFALIGN_LEFT:
+ font.params.posX = translation.x + 2;
+ break;
+ case WIFALIGN_RIGHT:
+ font.params.posX = translation.x + scale.x - 2;
+ break;
+ case WIFALIGN_CENTER:
+ default:
+ font.params.posX = translation.x + scale.x * 0.5f;
+ break;
+ }
+ switch (font.params.v_align)
+ {
+ case WIFALIGN_TOP:
+ font.params.posY = translation.y + 2;
+ break;
+ case WIFALIGN_BOTTOM:
+ font.params.posY = translation.y + scale.y - 2;
+ break;
+ case WIFALIGN_CENTER:
+ default:
+ font.params.posY = translation.y + scale.y * 0.5f;
+ break;
+ }
}
void wiLabel::Render(const wiGUI* gui, CommandList cmd) const
{
@@ -583,10 +608,10 @@ void wiTextInputField::Update(wiGUI* gui, float dt)
}
}
- font.params.posX = (int)translation.x + 2;
- font.params.posY = (int)(translation.y + scale.y * 0.5f);
- font_description.params.posX = (int)translation.x - 2;
- font_description.params.posY = (int)(translation.y + scale.y * 0.5f);
+ font.params.posX = translation.x + 2;
+ font.params.posY = translation.y + scale.y * 0.5f;
+ font_description.params.posX = translation.x - 2;
+ font_description.params.posY = translation.y + scale.y * 0.5f;
if (state == ACTIVE)
{
@@ -675,7 +700,6 @@ wiSlider::wiSlider(float start, float end, float defaultValue, float step, const
for (int i = IDLE; i < WIDGETSTATE_COUNT; ++i)
{
sprites_knob[i].params = sprites[i].params;
- sprites_knob[i].params.siz.x = 16;
}
sprites[IDLE].params.color = wiColor(60, 60, 60, 200);
@@ -709,7 +733,7 @@ void wiSlider::Update(wiGUI* gui, float dt)
wiWidget::Update(gui, dt);
valueInputField->Detach();
- valueInputField->SetSize(XMFLOAT2(40, scale.y));
+ valueInputField->SetSize(XMFLOAT2(40.0f, scale.y));
valueInputField->SetPos(XMFLOAT2(translation.x + scale.x + 2, translation.y));
valueInputField->AttachTo(this);
@@ -720,6 +744,7 @@ void wiSlider::Update(wiGUI* gui, float dt)
for (int i = 0; i < WIDGETSTATE_COUNT; ++i)
{
+ sprites_knob[i].params.siz.x = 16.0f;
valueInputField->SetColor(wiColor::fromFloat4(this->sprites_knob[i].params.color), (WIDGETSTATE)i);
}
valueInputField->font.params.color = this->font.params.color;
@@ -803,7 +828,7 @@ void wiSlider::Update(wiGUI* gui, float dt)
valueInputField->SetValue(value);
}
- font.params.posY = (int)(translation.y + scale.y * 0.5f);
+ font.params.posY = translation.y + scale.y * 0.5f;
const float knobWidth = sprites_knob[state].params.siz.x;
const float knobWidthHalf = knobWidth * 0.5f;
@@ -934,7 +959,7 @@ void wiCheckBox::Update(wiGUI* gui, float dt)
}
}
- font.params.posY = (int)(translation.y + scale.y * 0.5f);
+ font.params.posY = translation.y + scale.y * 0.5f;
sprites_check[state].params.pos.x = translation.x + scale.x * 0.25f;
sprites_check[state].params.pos.y = translation.y + scale.y * 0.25f;
@@ -1146,7 +1171,7 @@ void wiComboBox::Update(wiGUI* gui, float dt)
}
}
- font.params.posY = (int)(translation.y + sprites[state].params.siz.y * 0.5f);
+ font.params.posY = translation.y + sprites[state].params.siz.y * 0.5f;
}
void wiComboBox::Render(const wiGUI* gui, CommandList cmd) const
{
@@ -1226,7 +1251,7 @@ void wiComboBox::Render(const wiGUI* gui, CommandList cmd) const
if (selected >= 0)
{
- wiFont::Draw(items[selected], wiFontParams((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0,
+ wiFont::Draw(items[selected], wiFontParams(translation.x + scale.x*0.5f, translation.y + scale.y*0.5f, WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER,
font.params.color, font.params.shadowColor), cmd);
}
@@ -1293,7 +1318,7 @@ void wiComboBox::Render(const wiGUI* gui, CommandList cmd) const
}
}
wiImage::Draw(wiTextureHelper::getWhite(), fx, cmd);
- wiFont::Draw(items[i], wiFontParams((int)(translation.x + scale.x*0.5f), (int)(translation.y + scale.y*0.5f + GetItemOffset(i)), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER, 0, 0,
+ wiFont::Draw(items[i], wiFontParams(translation.x + scale.x*0.5f, translation.y + scale.y*0.5f + GetItemOffset(i), WIFONTSIZE_DEFAULT, WIFALIGN_CENTER, WIFALIGN_CENTER,
font.params.color, font.params.shadowColor), cmd);
}
}
@@ -1370,7 +1395,7 @@ int wiComboBox::GetSelected() const
-static const float windowcontrolSize = 20.0f;
+inline float windowcontrolSize() { return 20.0f; }
wiWindow::wiWindow(wiGUI* gui, const std::string& name, bool window_controls) : gui(gui)
{
assert(gui != nullptr && "Ivalid GUI!");
@@ -1526,42 +1551,42 @@ void wiWindow::Update(wiGUI* gui, float dt)
if (moveDragger != nullptr)
{
moveDragger->Detach();
- moveDragger->SetSize(XMFLOAT2(scale.x - windowcontrolSize * 3, windowcontrolSize));
- moveDragger->SetPos(XMFLOAT2(translation.x + windowcontrolSize, translation.y));
+ moveDragger->SetSize(XMFLOAT2(scale.x - windowcontrolSize() * 3, windowcontrolSize()));
+ moveDragger->SetPos(XMFLOAT2(translation.x + windowcontrolSize(), translation.y));
moveDragger->AttachTo(this);
}
if (closeButton != nullptr)
{
closeButton->Detach();
- closeButton->SetSize(XMFLOAT2(windowcontrolSize, windowcontrolSize));
- closeButton->SetPos(XMFLOAT2(translation.x + scale.x - windowcontrolSize, translation.y));
+ closeButton->SetSize(XMFLOAT2(windowcontrolSize(), windowcontrolSize()));
+ closeButton->SetPos(XMFLOAT2(translation.x + scale.x - windowcontrolSize(), translation.y));
closeButton->AttachTo(this);
}
if (minimizeButton != nullptr)
{
minimizeButton->Detach();
- minimizeButton->SetSize(XMFLOAT2(windowcontrolSize, windowcontrolSize));
- minimizeButton->SetPos(XMFLOAT2(translation.x + scale.x - windowcontrolSize * 2, translation.y));
+ minimizeButton->SetSize(XMFLOAT2(windowcontrolSize(), windowcontrolSize()));
+ minimizeButton->SetPos(XMFLOAT2(translation.x + scale.x - windowcontrolSize() * 2, translation.y));
minimizeButton->AttachTo(this);
}
if (resizeDragger_UpperLeft != nullptr)
{
resizeDragger_UpperLeft->Detach();
- resizeDragger_UpperLeft->SetSize(XMFLOAT2(windowcontrolSize, windowcontrolSize));
+ resizeDragger_UpperLeft->SetSize(XMFLOAT2(windowcontrolSize(), windowcontrolSize()));
resizeDragger_UpperLeft->SetPos(XMFLOAT2(translation.x, translation.y));
resizeDragger_UpperLeft->AttachTo(this);
}
if (resizeDragger_BottomRight != nullptr)
{
resizeDragger_BottomRight->Detach();
- resizeDragger_BottomRight->SetSize(XMFLOAT2(windowcontrolSize, windowcontrolSize));
- resizeDragger_BottomRight->SetPos(XMFLOAT2(translation.x + scale.x - windowcontrolSize, translation.y + scale.y - windowcontrolSize));
+ resizeDragger_BottomRight->SetSize(XMFLOAT2(windowcontrolSize(), windowcontrolSize()));
+ resizeDragger_BottomRight->SetPos(XMFLOAT2(translation.x + scale.x - windowcontrolSize(), translation.y + scale.y - windowcontrolSize()));
resizeDragger_BottomRight->AttachTo(this);
}
if (label != nullptr)
{
label->Detach();
- label->SetSize(XMFLOAT2(scale.x, windowcontrolSize));
+ label->SetSize(XMFLOAT2(scale.x, windowcontrolSize()));
label->SetPos(XMFLOAT2(translation.x, translation.y));
label->AttachTo(this);
}
@@ -2485,8 +2510,8 @@ void wiColorPicker::OnColorChanged(function func)
-static const float item_height = 20;
-static const float tree_scrollbar_width = 12;
+inline float item_height() { return 20.0f; }
+inline float tree_scrollbar_width() { return 12.0f; }
wiTreeList::wiTreeList(const std::string& name)
{
SetName(name);
@@ -2506,28 +2531,28 @@ wiTreeList::~wiTreeList()
}
float wiTreeList::GetItemOffset(int index) const
{
- return 2 + list_offset + index * item_height;
+ return 2 + list_offset + index * item_height();
}
Hitbox2D wiTreeList::GetHitbox_ListArea() const
{
- return Hitbox2D(XMFLOAT2(translation.x, translation.y + item_height + 1), XMFLOAT2(scale.x - tree_scrollbar_width - 1, scale.y - item_height - 1));
+ return Hitbox2D(XMFLOAT2(translation.x, translation.y + item_height() + 1), XMFLOAT2(scale.x - tree_scrollbar_width() - 1, scale.y - item_height() - 1));
}
Hitbox2D wiTreeList::GetHitbox_Item(int visible_count, int level) const
{
- XMFLOAT2 pos = XMFLOAT2(translation.x + 2 + level * item_height, translation.y + GetItemOffset(visible_count) + item_height * 0.5f);
+ XMFLOAT2 pos = XMFLOAT2(translation.x + 2 + level * item_height(), translation.y + GetItemOffset(visible_count) + item_height() * 0.5f);
Hitbox2D hitbox;
- hitbox.pos = XMFLOAT2(pos.x + item_height * 0.5f + 2, pos.y - item_height * 0.5f);
- hitbox.siz = XMFLOAT2(scale.x - 2 - item_height * 0.5f - 2 - level * item_height - tree_scrollbar_width - 2, item_height);
+ hitbox.pos = XMFLOAT2(pos.x + item_height() * 0.5f + 2, pos.y - item_height() * 0.5f);
+ hitbox.siz = XMFLOAT2(scale.x - 2 - item_height() * 0.5f - 2 - level * item_height() - tree_scrollbar_width() - 2, item_height());
return hitbox;
}
Hitbox2D wiTreeList::GetHitbox_ItemOpener(int visible_count, int level) const
{
- XMFLOAT2 pos = XMFLOAT2(translation.x + 2 + level * item_height, translation.y + GetItemOffset(visible_count) + item_height * 0.5f);
- return Hitbox2D(XMFLOAT2(pos.x, pos.y - item_height * 0.25f), XMFLOAT2(item_height * 0.5f, item_height * 0.5f));
+ XMFLOAT2 pos = XMFLOAT2(translation.x + 2 + level * item_height(), translation.y + GetItemOffset(visible_count) + item_height() * 0.5f);
+ return Hitbox2D(XMFLOAT2(pos.x, pos.y - item_height() * 0.25f), XMFLOAT2(item_height() * 0.5f, item_height() * 0.5f));
}
bool wiTreeList::HasScrollbar() const
{
- return scale.y < (int)items.size() * item_height;
+ return scale.y < (int)items.size() * item_height();
}
void wiTreeList::Update(wiGUI* gui, float dt)
{
@@ -2588,15 +2613,15 @@ void wiTreeList::Update(wiGUI* gui, float dt)
visible_count++;
parent_open = item.open;
parent_level = item.level;
- list_height += item_height;
+ list_height += item_height();
}
}
- const float scrollbar_begin = translation.y + item_height;
- const float scrollbar_end = scrollbar_begin + scale.y - item_height;
+ const float scrollbar_begin = translation.y + item_height();
+ const float scrollbar_end = scrollbar_begin + scale.y - item_height();
const float scrollbar_size = scrollbar_end - scrollbar_begin;
const float scrollbar_granularity = std::min(1.0f, scrollbar_size / list_height);
- scrollbar_height = std::max(tree_scrollbar_width, scrollbar_size * scrollbar_granularity);
+ scrollbar_height = std::max(tree_scrollbar_width(), scrollbar_size * scrollbar_granularity);
if (!click_down)
{
@@ -2604,8 +2629,8 @@ void wiTreeList::Update(wiGUI* gui, float dt)
}
Hitbox2D scroll_box;
- scroll_box.pos = XMFLOAT2(translation.x + scale.x - tree_scrollbar_width, translation.y + item_height + 1);
- scroll_box.siz = XMFLOAT2(tree_scrollbar_width, scale.y - item_height - 1);
+ scroll_box.pos = XMFLOAT2(translation.x + scale.x - tree_scrollbar_width(), translation.y + item_height() + 1);
+ scroll_box.siz = XMFLOAT2(tree_scrollbar_width(), scale.y - item_height() - 1);
if (scroll_box.intersects(pointerHitbox))
{
if (clicked)
@@ -2627,7 +2652,7 @@ void wiTreeList::Update(wiGUI* gui, float dt)
if (state == FOCUS)
{
- scrollbar_delta -= wiInput::GetPointer().z;
+ scrollbar_delta -= wiInput::GetPointer().z * 10;
}
scrollbar_delta = wiMath::Clamp(scrollbar_delta, 0, scrollbar_size - scrollbar_height);
scrollbar_value = wiMath::InverseLerp(scrollbar_begin, scrollbar_end, scrollbar_begin + scrollbar_delta);
@@ -2695,9 +2720,9 @@ void wiTreeList::Update(wiGUI* gui, float dt)
}
}
- sprites[state].params.siz.y = item_height;
- font.params.posX = (int)translation.x + 2;
- font.params.posY = (int)(translation.y + sprites[state].params.siz.y * 0.5f);
+ sprites[state].params.siz.y = item_height();
+ font.params.posX = translation.x + 2;
+ font.params.posY = translation.y + sprites[state].params.siz.y * 0.5f;
}
void wiTreeList::Render(const wiGUI* gui, CommandList cmd) const
{
@@ -2718,8 +2743,8 @@ void wiTreeList::Render(const wiGUI* gui, CommandList cmd) const
// scrollbar background
wiImageParams fx = sprites[state].params;
- fx.pos = XMFLOAT3(translation.x + scale.x - tree_scrollbar_width, translation.y + item_height + 1, 0);
- fx.siz = XMFLOAT2(tree_scrollbar_width, scale.y - item_height - 1);
+ fx.pos = XMFLOAT3(translation.x + scale.x - tree_scrollbar_width(), translation.y + item_height() + 1, 0);
+ fx.siz = XMFLOAT2(tree_scrollbar_width(), scale.y - item_height() - 1);
fx.color = sprites[IDLE].params.color;
wiImage::Draw(wiTextureHelper::getWhite(), fx, cmd);
@@ -2734,7 +2759,7 @@ void wiTreeList::Render(const wiGUI* gui, CommandList cmd) const
scrollbar_color = wiColor::White();
}
wiImage::Draw(wiTextureHelper::getWhite()
- , wiImageParams(translation.x + scale.x - tree_scrollbar_width, translation.y + item_height + 1 + scrollbar_delta, tree_scrollbar_width, scrollbar_height, scrollbar_color), cmd);
+ , wiImageParams(translation.x + scale.x - tree_scrollbar_width(), translation.y + item_height() + 1 + scrollbar_delta, tree_scrollbar_width(), scrollbar_height, scrollbar_color), cmd);
// list background
Hitbox2D itemlist_box = GetHitbox_ListArea();
@@ -2810,7 +2835,7 @@ void wiTreeList::Render(const wiGUI* gui, CommandList cmd) const
MiscCB cb;
cb.g_xColor = opener_highlight == i ? wiColor::White().toFloat4() : sprites[FOCUS].params.color;
- XMStoreFloat4x4(&cb.g_xTransform, XMMatrixScaling(item_height * 0.3f, item_height * 0.3f, 1) *
+ XMStoreFloat4x4(&cb.g_xTransform, XMMatrixScaling(item_height() * 0.3f, item_height() * 0.3f, 1) *
XMMatrixRotationZ(item.open ? XM_PIDIV2 : 0) *
XMMatrixTranslation(open_box.pos.x + open_box.siz.x * 0.5f, open_box.pos.y + open_box.siz.y * 0.25f, 0) *
Projection
@@ -2829,7 +2854,7 @@ void wiTreeList::Render(const wiGUI* gui, CommandList cmd) const
}
// Item name text:
- wiFont::Draw(item.name, wiFontParams((int)name_box.pos.x + 1, (int)(name_box.pos.y + name_box.siz.y * 0.5f), WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_CENTER, 0, 0,
+ wiFont::Draw(item.name, wiFontParams(name_box.pos.x + 1, name_box.pos.y + name_box.siz.y * 0.5f, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_CENTER,
font.params.color, font.params.shadowColor), cmd);
}
}
diff --git a/scripts/character_controller_tps.lua b/scripts/character_controller_tps.lua
index 925b88dfd..97f9726b5 100644
--- a/scripts/character_controller_tps.lua
+++ b/scripts/character_controller_tps.lua
@@ -412,7 +412,7 @@ runProcess(function()
main.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(24)
+ font.SetSize(14)
font.SetPos(Vector(10, GetScreenHeight() - 10))
font.SetAlign(WIFALIGN_LEFT, WIFALIGN_BOTTOM)
font.SetColor(0xFFADA3FF)
diff --git a/scripts/fighting_game.lua b/scripts/fighting_game.lua
index 5a160e5fc..14536dd9e 100644
--- a/scripts/fighting_game.lua
+++ b/scripts/fighting_game.lua
@@ -1946,7 +1946,7 @@ runProcess(function()
help_text = help_text .. "\n\t Revolver action: A, B, C, D (Hit action buttons in quick succession)"
help_text = help_text .. "\n\t Airborne heat: 2B, 8, 8C (Uppercut, then jump cancel into Air Kick)"
local font = SpriteFont(help_text);
- font.SetSize(20)
+ font.SetSize(14)
font.SetPos(Vector(10, GetScreenHeight() - 10))
font.SetAlign(WIFALIGN_LEFT, WIFALIGN_BOTTOM)
font.SetColor(0xFF4D21FF)
@@ -1954,7 +1954,7 @@ runProcess(function()
path.AddFont(font)
local info = SpriteFont("");
- info.SetSize(24)
+ info.SetSize(14)
info.SetPos(Vector(GetScreenWidth() / 2.5, GetScreenHeight() - 10))
info.SetAlign(WIFALIGN_LEFT, WIFALIGN_BOTTOM)
info.SetShadowColor(Vector(0,0,0,1))