moonlight-triangulation-1.4.0.2: ffi/bindings/python/src/moonlight_triangulation/_native_generated.py
# Generated from Moonlight.Triangulation.Foreign.Contract.
# Run moonlight-triangulation-ffi-contract write; do not edit this file.
from __future__ import annotations
import ctypes
from collections.abc import Sequence
from pathlib import Path
from typing import Final
ABI_VERSION: Final = 2
ML_STATUS_OK: Final = 0
ML_STATUS_NULL_POINTER: Final = 1
ML_STATUS_COUNT_OVERFLOW: Final = 2
ML_STATUS_BUFFER_TOO_SMALL: Final = 3
ML_STATUS_GEOMETRY_OBSTRUCTION: Final = 4
ML_STATUS_RUNTIME_FAILURE: Final = 5
ML_OBSTRUCTION_NONE: Final = 0
ML_OBSTRUCTION_INVALID_COORDINATE: Final = 1
ML_OBSTRUCTION_POINT_LOCATION_FAILED: Final = 2
ML_OBSTRUCTION_LOCATION_WALK_EXHAUSTED: Final = 3
ML_OBSTRUCTION_REFINEMENT_INPUT_TOPOLOGY_INVALID: Final = 4
ML_OBSTRUCTION_FRESH_INSERTION_MATCHED_EXISTING_VERTEX: Final = 5
ML_OBSTRUCTION_DEGENERATE_LINE_ENDPOINT_MISSING_OUTGOING: Final = 6
ML_OBSTRUCTION_DEGENERATE_LINE_ENDPOINT_TURN_MISSING: Final = 7
ML_OBSTRUCTION_DEGENERATE_LINE_CONNECTED_VERTEX_MISSING: Final = 8
ML_OBSTRUCTION_HULL_START_NOT_VISIBLE: Final = 9
ML_OBSTRUCTION_OUTER_RANGE_DID_NOT_TERMINATE: Final = 10
ML_OBSTRUCTION_OUTER_RANGE_CONTAINS_INNER_EDGE: Final = 11
ML_OBSTRUCTION_CONSTRAINED_EDGE_FLIP_REFUSED: Final = 12
ML_OBSTRUCTION_REMOVAL_VERTEX_OUT_OF_RANGE: Final = 13
ML_OBSTRUCTION_REMOVAL_EDGE_OUT_OF_RANGE: Final = 14
ML_OBSTRUCTION_REMOVAL_FACE_OUT_OF_RANGE: Final = 15
ML_OBSTRUCTION_REMOVAL_FACE_CYCLE_DID_NOT_TERMINATE: Final = 16
ML_OBSTRUCTION_REMOVAL_EMPTY_TRIANGULATION: Final = 17
ML_OBSTRUCTION_REMOVAL_TWO_POINT_DEGREE_MISMATCH: Final = 18
ML_OBSTRUCTION_REMOVAL_COLLINEAR_DEGREE_MISMATCH: Final = 19
ML_OBSTRUCTION_REMOVAL_BORDER_TOO_SHORT: Final = 20
ML_OBSTRUCTION_REMOVAL_BORDER_ARITY_MISMATCH: Final = 21
ML_OBSTRUCTION_REMOVAL_OUTGOING_CYCLE_DID_NOT_TERMINATE: Final = 22
ML_OBSTRUCTION_CIRCLE_SWEEP_HULL_EMPTY: Final = 23
ML_OBSTRUCTION_OUTER_CYCLE_DID_NOT_TERMINATE: Final = 24
ML_OBSTRUCTION_HIERARCHY_LEVEL_POPULATION_MISMATCH: Final = 25
ML_OBSTRUCTION_HIERARCHY_INSERTION_HANDLE_MISMATCH: Final = 26
ML_OBSTRUCTION_POINT_INDEX_CAPACITY_EXHAUSTED: Final = 27
ML_OBSTRUCTION_REFINEMENT_MINIMUM_ANGLE_NOT_FINITE: Final = 28
ML_OBSTRUCTION_REFINEMENT_MINIMUM_ANGLE_OUT_OF_RANGE: Final = 29
ML_OBSTRUCTION_REFINEMENT_MINIMUM_ANGLE_DERIVED_RATIO_NOT_FINITE: Final = 30
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_ADDITIONAL_VERTICES_NEGATIVE: Final = 31
ML_OBSTRUCTION_REFINEMENT_MINIMUM_AREA_NOT_FINITE: Final = 32
ML_OBSTRUCTION_REFINEMENT_MINIMUM_AREA_NEGATIVE: Final = 33
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_AREA_NOT_FINITE: Final = 34
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_AREA_NOT_POSITIVE: Final = 35
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_RADIUS_EDGE_RATIO_NOT_FINITE: Final = 36
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_RADIUS_EDGE_RATIO_NOT_POSITIVE: Final = 37
ML_OBSTRUCTION_REFINEMENT_MINIMUM_AREA_EXCEEDS_MAXIMUM: Final = 38
ML_OBSTRUCTION_REFINEMENT_SEED_FACE_NOT_ACTIVE: Final = 39
ML_OBSTRUCTION_REFINEMENT_DOMAIN_INTERFACE_EDGE_NOT_ACTIVE: Final = 40
ML_OBSTRUCTION_REFINEMENT_DOMAIN_INTERFACE_MISSING: Final = 41
ML_OBSTRUCTION_REFINEMENT_DOMAIN_INTERFACE_EXTRANEOUS: Final = 42
ML_OBSTRUCTION_REFINEMENT_DOMAIN_TOPOLOGY_CHANGED: Final = 43
ML_OBSTRUCTION_REFINEMENT_DOMAIN_REQUIRES_CONVEX_HULL_PRESERVATION: Final = 44
ML_OBSTRUCTION_REFINEMENT_DOMAIN_REQUIRES_CONSTRAINT_PRESERVATION: Final = 45
ML_OBSTRUCTION_REFINEMENT_DOMAIN_FORBIDS_OUTER_FACE_EXCLUSION: Final = 46
ML_OBSTRUCTION_REFINEMENT_DOMAIN_WOULD_CROSS_INTERFACE: Final = 47
ML_OBSTRUCTION_REFINEMENT_DOMAIN_WOULD_REWRITE_PROTECTED_FACE: Final = 48
ML_OBSTRUCTION_REFINEMENT_DOMAIN_PROTECTED_FACE_CHANGED: Final = 49
ML_OBSTRUCTION_CAPACITY_EXCEEDED: Final = 50
ML_OBSTRUCTION_HALF_EDGE_CAPACITY_EXCEEDED: Final = 51
ML_OBSTRUCTION_FACE_CAPACITY_EXCEEDED: Final = 52
ML_OBSTRUCTION_PAYLOAD_STORAGE_FAILURE: Final = 53
ML_OBSTRUCTION_COORDINATE_PAYLOAD_COUNT_MISMATCH: Final = 54
ML_OBSTRUCTION_CIRCLE_SWEEP_REQUIRES_DENSE_STORAGE: Final = 55
ML_OBSTRUCTION_SEAM_FRONTIER_UNAVAILABLE: Final = 56
ML_OBSTRUCTION_REFINEMENT_DOMAIN_REQUIRES_FINITE_VERTEX_BUDGET: Final = 57
ML_OBSTRUCTION_SEAM_SOURCE_EDGE_REQUIRES_FLIP: Final = 58
ML_OBSTRUCTION_SEAM_PROTECTED_SOURCE_FACE_CHANGED: Final = 59
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_EDGE_LENGTH_NOT_FINITE: Final = 60
ML_OBSTRUCTION_REFINEMENT_MAXIMUM_EDGE_LENGTH_NOT_POSITIVE: Final = 61
ML_OBSTRUCTION_REFINEMENT_OVERSIZED_EDGE: Final = 62
ML_OBSTRUCTION_REFINEMENT_SEAM_BRIDGE_BUDGET_EXCEEDED: Final = 63
ML_OBSTRUCTION_REFINEMENT_SEAM_BRIDGE_MIDPOINT_COLLAPSED: Final = 64
ML_OBSTRUCTION_BOUNDARY_SPLIT_REQUIRES_BOUNDARY_EDGE: Final = 65
ML_OBSTRUCTION_REFINEMENT_DOMAIN_INTERFACE_OPPOSITE_FACE_NOT_PERMITTED: Final = 66
ML_OBSTRUCTION_NULL_POINTER: Final = 100
ML_OBSTRUCTION_COUNT_OVERFLOW: Final = 101
ML_OBSTRUCTION_BUFFER_TOO_SMALL: Final = 102
ML_OBSTRUCTION_RUNTIME_FAILURE: Final = 103
ML_OBSTRUCTION_REGION_LAYOUT_INVALID: Final = 200
ML_OBSTRUCTION_REGION_VALIDATION_FAILED: Final = 201
ML_OBSTRUCTION_OVERLAY_FAILED: Final = 202
ML_OBSTRUCTION_REGION_PUBLICATION_FAILED: Final = 203
ML_OBSTRUCTION_VALUATION_FAILED: Final = 204
ML_OBSTRUCTION_MINKOWSKI_FAILED: Final = 205
ML_OBSTRUCTION_REGION_PROJECTION_FAILED: Final = 206
ML_COORDINATE_ERROR_NONE: Final = 0
ML_COORDINATE_ERROR_NAN: Final = 1
ML_COORDINATE_ERROR_INFINITE: Final = 2
ML_COORDINATE_ERROR_TOO_SMALL: Final = 3
ML_COORDINATE_ERROR_TOO_LARGE: Final = 4
ML_REGION_EXTERIOR: Final = 0
ML_REGION_BOUNDARY: Final = 1
ML_REGION_INTERIOR: Final = 2
ML_MINKOWSKI_ADDITION: Final = 0
ML_MINKOWSKI_EROSION: Final = 1
ML_MINKOWSKI_OPENING: Final = 2
ML_MINKOWSKI_CLOSING: Final = 3
class _Obstruction(ctypes.Structure):
_fields_ = [
("code", ctypes.c_uint32),
("coordinate_error", ctypes.c_uint32),
("input_index", ctypes.c_uint64),
("first_index", ctypes.c_uint64),
("second_index", ctypes.c_uint64),
("first_value", ctypes.c_double),
("second_value", ctypes.c_double),
("point_x", ctypes.c_double),
("point_y", ctypes.c_double),
("message", ctypes.c_char * 256),
]
class _NativeMinkowskiReceipt(ctypes.Structure):
_fields_ = [
("operation", ctypes.c_uint32),
("reserved", ctypes.c_uint32),
("input_components", ctypes.c_uint64),
("convex_pieces", ctypes.c_uint64),
("generated_pieces", ctypes.c_uint64),
("generated_convolution_edges", ctypes.c_uint64),
("overlay_passes", ctypes.c_uint64),
("exact_crossings", ctypes.c_uint64),
("output_cells", ctypes.c_uint64),
("exact_coordinate_bit_growth", ctypes.c_uint64),
]
class _NativeApi:
def __init__(self, library_path: Path) -> None:
library = ctypes.CDLL(str(library_path))
_configure(library, "ml_abi_version", (), ctypes.c_uint32)
_configure(library, "ml_runtime_initialize", (), ctypes.c_uint32)
_configure(library, "ml_delaunay_f64", (ctypes.POINTER(ctypes.c_double), ctypes.c_size_t, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_insert_many_f64", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_double), ctypes.c_size_t, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_site_union", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_site_intersection", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_site_difference", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_site_symmetric_difference", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_vertex_count", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_triangle_count", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_copy_vertices_f64", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_double), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_copy_triangles_u32", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_uint32), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_mesh_free", (ctypes.c_void_p,), None)
_configure(library, "ml_region_create_f64", (ctypes.POINTER(ctypes.c_double), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.c_size_t, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_counts", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_copy_f64", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_double), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.c_size_t, ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_union", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_intersection", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_difference", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_symmetric_difference", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_locate_point_f64", (ctypes.c_void_p, ctypes.c_double, ctypes.c_double, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_measure", (ctypes.c_void_p, ctypes.POINTER(ctypes.c_int64), ctypes.POINTER(ctypes.c_char), ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_free", (ctypes.c_void_p,), None)
_configure(library, "ml_structuring_element_create_f64", (ctypes.POINTER(ctypes.c_double), ctypes.c_size_t, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_structuring_element_free", (ctypes.c_void_p,), None)
_configure(library, "ml_region_minkowski_sum", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_NativeMinkowskiReceipt), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_offset", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_NativeMinkowskiReceipt), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_inset", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_NativeMinkowskiReceipt), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_open", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_NativeMinkowskiReceipt), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
_configure(library, "ml_region_close", (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(_NativeMinkowskiReceipt), ctypes.POINTER(_Obstruction)), ctypes.c_uint32)
self.library = library
def _configure(
library: ctypes.CDLL,
name: str,
parameters: Sequence[object],
result: object = ctypes.c_uint32,
) -> None:
function = getattr(library, name)
setattr(function, "argtypes", list(parameters))
setattr(function, "restype", result)