Files
Cesarus85--ringfall-mjolnir-vr/source/render/render.h
T
Stefan MaierandClaude Opus 5.5 b6a943f1a6 Merge upstream 2026-10-10: network version 25, touch controls, in-game settings, FOV options, voice chat, votekick
248 OpenCE commits (network version 25): touch controls and touch menus for
phones, single-player in-game Settings, opt-in FOV/viewmodel settings, voice
chat and votes to kick, lens flare culling, memory leak fixes (render
targets, gamepads, the Android audio stream), profiling builds, the
HALO_ANDROID split into HALO_ARM64_GUEST / HALO_GLES / HALO_ANDROID.

Conflicts and how they were resolved:
- README.md: ours kept whole. Upstream's README changes (portable build,
  profiling builds) went into docs/OPENCE_README.md: upstream's new text
  with our header note, links rewritten to ../ and our "made from your own
  copy" wording.
- port/android/README.md: both merged; upstream's touch, WSL and save
  notes taken, with our application id in every adb path; our VR section,
  signing.properties and wording kept; the stale "How it works" list
  dropped as upstream dropped it.
- Launcher icons (mipmap-*/ic_launcher_foreground.png, art/android-icon.png):
  ours (the Ringfall art). Upstream's helmet monochrome layers,
  drawable/ic_launcher_background.xml and its ic_launcher.xml were left out;
  our ic_launcher.xml, values/ic_launcher_background.xml and
  tools/android_icon.py stay. (port/assets/icon and tools/app_icon.py come
  in for the desktop builds' window icon only; do not run app_icon.py, it
  would write the helmet into the Android resources.)
- port/android/host/host_main.c: both config helpers kept, and upstream's
  emulator write tracking (native_bridge_active); upstream's display width
  block dropped in favour of ours (640 in VR) and its display density for
  the touch controls moved into our flat (non-VR) branch.
- port/linux/game/menu_functions.c: platform_text_field(typing, password)
  from upstream; the VR keyboard launch for text fields kept after it.
- port/linux/game/network_distributed.c: upstream's profile_scope wrappers,
  with network_vr_tick and bots_tick kept in their places.
- port/linux/src/dsound_sdl.c: both (our debug.audio_log, upstream's
  audio.output_device).
- port/linux/src/port_config.c: our temp-and-rename config write kept,
  under upstream's HALO_ARM64_GUEST (it is guest file I/O).
- port/linux/src/sdl_platform.c/.h: upstream's (Android menu pointer from
  the touchscreen, Steam keyboard, scoreboard pointer); our quit marker for
  the Steam Frame launcher, clipboard_seen and VR frame hooks kept. Our
  flat-mouse menu pointer (an emulator aid) is replaced by upstream's touch
  pointer, which also drives the menus on the emulator.
- port/linux/src/d3d8_gl.c: halo_ui_pointer_update is upstream's, with the
  VR controller ray taking over while VR is active (the touchscreen then
  is not the pointer); our persistent-buffer writes kept for stream and
  index uploads, now writing upstream's exact length and under HALO_GLES
  like the code around them (stream_reserve, index_upload, mirror_refresh
  too); multiview uniforms stay under HALO_ANDROID, the counter binding
  under HALO_GLES. Visibility counters: ours kept (the snapshot ring with
  multiview views, host_gl_counters_snapshot) over upstream's per-frame
  glCopyBufferSubData into counter_snapshots: ours reads finished frames
  without stalling and counts both eyes' samples once; upstream's
  desktop query batches come in unchanged.
- port/linux/src/xinput_sdl.c: both (VR controllers and touch controls).
  In VR the touch controls neither show nor act (touch_input_gamepad,
  touch_input_controls, touch move/look skipped); rumble goes to the
  controllers in VR, to the phone otherwise.
- source/interface/first_person_weapons.c: both (VR scope pass check and
  display.viewmodel_visible).
- source/interface/ui_widget.c: upstream's reworked menu targets taken
  (ui_mouse_fit_button_targets, merged rows, widened values), which do
  what our icon_x0 key picking and the 12-unit value arrows did; our VR
  label distance (25) kept, and a VR ray counts as a coarse pointer, so it
  gets the taller legend areas and the widened values (not the merged
  rows: a row's label still presses A). Our join code and VR options
  panels kept; their early return now forgets the frame's targets too.
  The on-screen keyboard: upstream's virtual_keyboard_click for taps and
  the mouse, ours (hover highlights the key) for the VR ray only.
- source/main/main.c: both (VR phases around upstream's profile scopes).

VR guards for new upstream features:
- view_fov.c: display.fov, display.viewmodel_fov and
  display.viewmodel_visible do nothing while VR is active (the headset
  gives each eye's frustum; the weapon is in the hand).
- Touch controls: off in VR (xinput_sdl.c), the menus' touch pointer too
  (d3d8_gl.c); the overlay stays hidden as the game never reports a scene.
- Lens flare culling (744040c8, b1a71709) uses global_window_parameters'
  frustum, which in VR is each eye's (per-eye passes) or the union frustum
  of the multiview centre camera: no change needed.
- In-game Settings: VR options still open with Y on the main and pause
  menus (checked flat with debug.vr_options).
- The back button change (enableOnBackInvokedCallback=false) keeps the
  legacy KEYCODE_BACK path, which targetSdk 35 already had: no change on
  Quest or Frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 08:51:46 +02:00

178 lines
4.6 KiB
C

/*
RENDER.H
header included in hcex build.
*/
#ifndef __RENDER_H
#define __RENDER_H
#pragma once
/* ---------- headers */
#include "render_cameras.h"
#include "structures/structures.h"
#include "structures/structure_render.h"
/* ---------- constants */
enum
{
MAXIMUM_RENDERED_DISTANT_LIGHTS = 2,
MAXIMUM_RENDERED_POINT_LIGHTS = 2,
/* port: twice the Xbox's 16384 structure triangles a frame */
MAXIMUM_RENDERED_ENVIRONMENT_SURFACES = 32768,
MAXIMUM_RENDERED_CLUSTERS = 128,
MAXIMUM_SURFACES_PER_STRUCTURE = 0x20000,
MAXIMUM_RENDERED_LIGHTS = 128,
/* the native builds' larger light pool (halo_port_capacity.h) */
MAXIMUM_LIGHTS_PER_MAP = HALO_PORT_MAXIMUM_LIGHTS_PER_MAP,
MAXIMUM_LENS_FLARES_PER_LIGHT = 8,
MAXIMUM_QUEUED_LENS_FLARES = 8,
};
/* ---------- macros */
/* ---------- structures */
struct render_distant_light
{
real_rgb_color color;
real_vector3d direction;
};
struct render_lighting
{
real_rgb_color ambient_color;
short distant_light_count;
word pad;
struct render_distant_light distant_lights[MAXIMUM_RENDERED_DISTANT_LIGHTS];
short point_light_count;
word pad1;
long point_light_indices[MAXIMUM_RENDERED_POINT_LIGHTS];
real_argb_color reflection_tint_color;
real_vector3d shadow_vector;
real_rgb_color shadow_color;
};
/* HCEX and the PC-demo PDB type node_matrices as a non-const `real_matrix4x3 *`.
It is declared const here because its users store const node-matrix pointers
into it (transparent_geometry_group.node_matrices is const in HCEX as well);
the qualifier changes no emitted byte, and the non-const spelling would add
eleven C4090 const-qualifier warnings in five translation units. */
struct render_skinning
{
real_matrix4x3 const *node_matrices;
short node_matrix_count;
};
struct rendered_cluster
{
short cluster_index;
real_rectangle2d clip_bounds;
struct render_frustum frustum;
};
struct render_globals
{
long frame_index;
long scene_index;
short local_player_index;
short window_index;
real time_delta_since_tick_sec;
struct render_camera camera;
struct render_frustum frustum;
struct render_fog fog;
long leaf_index;
long cluster_index;
boolean under_water;
boolean visible_sky_model;
short visible_sky_index;
// Bitvector of all clusters where bit set means the cluster is visible
unsigned long visible_cluster_flags[MAXIMUM_CLUSTERS_PER_STRUCTURE / LONG_BITS];
struct rendered_cluster rendered_clusters[MAXIMUM_RENDERED_CLUSTERS];
short rendered_cluster_count;
unsigned long environment_surface_flags[MAXIMUM_SURFACES_PER_STRUCTURE];
/* port: a long, as a short would wrap at the raised count */
long environment_surface_count;
long environment_surface_indices[MAXIMUM_RENDERED_ENVIRONMENT_SURFACES];
};
/* ---------- prototypes/RENDER.C */
void render_effects(boolean enable);
void render_initialize(void);
void render_initialize_for_new_map(void);
void render_dispose_from_old_map(void);
void render_dispose(void);
void render_frame(
struct render_window *windoze,
short window_count,
point2d const *screenshot_page_index,
point2d const *screenshot_index,
struct bitmap_data *screenshot_bitmap,
real time_delta_since_tick_sec);
void render_frame_pregame(
struct render_window const *window,
struct bitmap_data *bitmap);
void render_frame_present(
const point2d *screenshot_index,
struct bitmap_data *bitmap);
boolean render_location_visible(
struct location *location);
struct rendered_cluster *rendered_cluster_get(
short rendered_cluster_index);
/* ---------- prototypes/RENDER_CONTRAILS.C */
void render_contrails_ground_mapped(
void);
void render_contrails_media_mapped(
void);
void render_contrails_normal(
void);
/* ---------- prototypes/RENDER_OBJECTS.C */
void render_objects_initialize(
void);
void render_objects_initialize_for_new_map(
void);
void render_objects_dispose_from_old_map(
void);
void render_objects_dispose(
void);
struct render_lighting *object_get_cached_render_lighting(
long object_index,
real level_of_detail_pixels);
#ifdef HALO_ANDROID
/* VR: whether a player's own unit is drawn, seated at a wheel or a gun (the
first-person weapon is not, then), and whether it sits at a wheel or a gun
at all (render_objects.c) */
boolean render_object_vr_seated_body(
long object_index);
boolean render_object_vr_at_controls(
long object_index);
/* at an open wheel (a Warthog's), where its drawn hands hold it */
boolean render_object_vr_wheel_hands(
long object_index,
real_point3d *left,
real_point3d *right);
#endif
void render_objects(
void);
void render_object_shadows(
void);
/* ---------- globals */
extern struct render_globals render;
extern boolean render_particle_systems_enabled;
/* ---------- public code */
#endif // __RENDER_H