Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PointsCloudSystem

The PointCloudSystem (PCS) is a single updatable mesh. The points corresponding to the vertices of this big mesh. As it is just a mesh, the PointCloudSystem has all the same properties as any other BJS mesh : not more, not less. It can be scaled, rotated, translated, enlighted, textured, moved, etc. The PointCloudSystem is also a particle system, with each point being a particle. It provides some methods to manage the particles. However it is behavior agnostic. This means it has no emitter, no particle physics, no particle recycler. You have to implement your own behavior.

Full documentation here : TO BE ENTERED

Hierarchy

  • PointsCloudSystem

Implements

Index

Constructors

constructor

  • new PointsCloudSystem(name: string, pointSize: number, scene: Scene, options?: { updatable?: boolean }): PointsCloudSystem
  • Creates a PCS (Points Cloud System) object

    Parameters

    • name: string

      (String) is the PCS name, this will be the underlying mesh name

    • pointSize: number

      (number) is the size for each point. Has no effect on a WebGPU engine.

    • scene: Scene

      (Scene) is the scene in which the PCS is added

    • Optional options: { updatable?: boolean }

      defines the options of the PCS e.g.

      • updatable (optional boolean, default true) : if the PCS must be updatable or immutable
      • Optional updatable?: boolean

    Returns PointsCloudSystem

Properties

counterSearch playground for counter

counter: number

This a counter for your own usage. It's not set by any SPS functions.

meshSearch playground for mesh

mesh: Mesh

The PCS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are available.

nameSearch playground for name

name: string

The PCS name. This name is also given to the underlying mesh.

nbParticlesSearch playground for nbParticles

nbParticles: number

The PCS total number of particles. Read only. Use PCS.counter instead if you need to set your own value.

particlesSearch playground for particles

particles: CloudPoint[]

The PCS array of cloud point objects. Just access each particle as with any classic array. Example : var p = SPS.particles[i];

varsSearch playground for vars

vars: any

This empty object is intended to store some PCS specific or temporary values in order to lower the Garbage Collector activity. Please read :

Accessors

colors

  • get colors(): Float32Array
  • Gets the particle colors computed by the Point Cloud System

    Returns Float32Array

computeBoundingBox

  • get computeBoundingBox(): boolean
  • set computeBoundingBox(val: boolean): any
  • Gets if setParticles() computes or not the mesh bounding box when computing the particle positions.

    Returns boolean

  • Tells to setParticles() to compute or not the mesh bounding box when computing the particle positions.

    Parameters

    • val: boolean

    Returns any

computeParticleColor

  • get computeParticleColor(): boolean
  • set computeParticleColor(val: boolean): any
  • Gets if setParticles() computes the particle colors or not. Default value : false. The PCS is faster when it's set to false. Note : the particle colors are stored values, so setting computeParticleColor to false will keep yet the last colors set.

    Returns boolean

  • Tells to setParticles() to compute the particle colors or not. Default value : true. The PCS is faster when it's set to false. Note : the particle colors are stored values, so setting computeParticleColor to false will keep yet the last colors set.

    Parameters

    • val: boolean

    Returns any

computeParticleRotation

  • set computeParticleRotation(val: boolean): any
  • Tells to setParticles() to compute the particle rotations or not Default value : false. The PCS is faster when it's set to false Note : particle rotations are only applied to parent particles Note : the particle rotations aren't stored values, so setting computeParticleRotation to false will prevents the particle to rotate

    Parameters

    • val: boolean

    Returns any

computeParticleTexture

  • get computeParticleTexture(): boolean
  • set computeParticleTexture(val: boolean): any
  • Gets if setParticles() computes the particle textures or not. Default value : false. The PCS is faster when it's set to false. Note : the particle textures are stored values, so setting computeParticleTexture to false will keep yet the last colors set.

    Returns boolean

  • Gets if setParticles() computes the particle textures or not. Default value : false. The PCS is faster when it's set to false. Note : the particle textures are stored values, so setting computeParticleTexture to false will keep yet the last colors set.

    Parameters

    • val: boolean

    Returns any

isAlwaysVisible

  • get isAlwaysVisible(): boolean
  • set isAlwaysVisible(val: boolean): any
  • Gets whether the PCS is always visible or not doc :

    Returns boolean

  • Sets the PCS as always visible or not doc :

    Parameters

    • val: boolean

    Returns any

positions

  • get positions(): Float32Array
  • Gets the particle positions computed by the Point Cloud System

    Returns Float32Array

uvs

  • get uvs(): Float32Array
  • Gets the particle uvs computed by the Point Cloud System

    Returns Float32Array

Methods

addPointsSearch playground for addPoints

  • addPoints(nb: number, pointFunction?: any): number
  • Adds points to the PCS in random positions within a unit sphere

    Parameters

    • nb: number

      (positive integer) the number of particles to be created from this model

    • Optional pointFunction: any

      is an optional javascript function to be called for each particle on PCS creation

    Returns number

    the number of groups in the system

addSurfacePointsSearch playground for addSurfacePoints

  • addSurfacePoints(mesh: Mesh, nb: number, colorWith?: number, color?: Color4 | number, range?: number): number
  • Adds points to the PCS from the surface of the model shape

    Parameters

    • mesh: Mesh

      is any Mesh object that will be used as a surface model for the points

    • nb: number

      (positive integer) the number of particles to be created from this model

    • Optional colorWith: number

      determines whether a point is colored using color (default), uv, random, stated or none (invisible)

    • Optional color: Color4 | number

      (color4) to be used when colorWith is stated or color (number) when used to specify texture position

    • Optional range: number

      (number from 0 to 1) to determine the variation in shape and tone for a stated color

    Returns number

    the number of groups in the system

addVolumePointsSearch playground for addVolumePoints

  • addVolumePoints(mesh: Mesh, nb: number, colorWith?: number, color?: Color4 | number, range?: number): number
  • Adds points to the PCS inside the model shape

    Parameters

    • mesh: Mesh

      is any Mesh object that will be used as a surface model for the points

    • nb: number

      (positive integer) the number of particles to be created from this model

    • Optional colorWith: number

      determines whether a point is colored using color (default), uv, random, stated or none (invisible)

    • Optional color: Color4 | number

      (color4) to be used when colorWith is stated or color (number) when used to specify texture position

    • Optional range: number

      (number from 0 to 1) to determine the variation in shape and tone for a stated color

    Returns number

    the number of groups in the system

afterUpdateParticlesSearch playground for afterUpdateParticles

  • afterUpdateParticles(start?: number, stop?: number, update?: boolean): void
  • This will be called by setParticles() after all the other treatments and just before the actual mesh update. This will be passed three parameters. This does nothing and may be overwritten by the user.

    Parameters

    • Optional start: number

      the particle index in the particle array where to start to iterate, same than the value passed to setParticle()

    • Optional stop: number

      the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()

    • Optional update: boolean

      the boolean update value actually passed to setParticles()

    Returns void

beforeUpdateParticlesSearch playground for beforeUpdateParticles

  • beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void
  • This will be called before any other treatment by setParticles() and will be passed three parameters. This does nothing and may be overwritten by the user.

    Parameters

    • Optional start: number

      the particle index in the particle array where to start to iterate, same than the value passed to setParticle()

    • Optional stop: number

      the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()

    • Optional update: boolean

      the boolean update value actually passed to setParticles()

    Returns void

buildMeshAsyncSearch playground for buildMeshAsync

  • Builds the PCS underlying mesh. Returns a standard Mesh. If no points were added to the PCS, the returned mesh is just a single point.

    Parameters

    • Optional material: Material

      The material to use to render the mesh. If not provided, will create a default one

    Returns Promise<Mesh>

    a promise for the created mesh

disposeSearch playground for dispose

  • dispose(): void
  • Disposes the PCS.

    Returns void

initParticlesSearch playground for initParticles

  • initParticles(): void
  • This function does nothing. It may be overwritten to set all the particle first values. The PCS doesn't call this function, you may have to call it by your own. doc :

    Returns void

recycleParticleSearch playground for recycleParticle

  • This function does nothing. It may be overwritten to recycle a particle The PCS doesn't call this function, you can to call it doc :

    Parameters

    Returns CloudPoint

    the recycled particle

refreshVisibleSizeSearch playground for refreshVisibleSize

  • Visibility helper : Recomputes the visible size according to the mesh bounding box doc :

    Returns PointsCloudSystem

    the PCS.

setParticlesSearch playground for setParticles

  • Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc. This method calls updateParticle() for each particle of the SPS. For an animated SPS, it is usually called within the render loop.

    Parameters

    • Optional start: number

      The particle index in the particle array where to start to compute the particle property values (default 0)

    • Optional end: number

      The particle index in the particle array where to stop to compute the particle property values (default nbParticle - 1)

    • Optional update: boolean

      If the mesh must be finally updated on this call after all the particle computations (default true)

    Returns PointsCloudSystem

    the PCS.

setVisibilityBoxSearch playground for setVisibilityBox

  • setVisibilityBox(size: number): void
  • Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.

    Parameters

    • size: number

      the size (float) of the visibility box note : this doesn't lock the PCS mesh bounding box. doc :

    Returns void

updateParticleSearch playground for updateParticle

  • Updates a particle : this function should be overwritten by the user. It is called on each particle by setParticles(). This is the place to code each particle behavior. doc :

    example

    : just set a particle position or velocity and recycle conditions

    Parameters

    Returns CloudPoint

    the updated particle

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method