show game tablet
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "Tools.h"
|
||||
|
||||
#include "bx/filepath.h"
|
||||
#include "bx/math.h"
|
||||
#include "bx/timer.h"
|
||||
#include <imgui.h>
|
||||
#include <tracy/Tracy.hpp>
|
||||
@@ -34,8 +35,22 @@ namespace Tools
|
||||
return "---";
|
||||
}
|
||||
|
||||
void ModelDropdown(Gen::ModelHandle& modelHandle)
|
||||
bool EntityDataSettings(Gen::SavedEntityRenderData& data)
|
||||
{
|
||||
bool changed = false;
|
||||
changed |= ModelDropdown(data.Model);
|
||||
changed |= MaterialDropdown(data.Material);
|
||||
changed |= TextureDropdown(data.Texture);
|
||||
changed |= TransformUI(data.TF);
|
||||
changed |= ImGui::Checkbox("Visible", &data.Visible);
|
||||
changed |= ImGui::ColorEdit4("Color 1", &data.BaseColor.x);
|
||||
changed |= ImGui::ColorEdit4("Color 2", &data.HighlightColor.x);
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool ModelDropdown(Gen::ModelHandle& modelHandle)
|
||||
{
|
||||
bool changed = false;
|
||||
auto& R = Game::GameRendering::Get();
|
||||
const char* name = GetAssetPath(modelHandle.Asset);
|
||||
if (ImGui::BeginCombo("Model", name))
|
||||
@@ -45,14 +60,17 @@ namespace Tools
|
||||
if (ImGui::Selectable(GetAssetPath(R.Models[i].Handle.Asset), i == modelHandle.ModelIdx))
|
||||
{
|
||||
modelHandle = R.Models[i].Handle;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
void TextureDropdown(Gen::TextureHandle& texHandle)
|
||||
bool TextureDropdown(Gen::TextureHandle& texHandle)
|
||||
{
|
||||
bool changed = false;
|
||||
auto& R = Game::GameRendering::Get();
|
||||
const char* name = GetAssetPath(texHandle.Asset);
|
||||
if (ImGui::BeginCombo("Texture", name))
|
||||
@@ -65,6 +83,7 @@ namespace Tools
|
||||
if (ImGui::Selectable("", i == texHandle.TextureIdx, ImGuiSelectableFlags_AllowOverlap, {0, 64}))
|
||||
{
|
||||
texHandle = R.Textures[i].TexHandle;
|
||||
changed = true;
|
||||
}
|
||||
ImGui::SetCursorScreenPos(pos);
|
||||
ImGui::Image(R.Textures[i].RenderHandle.idx, {64, 64});
|
||||
@@ -74,7 +93,47 @@ namespace Tools
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool MaterialDropdown(Gen::EMaterial::Enum& material)
|
||||
{
|
||||
bool changed = false;
|
||||
const char* selectedText = "---";
|
||||
if (material < Gen::EMaterial::EntryCount)
|
||||
{
|
||||
selectedText = Gen::EMaterial::EntryNames[material];
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Material", selectedText))
|
||||
{
|
||||
for (int32_t i = 0; i < Gen::EMaterial::EntryCount; ++i)
|
||||
{
|
||||
if (ImGui::Selectable(Gen::EMaterial::EntryNames[i], i == material))
|
||||
{
|
||||
material = (Gen::EMaterial::Enum)i;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool TransformUI(Gen::Transform& transform)
|
||||
{
|
||||
bool changed = false;
|
||||
changed |= ImGui::DragFloat3("Pos", &transform.Position.x, 0.1f);
|
||||
Vec3 euler = EulerFromRotation(transform.Rotation);
|
||||
if (ImGui::DragFloat3("Rot", &euler.x, 0.1f))
|
||||
{
|
||||
transform.Rotation = RotationFromEuler(euler);
|
||||
changed = true;
|
||||
}
|
||||
changed |= ImGui::DragFloat3("Scale", &transform.Scale.x, 0.01f);
|
||||
return changed;
|
||||
}
|
||||
|
||||
void RenderDebugUI(Game::GameRendering& rendering)
|
||||
{
|
||||
auto& time = Game::GetInstance().Time;
|
||||
@@ -162,13 +221,22 @@ namespace Tools
|
||||
ImGui::Checkbox("Show ImGui Demo", &debug.ShowImguiDemo);
|
||||
ImGui::Checkbox("Show Stats", &debug.ShowStats);
|
||||
if (debug.ShowImguiDemo) ImGui::ShowDemoWindow(&debug.ShowImguiDemo);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Entity Groups");
|
||||
ImGui::Checkbox("Cubes", &level.Cubes.IsEnabled);
|
||||
ImGui::Checkbox("Tests", &level.Tests.IsEnabled);
|
||||
ImGui::Checkbox("PuzzleTiles", &level.PuzzleTiles.IsEnabled);
|
||||
ImGui::Checkbox("UIQuads", &level.UIQuads.IsEnabled);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Game Tablet");
|
||||
Tools::EntityDataSettings(player.Config.TabletRenderData);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Dithergen"))
|
||||
{
|
||||
DitherGen(rendering.DitherTextures, rendering.DitherRecursion);
|
||||
|
||||
Reference in New Issue
Block a user