Home Reference Source
public class | source

Particle

Extends:

GLBoostObjectGeometry → Particle

This Particle class handles particles expressions. You can define particles behaviors in a custom vertex shader. These particles are processed in GPU, so this is a very fast solution of particles expressions.

Constructor Summary

Public Constructor
public

constructor(glBoostContext: *, centerPointData: *, particleWidth: *, particleHeight: *, customVertexAttributes: *, performanceHint: *)

This is Particle class's constructor

Member Summary

Public Members
public
public

colors: *[]

public

normals: *[]

public

pointData: {}

public

positions: *[]

public

texcoords: *[]

Private Members
private

Method Summary

Public Methods
public

prepareToRender(expression: *, existCamera_f: *, pointLight: *, meshMaterial: *, renderPasses: *, mesh: *): boolean

public

updateVerticesData(centerPointData: *, particleWidth: *, particleHeight: *, customVertexAttributes: *)

Private Methods
private

_setupVertexAndIndexData(centerPointData: *, pHalfWidth: *, pHalfHeight: *, customVertexAttributes: *, needDefaultWhiteColor: *): {"vertexAttributes": *, "indexArray": *}

private

_setupVertexData(centerPointData: *, pHalfWidth: *, pHalfHeight: *, customVertexAttributes: *, performanceHint: *)

private

_updateVertexAndIndexData(centerPointData: *, pHalfWidth: *, pHalfHeight: *, customVertexAttributes: *, needDefaultWhiteColor: *): {"vertexAttributes": *, "indexArray": *}

Inherited Summary

From class GLBoostObject
public static
private static
private static
public get
public get
public get

Return the simple class-specific number.

public get
public get
public get
public get
public get
public get
public set
private
private
private
private
private
private
private
private
private
private
public
public
public
public

Return instance name.

public
private

_copy(instance: *)

private
From class Geometry
public get

AABB: *

public get
public get
public set
public get

rawAABB: *

private

_AABB: *

private
private
private
private
private
private

_materials: *[]

private
private
private

_vboObj: {}

private
private
private
public

draw(data: *)

public
public

getExtraDataForShader(name: *): *

public
public

getTriangleCount(mesh: *): *

public
public

isIndexed(): *

public

isTransparent(mesh: *): *

public

merge(geometrys: *)

public

mergeHarder(geometrys: *)

public

mergeHarderInner(geometry: *, typedArrayDic: *, isFirst: *)

take no thought geometry's materials

public

mergeInner(geometry: *, typedArrayDic: *, isFirst: *)

public

prepareGLSLProgram(expression: *, material: *, existCamera_f: *, lights: *, shaderClass: *, argShaderInstance: *): *

public

prepareToRender(expression: *, existCamera_f: *, lights: *, meshMaterial: *, mesh: *, shaderClass: *, argMaterials: *): *

public

rayCast(origVec3: *, dirVec3: *, isFrontFacePickable: *, isBackFacePickable: *): undefined[]

public

setExtraDataForShader(name: *, value: *)

public

setUpDisableAllVertexAttribArrays(gl: *, glslProgram: *)

public

setUpDisableVertexAttribArrays(gl: *, glslProgram: *, allVertexAttribs: *)

public

setUpEnableVertexAttribArrays(gl: *, glslProgram: *, allVertexAttribs: *)

public

setUpVertexAttribs(gl: *, glslProgram: *, allVertexAttribs: *)

public

setVerticesData(vertices: *, indicesArray: *, primitiveType: *, performanceHint: *)

public

updateVerticesData(vertices: *, skipUpdateAABB: *): boolean

private

_allVertexAttribs(vertices: *): *

return all vertex attribute name list

private

_calcArenbergInverseMatrices(primitiveType: *)

private

_calcArenbergMatrixFor3Vertices(vertexIndices: *, i: *, pos0IndexBase: *, pos1IndexBase: *, pos2IndexBase: *, incrementNum: *): number

private

_calcBaryCentricCoord(vertexNum: *, positionElementNumPerVertex: *)

private

_calcTangent(vertexNum: *, positionElementNumPerVertex: *, texcoordElementNumPerVertex: *, primitiveType: *)

private

_calcTangentFor3Vertices(vertexIndices: *, i: *, pos0IndexBase: *, pos1IndexBase: *, pos2IndexBase: *, uv0IndexBase: *, uv1IndexBase: *, uv2IndexBase: *, incrementNum: *)

private

_calcTangentPerVertex(pos0Vec3: *, pos1Vec3: *, pos2Vec3: *, uv0Vec2: *, uv1Vec2: *, uv2Vec2: *): *

private

_checkAndSetVertexComponentNumber(allVertexAttribs: *)

private

_createShaderInstance(glBoostContext: *, shaderClass: *): *

private
private
private

_getVAO(): *

private

_rayCastInner(origVec3: *, dirVec3: *, i: *, pos0IndexBase: *, pos1IndexBase: *, pos2IndexBase: *, isFrontFacePickable: *, isBackFacePickable: *): undefined[]

private

_setUpVertexAttibsWrapper(glslProgram: *)

private

_setVertexNtoSingleMaterial(material: *, index: *)

Public Constructors

public constructor(glBoostContext: *, centerPointData: *, particleWidth: *, particleHeight: *, customVertexAttributes: *, performanceHint: *) source

This is Particle class's constructor

Override:

Geometry#constructor

Params:

NameTypeAttributeDescription
glBoostContext *
centerPointData *
particleWidth *
particleHeight *
customVertexAttributes *
performanceHint *

Public Members

public centerPositions: *[] source

public colors: *[] source

public normals: *[] source

public pointData: {} source

public positions: *[] source

public texcoords: *[] source

Private Members

private _materialForBillboard: * source

Public Methods

public prepareToRender(expression: *, existCamera_f: *, pointLight: *, meshMaterial: *, renderPasses: *, mesh: *): boolean source

Override:

Geometry#prepareToRender

Params:

NameTypeAttributeDescription
expression *
existCamera_f *
pointLight *
meshMaterial *
renderPasses *
mesh *

Return:

boolean

public updateVerticesData(centerPointData: *, particleWidth: *, particleHeight: *, customVertexAttributes: *) source

Override:

Geometry#updateVerticesData

Params:

NameTypeAttributeDescription
centerPointData *
particleWidth *
particleHeight *
customVertexAttributes *

Private Methods

private _setupVertexAndIndexData(centerPointData: *, pHalfWidth: *, pHalfHeight: *, customVertexAttributes: *, needDefaultWhiteColor: *): {"vertexAttributes": *, "indexArray": *} source

Params:

NameTypeAttributeDescription
centerPointData *
pHalfWidth *
pHalfHeight *
customVertexAttributes *
needDefaultWhiteColor *

Return:

{"vertexAttributes": *, "indexArray": *}

private _setupVertexData(centerPointData: *, pHalfWidth: *, pHalfHeight: *, customVertexAttributes: *, performanceHint: *) source

Params:

NameTypeAttributeDescription
centerPointData *
pHalfWidth *
pHalfHeight *
customVertexAttributes *
performanceHint *

private _updateVertexAndIndexData(centerPointData: *, pHalfWidth: *, pHalfHeight: *, customVertexAttributes: *, needDefaultWhiteColor: *): {"vertexAttributes": *, "indexArray": *} source

Params:

NameTypeAttributeDescription
centerPointData *
pHalfWidth *
pHalfHeight *
customVertexAttributes *
needDefaultWhiteColor *

Return:

{"vertexAttributes": *, "indexArray": *}