1#ifndef YAZE_ZELDA3_DUNGEON_GEOMETRY_OBJECT_GEOMETRY_H
2#define YAZE_ZELDA3_DUNGEON_GEOMETRY_OBJECT_GEOMETRY_H
7#include <unordered_map>
10#include "absl/status/statusor.h"
126 int routine_id,
const RoomObject&
object)
const;
152 int routine_id,
const RoomObject&
object)
const;
199 return std::hash<uint64_t>()(
201 (
static_cast<uint64_t
>(
static_cast<uint16_t
>(k.
object_id)) << 8) |
208 mutable std::unordered_map<CacheKey, GeometryBounds, CacheKeyHash>
cache_;
Side-car geometry engine that replays draw routines against an off-screen buffer to calculate real ex...
static bool IsDiagonalCeilingRoutine(int routine_id)
Check if a routine ID corresponds to a diagonal ceiling.
std::vector< DrawRoutineInfo > routines_
absl::StatusOr< GeometryBounds > MeasureForLayerCompositing(int routine_id, const RoomObject &object) const
Measure bounds for a BG2 overlay object and mark it for masking.
absl::StatusOr< GeometryBounds > MeasureRoutine(const DrawRoutineInfo &routine, const RoomObject &object) const
std::unordered_map< int, DrawRoutineInfo > routine_map_
absl::StatusOr< GeometryBounds > MeasureByObjectId(const RoomObject &object) const
const DrawRoutineInfo * LookupRoutine(int routine_id) const
absl::StatusOr< GeometryBounds > MeasureByRoutineId(int routine_id, const RoomObject &object) const
static GeometryBounds ApplySelectionBounds(GeometryBounds render_bounds, int routine_id)
Compute tighter selection bounds for diagonal shapes.
static ObjectGeometry & Get()
std::unordered_map< CacheKey, GeometryBounds, CacheKeyHash > cache_
static bool IsLayerOneRoutine(int routine_id)
Get list of routine IDs that draw to BG2 layer.
Metadata about a draw routine.
Bounding box result for a draw routine execution.
std::tuple< int, int, int, int > GetBG1MaskRect(int obj_x, int obj_y) const
Get the BG1 mask rectangle in pixel coordinates.
std::optional< SelectionRect > selection_bounds
SelectionRect GetSelectionBounds() const
Get the selection bounds for hit testing.
int height_pixels() const
bool RequiresBG1Mask() const
Check if this object requires BG1 masking.
bool HasTighterSelectionBounds() const
Check if this object has a tighter selection hitbox.
size_t operator()(const CacheKey &k) const
bool operator==(const CacheKey &o) const
Simple rectangle for selection bounds.
int height_pixels() const