mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-27 16:17:12 +03:00
Merge branch 'main' of https://github.com/antopilo/Nuake
# Conflicts: # Editor/Editor.cpp
This commit is contained in:
@@ -34,11 +34,12 @@
|
||||
|
||||
#include "src/Misc/WindowTheming.h"
|
||||
|
||||
const std::string WindowTitle = "Nuake Editor";
|
||||
std::string WindowTitle = "Nuake Editor ";
|
||||
|
||||
int ApplicationMain(int argc, char* argv[])
|
||||
{
|
||||
bool playMode = false;
|
||||
using namespace Nuake;
|
||||
|
||||
std::string projectPath = "";
|
||||
|
||||
Vector2 editorResolution = Vector2(1280, 720);
|
||||
@@ -48,15 +49,6 @@ int ApplicationMain(int argc, char* argv[])
|
||||
char* arg = argv[i];
|
||||
std::string args = std::string(arg);
|
||||
|
||||
if (args == "--play")
|
||||
{
|
||||
if (argc > 2)
|
||||
{
|
||||
projectPath = std::string(argv[i + 1]);
|
||||
}
|
||||
playMode = true;
|
||||
}
|
||||
|
||||
if (args == "--resolution")
|
||||
{
|
||||
if (argc >= i + 1)
|
||||
@@ -84,7 +76,7 @@ int ApplicationMain(int argc, char* argv[])
|
||||
}
|
||||
|
||||
bool shouldLoadProject = false;
|
||||
if (!playMode && argc > 1)
|
||||
if (argc > 1)
|
||||
{
|
||||
shouldLoadProject = true;
|
||||
projectPath = std::string(argv[1]);
|
||||
@@ -136,8 +128,8 @@ int ApplicationMain(int argc, char* argv[])
|
||||
|
||||
WindowTheming::SetWindowDarkMode(window);
|
||||
|
||||
Nuake::EditorInterface editor;
|
||||
editor.BuildFonts();
|
||||
Nuake::EditorInterface editor;
|
||||
editor.BuildFonts();
|
||||
|
||||
if (monitorIdx != -1)
|
||||
{
|
||||
@@ -173,45 +165,45 @@ int ApplicationMain(int argc, char* argv[])
|
||||
Nuake::Engine::Tick();
|
||||
Nuake::Engine::Draw();
|
||||
|
||||
Timestep ts = Nuake::Engine::GetTimestep();
|
||||
Timestep ts = Nuake::Engine::GetTimestep();
|
||||
|
||||
Nuake::Vector2 WindowSize = window->GetSize();
|
||||
glViewport(0, 0, WindowSize.x, WindowSize.y);
|
||||
Nuake::Renderer2D::BeginDraw(WindowSize);
|
||||
Nuake::Vector2 WindowSize = window->GetSize();
|
||||
glViewport(0, 0, WindowSize.x, WindowSize.y);
|
||||
Nuake::Renderer2D::BeginDraw(WindowSize);
|
||||
|
||||
auto sceneFramebuffer = window->GetFrameBuffer();
|
||||
sceneFramebuffer->Bind();
|
||||
auto sceneFramebuffer = window->GetFrameBuffer();
|
||||
sceneFramebuffer->Bind();
|
||||
{
|
||||
Ref<Nuake::Scene> currentScene = Nuake::Engine::GetCurrentScene();
|
||||
Ref<EditorCamera> camera;
|
||||
if (currentScene)
|
||||
{
|
||||
Ref<Nuake::Scene> currentScene = Nuake::Engine::GetCurrentScene();
|
||||
Ref<EditorCamera> camera;
|
||||
if (currentScene)
|
||||
camera = currentScene->m_EditorCamera;
|
||||
}
|
||||
|
||||
if (currentScene && !Nuake::Engine::IsPlayMode())
|
||||
{
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
|
||||
if (editor.ShouldDrawAxis())
|
||||
{
|
||||
camera = currentScene->m_EditorCamera;
|
||||
//gizmoDrawer.DrawAxis(currentScene);
|
||||
}
|
||||
|
||||
if (currentScene && !Nuake::Engine::IsPlayMode())
|
||||
if (editor.ShouldDrawCollision())
|
||||
{
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
|
||||
if (editor.ShouldDrawAxis())
|
||||
{
|
||||
//gizmoDrawer.DrawAxis(currentScene);
|
||||
}
|
||||
|
||||
if (editor.ShouldDrawCollision())
|
||||
{
|
||||
gizmoDrawer.DrawGizmos(currentScene);
|
||||
}
|
||||
gizmoDrawer.DrawGizmos(currentScene);
|
||||
}
|
||||
}
|
||||
sceneFramebuffer->Unbind();
|
||||
|
||||
editor.Update(ts);
|
||||
editor.Draw();
|
||||
|
||||
Nuake::Engine::EndDraw();
|
||||
}
|
||||
sceneFramebuffer->Unbind();
|
||||
|
||||
editor.Update(ts);
|
||||
editor.Draw();
|
||||
|
||||
Nuake::Engine::EndDraw();
|
||||
}
|
||||
|
||||
|
||||
Nuake::Engine::Close();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "src/Scene/Systems/QuakeMapBuilder.h"
|
||||
#include <src/Core/FileSystem.h>
|
||||
|
||||
|
||||
class QuakeMapPanel : ComponentPanel {
|
||||
|
||||
public:
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <src/Scene/Components/ModelComponent.h>
|
||||
#include <src/Scene/Components/ParticleEmitterComponent.h>
|
||||
#include <src/Scene/Components/BoneComponent.h>
|
||||
#include <src/Scene/Components/AudioEmitterComponent.h>
|
||||
|
||||
GizmoDrawer::GizmoDrawer()
|
||||
{
|
||||
@@ -367,6 +368,26 @@ void GizmoDrawer::DrawGizmos(Ref<Scene> scene)
|
||||
renderList.AddToRenderList(Renderer::QuadMesh, particleTransform);
|
||||
}
|
||||
|
||||
renderList.Flush(gizmoShader, true);
|
||||
|
||||
auto audioView = scene->m_Registry.view<TransformComponent, AudioEmitterComponent>();
|
||||
for (auto e : audioView)
|
||||
{
|
||||
gizmoShader->SetUniformTex("gizmo_texture", TextureManager::Get()->GetTexture("resources/Gizmos/speaker.png").get());
|
||||
auto [transformComponent, audioEmitterComponent] = scene->m_Registry.get<TransformComponent, AudioEmitterComponent>(e);
|
||||
|
||||
auto initialTransform = transformComponent.GetGlobalTransform();
|
||||
Matrix4 transform = initialTransform;
|
||||
transform = glm::inverse(scene->m_EditorCamera->GetTransform());
|
||||
|
||||
// Translation
|
||||
const Vector3& globalPosition = transformComponent.GetGlobalPosition();
|
||||
transform[3] = initialTransform[3];
|
||||
transform = glm::scale(transform, Vector3(0.5f, 0.5f, 0.5f));
|
||||
|
||||
renderList.AddToRenderList(Renderer::QuadMesh, transform);
|
||||
}
|
||||
|
||||
renderList.Flush(gizmoShader, true);
|
||||
|
||||
RenderCommand::Enable(RendererEnum::DEPTH_TEST);
|
||||
|
||||
@@ -8,12 +8,9 @@
|
||||
#include <src/Resource/ResourceLoader.h>
|
||||
#include <src/Resource/FontAwesome5.h>
|
||||
#include <src/Scripting/WrenScript.h>
|
||||
|
||||
#include <Engine.h>
|
||||
|
||||
#include "src/Scene/Components/WrenScriptComponent.h"
|
||||
#include "src/Scene/Components/ParticleEmitterComponent.h"
|
||||
|
||||
|
||||
EditorSelectionPanel::EditorSelectionPanel()
|
||||
{
|
||||
}
|
||||
@@ -118,9 +115,10 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity)
|
||||
|
||||
void EditorSelectionPanel::DrawAddComponentMenu(Nuake::Entity entity)
|
||||
{
|
||||
if (entity.HasComponent<Nuake::NameComponent>())
|
||||
using namespace Nuake;
|
||||
if (entity.HasComponent<NameComponent>())
|
||||
{
|
||||
auto& entityName = entity.GetComponent<Nuake::NameComponent>().Name;
|
||||
auto& entityName = entity.GetComponent<NameComponent>().Name;
|
||||
ImGuiTextSTD("##Name", entityName);
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -129,27 +127,29 @@ void EditorSelectionPanel::DrawAddComponentMenu(Nuake::Entity entity)
|
||||
|
||||
if (ImGui::BeginPopup("ComponentPopup"))
|
||||
{
|
||||
MenuItemComponent("Wren Script", Nuake::WrenScriptComponent)
|
||||
MenuItemComponent("Camera", Nuake::CameraComponent)
|
||||
MenuItemComponent("Light", Nuake::LightComponent)
|
||||
MenuItemComponent("Wren Script", WrenScriptComponent);
|
||||
MenuItemComponent("Camera", CameraComponent);
|
||||
MenuItemComponent("Light", LightComponent);
|
||||
ImGui::Separator();
|
||||
MenuItemComponent("Model", Nuake::ModelComponent)
|
||||
MenuItemComponent("Skinned Model", Nuake::SkinnedModelComponent)
|
||||
MenuItemComponent("Bone", Nuake::BoneComponent)
|
||||
MenuItemComponent("Model", ModelComponent);
|
||||
MenuItemComponent("Skinned Model", SkinnedModelComponent);
|
||||
MenuItemComponent("Bone", BoneComponent)
|
||||
ImGui::Separator();
|
||||
MenuItemComponent("Sprite", Nuake::SpriteComponent)
|
||||
MenuItemComponent("Particle Emitter", Nuake::ParticleEmitterComponent)
|
||||
MenuItemComponent("Sprite", SpriteComponent)
|
||||
MenuItemComponent("Particle Emitter", ParticleEmitterComponent)
|
||||
ImGui::Separator();
|
||||
MenuItemComponent("Character Controller", Nuake::CharacterControllerComponent)
|
||||
MenuItemComponent("Rigid body", Nuake::RigidBodyComponent)
|
||||
MenuItemComponent("Character Controller", CharacterControllerComponent)
|
||||
MenuItemComponent("Rigid body", RigidBodyComponent)
|
||||
ImGui::Separator();
|
||||
MenuItemComponent("Box collider", Nuake::BoxColliderComponent)
|
||||
MenuItemComponent("Capsule collider", Nuake::CapsuleColliderComponent)
|
||||
MenuItemComponent("Cylinder collider", Nuake::CylinderColliderComponent)
|
||||
MenuItemComponent("Sphere collider", Nuake::SphereColliderComponent)
|
||||
MenuItemComponent("Mesh collider", Nuake::MeshColliderComponent)
|
||||
MenuItemComponent("Box collider", BoxColliderComponent)
|
||||
MenuItemComponent("Capsule collider", CapsuleColliderComponent)
|
||||
MenuItemComponent("Cylinder collider", CylinderColliderComponent)
|
||||
MenuItemComponent("Sphere collider", SphereColliderComponent)
|
||||
MenuItemComponent("Mesh collider", MeshColliderComponent)
|
||||
ImGui::Separator();
|
||||
MenuItemComponent("Quake map", Nuake::QuakeMapComponent)
|
||||
MenuItemComponent("Quake map", QuakeMapComponent);
|
||||
ImGui::Separator();
|
||||
MenuItemComponent("Audio Emitter", AudioEmitterComponent);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
Reference in New Issue
Block a user