Some component and rendering cleanup
This commit is contained in:
@@ -4,15 +4,37 @@
|
||||
|
||||
#include "engine/gameobjects/components/ModelComponent.hpp"
|
||||
|
||||
#include "engine/gameobjects/components/drawers.hpp"
|
||||
#include "engine/model/Model.hpp"
|
||||
#include "gui/safe_include.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
#ifdef TITOR_EDITOR
|
||||
void ModelComponent::drawImGui()
|
||||
{
|
||||
if ( ImGui::CollapsingHeader( "Model Component", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_DefaultOpen ) )
|
||||
{
|
||||
ImGui::Text( "MODEL COMPONENT WOOOOOO" );
|
||||
}
|
||||
drawComponentTransform( m_transform );
|
||||
|
||||
ImGui::Text( "MODEL COMPONENT WOOOOOO" );
|
||||
}
|
||||
|
||||
std::string_view ModelComponent::name() const
|
||||
{
|
||||
if ( m_model )
|
||||
return m_model->getName();
|
||||
else
|
||||
return "Empty Model";
|
||||
}
|
||||
#endif
|
||||
|
||||
Model* ModelComponent::operator->()
|
||||
{
|
||||
return m_model.get();
|
||||
}
|
||||
|
||||
const Model* ModelComponent::operator->() const
|
||||
{
|
||||
return m_model.get();
|
||||
}
|
||||
} // namespace fgl::engine
|
||||
|
||||
@@ -18,11 +18,9 @@
|
||||
#include "engine/debug/DEBUG_NAMES.hpp"
|
||||
#include "engine/descriptors/DescriptorPool.hpp"
|
||||
#include "engine/model/Model.hpp"
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/Renderer.hpp"
|
||||
#include "engine/tree/octtree/OctTreeNode.hpp"
|
||||
#include "gui_window_names.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "safe_include.hpp"
|
||||
|
||||
namespace fgl::engine::gui
|
||||
@@ -207,30 +205,6 @@ namespace fgl::engine::gui
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void drawObject( GameObject& game_object )
|
||||
{
|
||||
static std::string name_input_temp { "" };
|
||||
name_input_temp = game_object.getName();
|
||||
ImGui::InputText( "Name", &name_input_temp );
|
||||
if ( game_object.getName() != name_input_temp ) game_object.setName( name_input_temp );
|
||||
|
||||
// Transform - Position
|
||||
dragFloat3( "Position", game_object.getTransform().translation.vec() );
|
||||
|
||||
dragFloat3Rot( "Rotation", game_object.getRotation() );
|
||||
|
||||
dragFloat3( "Scale", game_object.getScale() );
|
||||
}
|
||||
|
||||
void drawComponents( const GameObject& game_object )
|
||||
{
|
||||
for ( ComponentEditorInterface* component : game_object.getComponents() )
|
||||
{
|
||||
ImGui::Separator();
|
||||
component->drawImGui();
|
||||
}
|
||||
}
|
||||
|
||||
void drawEntityInfo( [[maybe_unused]] FrameInfo& info )
|
||||
{
|
||||
ZoneScoped;
|
||||
@@ -243,7 +217,7 @@ namespace fgl::engine::gui
|
||||
}
|
||||
|
||||
drawObject( *selected_object );
|
||||
drawComponents( *selected_object );
|
||||
drawComponentsList( *selected_object );
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
class GameObject;
|
||||
class Device;
|
||||
class Renderer;
|
||||
class Window;
|
||||
@@ -23,6 +24,10 @@ namespace fgl::engine::gui
|
||||
void drawEntityInfo( FrameInfo& );
|
||||
void drawFilesystemGUI( FrameInfo& info );
|
||||
|
||||
void drawObject( GameObject& game_object );
|
||||
void drawComponentsList( GameObject& game_object );
|
||||
void drawSelectedComponent();
|
||||
|
||||
void drawCameraOutputs( FrameInfo& info );
|
||||
|
||||
void drawStats( const FrameInfo& info );
|
||||
|
||||
46
src/editor/src/gui/drawGameObject.cpp
Normal file
46
src/editor/src/gui/drawGameObject.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Created by kj16609 on 8/13/24.
|
||||
//
|
||||
|
||||
#include "engine/gameobjects/GameObject.hpp"
|
||||
#include "gui/helpers.hpp"
|
||||
|
||||
namespace fgl::engine::gui
|
||||
{
|
||||
void drawObject( GameObject& game_object )
|
||||
{
|
||||
static std::string name_input_temp { "" };
|
||||
name_input_temp = game_object.getName();
|
||||
ImGui::InputText( "Name", &name_input_temp );
|
||||
if ( game_object.getName() != name_input_temp ) game_object.setName( name_input_temp );
|
||||
|
||||
// Transform - Position
|
||||
dragFloat3( "Position", game_object.getTransform().translation.vec() );
|
||||
|
||||
dragFloat3Rot( "Rotation", game_object.getRotation() );
|
||||
|
||||
dragFloat3( "Scale", game_object.getScale() );
|
||||
}
|
||||
|
||||
static GameObjectComponentPtr selected_component { nullptr };
|
||||
|
||||
void drawComponentsList( GameObject& game_object )
|
||||
{
|
||||
ImGui::SeparatorText( "Components" );
|
||||
|
||||
for ( GameObjectComponentPtr component : game_object.getComponents() )
|
||||
{
|
||||
component->drawNode( selected_component );
|
||||
}
|
||||
|
||||
if ( selected_component )
|
||||
{
|
||||
ImGui::SeparatorText( "Selected Component" );
|
||||
|
||||
ImGui::PushID( ImGui::GetID( "ComponentEditor" ) );
|
||||
selected_component->drawImGui();
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fgl::engine::gui
|
||||
@@ -67,12 +67,8 @@ namespace fgl::engine
|
||||
|
||||
void loadGameObjects();
|
||||
|
||||
#ifdef TITOR_EDITOR
|
||||
|
||||
public:
|
||||
|
||||
#endif
|
||||
|
||||
FGL_FORCE_INLINE_FLATTEN void hookInitImGui( const std::function< void( Window&, Renderer& ) >& func )
|
||||
{
|
||||
func( m_window, m_renderer );
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "camera/Camera.hpp"
|
||||
#include "camera/CameraSwapchain.hpp"
|
||||
#include "pipeline/Pipeline.hpp"
|
||||
#include "rendering/pipelines/Pipeline.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
#include "descriptors/Descriptor.hpp"
|
||||
#include "descriptors/DescriptorSetLayout.hpp"
|
||||
#include "pipeline/Pipeline.hpp"
|
||||
#include "primitives/Frustum.hpp"
|
||||
#include "rendering/pipelines/Pipeline.hpp"
|
||||
#include "rendering/types.hpp"
|
||||
|
||||
#define MAX_LIGHTS 10
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "align.hpp"
|
||||
#include "engine/buffers/exceptions.hpp"
|
||||
#include "engine/literals/size.hpp"
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BufferSuballocationHandle.hpp"
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine::memory
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "CameraRenderer.hpp"
|
||||
|
||||
#include "CameraSwapchain.hpp"
|
||||
#include "engine/rendering/RenderPass.hpp"
|
||||
#include "engine/rendering/renderpass/RenderPass.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../rendering/pipelines/Attachment.hpp"
|
||||
#include "engine/descriptors/DescriptorSet.hpp"
|
||||
#include "engine/rendering/Attachment.hpp"
|
||||
#include "engine/rendering/SwapChain.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "engine/rendering/Attachment.hpp"
|
||||
#include "../rendering/pipelines/Attachment.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
|
||||
template < typename T >
|
||||
concept is_descriptor_set_collection = requires( T t ) {
|
||||
typename T::DescriptorSetTuple;
|
||||
@@ -16,4 +18,4 @@ namespace fgl::engine
|
||||
} -> std::same_as< const std::uint64_t& >;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace fgl::engine
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
#include "DescriptorPool.hpp"
|
||||
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine::descriptors
|
||||
{
|
||||
|
||||
vk::raii::DescriptorPool createPool( Device& device, std::uint32_t set_count )
|
||||
vk::raii::DescriptorPool createPool( std::uint32_t set_count )
|
||||
{
|
||||
std::vector< vk::DescriptorPoolSize > pool_sizes {};
|
||||
for ( auto& [ type, ratio ] : descriptor_allocation_ratios )
|
||||
@@ -24,11 +24,10 @@ namespace fgl::engine::descriptors
|
||||
pool_info.setFlags(
|
||||
vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet | vk::DescriptorPoolCreateFlagBits::eUpdateAfterBind );
|
||||
|
||||
return device->createDescriptorPool( pool_info );
|
||||
return Device::getInstance()->createDescriptorPool( pool_info );
|
||||
}
|
||||
|
||||
DescriptorPool::DescriptorPool( Device& device, std::uint32_t set_count ) :
|
||||
m_pool( createPool( device, set_count ) )
|
||||
DescriptorPool::DescriptorPool( std::uint32_t set_count ) : m_pool( createPool( set_count ) )
|
||||
{}
|
||||
|
||||
[[nodiscard]] vk::raii::DescriptorSet DescriptorPool::allocateSet( vk::raii::DescriptorSetLayout& layout )
|
||||
@@ -48,10 +47,10 @@ namespace fgl::engine::descriptors
|
||||
|
||||
static DescriptorPool* s_pool { nullptr };
|
||||
|
||||
DescriptorPool& DescriptorPool::init( Device& device )
|
||||
DescriptorPool& DescriptorPool::init()
|
||||
{
|
||||
assert( !s_pool && "Descriptor pool already initialized" );
|
||||
s_pool = new DescriptorPool( device, 1000 );
|
||||
s_pool = new DescriptorPool( 1000 );
|
||||
return *s_pool;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace fgl::engine::descriptors
|
||||
{
|
||||
vk::raii::DescriptorPool m_pool;
|
||||
|
||||
DescriptorPool( Device& device, std::uint32_t set_count );
|
||||
DescriptorPool( std::uint32_t set_count );
|
||||
|
||||
public:
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace fgl::engine::descriptors
|
||||
|
||||
VkDescriptorPool operator*() { return *m_pool; }
|
||||
|
||||
static DescriptorPool& init( Device& device );
|
||||
static DescriptorPool& init();
|
||||
[[nodiscard]] static DescriptorPool& getInstance();
|
||||
|
||||
[[nodiscard]] vk::raii::DescriptorSet allocateSet( vk::raii::DescriptorSetLayout& layout );
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "engine/concepts/is_descriptor.hpp"
|
||||
#include "engine/concepts/is_descriptor_set.hpp"
|
||||
#include "engine/concepts/is_empty_descriptor_set.hpp"
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine::descriptors
|
||||
{
|
||||
|
||||
@@ -22,28 +22,16 @@ namespace fgl::engine
|
||||
ModelComponent( std::shared_ptr< Model > && model ) : m_model( std::forward< decltype( m_model ) >( model ) )
|
||||
{}
|
||||
|
||||
#ifdef TITOR_EDITOR
|
||||
void drawImGui() override;
|
||||
|
||||
std::string_view name() const override
|
||||
{
|
||||
//TODO: Get name of component
|
||||
return "TEST NAME";
|
||||
}
|
||||
#endif
|
||||
std::string_view name() const override;
|
||||
|
||||
virtual ~ModelComponent() override
|
||||
{}
|
||||
|
||||
Model* operator->()
|
||||
{
|
||||
return m_model.get();
|
||||
}
|
||||
Model* operator->();
|
||||
|
||||
const Model* operator->() const
|
||||
{
|
||||
return m_model.get();
|
||||
}
|
||||
const Model* operator->() const;
|
||||
};
|
||||
|
||||
static_assert( is_component< ModelComponent > );
|
||||
|
||||
69
src/engine/gameobjects/components/drawers.cpp
Normal file
69
src/engine/gameobjects/components/drawers.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Created by kj16609 on 8/13/24.
|
||||
//
|
||||
|
||||
#include "drawers.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
void InputRotation( const char* label, Rotation& rot, float speed )
|
||||
{
|
||||
enum Axis
|
||||
{
|
||||
Pitch = 0,
|
||||
Yaw = 1,
|
||||
Roll = 2
|
||||
};
|
||||
|
||||
glm::vec3 dat { glm::degrees( rot.euler() ) };
|
||||
const glm::vec3 c_dat { dat };
|
||||
|
||||
assert( &dat.x + 1 == &dat.y );
|
||||
assert( &dat.y + 1 == &dat.z );
|
||||
|
||||
ImGui::DragFloat3( label, &dat.x, speed );
|
||||
|
||||
const glm::vec3 diff { c_dat - dat };
|
||||
constexpr float epsilon { std::numeric_limits< float >::epsilon() };
|
||||
|
||||
const glm::vec< 3, bool > changed_high { glm::greaterThanEqual( diff, glm::vec3( epsilon ) ) };
|
||||
const glm::vec< 3, bool > changed_low { glm::lessThanEqual( diff, glm::vec3( -epsilon ) ) };
|
||||
const glm::vec< 3, bool > changed { changed_high || changed_low };
|
||||
|
||||
// Convert back to radians
|
||||
dat = glm::radians( dat );
|
||||
|
||||
if ( changed[ Pitch ] )
|
||||
{
|
||||
rot.pitch() = dat[ Pitch ];
|
||||
}
|
||||
|
||||
if ( changed[ Roll ] )
|
||||
{
|
||||
rot.roll() = dat[ Roll ];
|
||||
}
|
||||
|
||||
if ( changed[ Yaw ] )
|
||||
{
|
||||
rot.yaw() = dat[ Yaw ];
|
||||
}
|
||||
}
|
||||
|
||||
void drawComponentTransform( ComponentTransform& transform )
|
||||
{
|
||||
if ( ImGui::CollapsingHeader( "Transform" ) )
|
||||
{
|
||||
constexpr float speed { 1.0f };
|
||||
|
||||
ImGui::DragFloat3( "Position", &transform.translation.x, speed );
|
||||
|
||||
InputRotation( "Rotation", transform.rotation, speed );
|
||||
|
||||
ImGui::DragFloat3( "Scale", &transform.scale.x, speed );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fgl::engine
|
||||
13
src/engine/gameobjects/components/drawers.hpp
Normal file
13
src/engine/gameobjects/components/drawers.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Created by kj16609 on 8/13/24.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "interface/GameObjectComponent.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
void drawComponentTransform( ComponentTransform& transform );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Created by kj16609 on 8/13/24.
|
||||
//
|
||||
|
||||
#include "ComponentEditorInterface.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
} // namespace fgl::engine
|
||||
@@ -4,19 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef TITOR_EDITOR
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
struct ComponentEditorInterface
|
||||
{
|
||||
#ifdef TITOR_EDITOR
|
||||
virtual void drawImGui() = 0;
|
||||
virtual std::string_view name() const = 0;
|
||||
#endif
|
||||
virtual ~ComponentEditorInterface() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by kj16609 on 8/13/24.
|
||||
//
|
||||
|
||||
#include "GameObjectComponent.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
constexpr auto indent_amount { 1.0f };
|
||||
|
||||
void GameObjectComponentBase::drawNode( GameObjectComponentPtr& selected_out )
|
||||
{
|
||||
ImGui::Indent( indent_amount );
|
||||
if ( ImGui::Selectable( this->name().data() ) )
|
||||
{
|
||||
selected_out = this;
|
||||
}
|
||||
|
||||
drawChildren( selected_out );
|
||||
ImGui::Unindent( indent_amount );
|
||||
}
|
||||
|
||||
void GameObjectComponentBase::drawChildren( GameObjectComponentPtr& selected_out )
|
||||
{
|
||||
for ( auto* child : m_children )
|
||||
{
|
||||
child->drawNode( selected_out );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fgl::engine
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ComponentEngineInterface.hpp"
|
||||
#include "engine/primitives/TransformComponent.hpp"
|
||||
|
||||
@@ -16,7 +18,7 @@ namespace fgl::engine
|
||||
{
|
||||
enum Mode
|
||||
{
|
||||
//! Object is non moving,
|
||||
//! Object is non moving, When this is set only the transform on the component should be used.
|
||||
Static,
|
||||
//! Object moves in relation to it's parent
|
||||
Local,
|
||||
@@ -26,7 +28,13 @@ namespace fgl::engine
|
||||
};
|
||||
|
||||
struct GameObjectComponentBase : public ComponentEditorInterface, public ComponentEngineInterface
|
||||
{};
|
||||
{
|
||||
std::vector< GameObjectComponentBase* > m_children {};
|
||||
|
||||
void drawNode( GameObjectComponentBase*& selected_out );
|
||||
|
||||
void drawChildren( GameObjectComponentBase*& selected_out );
|
||||
};
|
||||
|
||||
using GameObjectComponentPtr = GameObjectComponentBase*;
|
||||
|
||||
@@ -44,7 +52,9 @@ namespace fgl::engine
|
||||
template < typename T >
|
||||
concept is_component = requires( T t ) {
|
||||
std::is_base_of_v< T, ComponentEngineInterface >;
|
||||
{ t.ID } -> std::same_as< const ComponentEngineInterface::ComponentID& >;
|
||||
{
|
||||
t.ID
|
||||
} -> std::same_as< const ComponentEngineInterface::ComponentID& >;
|
||||
};
|
||||
|
||||
} // namespace fgl::engine
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "engine/logging/logging.hpp"
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
#include "vma/vma_impl.hpp"
|
||||
#include "vulkan/vulkan.hpp"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -78,19 +78,22 @@ namespace fgl::engine
|
||||
}
|
||||
|
||||
Model::Model(
|
||||
ModelBuilder& builder, const OrientedBoundingBox< CoordinateSpace::Model > bounding_box, std::string name ) :
|
||||
ModelBuilder& builder,
|
||||
const OrientedBoundingBox< CoordinateSpace::Model >& bounding_box,
|
||||
const std::string& name ) :
|
||||
Model( std::move( builder.m_primitives ), bounding_box, name )
|
||||
{}
|
||||
|
||||
Model::Model(
|
||||
std::vector< Primitive >&& primitives,
|
||||
const OrientedBoundingBox< CoordinateSpace::Model > bounding_box,
|
||||
std::string name ) :
|
||||
const OrientedBoundingBox< CoordinateSpace::Model >& bounding_box,
|
||||
const std::string& name ) :
|
||||
m_draw_parameters( buildParameters( primitives ) ),
|
||||
m_name( name ),
|
||||
m_bounding_box( bounding_box )
|
||||
{
|
||||
assert( bounding_box.middle.vec() != constants::DEFAULT_VEC3 );
|
||||
assert( !name.empty() );
|
||||
assert( bounding_box.m_transform.translation.vec() != constants::DEFAULT_VEC3 );
|
||||
m_primitives = std::move( primitives );
|
||||
}
|
||||
|
||||
|
||||
@@ -72,12 +72,14 @@ namespace fgl::engine
|
||||
const std::string& getName() const { return m_name; }
|
||||
|
||||
Model(
|
||||
ModelBuilder& builder, OrientedBoundingBox< CoordinateSpace::Model > bounding_box, std::string name = {} );
|
||||
ModelBuilder& builder,
|
||||
const OrientedBoundingBox< CoordinateSpace::Model >& bounding_box,
|
||||
const std::string& name = {} );
|
||||
|
||||
Model(
|
||||
std::vector< Primitive >&& primitives,
|
||||
OrientedBoundingBox< CoordinateSpace::Model > bounding_box,
|
||||
std::string name = {} );
|
||||
const OrientedBoundingBox< CoordinateSpace::Model >& bounding_box,
|
||||
const std::string& name = {} );
|
||||
|
||||
~Model() = default;
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ namespace fgl::engine
|
||||
|
||||
PrimitiveTextures m_textures;
|
||||
|
||||
std::string m_name { "Unnamed Primitive" };
|
||||
|
||||
//! Returns true if the primitive is ready to be rendered (must have all textures, vertex buffer, and index buffer ready)
|
||||
bool ready() const { return m_textures.ready() && m_vertex_buffer.ready() && m_index_buffer.ready(); }
|
||||
|
||||
|
||||
@@ -433,7 +433,8 @@ namespace fgl::engine
|
||||
|
||||
const auto bounding_box { createModelBoundingBox( finished_primitives ) };
|
||||
|
||||
return std::make_shared< Model >( std::move( finished_primitives ), bounding_box, mesh.name );
|
||||
return std::make_shared<
|
||||
Model >( std::move( finished_primitives ), bounding_box, mesh.name.empty() ? "Unnamed Model" : mesh.name );
|
||||
}
|
||||
|
||||
void SceneBuilder::handleNode( const int node_idx, const tinygltf::Model& root )
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "QueuePool.hpp"
|
||||
|
||||
#include "Attachment.hpp"
|
||||
#include "pipelines/Attachment.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Device.hpp"
|
||||
#include "SwapChain.hpp"
|
||||
#include "engine/Window.hpp"
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
#include "Device.hpp"
|
||||
#include "SwapChain.hpp"
|
||||
|
||||
//clang-format: off
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Attachment.hpp"
|
||||
#include "RenderPass.hpp"
|
||||
#include "Subpass.hpp"
|
||||
#include "engine/assets/TransferManager.hpp"
|
||||
#include "engine/descriptors/DescriptorSet.hpp"
|
||||
#include "pipelines/Attachment.hpp"
|
||||
#include "renderpass/RenderPass.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Attachment.hpp"
|
||||
#include "Device.hpp"
|
||||
#include "devices/Device.hpp"
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/texture/Texture.hpp"
|
||||
#include "pipelines/Attachment.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace fgl::engine
|
||||
|
||||
global_device = this;
|
||||
|
||||
DescriptorPool::init( *global_device );
|
||||
DescriptorPool::init();
|
||||
}
|
||||
|
||||
Device::~Device()
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Instance.hpp"
|
||||
#include "PhysicalDevice.hpp"
|
||||
#include "Surface.hpp"
|
||||
#include "engine/Window.hpp"
|
||||
#include "engine/rendering/Instance.hpp"
|
||||
#include "engine/rendering/Surface.hpp"
|
||||
#include "vma/vma_impl.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#include "PhysicalDevice.hpp"
|
||||
|
||||
#include "Instance.hpp"
|
||||
#include "Surface.hpp"
|
||||
#include "engine/logging/logging.hpp"
|
||||
#include "engine/rendering/Instance.hpp"
|
||||
#include "engine/rendering/Surface.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "QueuePool.hpp"
|
||||
#include "engine/FGL_DEFINES.hpp"
|
||||
#include "engine/rendering/QueuePool.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -11,9 +11,9 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "engine/concepts/is_attachment.hpp"
|
||||
#include "engine/image/Image.hpp"
|
||||
#include "types.hpp"
|
||||
#include "../../concepts/is_attachment.hpp"
|
||||
#include "../../image/Image.hpp"
|
||||
#include "../types.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "Shader.hpp"
|
||||
#include "engine/model/Model.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine::internal
|
||||
{
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <vector>
|
||||
|
||||
#include "PipelineConfigInfo.hpp"
|
||||
#include "engine/rendering/Device.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
class Device;
|
||||
struct ShaderHandle;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "PipelineConfigInfo.hpp"
|
||||
|
||||
#include "engine/model/Model.hpp"
|
||||
#include "../../model/Model.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -91,6 +91,7 @@ namespace fgl::engine
|
||||
{
|
||||
case None:
|
||||
disableVertexInput( info );
|
||||
break;
|
||||
case Simple:
|
||||
{
|
||||
info.binding_descriptions = SimpleVertex::getBindingDescriptions();
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "engine/FGL_DEFINES.hpp"
|
||||
#include "../../FGL_DEFINES.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../concepts/is_descriptor_set_collection.hpp"
|
||||
#include "../../concepts/is_empty_descriptor_set.hpp"
|
||||
#include "../../descriptors/DescriptorSet.hpp"
|
||||
#include "Pipeline.hpp"
|
||||
#include "Shader.hpp"
|
||||
#include "engine/concepts/is_descriptor_set_collection.hpp"
|
||||
#include "engine/concepts/is_empty_descriptor_set.hpp"
|
||||
#include "engine/descriptors/DescriptorSet.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "Shader.hpp"
|
||||
|
||||
#include "engine/rendering/Device.hpp"
|
||||
#include "engine/shaders/Compiler.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
#include "shaders/Compiler.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "engine/logging/logging.hpp"
|
||||
#include "../../logging/logging.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "RenderPass.hpp"
|
||||
|
||||
#include "Device.hpp"
|
||||
#include "engine/rendering/devices/Device.hpp"
|
||||
|
||||
namespace fgl::engine::rendering
|
||||
{
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
#include "Attachment.hpp"
|
||||
#include "engine/concepts/is_attachment.hpp"
|
||||
#include "pipelines/Attachment.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <engine/pipeline/PipelineT.hpp>
|
||||
|
||||
#include "concepts.hpp"
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/descriptors/DescriptorSetCollection.hpp"
|
||||
#include "engine/rendering/pipelines/PipelineT.hpp"
|
||||
#include "engine/rendering/pipelines/Shader.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "../rendering/pipelines/PipelineT.hpp"
|
||||
#include "engine/buffers/vector/HostVector.hpp"
|
||||
#include "engine/model/Model.hpp"
|
||||
#include "engine/pipeline/PipelineT.hpp"
|
||||
#include "engine/rendering/SwapChain.hpp"
|
||||
#include "engine/systems/modelRendering/StandardPipeline.hpp"
|
||||
#include "engine/systems/modelRendering/TexturedPipeline.hpp"
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "../rendering/pipelines/PipelineT.hpp"
|
||||
#include "../rendering/pipelines/Shader.hpp"
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/descriptors/DescriptorSetCollection.hpp"
|
||||
#include "engine/descriptors/DescriptorSetLayout.hpp"
|
||||
#include "engine/pipeline/PipelineT.hpp"
|
||||
#include "engine/pipeline/Shader.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "../rendering/pipelines/PipelineT.hpp"
|
||||
#include "engine/buffers/vector/HostVector.hpp"
|
||||
#include "engine/camera/CameraDescriptor.hpp"
|
||||
#include "engine/descriptors/Descriptor.hpp"
|
||||
#include "engine/descriptors/DescriptorSetCollection.hpp"
|
||||
#include "engine/pipeline/PipelineT.hpp"
|
||||
#include "engine/rendering/SwapChain.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../rendering/pipelines/PipelineT.hpp"
|
||||
#include "concepts.hpp"
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/buffers/vector/HostVector.hpp"
|
||||
#include "engine/camera/Camera.hpp"
|
||||
#include "engine/descriptors/DescriptorSetCollection.hpp"
|
||||
#include "engine/model/Model.hpp"
|
||||
#include "engine/pipeline/PipelineT.hpp"
|
||||
#include "engine/rendering/SwapChain.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "../../rendering/pipelines/PipelineT.hpp"
|
||||
#include "../../rendering/pipelines/Shader.hpp"
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/camera/CameraDescriptor.hpp"
|
||||
#include "engine/descriptors/DescriptorSetCollection.hpp"
|
||||
#include "engine/pipeline/PipelineT.hpp"
|
||||
#include "engine/pipeline/Shader.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "../../rendering/pipelines/PipelineT.hpp"
|
||||
#include "../../rendering/pipelines/Shader.hpp"
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/descriptors/DescriptorSetCollection.hpp"
|
||||
#include "engine/pipeline/PipelineT.hpp"
|
||||
#include "engine/pipeline/Shader.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user