@bitbybit-dev/core
Version:
Bit By Bit Developers Core CAD API to Program Geometry
123 lines (122 loc) • 3.94 kB
TypeScript
/**
* Shared constants for DrawHelper implementations across all game engines.
* These constants ensure consistency between PlayCanvas, ThreeJS, and BabylonJS implementations.
*/
/**
* Default material properties for different geometry types
*/
export declare const MATERIAL_DEFAULTS: {
/** Depth bias to prevent z-fighting between faces and edges */
readonly DEPTH_BIAS: 2;
/** Slope-dependent depth bias */
readonly SLOPE_DEPTH_BIAS: 2;
/** Metalness values for PBR materials */
readonly METALNESS: {
/** For VERB surfaces */
readonly SURFACE: 0.5;
/** For JSCAD meshes */
readonly JSCAD: 0.4;
/** For OCCT shapes */
readonly OCCT: 0.4;
/** For Manifold shapes */
readonly MANIFOLD: 0.5;
};
/** Roughness values for PBR materials (inverse of gloss) */
readonly ROUGHNESS: {
/** For VERB surfaces */
readonly SURFACE: 0.7;
/** For JSCAD meshes */
readonly JSCAD: 0.6;
/** For OCCT shapes */
readonly OCCT: 0.8;
/** For Manifold shapes */
readonly MANIFOLD: 0.7;
};
/** Gloss values for PBR materials (PlayCanvas uses gloss instead of roughness) */
readonly GLOSS: {
/** For VERB surfaces */
readonly SURFACE: 0.3;
/** For JSCAD meshes */
readonly JSCAD: 0.4;
/** For OCCT shapes */
readonly OCCT: 0.2;
/** For Manifold shapes */
readonly MANIFOLD: 0.3;
};
};
/**
* Default geometry rendering options
*/
export declare const GEOMETRY_DEFAULTS: {
/** Default line width for polylines and edges */
readonly LINE_WIDTH: 2;
/** Default point/sphere size */
readonly POINT_SIZE: 0.1;
/** Default opacity (fully opaque) */
readonly OPACITY: 1;
/** Default edge width for OCCT shapes */
readonly EDGE_WIDTH: 2;
/** Default vertex size for OCCT shapes */
readonly VERTEX_SIZE: 0.03;
/** Default tessellation precision for OCCT shapes */
readonly PRECISION: 0.01;
/** Default edge index label height */
readonly EDGE_INDEX_HEIGHT: 0.06;
/** Default face index label height */
readonly FACE_INDEX_HEIGHT: 0.06;
/** Default text line spacing */
readonly TEXT_LINE_SPACING: 1.5;
/** Default text vertical offset */
readonly TEXT_VERTICAL_OFFSET: 0.05;
/** Default polyline width adjustment */
readonly POLYLINE_WIDTH: 0.2;
};
/**
* Default color values (hex strings)
*/
export declare const DEFAULT_COLORS: {
/** Default color for basic geometry */
readonly DEFAULT: "#ff0000";
/** Default edge color for OCCT shapes */
readonly EDGE: "#ffffff";
/** Default polyline color */
readonly POLYLINE: "#ff00ff";
/** Default vertex color for OCCT shapes */
readonly VERTEX: "#ffaaff";
/** Default face color for OCCT shapes */
readonly FACE: "#ff0000";
/** Default back face color - blue to distinguish face orientation */
readonly BACK_FACE: "#0000ff";
/** Default edge index label color */
readonly EDGE_INDEX: "#ff00ff";
/** Default face index label color */
readonly FACE_INDEX: "#0000ff";
/** Default cross-section color for Manifold */
readonly CROSS_SECTION: "#ff00ff";
};
/**
* Material cache configuration
*/
export declare const CACHE_CONFIG: {
/** Maximum number of materials to cache per scene */
readonly MAX_MATERIALS: 1000;
/** Precision for alpha value comparison (decimal places) */
readonly ALPHA_PRECISION: 4;
};
/**
* Logging levels for DrawHelper
*/
export declare enum LogLevel {
NONE = 0,
ERROR = 1,
WARN = 2,
INFO = 3,
DEBUG = 4
}
/**
* Type definitions for constants
*/
export type MaterialDefaults = typeof MATERIAL_DEFAULTS;
export type GeometryDefaults = typeof GEOMETRY_DEFAULTS;
export type DefaultColors = typeof DEFAULT_COLORS;
export type CacheConfig = typeof CACHE_CONFIG;