0.0.5 • Published 10 months ago

quanty3djs v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

quanty3djs

Description

quanty3djs is a javascript library for 3d visualization. It is based on three.js and its ecosystem.

installation

  1. npm install

    npm install quanty3djs
  2. pnpm install

    pnpm install quanty3djs

Classes

QuantyWorld

Description

QuantyWorld is the main class of quanty3djs. It is a wrapper of three.js scene and renderer. It provides a simple interface to create and manage 3d objects.

Constructor

new QuantyWorld({
    canvas,
    antialias = false,
    alpha = false,
    context = null,
    depth = true,
    failIfMajorPerformanceCaveat = false,
    logarithmicDepthBuffer = false,
    powerPreference = "default",
    precision = "highp",
    premultipliedAlpha = true,
    preserveDrawingBuffer = false,
    stencil = true,
  })

Parameters

  • canvas: HTMLCanvasElement

    The canvas element to be used as the rendering surface.

  • antialias: Boolean

    Whether to perform antialiasing.

  • alpha: Boolean

    Whether the canvas contains an alpha (transparency) buffer or not.

  • context: WebGLRenderingContext

    A WebGL context object to use instead of creating a new one.

  • depth: Boolean

    Whether the drawing buffer has a depth buffer of at least 16 bits.

  • failIfMajorPerformanceCaveat: Boolean

    If the value is true, the user agent will opt out of hardware acceleration when creating the context.

  • logarithmicDepthBuffer: Boolean

    Whether to use a logarithmic depth buffer.

  • powerPreference: String

    A hint to the user agent indicating what configuration of GPU is suitable for the WebGL context. Can be "high-performance", "low-power" or "default".

  • precision: String

    A hint to the user agent indicating what precision to use for the shaders. Can be "highp", "mediump" or "lowp".

  • premultipliedAlpha: Boolean

    Whether or not the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.

  • preserveDrawingBuffer: Boolean

    If the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author.

  • stencil: Boolean

    Whether the drawing buffer has a stencil buffer of at least 8 bits.

Methods

  • render()

    Render the scene.

  • resizeRendererToDisplaySize()

    Resize the renderer to the display size.

  • adjustCamera(scaleFactor=0.3)

    Adjust the camera position and target.

  • addMesh(mesh)

    Add a mesh to the scene.

  • addMeshes(meshes)

    Add meshes to the scene.

  • removeAllMeshes()

    Remove all meshes from the scene.

  • removeMesh(mesh)

    Remove a mesh from the scene.

  • addGltf(url,onProgress)

    Add a gltf model to the scene.

  • clear()

    Clear the GPU memory.

  • enableScreenshot()

    Enable screenshot.

  • extractGltf()

    Extract all meshes of a gltf file

ResourceTracker

Description

ResourceTracker is a class to track the resources of mesh's geometry and material.

Constructor

new ResourceTracker()

Methods

  • track(mesh)

    Track the resources of mesh's geometry and material.

  • untrack(mesh)

    Untrack the resources of mesh's geometry and material.

  • dispose()

    Dispose the resources.

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago