Bitbybit Docs
    Preparing search index...

    Class DrawComplete

    Desenhar qualquer coisa na cena: formas do kernel, pontos, linhas, polilinhas, curvas, malhas e tags passam todos por drawAnyAsync, que escolhe o renderizador certo para a entidade e devolve o objeto desenhado. Os métodos options constroem as opções de desenho com predefinições para cada tipo de entidade, createPBRMaterial e createTexture criam materiais para as ranhuras das faces, e um objeto desenhado pode ser redesenhado no lugar passando-o de volta.

    Hierarchy (View Summary)

    Index

    Constructors

    draw

    • Draws any kind of geometry after all input promises are resolved. Inputs can also be non-promise like.

      Type Parameters

      • E extends any

      Parameters

      • inputs: DrawAny<E>

        Contains options and entities to be drawn

      Returns Promise<Drawn<E, Mesh>>

      BabylonJS Mesh Promise

    • Draws a grid mesh on the ground plane in 3D space. This helps to orient yourself in the world.

      Parameters

      Returns Mesh

    draw async

    • Draws any entity into the scene, as drawAnyAsync does, without giving the drawn object back; for the last step of a script that only needs the result to appear.

      Parameters

      • inputs: DrawAny

        The entity to draw and the optional drawing options

      Returns Promise<void>

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 10, length: 10, height: 10, center: [0, 0, 0] });
      await bitbybit.draw.drawAnyAsyncNoReturn({ entity: box });

    draw sync

    • Draws an entity that needs no kernel work, as drawAny does, without giving the drawn object back; points, lines, polylines and tags qualify, kernel shapes do not.

      Parameters

      • inputs: DrawAny

        The entity to draw and the optional drawing options

      Returns void

      bitbybit.draw.drawAnyNoReturn({ entity: [[0, 0, 0], [5, 5, 5], [10, 0, 0]] });
      
    • Draws an entity that needs no kernel work into the scene right away and gives back the drawn object: points, lines, polylines, tags and nodes.

      Kernel shapes from OCCT, JSCAD and Manifold must go through drawAnyAsync, which waits for the kernel to mesh them.

      Type Parameters

      • E extends any

      Parameters

      • inputs: DrawAny<E>

        The entity to draw, the optional drawing options and the previous result when updating

      Returns Drawn<E, Mesh>

      What drawing the entity produces: a scene object for geometry, the tag or tags for a tag, an axis triad for a node; undefined for an empty list

      const options = bitbybit.draw.optionsSimple({ colours: "#00ff00", size: 0.5, opacity: 1, updatable: false, hidden: false, drawTwoSided: true, backFaceColour: "#0000ff", backFaceOpacity: 1, colorMapStrategy: Bit.Inputs.Base.colorMapStrategyEnum.lastColorRemainder, arrowSize: 0, arrowAngle: 15 });
      const drawn = bitbybit.draw.drawAny({ entity: [[0, 0, 0], [5, 5, 5], [10, 0, 0]], options });

    grid

    • Draws a grid on the ground plane, as drawGridMesh does, without giving the mesh back.

      Parameters

      Returns void

      bitbybit.draw.drawGridMeshNoReturn({ width: 400, height: 400, subdivisions: 10, majorUnitFrequency: 10, minorUnitVisibility: 0.45, gridRatio: 0.5, opacity: 0.5, backFaceCulling: false, mainColor: "#ffffff", secondaryColor: "#ffffff" });
      

    material

    • Creates an image texture from a URL for the texture slots of createPBRMaterial, with tiling, offset, rotation and filtering that mean the same in every renderer.

      Parameters

      • inputs: GenericTextureDto

        The image URL and the tiling, offset, rotation, flip and sampling options

      Returns Texture

      The engine's texture

      const texture = bitbybit.draw.createTexture({ url: "https://example.com/wood.jpg", name: "wood", uScale: 2, vScale: 2, uOffset: 0, vOffset: 0, wAng: 0, invertY: false, invertZ: false, samplingMode: Bit.Inputs.Draw.samplingModeEnum.trilinear });
      
    • Creates a physically based material from settings that mean the same in every renderer: base color, metallic and roughness, opacity, emissive glow, the texture slots and the alpha and side options; put it in the faceMaterial of the drawing options.

      Parameters

      • inputs: GenericPBRMaterialDto

        The name, colors, metallic and roughness values, opacity, textures and rendering options

      Returns PBRMetallicRoughnessMaterial

      The engine's material

      const material = bitbybit.draw.createPBRMaterial({ name: "steel", baseColor: "#c0c0c0", metallic: 1, roughness: 0.4, alpha: 1, emissiveColor: "#000000", emissiveIntensity: 1, zOffset: 0, zOffsetUnits: 0, alphaMode: Bit.Inputs.Draw.alphaModeEnum.opaque, alphaCutoff: 0.5, doubleSided: false, wireframe: false, unlit: false });
      const options = bitbybit.draw.optionsOcctShapeMaterial({ precision: 0.01, faceMaterial: material, drawEdges: true, edgeColour: "#ffffff", edgeWidth: 2 });

    options

    • Builds the most used drawing options for OCCT shapes, precision, face and edge colors and two-sided rendering, with defaults for what is left out.

      Parameters

      Returns DrawOcctShapeSimpleOptions

      The drawing options

      const options = bitbybit.draw.optionsOcctShapeSimple({ precision: 0.01, drawFaces: true, faceColour: "#ff0000", drawEdges: true, edgeColour: "#ffffff", edgeWidth: 2, drawTwoSided: true, backFaceColour: "#0000ff", backFaceOpacity: 1 });
      
    • Builds drawing options for OCCT shapes whose faces use a full engine material, as createPBRMaterial makes one, plus the precision and edge style.

      Parameters

      Returns DrawOcctShapeMaterialOptions

      The drawing options

      const material = bitbybit.draw.createPBRMaterial({ name: "steel", baseColor: "#c0c0c0", metallic: 1, roughness: 0.4, alpha: 1, emissiveColor: "#000000", emissiveIntensity: 1, zOffset: 0, zOffsetUnits: 0, alphaMode: Bit.Inputs.Draw.alphaModeEnum.opaque, alphaCutoff: 0.5, doubleSided: false, wireframe: false, unlit: false });
      const options = bitbybit.draw.optionsOcctShapeMaterial({ precision: 0.01, faceMaterial: material, drawEdges: true, edgeColour: "#ffffff", edgeWidth: 2 });
    • Builds drawing options for Manifold solids and cross-sections: face color or a full engine material, the line style of cross-sections, normals and the two-sided rendering.

      Parameters

      Returns DrawManifoldOrCrossSectionOptions

      The drawing options

      const options = bitbybit.draw.optionsManifoldShapeMaterial({ faceOpacity: 1, faceColour: "#ff0000", faceMaterial: material, crossSectionColour: "#ff00ff", crossSectionWidth: 2, crossSectionOpacity: 1, computeNormals: false, drawTwoSided: true, backFaceColour: "#0000ff", backFaceOpacity: 1 });
      const drawn = await bitbybit.draw.drawAnyAsync({ entity: solid, options });