Cleanup
This commit is contained in:
@@ -49,7 +49,7 @@ namespace fgl::engine
|
||||
vk::MemoryPropertyFlagBits::eDeviceLocal ) };
|
||||
|
||||
// SubPass 0
|
||||
GuiSystem m_gui_system { Device::getInstance(), m_renderer.getSwapChainRenderPass() };
|
||||
GuiSystem m_gui_system { m_renderer.getSwapChainRenderPass() };
|
||||
|
||||
// Temp function
|
||||
std::function< void( FrameInfo& ) > renderGui { []( [[maybe_unused]] FrameInfo& ) noexcept {} };
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#define FGL_ASSERT( test, msg )
|
||||
#endif
|
||||
|
||||
#define FGL_UNIMPLEMENTED() FGL_ASSERT( false, "unimplemented" );
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include <utility>
|
||||
#define FGL_UNREACHABLE() \
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace fgl::engine
|
||||
|
||||
void setCursorPos( GLFWwindow* window, const glm::vec2 pos )
|
||||
{
|
||||
glfwSetCursorPos( window, static_cast< double >( pos.x ), static_cast< double >( pos.y ) );
|
||||
glfwSetCursorPos( window, pos.x, pos.y );
|
||||
}
|
||||
|
||||
glm::vec2 getCursorPos( GLFWwindow* window )
|
||||
@@ -28,7 +28,7 @@ namespace fgl::engine
|
||||
return { xpos, ypos };
|
||||
}
|
||||
|
||||
void KeyboardMovementController::moveInPlaneXZ( GLFWwindow* window, float dt, fgl::engine::GameObject& target )
|
||||
void KeyboardMovementController::moveInPlaneXZ( GLFWwindow* window, float dt, GameObject& target )
|
||||
{
|
||||
assert( window );
|
||||
constexpr float rotation_rate { 1.0f };
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace fgl::engine
|
||||
m_resource( img ),
|
||||
m_descriptor_info(),
|
||||
m_image_view( createImageView( img ) ),
|
||||
m_sampler()
|
||||
m_sampler(),
|
||||
m_name( "Unnamed ImageView" )
|
||||
{
|
||||
m_descriptor_info.imageLayout = img->m_final_layout;
|
||||
m_descriptor_info.imageView = m_image_view;
|
||||
@@ -53,8 +54,7 @@ namespace fgl::engine
|
||||
}
|
||||
|
||||
ImageView::~ImageView()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void ImageView::setName( const std::string str )
|
||||
{
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace fgl::engine
|
||||
struct ModelMatrixInfo
|
||||
{
|
||||
glm::mat4 model_matrix;
|
||||
//MaterialID material_id;
|
||||
std::uint32_t albedo_id;
|
||||
std::uint32_t normal_id;
|
||||
std::uint32_t metallic_roughness;
|
||||
};
|
||||
|
||||
class Model
|
||||
|
||||
@@ -57,8 +57,6 @@ namespace fgl::engine
|
||||
|
||||
attribute_descriptions.emplace_back( 8, 1, vk::Format::eR32Uint, offsetof( ModelMatrixInfo, albedo_id ) );
|
||||
attribute_descriptions.emplace_back( 9, 1, vk::Format::eR32Uint, offsetof( ModelMatrixInfo, normal_id ) );
|
||||
attribute_descriptions
|
||||
.emplace_back( 10, 1, vk::Format::eR32Uint, offsetof( ModelMatrixInfo, metallic_roughness ) );
|
||||
|
||||
return attribute_descriptions;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace fgl::engine
|
||||
|
||||
// SubPass 0
|
||||
//TerrainSystem m_terrain_system { Device::getInstance(), m_renderpass };
|
||||
EntityRendererSystem m_entity_renderer { Device::getInstance(), m_renderpass };
|
||||
LineDrawer m_line_drawer { Device::getInstance(), m_renderpass };
|
||||
EntityRendererSystem m_entity_renderer { m_renderpass };
|
||||
LineDrawer m_line_drawer { m_renderpass };
|
||||
|
||||
// SubPass 1
|
||||
CompositionSystem m_composition_system { Device::getInstance(), m_renderpass };
|
||||
CompositionSystem m_composition_system { m_renderpass };
|
||||
|
||||
void beginRenderPass(
|
||||
const vk::raii::CommandBuffer& command_buffer, CameraSwapchain& swapchain, const FrameIndex index );
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace fgl::engine::memory
|
||||
BufferSuballocation( buffer.allocate( size ) )
|
||||
{}
|
||||
|
||||
BufferSuballocation::BufferSuballocation( Buffer& buffer, std::size_t t_size, std::size_t t_align ) :
|
||||
BufferSuballocation::BufferSuballocation( Buffer& buffer, std::size_t t_size, std::uint32_t t_align ) :
|
||||
BufferSuballocation( buffer.allocate( t_size, t_align ) )
|
||||
{}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace fgl::engine::memory
|
||||
|
||||
void flush( vk::DeviceSize beg, vk::DeviceSize end );
|
||||
|
||||
explicit BufferSuballocation( Buffer& buffer, std::size_t t_size, std::size_t t_align );
|
||||
explicit BufferSuballocation( Buffer& buffer, std::size_t t_size, std::uint32_t t_align );
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "engine/FGL_DEFINES.hpp"
|
||||
#include "engine/constants.hpp"
|
||||
|
||||
namespace fgl::engine
|
||||
@@ -93,14 +94,20 @@ namespace fgl::engine
|
||||
return std::atan2( siny_cosp, cosy_cosp );
|
||||
}
|
||||
|
||||
void Rotation::setX( const float value )
|
||||
{}
|
||||
void Rotation::setX( [[maybe_unused]] const float value )
|
||||
{
|
||||
FGL_UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Rotation::setY( const float value )
|
||||
{}
|
||||
void Rotation::setY( [[maybe_unused]] const float value )
|
||||
{
|
||||
FGL_UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Rotation::setZ( const float value )
|
||||
{}
|
||||
void Rotation::setZ( [[maybe_unused]] const float value )
|
||||
{
|
||||
FGL_UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Rotation::addX( const float value )
|
||||
{
|
||||
|
||||
@@ -155,9 +155,14 @@ namespace fgl::engine
|
||||
// points[ 7 ] = Coordinate< CType >( xp_yn_zn );
|
||||
|
||||
constexpr static std::array< Coordinate< CType >, POINT_COUNT > const_points {
|
||||
Coordinate< CType >( xp_yp_zp ), Coordinate< CType >( xn_yp_zp ), Coordinate< CType >( xn_yp_zn ),
|
||||
Coordinate< CType >( xp_yp_zn ), Coordinate< CType >( xp_yn_zp ), Coordinate< CType >( xn_yn_zp ),
|
||||
Coordinate< CType >( xn_yn_zn ), Coordinate< CType >( xp_yn_zn )
|
||||
{ Coordinate< CType >( xp_yp_zp ),
|
||||
Coordinate< CType >( xn_yp_zp ),
|
||||
Coordinate< CType >( xn_yp_zn ),
|
||||
Coordinate< CType >( xp_yp_zn ),
|
||||
Coordinate< CType >( xp_yn_zp ),
|
||||
Coordinate< CType >( xn_yn_zp ),
|
||||
Coordinate< CType >( xn_yn_zn ),
|
||||
Coordinate< CType >( xp_yn_zn ) }
|
||||
};
|
||||
|
||||
std::array< Coordinate< CType >, POINT_COUNT > points {};
|
||||
@@ -166,7 +171,7 @@ namespace fgl::engine
|
||||
|
||||
const glm::mat4 rot_mat { transform_mode == TransformMode::Matrix ? m_matrix : m_transform.mat4() };
|
||||
|
||||
for ( auto i = 0; i < const_points.size(); ++i )
|
||||
for ( std::size_t i = 0; i < const_points.size(); ++i )
|
||||
{
|
||||
FGL_ASSUME( i < POINT_COUNT + 1 );
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wduplicated-branches"
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/matrix_decompose.hpp>
|
||||
#include <glm/mat4x4.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "MatrixEvolvedTypes.hpp"
|
||||
|
||||
|
||||
@@ -66,7 +66,10 @@ namespace fgl::engine
|
||||
Renderer::~Renderer()
|
||||
{}
|
||||
|
||||
TracyVkCtx createContext( PhysicalDevice& physical_device, Device& device, vk::raii::CommandBuffer& cmd_buffer )
|
||||
TracyVkCtx createContext(
|
||||
[[maybe_unused]] PhysicalDevice& physical_device,
|
||||
[[maybe_unused]] Device& device,
|
||||
[[maybe_unused]] vk::raii::CommandBuffer& cmd_buffer )
|
||||
{
|
||||
#if ENABLE_CALIBRATED_PROFILING
|
||||
|
||||
@@ -109,7 +112,6 @@ namespace fgl::engine
|
||||
|
||||
m_command_buffer = Device::getInstance().device().allocateCommandBuffers( alloc_info );
|
||||
|
||||
#if TRACY_ENABLE
|
||||
m_tracy_ctx = createContext( m_phy_device, Device::getInstance(), m_command_buffer[ 0 ] );
|
||||
|
||||
/*
|
||||
@@ -121,7 +123,6 @@ namespace fgl::engine
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.vkGetPhysicalDeviceCalibrateableTimeDomainsEXT,
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.vkGetCalibratedTimestampsEXT );
|
||||
*/
|
||||
#endif
|
||||
|
||||
alloc_info.level = vk::CommandBufferLevel::eSecondary;
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// Created by kj16609 on 10/10/24.
|
||||
//
|
||||
|
||||
#include "AttachmentPresets.hpp"
|
||||
|
||||
namespace fgl::engine::AttachmentPresets
|
||||
{
|
||||
|
||||
void configureForPresent( AttachmentBuilder& builder )
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace fgl::engine::AttachmentPresets
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// Created by kj16609 on 10/10/24.
|
||||
//
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
class AttachmentBuilder;
|
||||
}
|
||||
|
||||
namespace fgl::engine::AttachmentPresets
|
||||
{
|
||||
|
||||
void configureForPresent( AttachmentBuilder& builder );
|
||||
|
||||
}
|
||||
@@ -11,6 +11,11 @@
|
||||
#include "engine/constants.hpp"
|
||||
#include "engine/debug/logging/logging.hpp"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#include <shaderc/shaderc.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -54,7 +59,10 @@ namespace fgl::engine
|
||||
};
|
||||
|
||||
shaderc_include_result* Includer::GetInclude(
|
||||
const char* requested_source, shaderc_include_type type, const char* requesting_source, size_t include_depth )
|
||||
const char* requested_source,
|
||||
[[maybe_unused]] shaderc_include_type type,
|
||||
const char* requesting_source,
|
||||
[[maybe_unused]] size_t include_depth )
|
||||
{
|
||||
const std::string_view requsted { requested_source };
|
||||
const std::string_view requster { requesting_source };
|
||||
|
||||
@@ -3,8 +3,13 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <shaderc/shaderc.hpp>
|
||||
namespace shaderc
|
||||
{
|
||||
class Compiler;
|
||||
}
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace fgl::engine
|
||||
}
|
||||
|
||||
void Pipeline::bindDescriptor(
|
||||
vk::raii::CommandBuffer& command_buffer, std::size_t descriptor_idx, descriptors::DescriptorSet& set )
|
||||
vk::raii::CommandBuffer& command_buffer, DescriptorIDX descriptor_idx, descriptors::DescriptorSet& set )
|
||||
{
|
||||
const std::vector< vk::DescriptorSet > sets { *set };
|
||||
constexpr std::vector< std::uint32_t > offsets {};
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
using DescriptorIDX = std::uint32_t;
|
||||
|
||||
class Pipeline
|
||||
{
|
||||
vk::raii::Pipeline m_pipeline;
|
||||
@@ -22,10 +24,9 @@ namespace fgl::engine
|
||||
|
||||
void bind( vk::raii::CommandBuffer& );
|
||||
|
||||
void bindDescriptor( vk::raii::CommandBuffer&, std::size_t descriptor_idx, descriptors::DescriptorSet& set );
|
||||
void bindDescriptor( vk::raii::CommandBuffer&, DescriptorIDX descriptor_idx, descriptors::DescriptorSet& set );
|
||||
void bindDescriptor( vk::raii::CommandBuffer& comd_buffer, descriptors::DescriptorSet& set );
|
||||
|
||||
|
||||
void setDebugName( const char* str );
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
PipelineBuilder::PipelineBuilder( vk::raii::RenderPass& renderpass, std::size_t subpass_stage ) :
|
||||
PipelineBuilder::PipelineBuilder( vk::raii::RenderPass& renderpass, const std::uint32_t subpass_stage ) :
|
||||
m_render_pass( renderpass ),
|
||||
subpass_idx( subpass_stage )
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace fgl::engine
|
||||
|
||||
for ( std::size_t i = 0; i < set_layouts.size(); ++i )
|
||||
{
|
||||
auto itter { descriptor_set_layouts.find( i ) };
|
||||
auto itter { descriptor_set_layouts.find( static_cast< SetID >( i ) ) };
|
||||
if ( itter == descriptor_set_layouts.end() )
|
||||
{
|
||||
// Could not find it. Empty
|
||||
@@ -143,7 +143,7 @@ namespace fgl::engine
|
||||
//info.dynamic_state_info.flags = 0;
|
||||
}
|
||||
|
||||
void PipelineBuilder::setTopology( vk::PrimitiveTopology primitive_topology )
|
||||
void PipelineBuilder::setTopology( const vk::PrimitiveTopology primitive_topology )
|
||||
{
|
||||
config.assembly_info.topology = primitive_topology;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ namespace fgl::engine
|
||||
class PipelineBuilder
|
||||
{
|
||||
vk::raii::RenderPass& m_render_pass;
|
||||
std::size_t subpass_idx;
|
||||
std::uint32_t subpass_idx;
|
||||
|
||||
struct
|
||||
{
|
||||
std::vector< vk::VertexInputBindingDescription > bindings;
|
||||
std::vector< vk::VertexInputAttributeDescription > attributes;
|
||||
} vertex_input_descriptions;
|
||||
std::vector< vk::VertexInputBindingDescription > bindings {};
|
||||
std::vector< vk::VertexInputAttributeDescription > attributes {};
|
||||
} vertex_input_descriptions {};
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace fgl::engine
|
||||
// Default config
|
||||
Config();
|
||||
|
||||
} config;
|
||||
} config {};
|
||||
|
||||
void setTopology( vk::PrimitiveTopology primitive_topology );
|
||||
void disableVertexInput();
|
||||
@@ -90,7 +90,7 @@ namespace fgl::engine
|
||||
|
||||
void setAttributeDescriptions( const std::vector< vk::VertexInputAttributeDescription >& descriptions );
|
||||
|
||||
PipelineBuilder( vk::raii::RenderPass& renderpass, std::size_t subpass_stage );
|
||||
PipelineBuilder( vk::raii::RenderPass& renderpass, std::uint32_t subpass_stage );
|
||||
|
||||
void setVertexShader( std::shared_ptr< Shader >&& shader )
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <engine/texture/Texture.hpp>
|
||||
|
||||
#include "engine/rendering/pipelines/attachments/AttachmentPresets.hpp"
|
||||
#include "engine/rendering/pipelines/v2/AttachmentBuilder.hpp"
|
||||
#include "engine/rendering/pipelines/v2/Pipeline.hpp"
|
||||
#include "engine/rendering/pipelines/v2/PipelineBuilder.hpp"
|
||||
@@ -14,16 +13,8 @@
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
CompositionSystem::CompositionSystem( [[maybe_unused]] Device& device, vk::raii::RenderPass& render_pass )
|
||||
CompositionSystem::CompositionSystem( vk::raii::RenderPass& render_pass )
|
||||
{
|
||||
/*
|
||||
PipelineConfigInfo composition_info { render_pass };
|
||||
PipelineConfigInfo::addColorAttachmentConfig( composition_info );
|
||||
PipelineConfigInfo::disableVertexInput( composition_info );
|
||||
PipelineConfigInfo::disableCulling( composition_info );
|
||||
composition_info.subpass = 1;
|
||||
*/
|
||||
|
||||
constexpr std::size_t SUBPASS { 1 };
|
||||
|
||||
PipelineBuilder builder { render_pass, SUBPASS };
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace fgl::engine
|
||||
|
||||
public:
|
||||
|
||||
CompositionSystem( Device& device, vk::raii::RenderPass& render_pass );
|
||||
CompositionSystem( vk::raii::RenderPass& render_pass );
|
||||
~CompositionSystem() = default;
|
||||
|
||||
void pass( FrameInfo& info );
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace fgl::engine
|
||||
{
|
||||
EntityRendererSystem::EntityRendererSystem( Device& device, vk::raii::RenderPass& render_pass ) : m_device( device )
|
||||
EntityRendererSystem::EntityRendererSystem( vk::raii::RenderPass& render_pass )
|
||||
{
|
||||
ZoneScoped;
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace fgl::engine
|
||||
|
||||
class EntityRendererSystem
|
||||
{
|
||||
Device& m_device;
|
||||
|
||||
//! Standard pipeline for textureless models
|
||||
std::unique_ptr< Pipeline > m_standard_pipeline {};
|
||||
|
||||
@@ -54,7 +52,7 @@ namespace fgl::engine
|
||||
void texturelessPass( const FrameInfo& info );
|
||||
void texturedPass( const FrameInfo& info );
|
||||
|
||||
EntityRendererSystem( Device& device, vk::raii::RenderPass& render_pass );
|
||||
EntityRendererSystem( vk::raii::RenderPass& render_pass );
|
||||
~EntityRendererSystem();
|
||||
EntityRendererSystem( EntityRendererSystem&& other ) = delete;
|
||||
EntityRendererSystem( const EntityRendererSystem& other ) = delete;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace fgl::engine
|
||||
{
|
||||
|
||||
GuiSystem::GuiSystem( Device& device, vk::raii::RenderPass& render_pass )
|
||||
GuiSystem::GuiSystem( vk::raii::RenderPass& render_pass )
|
||||
{
|
||||
PipelineConfigInfo info { render_pass };
|
||||
PipelineConfigInfo::addColorAttachmentConfig( info );
|
||||
|
||||
@@ -17,15 +17,14 @@ namespace fgl::engine
|
||||
*/
|
||||
class GuiSystem
|
||||
{
|
||||
|
||||
std::unique_ptr< Pipeline > m_pipeline;
|
||||
std::unique_ptr< Pipeline > m_pipeline {};
|
||||
|
||||
//Setup isn't needed for this. So we can just never define this safely.
|
||||
[[maybe_unused]] vk::raii::CommandBuffer& setupSystem( FrameInfo& info );
|
||||
|
||||
public:
|
||||
|
||||
GuiSystem( Device& device, vk::raii::RenderPass& render_pass );
|
||||
GuiSystem( vk::raii::RenderPass& render_pass );
|
||||
|
||||
FGL_DELETE_ALL_Ro5( GuiSystem );
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace fgl::engine
|
||||
|
||||
inline static std::vector< VertexLine > m_lines {};
|
||||
|
||||
LineDrawer::LineDrawer( Device& device, vk::raii::RenderPass& render_pass )
|
||||
LineDrawer::LineDrawer( vk::raii::RenderPass& render_pass )
|
||||
{
|
||||
PipelineBuilder builder { render_pass, 0 };
|
||||
|
||||
@@ -79,7 +79,8 @@ namespace fgl::engine
|
||||
|
||||
command_buffer.setLineWidth( 5.0f );
|
||||
|
||||
command_buffer.draw( m_lines.size() * 2, m_lines.size(), 0, 0 );
|
||||
command_buffer.draw(
|
||||
static_cast< std::uint32_t >( m_lines.size() * 2 ), static_cast< std::uint32_t >( m_lines.size() ), 0, 0 );
|
||||
|
||||
m_lines.clear();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace fgl::engine
|
||||
vk::raii::CommandBuffer& setupSystem( FrameInfo& info );
|
||||
void pass( FrameInfo& info );
|
||||
|
||||
LineDrawer( Device& device, vk::raii::RenderPass& render_pass );
|
||||
LineDrawer( vk::raii::RenderPass& render_pass );
|
||||
|
||||
~LineDrawer();
|
||||
};
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace fgl::engine
|
||||
vk::ImageLayout::eUndefined,
|
||||
vk::ImageLayout::eShaderReadOnlyOptimal ) ),
|
||||
m_image_view( m_image->getView() ),
|
||||
m_extent( extent )
|
||||
m_extent( extent ),
|
||||
m_name( "Default Texture Name" )
|
||||
{
|
||||
memory::TransferManager::getInstance()
|
||||
.copyToImage( std::forward< std::vector< std::byte > >( data ), *m_image );
|
||||
@@ -212,7 +213,8 @@ namespace fgl::engine
|
||||
m_image(),
|
||||
m_image_view( image.getView() ),
|
||||
//TODO: Figure out how to get extents from images.
|
||||
m_extent()
|
||||
m_extent(),
|
||||
m_name( "Default Texture Name" )
|
||||
{
|
||||
m_image_view->getSampler() = std::move( sampler );
|
||||
}
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
#include <engine/FrameInfo.hpp>
|
||||
#include <glm/gtx/string_cast.hpp>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#include <imgui.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "engine/assets/model/Model.hpp"
|
||||
#include "engine/clock.hpp"
|
||||
@@ -373,8 +377,8 @@ namespace fgl::engine
|
||||
{
|
||||
assert( std::holds_alternative< OctTreeNodeLeaf >( this->m_node_data ) );
|
||||
auto& game_objects { std::get< OctTreeNodeLeaf >( this->m_node_data ) };
|
||||
return std::find_if(
|
||||
game_objects.begin(), game_objects.end(), [ id ]( const GameObject& obj ) { return id == obj.getId(); } );
|
||||
return std::ranges::
|
||||
find_if( game_objects, [ id ]( const GameObject& obj ) noexcept { return id == obj.getId(); } );
|
||||
}
|
||||
|
||||
bool OctTreeNode::canContain( const GameObject& obj ) const
|
||||
@@ -403,18 +407,18 @@ namespace fgl::engine
|
||||
return m_parent->getRoot();
|
||||
}
|
||||
|
||||
void OctTreeNode::getAllLeafs( std::vector< OctTreeNodeLeaf* >& objects )
|
||||
void OctTreeNode::getAllLeafs( std::vector< OctTreeNodeLeaf* >& out_leafs )
|
||||
{
|
||||
ZoneScoped;
|
||||
if ( std::holds_alternative< OctTreeNodeLeaf >( m_node_data ) )
|
||||
{
|
||||
auto& leaf { std::get< OctTreeNodeLeaf >( m_node_data ) };
|
||||
//No point in us giving back an empty leaf
|
||||
if ( leaf.size() > 0 ) objects.emplace_back( &leaf );
|
||||
if ( leaf.size() > 0 ) out_leafs.emplace_back( &leaf );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& nodes { std::get< OctTreeNodeArray >( m_node_data ) };
|
||||
const auto& nodes { std::get< OctTreeNodeArray >( m_node_data ) };
|
||||
|
||||
for ( std::size_t x = 0; x < 2; ++x )
|
||||
{
|
||||
@@ -423,7 +427,7 @@ namespace fgl::engine
|
||||
for ( std::size_t z = 0; z < 2; ++z )
|
||||
{
|
||||
auto ret { nodes[ x ][ y ][ z ]->getAllLeafs() };
|
||||
objects.insert( objects.end(), ret.begin(), ret.end() );
|
||||
out_leafs.insert( out_leafs.end(), ret.begin(), ret.end() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user