EPOK RUNTIME
World2D
world2d.hpp · the world2d module
Module
the world2d module.
Include this module
C++ include
#include "world2d.hpp"Types
Aabb2DStruct declared by the world2d module for the world2d module.StructAffine2D2x3 affine matrix: linear part `m` (rotation and scale, shear when inherited) plus the translation `t`.StructCamera2D---- Camera2D ------------------------------------------------------------------------ Projection convention (no dependency whatsoever on the 3D camera or on projection_focal): screen = viewport_center + R(-camera.rotation) * (world - camera.position) * k with k = zoom * pixels_per_unit_2d, and the screen Y axis pointing DOWN while the world Y axis points UP, so the Y component is negated.StructCollider2D---- 2D colliders -------------------------------------------------------------------- Semantics and deliberate limits: * A collider is placed by a world position plus `offset`, both in world axes.StructColliderEntry2DOne synchronized collider.StructCollisionWorld2DBounded 2D collision world mirroring the shape of epok::CollisionWorld: fixed capacity, no allocation, conservative world AABBs for the broad phase and for sweeps, exact shape tests for triggers.Class templateMoveResult2DStruct declared by the world2d module for the world2d module.StructPick2DEntryOne candidate for pick_2d: its world AABB and its draw key.StructShapeEnum declared by the world2d module for the world2d module.EnumSineTable2DStruct declared by the world2d module for the world2d module.StructSpatialHit2DStruct declared by the world2d module for the world2d module.StructFunctions and methods
aabb2d_containsPerforms `aabb2d contains` as part of the world2d module.Functionaabb2d_overlapPerforms `aabb2d overlap` as part of the world2d module.Functionaabb2d_touchPerforms `aabb2d touch` as part of the world2d module.Functionaabb2d_translatedPerforms `aabb2d translated` as part of the world2d module.FunctionboundsPerforms `bounds` as part of the world2d module.Methodbox_circle_overlap_2dClosest point on the box to the circle centre; touching counts only when inclusive.Functioncamera2d_pixels_per_unitPerforms `camera2d pixels per unit` as part of the world2d module.Functioncamera2d_viewport_centerPerforms `camera2d viewport center` as part of the world2d module.Functioncircle_overlap_2dPerforms `circle overlap 2d` as part of the world2d module.Functionclamp_raw_2dSaturating conversion of a raw Q12 accumulator back into Fixed.FunctionclearClears clear as part of the world2d module.Methodcollider2d_boundsPerforms `collider2d bounds` as part of the world2d module.Functioncollider2d_centerWorld centre of a collider: the owner's world position plus the (unrotated) offset.Functioncollider2d_overlapShape-aware pair test in world space.Functioncomposeparent * child: the child's local matrix expressed in the parent's space.Functioncos_degreesPerforms `cos degrees` as part of the world2d module.FunctiondirectionSame as point() without the translation: for directions, extents and velocities.MethoddisablePerforms `disable` as part of the world2d module.Methoddistance_squared_raw_2dSquared distance in raw Q24; |position| <= 8192 keeps this inside 2^51.Functiondraw_key_2d---- draw order ---------------------------------------------------------------------- A single monotonically comparable key so the renderer never needs a multi-field comparator: layer (int8, coarse) above draw_order (int16) above the creation index (uint16, the tie breaker that makes the order stable and reproducible across frames).Functionfixed_in_rangePerforms `fixed in range` as part of the world2d module.FunctionidentityPerforms `identity` as part of the world2d module.MethodlivePerforms `live` as part of the world2d module.Methodlocal_matrixLocal matrix of a Transform2D: translate * rotate * scale, applied in that order to a point (scale first, then rotation, then translation).Functionmake_sine_table_2dPerforms `make sine table 2d` as part of the world2d module.Functionmove_and_slide_2dAxis-separated resolution: X is applied first and clipped against every blocking box whose Y span overlaps, then Y is applied against the updated position.Methodmul_2dPerforms `mul 2d` as part of the world2d module.Functionoperator boolPerforms `operator bool` as part of the world2d module.Conversion operatoroverlapReturns the total number of matches; only the first `output_capacity` are written.Methodpick_2dTopmost entry under a screen point (highest draw key wins; ties go to the lowest index, which keeps the result stable).FunctionpointPerforms `point` as part of the world2d module.MethodpositionPerforms `position` as part of the world2d module.Methodraycast2d`displacement` is the complete segment, not a unit direction.Methodscreen_to_worldExact inverse of world_to_screen up to Q12 rounding.FunctionsetSets set as part of the world2d module.Methodsin_degreesSine of an angle in degrees.Functionsine_quarter_2dsin of an angle inside the first quadrant, expressed in raw Q12 degrees [0, 90*4096].Functionsine_series_2dPerforms `sine series 2d` as part of the world2d module.Functionsort_draw_orderBounded, allocation-free, stable insertion sort of an index array by draw key.Function templatesyncReplaces the whole live set in one call; slots beyond `count` become disabled and therefore produce trigger exits on the next update_triggers().Methodtransform2d_clampClamps into the documented range instead of rejecting.Functiontransform2d_validDocumented validity of a Transform2D.Functionupdate_triggersEnter/Stay/Exit per pair, exactly once each, using the exact shape tests.Function templateworld_matrix_2dWorld matrix of a SceneComponent2D by walking its attach_parent chain.Function templateworld_to_screenPerforms `world to screen` as part of the world2d module.FunctionFields, variables and values
activeExposes `active` on `epok::ColliderEntry2D` for the world2d module.FieldblockedExposes `blocked` on `epok::MoveResult2D` for the world2d module.FieldboxExposes `box` on `epok::Pick2DEntry` for the world2d module.FieldBoxNamed value `Box` in `epok::Collider2D::Shape`.Enum valueCircleNamed value `Circle` in `epok::Collider2D::Shape`.Enum valuecolliderExposes `collider` on `epok::ColliderEntry2D` for the world2d module.Fielddegrees_per_quarter_rawExposes `degrees_per_quarter_raw` on the `epok::detail` namespace for the world2d module.Variabledegrees_per_turn_rawExposes `degrees_per_turn_raw` on the `epok::detail` namespace for the world2d module.VariabledisplacementExposes `displacement` on `epok::MoveResult2D` for the world2d module.Fielddropped_trigger_pairsExposes `dropped_trigger_pairs` on `epok::CollisionWorld2D` for the world2d module.FieldenabledExposes `enabled` on `epok::Collider2D` for the world2d module.FieldenabledExposes `enabled` on `epok::Pick2DEntry` for the world2d module.FieldfractionExposes `fraction` on `epok::SpatialHit2D` for the world2d module.FieldgenerationExposes `generation` on `epok::ColliderEntry2D` for the world2d module.FieldgenerationExposes `generation` on `epok::SpatialHit2D` for the world2d module.Fieldhalf_extentsExposes `half_extents` on `epok::Collider2D` for the world2d module.FieldindexExposes `index` on `epok::MoveResult2D` for the world2d module.FieldindexExposes `index` on `epok::SpatialHit2D` for the world2d module.FieldkeyExposes `key` on `epok::Pick2DEntry` for the world2d module.FieldlayerExposes `layer` on `epok::Collider2D` for the world2d module.Fieldlayer_maskExposes `layer_mask` on `epok::Collider2D` for the world2d module.FieldmExposes `m` on `epok::Affine2D` for the world2d module.FieldmaxExposes `max` on `epok::Aabb2D` for the world2d module.FieldminExposes `min` on `epok::Aabb2D` for the world2d module.FieldnormalExposes `normal` on `epok::MoveResult2D` for the world2d module.FieldnormalExposes `normal` on `epok::SpatialHit2D` for the world2d module.FieldoffsetExposes `offset` on `epok::Collider2D` for the world2d module.Fieldpixels_per_unit_2dScreen pixels covered by one world unit at zoom 1.VariablepointExposes `point` on `epok::SpatialHit2D` for the world2d module.FieldpositionExposes `position` on `epok::Camera2D` for the world2d module.FieldpositionExposes `position` on `epok::ColliderEntry2D` for the world2d module.FieldradiusExposes `radius` on `epok::Collider2D` for the world2d module.FieldrotationExposes `rotation` on `epok::Camera2D` for the world2d module.FieldshapeExposes `shape` on `epok::Collider2D` for the world2d module.Fieldsine_step_raw1440, exactVariablesine_table_2dExposes `sine_table_2d` on the `epok::detail` namespace for the world2d module.Variablestarted_insideExposes `started_inside` on `epok::SpatialHit2D` for the world2d module.FieldtExposes `t` on `epok::Affine2D` for the world2d module.FieldtriggerExposes `trigger` on `epok::Collider2D` for the world2d module.Fieldunresolved_overlapExposes `unresolved_overlap` on `epok::MoveResult2D` for the world2d module.FieldvaluesExposes `values` on `epok::detail::SineTable2D` for the world2d module.Fieldviewportx, y, width, height in pixels.Fieldworld2d_depth_limitMaximum length of an attachment chain resolved in one call (root included).Variableworld2d_position_limitExposes `world2d_position_limit` on the `epok` namespace for the world2d module.Variableworld2d_scale_limitExposes `world2d_scale_limit` on the `epok` namespace for the world2d module.VariablezoomExposes `zoom` on `epok::Camera2D` for the world2d module.Field