Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
roby2014 committed Oct 4, 2023
1 parent 51cd43e commit 9e9d2a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
35 changes: 20 additions & 15 deletions engine/src/cubos/engine/tools/palette_editor/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
#include "imgui.h"

#include <cubos/core/data/old/debug_serializer.hpp>
#include <cubos/core/log.hpp>

#include <cubos/engine/assets/asset.hpp>
#include <cubos/engine/imgui/plugin.hpp>
#include <cubos/engine/voxels/palette.hpp>
#include <cubos/engine/tools/palette_editor/plugin.hpp>
#include <cubos/engine/renderer/plugin.hpp>
#include <cubos/engine/assets/asset.hpp>
#include <cubos/engine/tools/asset_explorer/plugin.hpp>
#include <cubos/engine/tools/palette_editor/plugin.hpp>
#include <cubos/engine/voxels/palette.hpp>
#include <cubos/engine/voxels/plugin.hpp>

#include "imgui.h"

using cubos::core::data::old::Debug;
using cubos::core::ecs::Read;
using cubos::core::ecs::Write;
using cubos::core::data::old::Debug;
using namespace cubos::engine;

struct SelectedPaletteInfo
{
VoxelPalette palette;
};

static void checkAssetEventSystem(cubos::core::ecs::EventReader<tools::AssetSelectedEvent> reader,
Read<Assets> assets, Write<Renderer>, Write<SelectedPaletteInfo> selectedPalette)
static void checkAssetEventSystem(cubos::core::ecs::EventReader<tools::AssetSelectedEvent> reader, Read<Assets> assets,
Write<SelectedPaletteInfo> selectedPalette)
{
for (const auto& event : reader)
{
Expand All @@ -34,27 +35,31 @@ static void checkAssetEventSystem(cubos::core::ecs::EventReader<tools::AssetSele
}
}

static void paletteEditor(Write<Renderer> renderer, Write<SelectedPaletteInfo> selectedPalette) {
static void paletteEditor(Write<Renderer> renderer, Write<SelectedPaletteInfo> selectedPalette)
{
auto& palette = selectedPalette->palette;

if (palette.data() == nullptr) {
if (palette.data() == nullptr)
{
return; // no data on the palette yet!
}

ImGui::Begin("Palette Editor");


for (uint16_t materialIndex = 1; materialIndex < palette.size(); ++materialIndex) {
for (uint16_t materialIndex = 1; materialIndex < palette.size(); ++materialIndex)
{
const VoxelMaterial& material = palette.get(materialIndex);

std::string label = "Material " + std::to_string(materialIndex);
if (ImGui::ColorEdit4(label.c_str(), (float*)&material.color.r)) {
if (ImGui::ColorEdit4(label.c_str(), (float*)&material.color.r))
{
VoxelMaterial newMaterial = material;
palette.set(materialIndex, newMaterial);
}
}

if (ImGui::Button("Set this Palette as default")) {
if (ImGui::Button("Set this Palette as default"))
{
CUBOS_INFO("New palette set: {}", Debug(palette));
(*renderer)->setPalette(palette);
}
Expand Down
3 changes: 2 additions & 1 deletion tools/tesseratos/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#include <cubos/engine/settings/settings.hpp>
#include <cubos/engine/tools/asset_explorer/plugin.hpp>
#include <cubos/engine/tools/entity_inspector/plugin.hpp>
#include <cubos/engine/tools/palette_editor/plugin.hpp>
#include <cubos/engine/tools/scene_editor/plugin.hpp>
#include <cubos/engine/tools/settings_inspector/plugin.hpp>
#include <cubos/engine/tools/world_inspector/plugin.hpp>
#include <cubos/engine/transform/plugin.hpp>
#include <cubos/engine/tools/palette_editor/plugin.hpp>


using cubos::core::ecs::Commands;
using cubos::core::ecs::Write;
Expand Down

0 comments on commit 9e9d2a6

Please sign in to comment.