yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::GeometryBounds Struct Reference

Bounding box result for a draw routine execution. More...

#include <object_geometry.h>

Public Member Functions

int max_x_tiles () const
 
int max_y_tiles () const
 
int width_pixels () const
 
int height_pixels () const
 
int min_x_pixels () const
 
int min_y_pixels () const
 
bool RequiresBG1Mask () const
 Check if this object requires BG1 masking.
 
SelectionRect GetSelectionBounds () const
 Get the selection bounds for hit testing.
 
std::tuple< int, int, int, int > GetBG1MaskRect (int obj_x, int obj_y) const
 Get the BG1 mask rectangle in pixel coordinates.
 

Public Attributes

int min_x_tiles = 0
 
int min_y_tiles = 0
 
int width_tiles = 0
 
int height_tiles = 0
 
bool is_bg2_overlay = false
 

Detailed Description

Bounding box result for a draw routine execution.

All values are in tile units. Convenience helpers expose pixel sizes for callers that need screen-space values.

For BG2 overlay objects (Layer 1 objects), the bounds also serve as the BG1 mask rectangle - the area where BG1 pixels should be transparent to allow BG2 content to show through during compositing.

Selection uses this full rendered footprint. Shape-aware pixel hit testing belongs in the editor; shrinking this rectangle can make visible edge tiles impossible to select.

Definition at line 45 of file object_geometry.h.

Member Function Documentation

◆ max_x_tiles()

int yaze::zelda3::GeometryBounds::max_x_tiles ( ) const
inline

Definition at line 55 of file object_geometry.h.

References min_x_tiles, and width_tiles.

◆ max_y_tiles()

int yaze::zelda3::GeometryBounds::max_y_tiles ( ) const
inline

Definition at line 56 of file object_geometry.h.

References height_tiles, and min_y_tiles.

◆ width_pixels()

int yaze::zelda3::GeometryBounds::width_pixels ( ) const
inline

Definition at line 57 of file object_geometry.h.

References width_tiles.

Referenced by GetBG1MaskRect().

◆ height_pixels()

int yaze::zelda3::GeometryBounds::height_pixels ( ) const
inline

Definition at line 58 of file object_geometry.h.

References height_tiles.

Referenced by GetBG1MaskRect().

◆ min_x_pixels()

int yaze::zelda3::GeometryBounds::min_x_pixels ( ) const
inline

Definition at line 61 of file object_geometry.h.

References min_x_tiles.

◆ min_y_pixels()

int yaze::zelda3::GeometryBounds::min_y_pixels ( ) const
inline

Definition at line 62 of file object_geometry.h.

References min_y_tiles.

◆ RequiresBG1Mask()

bool yaze::zelda3::GeometryBounds::RequiresBG1Mask ( ) const
inline

Check if this object requires BG1 masking.

BG2 overlay objects need corresponding pixels in BG1 marked as transparent so the BG2 content shows through during layer compositing. 94 rooms in vanilla ALTTP have such objects.

Definition at line 71 of file object_geometry.h.

References is_bg2_overlay, and width_tiles.

◆ GetSelectionBounds()

SelectionRect yaze::zelda3::GeometryBounds::GetSelectionBounds ( ) const
inline

Get the selection bounds for hit testing.

Definition at line 76 of file object_geometry.h.

References height_tiles, min_x_tiles, min_y_tiles, and width_tiles.

◆ GetBG1MaskRect()

std::tuple< int, int, int, int > yaze::zelda3::GeometryBounds::GetBG1MaskRect ( int obj_x,
int obj_y ) const
inline

Get the BG1 mask rectangle in pixel coordinates.

Parameters
obj_xObject's base X position in tiles
obj_yObject's base Y position in tiles
Returns
Tuple of (start_x, start_y, width, height) in pixels

Definition at line 87 of file object_geometry.h.

References height_pixels(), min_x_tiles, min_y_tiles, and width_pixels().

Here is the call graph for this function:

Member Data Documentation

◆ min_x_tiles

int yaze::zelda3::GeometryBounds::min_x_tiles = 0

◆ min_y_tiles

int yaze::zelda3::GeometryBounds::min_y_tiles = 0

◆ width_tiles

int yaze::zelda3::GeometryBounds::width_tiles = 0

◆ height_tiles

int yaze::zelda3::GeometryBounds::height_tiles = 0

◆ is_bg2_overlay

bool yaze::zelda3::GeometryBounds::is_bg2_overlay = false

The documentation for this struct was generated from the following file: