Skip to content

Commit

Permalink
Added a shared mesh storage to avoid generating meshes every time a d…
Browse files Browse the repository at this point in the history
…ebug container is created.
  • Loading branch information
DmitriySalnikov committed Apr 1, 2024
1 parent f5f24e2 commit 26ff684
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 121 deletions.
7 changes: 4 additions & 3 deletions examples_dd3d/DebugDrawDemoScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ func _physics_process(delta: float) -> void:


func main_update(delta: float) -> void:
if Input.is_action_just_pressed("ui_end"):
DebugDraw3D.regenerate_geometry_meshes()

DebugDraw3D.scoped_config().set_thickness(debug_thickness).set_center_brightness(debug_center_brightness)
if false: #test
var _s11 = DebugDraw3D.new_scoped_config().set_thickness(1)
Expand Down Expand Up @@ -130,6 +127,10 @@ func main_update(delta: float) -> void:
DebugDraw3D.config.freeze_3d_render = Input.is_key_pressed(KEY_DOWN)
DebugDraw3D.config.visible_instance_bounds = Input.is_key_pressed(KEY_RIGHT)

# Regenerate meshes
if Input.is_action_just_pressed("ui_end"):
DebugDraw3D.regenerate_geometry_meshes()

# Some property toggles
if _is_key_just_pressed(KEY_LEFT):
DebugDraw3D.config.use_frustum_culling = !DebugDraw3D.config.use_frustum_culling
Expand Down
7 changes: 4 additions & 3 deletions examples_dd3d/DebugDrawDemoSceneCS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ public override void _PhysicsProcess(double delta)

void MainUpdate(double delta)
{
if (Input.IsActionJustPressed("ui_end"))
DebugDraw3D.RegenerateGeometryMeshes();

DebugDraw3D.ScopedConfig().SetThickness(debug_thickness);
#pragma warning disable CS0162 // Unreachable code detected
if (false) // #test
Expand Down Expand Up @@ -312,6 +309,10 @@ void MainUpdate(double delta)
DebugDraw3D.Config.Freeze3dRender = Input.IsKeyPressed(Key.Down);
DebugDraw3D.Config.VisibleInstanceBounds = Input.IsKeyPressed(Key.Right);

// Regenerate meshes
if (Input.IsActionJustPressed("ui_end"))
DebugDraw3D.RegenerateGeometryMeshes();

// Some property toggles
if (_is_key_just_pressed(Key.Left))
DebugDraw3D.Config.UseFrustumCulling = !DebugDraw3D.Config.UseFrustumCulling;
Expand Down
51 changes: 46 additions & 5 deletions src/3d/debug_draw_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,49 @@ Node *DebugDraw3D::get_root_node() {
return root_node;
}

Ref<ArrayMesh> *DebugDraw3D::get_shared_meshes() {
LOCK_GUARD(datalock);
if (!shared_generated_meshes.size()) {
bool p_add_bevel = PS()->get_setting(root_settings_section + s_add_bevel_to_volumetric);
bool p_use_icosphere = PS()->get_setting(root_settings_section + s_use_icosphere);
bool p_use_icosphere_hd = PS()->get_setting(root_settings_section + s_use_icosphere_hd);

shared_generated_meshes.resize((int)InstanceType::MAX);

// WIREFRAME

shared_generated_meshes[(int)InstanceType::CUBE] = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::CubeVertexes, GeometryGenerator::CubeIndexes);
shared_generated_meshes[(int)InstanceType::CUBE_CENTERED] = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::CenteredCubeVertexes, GeometryGenerator::CubeIndexes);
shared_generated_meshes[(int)InstanceType::ARROWHEAD] = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::ArrowheadVertexes, GeometryGenerator::ArrowheadIndexes);
shared_generated_meshes[(int)InstanceType::POSITION] = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::PositionVertexes, GeometryGenerator::PositionIndexes);
shared_generated_meshes[(int)InstanceType::SPHERE] = p_use_icosphere ? GeometryGenerator::CreateIcosphereLines(0.5f, 1) : GeometryGenerator::CreateSphereLines(8, 8, 0.5f, 2);
shared_generated_meshes[(int)InstanceType::SPHERE_HD] = p_use_icosphere_hd ? GeometryGenerator::CreateIcosphereLines(0.5f, 2) : GeometryGenerator::CreateSphereLines(16, 16, 0.5f, 2);
shared_generated_meshes[(int)InstanceType::CYLINDER] = GeometryGenerator::CreateCylinderLines(16, 1, 1, 2);
shared_generated_meshes[(int)InstanceType::CYLINDER_AB] = GeometryGenerator::RotatedMesh(GeometryGenerator::CreateCylinderLines(16, 1, 1, 2), Vector3_RIGHT, Math::deg_to_rad(90.f));

// VOLUMETRIC

shared_generated_meshes[(int)InstanceType::LINE_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::LineVertexes), p_add_bevel);
shared_generated_meshes[(int)InstanceType::CUBE_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::CUBE], p_add_bevel);
shared_generated_meshes[(int)InstanceType::CUBE_CENTERED_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::CUBE_CENTERED], p_add_bevel);
shared_generated_meshes[(int)InstanceType::ARROWHEAD_VOLUMETRIC] = GeometryGenerator::CreateVolumetricArrowHead(.25f, 1.f, 1.f, p_add_bevel);
shared_generated_meshes[(int)InstanceType::POSITION_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::POSITION], p_add_bevel);
shared_generated_meshes[(int)InstanceType::SPHERE_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::SPHERE], false);
shared_generated_meshes[(int)InstanceType::SPHERE_HD_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::SPHERE_HD], false);
shared_generated_meshes[(int)InstanceType::CYLINDER_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::CYLINDER], false);
shared_generated_meshes[(int)InstanceType::CYLINDER_AB_VOLUMETRIC] = GeometryGenerator::ConvertWireframeToVolumetric(shared_generated_meshes[(int)InstanceType::CYLINDER_AB], false);

// SOLID

shared_generated_meshes[(int)InstanceType::BILLBOARD_SQUARE] = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_TRIANGLES, GeometryGenerator::CenteredSquareVertexes, GeometryGenerator::SquareBackwardsIndexes);
shared_generated_meshes[(int)InstanceType::PLANE] = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_TRIANGLES, GeometryGenerator::CenteredSquareVertexes, GeometryGenerator::SquareIndexes);
}

return shared_generated_meshes.data();
}

std::shared_ptr<DebugGeometryContainer> DebugDraw3D::create_debug_container() {
return std::make_shared<DebugGeometryContainer>(
this,
PS()->get_setting(root_settings_section + s_add_bevel_to_volumetric),
PS()->get_setting(root_settings_section + s_use_icosphere),
PS()->get_setting(root_settings_section + s_use_icosphere_hd));
return std::make_shared<DebugGeometryContainer>(this);
}

std::shared_ptr<DebugGeometryContainer> DebugDraw3D::get_debug_container(Viewport *p_vp) {
Expand Down Expand Up @@ -543,6 +580,10 @@ Ref<DebugDraw3DStats> DebugDraw3D::get_render_stats_for_world(Viewport *viewport
void DebugDraw3D::regenerate_geometry_meshes() {
#ifndef DISABLE_DEBUG_RENDERING
LOCK_GUARD(datalock);

// Force regenerate meshes
shared_generated_meshes.clear();

for (auto &p : debug_containers) {
Ref<World3D> old_world = p.second->get_world();

Expand Down
8 changes: 5 additions & 3 deletions src/3d/debug_draw_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
#include "common/colors.h"
#include "common/i_scope_storage.h"
#include "config_scope_3d.h"
#include "render_instances_enums.h"
#include "utils/profiler.h"

#include <map>
#include <memory>
#include <mutex>

GODOT_WARNING_DISABLE()
#include <godot_cpp/classes/array_mesh.hpp>
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/shader.hpp>
#include <godot_cpp/classes/shader_material.hpp>
Expand All @@ -26,9 +28,6 @@ class DebugDraw3DStats;
#ifndef DISABLE_DEBUG_RENDERING
class DebugGeometryContainer;
struct DelayedRendererLine;

enum class InstanceType : char;
enum class ConvertableInstanceType : char;
#endif

#ifndef DISABLE_DEBUG_RENDERING
Expand Down Expand Up @@ -154,6 +153,8 @@ class DebugDraw3D : public Object, public IScopeStorage<DebugDraw3DScopeConfig,
const std::shared_ptr<DebugDraw3DScopeConfig::Data> scoped_config_for_current_thread() override;

// Meshes
/// Store meshes shared between many debug containers
std::vector<Ref<ArrayMesh> > shared_generated_meshes;
/// Store World3D id and debug container
std::unordered_map<uint64_t, std::shared_ptr<DebugGeometryContainer> > debug_containers;
struct viewportToWorldCache {
Expand All @@ -180,6 +181,7 @@ class DebugDraw3D : public Object, public IScopeStorage<DebugDraw3DScopeConfig,
void _unregister_scoped_config(uint64_t p_thread_id, uint64_t p_guard_id) override;
void _clear_scoped_configs() override;

Ref<ArrayMesh> *get_shared_meshes();
std::shared_ptr<DebugGeometryContainer> create_debug_container();
std::shared_ptr<DebugGeometryContainer> get_debug_container(Viewport *p_vp);
void _register_viewport_world_deferred(Viewport *p_vp, const uint64_t p_world_id);
Expand Down
75 changes: 21 additions & 54 deletions src/3d/debug_geometry_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GODOT_WARNING_DISABLE()
GODOT_WARNING_RESTORE()
using namespace godot;

DebugGeometryContainer::DebugGeometryContainer(class DebugDraw3D *p_root, const bool &p_add_bevel, const bool &p_use_icosphere, const bool &p_use_icosphere_hd) {
DebugGeometryContainer::DebugGeometryContainer(class DebugDraw3D *p_root) {
ZoneScoped;
owner = p_root;
RenderingServer *rs = RenderingServer::get_singleton();
Expand All @@ -42,66 +42,33 @@ DebugGeometryContainer::DebugGeometryContainer(class DebugDraw3D *p_root, const

// Generate geometry and create MMI's in RenderingServer
{
auto array_mesh_cube = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::CubeVertexes, GeometryGenerator::CubeIndexes);
CreateMMI(InstanceType::CUBE, UsingShaderType::Wireframe, NAMEOF(mmi_cubes), array_mesh_cube);
auto *meshes = owner->get_shared_meshes();

auto array_mesh_cube_center = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::CenteredCubeVertexes, GeometryGenerator::CubeIndexes);
CreateMMI(InstanceType::CUBE_CENTERED, UsingShaderType::Wireframe, NAMEOF(mmi_cubes_centered), array_mesh_cube_center);

auto array_mesh_arrow_head = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::ArrowheadVertexes, GeometryGenerator::ArrowheadIndexes);
CreateMMI(InstanceType::ARROWHEAD, UsingShaderType::Wireframe, NAMEOF(mmi_arrowheads), array_mesh_arrow_head);

auto array_mesh_pos = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::PositionVertexes, GeometryGenerator::PositionIndexes);
CreateMMI(InstanceType::POSITION, UsingShaderType::Wireframe, NAMEOF(mmi_positions), array_mesh_pos);

auto array_mesh_sphere = p_use_icosphere ? GeometryGenerator::CreateIcosphereLines(0.5f, 1) : GeometryGenerator::CreateSphereLines(8, 8, 0.5f, 2);
CreateMMI(InstanceType::SPHERE, UsingShaderType::Wireframe, NAMEOF(mmi_spheres), array_mesh_sphere);

auto array_mesh_sphere_hd = p_use_icosphere_hd ? GeometryGenerator::CreateIcosphereLines(0.5f, 2) : GeometryGenerator::CreateSphereLines(16, 16, 0.5f, 2);
CreateMMI(InstanceType::SPHERE_HD, UsingShaderType::Wireframe, NAMEOF(mmi_spheres_hd), array_mesh_sphere_hd);

auto array_mesh_cylinder = GeometryGenerator::CreateCylinderLines(16, 1, 1, 2);
CreateMMI(InstanceType::CYLINDER, UsingShaderType::Wireframe, NAMEOF(mmi_cylinders), array_mesh_cylinder);

auto array_mesh_cylinder_ab = GeometryGenerator::RotatedMesh(GeometryGenerator::CreateCylinderLines(16, 1, 1, 2), Vector3_RIGHT, Math::deg_to_rad(90.f));
CreateMMI(InstanceType::CYLINDER_AB, UsingShaderType::Wireframe, NAMEOF(mmi_cylinders), array_mesh_cylinder_ab);
CreateMMI(InstanceType::CUBE, UsingShaderType::Wireframe, NAMEOF(mmi_cubes), meshes[(int)InstanceType::CUBE]);
CreateMMI(InstanceType::CUBE_CENTERED, UsingShaderType::Wireframe, NAMEOF(mmi_cubes_centered), meshes[(int)InstanceType::CUBE_CENTERED]);
CreateMMI(InstanceType::ARROWHEAD, UsingShaderType::Wireframe, NAMEOF(mmi_arrowheads), meshes[(int)InstanceType::ARROWHEAD]);
CreateMMI(InstanceType::POSITION, UsingShaderType::Wireframe, NAMEOF(mmi_positions), meshes[(int)InstanceType::POSITION]);
CreateMMI(InstanceType::SPHERE, UsingShaderType::Wireframe, NAMEOF(mmi_spheres), meshes[(int)InstanceType::SPHERE]);
CreateMMI(InstanceType::SPHERE_HD, UsingShaderType::Wireframe, NAMEOF(mmi_spheres_hd), meshes[(int)InstanceType::SPHERE_HD]);
CreateMMI(InstanceType::CYLINDER, UsingShaderType::Wireframe, NAMEOF(mmi_cylinders), meshes[(int)InstanceType::CYLINDER]);
CreateMMI(InstanceType::CYLINDER_AB, UsingShaderType::Wireframe, NAMEOF(mmi_cylinders), meshes[(int)InstanceType::CYLINDER_AB]);

// VOLUMETRIC

auto array_mesh_line_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_LINES, GeometryGenerator::LineVertexes), p_add_bevel);
CreateMMI(InstanceType::LINE_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cubes_volumetric), array_mesh_line_volumetric);

auto array_mesh_cube_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_cube, p_add_bevel);
CreateMMI(InstanceType::CUBE_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cubes_volumetric), array_mesh_cube_volumetric);

auto array_mesh_cube_centered_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_cube_center, p_add_bevel);
CreateMMI(InstanceType::CUBE_CENTERED_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cubes_centered_volumetric), array_mesh_cube_centered_volumetric);

auto array_mesh_arrow_head_volumetric = GeometryGenerator::CreateVolumetricArrowHead(.25f, 1.f, 1.f, p_add_bevel);
CreateMMI(InstanceType::ARROWHEAD_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_arrowheads_volumetric), array_mesh_arrow_head_volumetric);

auto array_mesh_pos_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_pos, p_add_bevel);
CreateMMI(InstanceType::POSITION_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_positions_volumetric), array_mesh_pos_volumetric);

auto array_mesh_sphere_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_sphere, false);
CreateMMI(InstanceType::SPHERE_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_spheres_volumetric), array_mesh_sphere_volumetric);

auto array_mesh_sphere_hd_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_sphere_hd, false);
CreateMMI(InstanceType::SPHERE_HD_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_spheres_hd_volumetric), array_mesh_sphere_hd_volumetric);

auto array_mesh_cylinder_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_cylinder, false);
CreateMMI(InstanceType::CYLINDER_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cylinders_volumetric), array_mesh_cylinder_volumetric);

auto array_mesh_cylinder_ab_volumetric = GeometryGenerator::ConvertWireframeToVolumetric(array_mesh_cylinder_ab, false);
CreateMMI(InstanceType::CYLINDER_AB_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cylinders_volumetric), array_mesh_cylinder_ab_volumetric);
CreateMMI(InstanceType::LINE_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cubes_volumetric), meshes[(int)InstanceType::LINE_VOLUMETRIC]);
CreateMMI(InstanceType::CUBE_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cubes_volumetric), meshes[(int)InstanceType::CUBE_VOLUMETRIC]);
CreateMMI(InstanceType::CUBE_CENTERED_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cubes_centered_volumetric), meshes[(int)InstanceType::CUBE_CENTERED_VOLUMETRIC]);
CreateMMI(InstanceType::ARROWHEAD_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_arrowheads_volumetric), meshes[(int)InstanceType::ARROWHEAD_VOLUMETRIC]);
CreateMMI(InstanceType::POSITION_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_positions_volumetric), meshes[(int)InstanceType::POSITION_VOLUMETRIC]);
CreateMMI(InstanceType::SPHERE_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_spheres_volumetric), meshes[(int)InstanceType::SPHERE_VOLUMETRIC]);
CreateMMI(InstanceType::SPHERE_HD_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_spheres_hd_volumetric), meshes[(int)InstanceType::SPHERE_HD_VOLUMETRIC]);
CreateMMI(InstanceType::CYLINDER_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cylinders_volumetric), meshes[(int)InstanceType::CYLINDER_VOLUMETRIC]);
CreateMMI(InstanceType::CYLINDER_AB_VOLUMETRIC, UsingShaderType::Expandable, NAMEOF(mmi_cylinders_volumetric), meshes[(int)InstanceType::CYLINDER_AB_VOLUMETRIC]);

// SOLID

auto array_mesh_billboard = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_TRIANGLES, GeometryGenerator::CenteredSquareVertexes, GeometryGenerator::SquareBackwardsIndexes);
CreateMMI(InstanceType::BILLBOARD_SQUARE, UsingShaderType::Billboard, NAMEOF(mmi_billboard_squares), array_mesh_billboard);

auto array_mesh_plane = GeometryGenerator::CreateMeshNative(Mesh::PrimitiveType::PRIMITIVE_TRIANGLES, GeometryGenerator::CenteredSquareVertexes, GeometryGenerator::SquareIndexes);
CreateMMI(InstanceType::PLANE, UsingShaderType::Solid, NAMEOF(mmi_planes), array_mesh_plane);
CreateMMI(InstanceType::BILLBOARD_SQUARE, UsingShaderType::Billboard, NAMEOF(mmi_billboard_squares), meshes[(int)InstanceType::BILLBOARD_SQUARE]);
CreateMMI(InstanceType::PLANE, UsingShaderType::Solid, NAMEOF(mmi_planes), meshes[(int)InstanceType::PLANE]);

set_render_layer_mask(1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/3d/debug_geometry_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DebugGeometryContainer {
void CreateMMI(InstanceType p_type, UsingShaderType p_shader, const String &p_name, Ref<ArrayMesh> p_mesh);

public:
DebugGeometryContainer(class DebugDraw3D *p_root, const bool &p_add_bevel, const bool &p_use_icosphere, const bool &p_use_icosphere_hd);
DebugGeometryContainer(class DebugDraw3D *p_root);
~DebugGeometryContainer();

void set_world(Ref<World3D> p_new_world);
Expand Down
54 changes: 2 additions & 52 deletions src/3d/render_instances.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#ifndef DISABLE_DEBUG_RENDERING

#include "3d/config_scope_3d.h"
#include "config_scope_3d.h"
#include "render_instances_enums.h"
#include "utils/math_utils.h"
#include "utils/utils.h"

Expand All @@ -21,57 +22,6 @@ class MultiMesh;
class DebugDraw3DStats;
class GeometryPool;

enum class GeometryType : char {
Wireframe,
Volumetric,
Solid,
};

enum class ConvertableInstanceType : char {
CUBE,
CUBE_CENTERED,
ARROWHEAD,
POSITION,
SPHERE,
CYLINDER,
CYLINDER_AB,
};

enum class InstanceType : char {
// Basic wireframe
CUBE,
CUBE_CENTERED,
ARROWHEAD,
POSITION,
SPHERE,
SPHERE_HD,
CYLINDER,
CYLINDER_AB,

// Volumetric from wireframes
LINE_VOLUMETRIC,
CUBE_VOLUMETRIC,
CUBE_CENTERED_VOLUMETRIC,
ARROWHEAD_VOLUMETRIC,
POSITION_VOLUMETRIC,
SPHERE_VOLUMETRIC,
SPHERE_HD_VOLUMETRIC,
CYLINDER_VOLUMETRIC,
CYLINDER_AB_VOLUMETRIC,

// Solid geometry
BILLBOARD_SQUARE,
PLANE,

MAX,
};

enum class ProcessType : char {
PROCESS,
PHYSICS_PROCESS,
MAX,
};

class GeometryPoolCullingData {
public:
std::vector<std::array<Plane, 6> > m_frustums;
Expand Down
52 changes: 52 additions & 0 deletions src/3d/render_instances_enums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#pragma once

enum class GeometryType : char {
Wireframe,
Volumetric,
Solid,
};

enum class ConvertableInstanceType : char {
CUBE,
CUBE_CENTERED,
ARROWHEAD,
POSITION,
SPHERE,
CYLINDER,
CYLINDER_AB,
};

enum class InstanceType : char {
// Basic wireframe
CUBE,
CUBE_CENTERED,
ARROWHEAD,
POSITION,
SPHERE,
SPHERE_HD,
CYLINDER,
CYLINDER_AB,

// Volumetric from wireframes
LINE_VOLUMETRIC,
CUBE_VOLUMETRIC,
CUBE_CENTERED_VOLUMETRIC,
ARROWHEAD_VOLUMETRIC,
POSITION_VOLUMETRIC,
SPHERE_VOLUMETRIC,
SPHERE_HD_VOLUMETRIC,
CYLINDER_VOLUMETRIC,
CYLINDER_AB_VOLUMETRIC,

// Solid geometry
BILLBOARD_SQUARE,
PLANE,

MAX,
};

enum class ProcessType : char {
PROCESS,
PHYSICS_PROCESS,
MAX,
};
1 change: 1 addition & 0 deletions src/dev_debug_draw_3d_Library.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@
<ClInclude Include="3d\debug_geometry_container.h">
<DeploymentContent>false</DeploymentContent>
</ClInclude>
<ClInclude Include="3d\render_instances_enums.h" />
<ClInclude Include="3d\stats_3d.h">
<DeploymentContent>false</DeploymentContent>
</ClInclude>
Expand Down
3 changes: 3 additions & 0 deletions src/dev_debug_draw_3d_Library.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
<ClInclude Include="common\i_scope_storage.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="3d\render_instances_enums.h">
<Filter>3d</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Natvis Include="debug_strings.natvis" />
Expand Down

0 comments on commit 26ff684

Please sign in to comment.