Skip to content

Commit

Permalink
Mapped render_structure_globals (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
theTwister authored and theTwister committed Sep 12, 2023
1 parent 3c543f2 commit be3cf1a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions game/source/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "physics/havok_entity_iterator.hpp"
#include "rasterizer/rasterizer.hpp"
#include "render/render_objects_static_lighting.hpp"
#include "render/render_structure.hpp"
#include "render/views/render_view.hpp"
#include "screenshots/screenshots_uploader.hpp"
#include "simulation/simulation.hpp"
Expand Down Expand Up @@ -244,6 +245,7 @@ void __cdecl main_loop_body_begin()
c_lights_view::g_debug_clip_planes;
c_visible_items::m_items;
c_visible_items::m_marker_indices;
g_render_structure_globals;

s_thread_local_storage* tls = get_tls();

Expand Down
2 changes: 2 additions & 0 deletions game/source/render/render_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "cseries/cseries.hpp"

REFERENCE_DECLARE(0x050E8938, render_structure_globals, g_render_structure_globals);

s_structure_bsp_resources* c_structure_bsp_resource_interface::get_resources() const
{
return DECLFUNC(0x004E9550, s_structure_bsp_resources*, __thiscall, c_structure_bsp_resource_interface const*)(this);
Expand Down
61 changes: 61 additions & 0 deletions game/source/render/render_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,64 @@ struct large_collision_vertex
};
static_assert(sizeof(large_collision_vertex) == 0x14);

struct s_render_cluster_part
{
dword_flags flags;
s_cluster_reference cluster_reference;
word mesh_index;
word part_index;
};
static_assert(sizeof(s_render_cluster_part) == 0xC);

struct render_instance_mesh
{
dword_flags flags;
short structure_bsp_index;
word lightmap_instance_index;
word __unknown8;
word part_index;
byte __unknownC;
};
static_assert(sizeof(render_instance_mesh) == 0x10);

struct scenario_lightmap_bsp_data_definition;
struct s_render_geometry;
struct render_structure_globals
{
struct
{
dword_flags flags;
c_static_array<long, 16> lightmap_bsp_type;
c_static_array<scenario_lightmap_bsp_data_definition*, 16> lightmap_bsp_data;
c_static_array<s_render_geometry*, 16> render_geometry;
} cached;

c_static_sized_dynamic_array<s_render_cluster_part, 2048> render_cluster_parts;
c_static_sized_dynamic_array<render_instance_mesh, 3072> render_instance_meshes;

long marker_index;

struct
{
long __unknown0[1];

// __unknown4[0] == render_cluster_parts.m_count
long __unknown4[5];
} render_cluster_part_markers;

struct
{
long __unknown0[1];

// __unknown4[0] == render_instance_meshes.m_count
long __unknown4[5];
} render_instance_mesh_markers;

long scenario_sbsp_index;
long lightmap_cluster_reference;
long lightmap_instance_index;
};
static_assert(sizeof(render_structure_globals) == 0x1210C);

extern render_structure_globals& g_render_structure_globals;

0 comments on commit be3cf1a

Please sign in to comment.