import * as Inputs from "./index"; import { Base } from "./base-inputs"; import type * as Models from "@bitbybit-dev/core/lib/api/models"; /** * Options for drawing geometry into a Three.js scene: color, opacity, size, and the per-kind settings * that control how points, lines, polylines, meshes, surfaces and kernel shapes become renderer * objects. Passing an existing drawn object back in updates it in place. */ export declare namespace Draw { type DrawOptions = DrawOcctShapeOptions | DrawBasicGeometryOptions | DrawManifoldOrCrossSectionOptions | DrawFrameOptions | DrawRecipeMeshesOptions; /** * A kernel shape with the looks to draw it in: a base look for the whole shape and groups of * faces that override it, by the face indexes `shapes.face.getFaces` gives, with the colors of * its edges. A part that `occt.design.build` returns is one already; drawn, the shape becomes * one mesh. */ interface ShapeWithAppearance { /** The shape to draw, as the Bitbybit OCCT Kernel returns it. */ shape: Inputs.OCCT.TopoDSShapePointer; /** * How the shape looks. Each `faces` entry gives its values to the faces it lists, `edgeColor` * colors the edges and each `edges` entry the edges it lists, by the indexes * `shapes.edge.getEdges` gives; left out, the shape takes the colors of the options. */ appearance?: Models.OCCT.DesignBuiltAppearance | undefined; } /** * Everything a draw call will accept: points, lines, segments and polylines; Verb curves and * surfaces; the handles the OCCT, Manifold and JSCAD kernels return; kernel shapes with their * appearance and what `occt.design.build` returns; tags; whatever a layer above these packages * has taught the call to draw; and a list of any one of them. This union is what makes one draw * call able to render anything these packages produce without you having to say which kind it is. * * A design build draws every placement as an instance. Drawn again into the group it returned, * with the same parts at the same component paths, it only moves them, so animating from joint * values never meshes again. * * The list arms are one per kind rather than a single list of the union, because that is what is * true: drawing a list applies one set of options to one kind of thing, and every plural handler * reads its list as homogeneous. A mixed list is not something this call can draw, and saying so * here is what stops one being written. * * `Base.Vector3` is not listed and is still accepted: it is the same type as `Base.Point3`. * * `number[]` and `number[][]` are listed, and are the loosest members here on purpose. A point is * the tuple `Base.Point3`, but the vector services are honestly `number[]` - they operate on a * vector of any length - so every result of `vector.add`, `cross`, `lerp` and their siblings is a * `number[]`, and drawing one is ordinary. Dropping these arms would narrow the union at the cost * of making the library's own output undrawable without a cast. */ type Entity = number[] | Base.Point3 | Base.Line3 | Base.Segment3 | Base.Polyline3 | Base.Frame | Base.VerbCurve | Base.VerbSurface | Inputs.OCCT.TopoDSShapePointer | ShapeWithAppearance | Models.OCCT.DesignBuildResult | Models.OCCT.DesignSection | Inputs.OCCT.DecomposedMeshDto | Inputs.Manifold.ManifoldPointer | Inputs.Manifold.CrossSectionPointer | Inputs.Manifold.DecomposedManifoldMeshDto | Inputs.Manifold.RecipeMeshesDto | Inputs.JSCAD.JSCADEntity | Inputs.Tag.TagDto | CustomGeometryDrawable | number[][] | Base.Point3[] | Base.Line3[] | Base.Segment3[] | Base.Polyline3[] | Base.Frame[] | Base.VerbCurve[] | Base.VerbSurface[] | Inputs.OCCT.TopoDSShapePointer[] | ShapeWithAppearance[] | Inputs.OCCT.DecomposedMeshDto[] | Inputs.Manifold.ManifoldPointer[] | Inputs.Manifold.CrossSectionPointer[] | Inputs.Manifold.DecomposedManifoldMeshDto[] | Inputs.JSCAD.JSCADEntity[] | Inputs.Tag.TagDto[]; /** * Metadata a drawn tag carries so that handing it back updates it in place. */ interface DrawnTagMeta { type: drawingTypes; /** Whatever options the draw was given. Drawing a tag without any records only updatability. */ options: DrawOptions | { updatable: boolean; }; } /** * A drawn tag. Drawing a tag produces the tag itself rather than a scene object, because a tag is * rendered as an HTML overlay positioned from the scene rather than as geometry in it. */ interface DrawnTag extends Inputs.Tag.TagDto { userData?: DrawnTagMeta | undefined; } /** * A list of drawn tags. The list itself carries the metadata as well as each tag does, because an * update is driven by handing back what drawing returned, which for a list of tags is the list. */ type DrawnTags = DrawnTag[] & { userData?: DrawnTagMeta | undefined; }; /** * A drawable a layer above these packages taught the draw call to render, drawn as geometry. * `type` is the discriminant it is matched on, the same convention the kernels already follow * at runtime with "occ-shape" and "manifold-shape". */ interface CustomGeometryDrawable { readonly type: string; readonly name: string; } /** * Everything drawing can produce, for the dispatch that does not yet know which of them it is * about to produce. A caller does know, which is what `Drawn` is for. */ type DrawnAny = T | DrawnTag | DrawnTags | undefined; /** * What drawing a particular entity resolves to. * * One call draws a dozen kinds of thing, and what comes back depends on which kind went in: a * tag becomes the tag itself, because it renders as an HTML overlay positioned from the scene * rather than as geometry in it; an overlay a host application resolves becomes a handle that * only knows how to dispose itself; everything else becomes a scene object. Spelling that out * here is what lets a caller use what it gets back without first narrowing a union it already * knows the answer to. * * An `E` that is not known - the whole `Entity` union, or an `any` - resolves to the union of * every branch, which is the honest answer for a caller that does not know either. * * The empty-list arm is not decoration. `{ entity: [] }` infers `E` as `never[]`, and `never` * satisfies every other branch, so without it a literal empty list types as drawn tags. */ type Drawn = E extends readonly unknown[] ? ([E[number]] extends [never] ? undefined : E[number] extends Inputs.Tag.TagDto ? DrawnTags : T) : E extends Inputs.Tag.TagDto ? DrawnTag : T; /** * Feeds `draw.drawAnyAsync` and `drawAny`: the entity to draw, the options for its kind and, * when redrawing, the scene object from the previous draw. */ class DrawAny { constructor(entity?: E, options?: DrawOptions, group?: U); /** * What to draw: a point, line, polyline, frame, curve, surface, kernel shape, mesh or tag, or a * list of one of these kinds. Kernel shapes need `draw.drawAnyAsync`. * @default undefined */ entity: E; /** * How the drawing looks, matched to the entity: basic options for points, lines, polylines * and JSCAD meshes, OCCT options for shapes, and so on; left out, defaults are used * @default undefined * @optional true */ options?: DrawOptions | undefined; /** * A group an earlier draw returned. Kinds drawn with `updatable` set change in place, a design * build only moves its parts, and without `options` its earlier options apply. * @optional true */ group?: U | undefined; } /** * Taken by `draw.drawAnyAsync` for Manifold solids, meshes and cross-sections: the face color or * engine material, the shading and back faces of solids, and the outline of cross-sections. */ class DrawManifoldOrCrossSectionOptions { /** * Provide options without default values */ constructor(faceOpacity?: number, faceMaterial?: Base.Material, faceColour?: Base.Color, crossSectionColour?: Base.Color, crossSectionWidth?: number, crossSectionOpacity?: number, computeNormals?: boolean, drawTwoSided?: boolean, backFaceColour?: Base.Color, backFaceOpacity?: number, minSharpAngle?: number); /** * How opaque the faces are, from 0 to 1; in this renderer any value below 1 hides them * entirely. A `faceMaterial` replaces it. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ faceOpacity?: number | undefined; /** * The color of the faces of solids and meshes, as a hex string; a `faceMaterial` replaces it. * @default #ff0000 */ faceColour?: Base.Color | undefined; /** * An engine material for the faces, such as `draw.createPBRMaterial` makes; given, it replaces * `faceColour` and `faceOpacity`. * @default undefined * @optional true */ faceMaterial?: Base.Material | undefined; /** * The color of the outline of a cross-section, as a hex string. * @default #ff00ff */ crossSectionColour?: Base.Color | undefined; /** * The on-screen width of the outline of a cross-section, a third of it in pixels and at least * one. * @default 2 */ crossSectionWidth?: number | undefined; /** * How opaque the outline of a cross-section is; this renderer draws it opaque whatever the * value. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ crossSectionOpacity?: number | undefined; /** * When true, the mesh shades smoothly across edges flatter than `minSharpAngle` and keeps * sharper ones crisp; when false, every face is shaded flat. * @default true */ computeNormals?: boolean | undefined; /** * The angle between two faces, in degrees, above which their shared edge is drawn sharp when * `computeNormals` is true. * @default 40 * @minimum 0 * @maximum 180 * @step 5 */ minSharpAngle?: number | undefined; /** * When true, the back of the faces of solids and meshes is drawn in `backFaceColour`, which * shows which way they face. * @default true */ drawTwoSided?: boolean | undefined; /** * The color of the back of the faces, as a hex string; used with `drawTwoSided`. * @default #0000ff */ backFaceColour?: Base.Color | undefined; /** * How opaque the back of the faces is, from 0 to 1, with `drawTwoSided`; this renderer draws * the backs opaque whatever the value. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ backFaceOpacity?: number | undefined; } /** * Built by `draw.optionsOcctShape` for OCCT shapes: meshing, which faces, edges, vertices and * labels show in what colors, iso curves, surface analysis and caching. Shapes with an appearance * and design builds skip vertices, labels, arrows, iso curves, analysis and `faceMaterial`. */ class DrawOcctShapeOptions { /** * Provide options without default values */ constructor(faceOpacity?: number, edgeOpacity?: number, edgeColour?: Base.Color, faceMaterial?: Base.Material, faceColour?: Base.Color, edgeWidth?: number, drawEdges?: boolean, drawFaces?: boolean, drawVertices?: boolean, vertexColour?: Base.Color, vertexSize?: number, precision?: number, drawEdgeIndexes?: boolean, edgeIndexHeight?: number, edgeIndexColour?: Base.Color, drawFaceIndexes?: boolean, faceIndexHeight?: number, faceIndexColour?: Base.Color, drawTwoSided?: boolean, backFaceColour?: Base.Color, backFaceOpacity?: number, edgeArrowSize?: number, edgeArrowAngle?: number, keepMeshData?: boolean, allowQualityDecrease?: boolean, forceFaceDeflection?: boolean, drawIsoCurves?: boolean, isoCurvesU?: number, isoCurvesV?: number, isoCurvesColour?: Base.Color, surfaceAnalysis?: Inputs.OCCT.surfaceAnalysisEnum, draftDirection?: Base.Vector3, analysisMin?: number, analysisMax?: number, edgeContrast?: number, angularDeflection?: number, relativeDeflection?: boolean, precisionShare?: number, edgeWidthBySize?: boolean, wireColour?: Base.Color); /** * How opaque the faces are, from 0 to 1, multiplied into each look's own opacity. This renderer * shows it on faces drawn in looks only; plain faces stay opaque. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ faceOpacity?: number | undefined; /** * How opaque the edges of a design build are, from 0 to 1; this renderer draws the edges and * iso curves of other shapes opaque. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ edgeOpacity?: number | undefined; /** * The color of the edges, as a hex string, unless `edgeContrast` derives it from the faces; the * edge colors of an appearance win over both. * @default #ffffff */ edgeColour?: Base.Color | undefined; /** * Edges take their faces' color moved toward black, or toward white on dark faces, by this * amount from 0 to 1, instead of `edgeColour`. Appearance edge colors still win. * @default undefined * @optional true * @minimum 0 * @maximum 1 * @step 0.05 */ edgeContrast?: number | undefined; /** * The color of the edges of a shape drawn without faces (a wire, an edge, or `drawFaces` off), in * place of `edgeColour` and `edgeContrast`; appearance edge colors still win. * @default undefined * @optional true */ wireColour?: Base.Color | undefined; /** * The color of the faces, as a hex string. A `faceMaterial` or a `surfaceAnalysis` takes its * place, and the colors of an appearance win over it. * @default #ff0000 */ faceColour?: Base.Color | undefined; /** * The color of the vertex markers, as a hex string; used with `drawVertices`. * @default #ff00ff */ vertexColour?: Base.Color | undefined; /** * An engine material for the faces, such as `draw.createPBRMaterial` makes; it replaces * `faceColour` and `faceOpacity`, and a `surfaceAnalysis` replaces it in turn. * @default undefined * @optional true */ faceMaterial?: Base.Material | undefined; /** * The on-screen width of the edge and iso curve lines, a third of it in pixels and at least * one. * @default 2 * @minimum 0 * @maximum Infinity * @step 0.1 */ edgeWidth?: number | undefined; /** * When true, `edgeWidth` scales with the size of what is drawn. Edge widths here are in * pixels, which already look alike at any size, so this changes nothing. * @default false */ edgeWidthBySize?: boolean | undefined; /** * The diameter of the vertex markers, in model units; used with `drawVertices`. * @default 0.03 * @minimum 0 * @maximum Infinity * @step 0.01 */ vertexSize?: number | undefined; /** * When false, the edges are not drawn. Drawn edges or iso curves push the faces back slightly * in depth so the lines show on top. * @default true */ drawEdges?: boolean | undefined; /** * When false, the faces and their backs are not drawn and no `surfaceAnalysis` is computed; the * face index labels still are. * @default true */ drawFaces?: boolean | undefined; /** * When true, each vertex of the shape is drawn as a small sphere in `vertexColour`, * `vertexSize` across. * @default false */ drawVertices?: boolean | undefined; /** * The largest distance, in model units, the triangles and edge lines may stray from the curved * shape; smaller is finer and heavier. * @default 0.01 * @minimum 0 * @maximum Infinity * @step 0.01 */ precision?: number | undefined; /** * The largest angle, in radians, a curved face may turn between neighboring triangles; smaller * follows curvature more closely with more triangles. * @default 0.5 * @minimum 0.001 * @maximum 3.14159 * @step 0.05 */ angularDeflection?: number | undefined; /** * When true, `precision` is a fraction of each edge's and face's size instead of model units, so * small and large parts get triangles in proportion to their size. * @default false */ relativeDeflection?: boolean | undefined; /** * Raises `precision` to this share of the longest side of each shape's bounding box, so large * shapes mesh coarser and small ones keep `precision`. Ignored with `relativeDeflection`. * @default 0 * @minimum 0 * @maximum 1 * @step 0.00001 */ precisionShare?: number | undefined; /** * When true, each edge's index is written beside the middle of the edge, handy for picking * edges to fillet. * @default false */ drawEdgeIndexes?: boolean | undefined; /** * The height of the edge index labels, in model units; they are drawn as lines in a plane * parallel to XY. * @default 0.06 * @minimum 0 * @maximum Infinity * @step 0.01 */ edgeIndexHeight?: number | undefined; /** * The color of the edge index labels, as a hex string. * @default #ff00ff */ edgeIndexColour?: Base.Color | undefined; /** * When true, each face's index is written near the middle of the face, handy for picking faces. * @default false */ drawFaceIndexes?: boolean | undefined; /** * The height of the face index labels, in model units; they are drawn as lines in a plane * parallel to XY. * @default 0.06 * @minimum 0 * @maximum Infinity * @step 0.01 */ faceIndexHeight?: number | undefined; /** * The color of the face index labels, as a hex string. * @default #0000ff */ faceIndexColour?: Base.Color | undefined; /** * When true, the back of each face is drawn in `backFaceColour`, which shows which way faces * point. A design build draws no backs. * @default true */ drawTwoSided?: boolean | undefined; /** * The color of the back of the faces, as a hex string; used with `drawTwoSided`. * @default #0000ff */ backFaceColour?: Base.Color | undefined; /** * How opaque the back of the faces is, from 0 to 1, with `drawTwoSided`; this renderer draws * the backs opaque whatever the value. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ backFaceOpacity?: number | undefined; /** * The length of an arrow head at the end of each edge, showing its direction, in model units; 0 * draws none. * @default 0 * @minimum 0 * @maximum Infinity * @step 0.01 */ edgeArrowSize?: number | undefined; /** * The angle, in degrees, between each line of an arrow head and its edge; larger spreads the * head wider. * @default 15 * @minimum 0 * @maximum 90 * @step 1 */ edgeArrowAngle?: number | undefined; /** * When true, the triangulation stays cached on each shape after drawing; when false it is * cleared so memory does not grow across draws. * @default false */ keepMeshData?: boolean | undefined; /** * When true, a shape already meshed more finely may be remeshed at the coarser precision asked * for. * @default true */ allowQualityDecrease?: boolean | undefined; /** * When true, every face is remeshed at the requested precision even when a triangulation is * cached. * @default false */ forceFaceDeflection?: boolean | undefined; /** * When true, each face's iso curves are drawn with the shape, as its edges are: at `edgeWidth` * and `edgeOpacity`, in `isoCurvesColour`. * @default false */ drawIsoCurves?: boolean | undefined; /** * How many iso curves of constant u each face gets with `drawIsoCurves`, at values spread evenly * inside its u range and trimmed to the face. * @default 5 * @minimum 0 * @maximum 1000 * @step 1 */ isoCurvesU?: number | undefined; /** * How many iso curves of constant v each face gets with `drawIsoCurves`, at values spread evenly * inside its v range and trimmed to the face. * @default 5 * @minimum 0 * @maximum 1000 * @step 1 */ isoCurvesV?: number | undefined; /** * The color of the iso curves as a hex string. * @default #808080 */ isoCurvesColour?: Base.Color | undefined; /** * The surface analysis coloring the faces instead of `faceColour` and `faceMaterial`, from blue at * `analysisMin` through green to red at `analysisMax`; vertices without a value keep `faceColour`. * @default none */ surfaceAnalysis?: Inputs.OCCT.surfaceAnalysisEnum | undefined; /** * The pull direction the draft angles, in degrees, are measured against; read only when * `surfaceAnalysis` is `draftAngle`. * @default [0, 1, 0] */ draftDirection?: Base.Vector3 | undefined; /** * The analysis value drawn blue, and anything below it; left out, the lowest finite value * found. * @default undefined * @optional true */ analysisMin?: number | undefined; /** * The analysis value drawn red, and anything above it; left out, the highest finite value * found. * @default undefined * @optional true */ analysisMax?: number | undefined; } /** * Built by `draw.optionsSimple` for points, lines, polylines, JSCAD paths and meshes, and Verb * curves and surfaces: colors, size, opacity, back faces and arrow heads. Drawn with no options, * lines, polylines and curves get `size` 2 in magenta. */ class DrawBasicGeometryOptions { constructor(colours?: string | string[], size?: number, opacity?: number, updatable?: boolean, hidden?: boolean, drawTwoSided?: boolean, backFaceColour?: Base.Color, backFaceOpacity?: number, colorMapStrategy?: Base.colorMapStrategyEnum, arrowSize?: number, arrowAngle?: number); /** * One hex color for everything drawn, or a list with one per point, line, polyline, surface or * JSCAD mesh; a polyline or JSCAD mesh with its own color keeps it. * @default #ff0000 */ colours?: string | string[] | undefined; /** * How a `colours` list shorter than what is drawn is spread: first color for all, last for the * rest, repeating, or back and forth. JSCAD meshes ignore it. * @default lastColorRemainder */ colorMapStrategy?: Base.colorMapStrategyEnum | undefined; /** * The diameter of each point in model units and the on-screen width of lines, a third of it in * pixels, at least one. Lines drawn without options get 2. * @default 0.1 * @minimum 0 * @maximum Infinity * @step 0.1 */ size?: number | undefined; /** * The opacity of points and surfaces, from 0 for invisible to 1 for opaque; this renderer draws * lines and JSCAD meshes opaque. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ opacity?: number | undefined; /** * When true, handing the drawn object back as `group` changes it in place instead of drawing a * new one. * @default false */ updatable?: boolean | undefined; /** * When true, surfaces and JSCAD meshes are drawn but not shown until made visible; points and * lines ignore it. * @default false */ hidden?: boolean | undefined; /** * When true, the back of each surface and JSCAD mesh is drawn in `backFaceColour`, which shows * which way it faces. * @default true */ drawTwoSided?: boolean | undefined; /** * The color of the back of surfaces and JSCAD meshes, as a hex string; used with * `drawTwoSided`. * @default #0000ff */ backFaceColour?: Base.Color | undefined; /** * How opaque the back of surfaces and JSCAD meshes is, from 0 to 1, with `drawTwoSided`; this * renderer draws the backs opaque whatever the value. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ backFaceOpacity?: number | undefined; /** * The length of the arrow head at the end of each line, polyline and curve, showing its * direction, in model units; 0 draws none. * @default 0 * @minimum 0 * @maximum Infinity * @step 0.01 */ arrowSize?: number | undefined; /** * The angle, in degrees, between each line of an arrow head and the line it ends; larger * spreads the head wider. * @default 15 * @minimum 0 * @maximum 90 * @step 1 */ arrowAngle?: number | undefined; } /** * Texture filtering mode - how the texture is sampled when scaled */ enum samplingModeEnum { nearest = "nearest", bilinear = "bilinear", trilinear = "trilinear" } /** * Feeds `draw.createTexture`: the image to load and how it lies on a surface, its tiling, offset, * rotation and flip, and how it is filtered; the texture then goes into a texture slot of * `draw.createPBRMaterial`. */ class GenericTextureDto { constructor(url?: string, name?: string, uScale?: number, vScale?: number, uOffset?: number, vOffset?: number, wAng?: number, invertY?: boolean, invertZ?: boolean, samplingMode?: samplingModeEnum); /** * Where the image is loaded from, as a path relative to the page or a full web address. * @default undefined */ url: string; /** * The name the engine gives the texture. * @default Texture */ name?: string | undefined; /** * How many times the image repeats along U, the first texture direction of the surface. * @default 1 * @minimum 0 * @maximum Infinity * @step 0.1 */ uScale?: number | undefined; /** * How many times the image repeats along V, the second texture direction of the surface. * @default 1 * @minimum 0 * @maximum Infinity * @step 0.1 */ vScale?: number | undefined; /** * How far the image is shifted along U, in image widths. * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ uOffset?: number | undefined; /** * How far the image is shifted along V, in image heights. * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ vOffset?: number | undefined; /** * How far the image is turned on the surface, in radians. * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ wAng?: number | undefined; /** * When false, the default, the image is flipped vertically as it loads; true keeps its rows in * file order. * @default false */ invertY?: boolean | undefined; /** * Not read by this renderer; the image keeps its orientation whatever the value. * @default false */ invertZ?: boolean | undefined; /** * How the image is sampled when shown larger or smaller than its pixels: `nearest` keeps hard * pixels, `bilinear` blends neighbors, and `trilinear` also blends between mipmap levels. * @default nearest */ samplingMode?: samplingModeEnum | undefined; } /** * Alpha/blend modes that determine how transparent materials are rendered */ enum alphaModeEnum { opaque = "opaque", mask = "mask", blend = "blend" } /** * Feeds `draw.createPBRMaterial`: a physically based material for the `faceMaterial` of the drawing * options, from a base color, metallic and roughness values, opacity, glow, texture slots and how * the faces are rendered. */ class GenericPBRMaterialDto { constructor(name?: string, baseColor?: Base.Color, metallic?: number, roughness?: number, alpha?: number, emissiveColor?: Base.Color, emissiveIntensity?: number, zOffset?: number, zOffsetUnits?: number, baseColorTexture?: Base.Texture, metallicRoughnessTexture?: Base.Texture, normalTexture?: Base.Texture, emissiveTexture?: Base.Texture, occlusionTexture?: Base.Texture, alphaMode?: alphaModeEnum, alphaCutoff?: number, doubleSided?: boolean, wireframe?: boolean, unlit?: boolean); /** * The name the engine gives the material. * @default PBRMaterial */ name?: string | undefined; /** * The base color of the surface, as a hex string. * @default #0000ff */ baseColor?: Base.Color | undefined; /** * How metallic the surface is, from 0 for plastic-like to 1 for metal. * @default 0.5 * @minimum 0 * @maximum 1 * @step 0.1 */ metallic?: number | undefined; /** * How rough the surface is, from 0 for a mirror-like shine to 1 for a matte finish. * @default 0.5 * @minimum 0 * @maximum 1 * @step 0.1 */ roughness?: number | undefined; /** * How opaque the material is, from 0 for invisible to 1 for opaque; the default `opaque` mode * of `alphaMode` ignores it and `blend` shows it. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ alpha?: number | undefined; /** * The color the surface glows with whatever the scene's lights, as a hex string; black, the * default, adds no glow. * @default #000000 */ emissiveColor?: Base.Color | undefined; /** * How strongly the surface glows: the emissive color is multiplied by it. * @default 1 * @minimum 0 * @maximum Infinity * @step 0.1 */ emissiveIntensity?: number | undefined; /** * A depth offset scaled by the slope of each face, which moves coplanar surfaces in front of or * behind each other to stop flicker. * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ zOffset?: number | undefined; /** * A constant depth offset added to `zOffset`, in the smallest steps the depth buffer can tell * apart. * @default 0 * @minimum -Infinity * @maximum Infinity * @step 1 */ zOffsetUnits?: number | undefined; /** * An image from `draw.createTexture` for the base color of the surface. * @default undefined * @optional true */ baseColorTexture?: Base.Texture | undefined; /** * An image holding metallic in its blue channel and roughness in its green channel, as glTF * lays them out. * @default undefined * @optional true */ metallicRoughnessTexture?: Base.Texture | undefined; /** * A normal map, which adds surface detail by bending the lighting without changing the * geometry. * @default undefined * @optional true */ normalTexture?: Base.Texture | undefined; /** * An image giving where and in which color the surface glows. * @default undefined * @optional true */ emissiveTexture?: Base.Texture | undefined; /** * An ambient occlusion map, which darkens the creases and corners light reaches less. * @default undefined * @optional true */ occlusionTexture?: Base.Texture | undefined; /** * How opacity is applied: `opaque` ignores it, `mask` cuts away pixels below `alphaCutoff`, and * `blend` draws the faces see-through. * @default opaque */ alphaMode?: alphaModeEnum | undefined; /** * The opacity below which a pixel is cut away; used with `alphaMode` set to `mask`. * @default 0.5 * @minimum 0 * @maximum 1 * @step 0.05 */ alphaCutoff?: number | undefined; /** * When true, both sides of each face are drawn; when false, the back is culled. * @default false */ doubleSided?: boolean | undefined; /** * When true, only the edges of the triangles are drawn. * @default false */ wireframe?: boolean | undefined; /** * When true, the surface shows its base color flat, as a glow the scene's lights do not change. * @default false */ unlit?: boolean | undefined; } /** * Feeds `draw.optionsFrame`: how a frame is drawn, as its three axes in their own colors and a * small grid in its plane that marks it as a plane. */ class DrawFrameOptions { constructor(size?: number, colorX?: Base.Color, colorY?: Base.Color, colorZ?: Base.Color, drawPlane?: boolean, colorPlane?: Base.Color, lineWidth?: number, updatable?: boolean); /** * Length of each axis, in model units; the grid in the plane is as wide, centered on the origin. * @default 1 * @minimum 0 * @exclusiveMinimum true * @maximum Infinity * @step 0.1 */ size?: number | undefined; /** * Color of the X axis, which runs along the frame's direction. * @default #ff0000 */ colorX?: Base.Color | undefined; /** * Color of the Y axis. * @default #00ff00 */ colorY?: Base.Color | undefined; /** * Color of the Z axis, which runs along the frame's normal. * @default #0000ff */ colorZ?: Base.Color | undefined; /** * Whether to draw the small grid in the frame's plane around its origin. * @default true */ drawPlane?: boolean | undefined; /** * Color of the grid in the frame's plane. * @default #808080 */ colorPlane?: Base.Color | undefined; /** * The on-screen width of the axis and grid lines, a third of it in pixels and at least one. * @default 2 * @minimum 0 * @maximum Infinity * @step 0.1 */ lineWidth?: number | undefined; /** * When true, handing the drawn frame back as `group` changes it in place instead of drawing a * new one. * @default false */ updatable?: boolean | undefined; } /** * How the meshes of a recipe, as `manifold.recipes.meshes` gives them, are drawn: the tag * naming an element, when a mesh placed many times becomes instances, the size of a merged * batch, and the look of roots without a color. */ class DrawRecipeMeshesOptions { constructor(elementKey?: string, instancing?: boolean, minInstances?: number, maxBatchVertices?: number, defaultColour?: Base.Color, defaultOpacity?: number, metallic?: number, roughness?: number); /** * The tag whose value names an element, so the roots sharing it show, hide, color and pick * as one. * @default globalId */ elementKey?: string | undefined; /** * When true, a mesh placed often enough by matrices that only turn and move is drawn as * instances, one draw call for all of them. * @default true */ instancing?: boolean | undefined; /** * How many such placements of one mesh make it instances. * @default 2 * @minimum 2 * @maximum Infinity * @step 1 */ minInstances?: number | undefined; /** * The most vertices one merged batch holds; more start another batch. * @default 1000000 * @minimum 1 * @maximum Infinity * @step 1000 */ maxBatchVertices?: number | undefined; /** * The color of a root whose tag has no `rgba`. * @default #cccccc */ defaultColour?: Base.Color | undefined; /** * The opacity of such a root, from 0 to 1. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ defaultOpacity?: number | undefined; /** * How metallic every surface is, from 0 to 1. * @default 0 * @minimum 0 * @maximum 1 * @step 0.1 */ metallic?: number | undefined; /** * How rough every surface is, from 0 to 1. * @default 0.8 * @minimum 0 * @maximum 1 * @step 0.1 */ roughness?: number | undefined; } /** * Elements of a drawn recipe to show or hide, by the values of their element tag. */ class RecipeElementsVisibilityDto { constructor(drawn?: T, keys?: string[], visible?: boolean); /** * The drawn recipe, as drawing its meshes returned it. * @default undefined */ drawn: T; /** * The elements, by the values of their element tag, such as global ids. * @default undefined */ keys: string[]; /** * Whether they are shown. * @default true */ visible?: boolean | undefined; } /** * Elements of a drawn recipe to show in one color, or to give back their own, by the values * of their element tag. */ class RecipeElementsColourDto { constructor(drawn?: T, keys?: string[], colour?: Base.Color, opacity?: number); /** * The drawn recipe, as drawing its meshes returned it. * @default undefined */ drawn: T; /** * The elements, by the values of their element tag, such as global ids. * @default undefined */ keys: string[]; /** * The color to show them in; left out, each takes its own color back. * @default undefined * @optional true */ colour?: Base.Color | undefined; /** * The opacity that color is shown with, from 0 to 1; it shows only in an element drawn * see-through already. * @default 1 * @minimum 0 * @maximum 1 * @step 0.1 */ opacity?: number | undefined; } /** * What a pick hit in a drawn recipe: the mesh, and the triangle or the instance the engine * reports for it. */ class RecipeElementPickDto { constructor(drawn?: T, mesh?: M, triangle?: number, instance?: number); /** * The drawn recipe, as drawing its meshes returned it. * @default undefined */ drawn: T; /** * The mesh the pick hit. * @default undefined */ mesh: M; /** * The triangle the pick hit, which the engine reports for a merged batch. * @default undefined * @optional true */ triangle?: number | undefined; /** * The instance the pick hit, which the engine reports for instances. * @default undefined * @optional true */ instance?: number | undefined; } /** * The kind of geometry a draw call detected, in singular and plural forms - point, line, node, * polyline, Verb curve and surface, JSCAD mesh, and so on. Written onto a drawn object so that * handing it back finds the handler that made it, and readable so you can tell what a handle * refers to when updating or disposing it. * * The values are strings rather than ordinals, and the membership is the same in every renderer. * As ordinals they were neither: the three renderers listed different kinds, so the same number * meant a Manifold solid in one and a list of OCCT shapes in another, and a value written by one * renderer read as a different kind in the next. A string says what it is wherever it is read. */ enum drawingTypes { point = "point", points = "points", line = "line", lines = "lines", node = "node", nodes = "nodes", polyline = "polyline", polylines = "polylines", frame = "frame", frames = "frames", verbCurve = "verbCurve", verbCurves = "verbCurves", verbSurface = "verbSurface", verbSurfaces = "verbSurfaces", jscadMesh = "jscadMesh", jscadMeshes = "jscadMeshes", jscadPath = "jscadPath", jscadPaths = "jscadPaths", occt = "occt", occtShapes = "occtShapes", manifold = "manifold", recipeMeshes = "recipeMeshes", tag = "tag", tags = "tags" } }