Editor Asset explorer setup

This commit is contained in:
Nigel Barink 2022-11-10 21:50:27 +01:00
parent c57177a1a9
commit f7a85d53ab
13 changed files with 83 additions and 8 deletions

1
.gitattributes vendored
View File

@ -1,2 +1,3 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.xcf filter=lfs diff=lfs merge=lfs -text

BIN
Editor/rsc/AssetIcon.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Editor/rsc/AssetIcon.xcf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Editor/rsc/FodlerIcon.xcf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Editor/rsc/FolderIcon.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,4 +1,7 @@
#pragma once
#include "Project/Project.h"
struct EditorContext {
std::shared_ptr<Project> CurrentProject;

View File

@ -3,7 +3,7 @@
#include "../../YoggieEngine/src/Graphics/Memory/Framebuffer.h"
#include "../../YoggieEngine/src/PerfCounter.h"
#include "../../YoggieEngine/src/Scene/Entity.h"
#include "Project.h"
#include "Project/Project.h"
class EditorRuntime : public ApplicationRuntime {
@ -31,7 +31,6 @@ public:
auto& rendercube2 = cube2.AddComponent<Render3DComponent>();
rendercube2.mesh = *(Model->renderable->mesh);
// create an ambient light source
auto AmbientLight = MainScene.AddEntity("AmbientLight");
auto light = AmbientLight.AddComponent<LightComponent>();

View File

@ -3,6 +3,7 @@
#include <iostream>
#include "../../YoggieEngine/src/Scene/Components.h"
#include "../../YoggieEngine/src/Scene/Entity.h"
class Editor;
void ComponentView(const std::string& componentName, voidFunction func)
@ -169,7 +170,49 @@ void Console() {
}
void AssetsFinder() {
static YoggieEngine::Texture folderIcon ("rsc/folderIcon.png");
static YoggieEngine::Texture AssetIcon("rsc/assetIcon.png");
static int iconSize = 60;
ImGui::Begin("Asset-Finder", false);
ImGui::Dummy(ImVec2{ 128, 128 });
ImGui::DragInt("IconSize", &iconSize, 1, 30, 90);
if (ImGui::BeginTable("##resources", 3))
{
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.f, 0.f, 0.f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.f, 1.f, 1.f, 0.2f));
for (int row = 0; row < 4; row++) {
ImGui::TableNextRow();
for (int column = 0; column < 3; column++) {
ImGui::TableSetColumnIndex(column);
if (column % 2) {
ImGui::ImageButton(
(ImTextureID)folderIcon.GetID(),
ImVec2{ (float)iconSize,(float)iconSize });
ImGui::Text("Folder %d", row);
}
else {
ImGui::ImageButton(
(ImTextureID)AssetIcon.GetID(),
ImVec2{ (float)iconSize, (float)iconSize });
ImGui::Text("Asset %d", row);
}
}
}
ImGui::PopStyleColor(3);
ImGui::EndTable();
}
ImGui::End();
}

View File

@ -15,7 +15,7 @@ namespace YoggieEngine {
glGenTextures(1, &Id);
glBindTexture(GL_TEXTURE_2D, Id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);

View File

@ -6,7 +6,7 @@ namespace YoggieEngine {
void Bind();
void Unbind();
const unsigned int GetID() const { return Id; }
private:
unsigned int Id;
};

View File

@ -1,4 +1,5 @@
#pragma once
typedef uint64_t ENTITY_UUID;
namespace YoggieEngine {
class Scene;
class Entity {

View File

@ -0,0 +1,16 @@
#pragma once
#include <cstdint>
class UUID {
public:
static uint64_t Generate()
{
return ++last;
}
private:
static uint64_t last ;
};