Cube

clay.geometry. Cube

# new Cube(optopt)

Source:
Parameters:
Name Type Attributes Description
opt Object <optional>
Properties
Name Type Attributes Description
widthSegments number <optional>
heightSegments number <optional>
depthSegments number <optional>
inside boolean <optional>

Extends

Members

# __uid__ :number

Source:
Inherited From:
Type:
  • number

# attributes :Object.<string, clay.Geometry.Attribute>

Source:
Inherited From:

Attributes of geometry. Including:

  • position
  • texcoord0
  • texcoord1
  • normal
  • tangent
  • color
  • weight
  • joint
  • barycentric
Type:
  • Object.<string, clay.Geometry.Attribute>

# boundingBox :clay.BoundingBox

Source:
Inherited From:

Calculated bounding box of geometry.

Type:

# depthSegments :number

Source:
Type:
  • number

# dynamic :boolean

Source:
Overrides:

Is vertices data dynamically updated. Attributes value can't be changed after first render if dyanmic is false.

Type:
  • boolean

# heightSegments :number

Source:
Type:
  • number

# indices :Uint16Array|Uint32Array

Source:
Inherited From:

Indices of geometry.

Type:
  • Uint16Array | Uint32Array

# inside :boolean

Source:
Type:
  • boolean

# mainAttribute :string

Source:
Inherited From:

Main attribute will be used to count vertex number

Type:
  • string

# (nullable) pick :function

Source:
Inherited From:

User defined picking algorithm instead of default triangle ray intersection x, y are NDC.

(x, y, renderer, camera, renderable, out) => boolean
Type:
  • function

# (nullable) pickByRay :function

Source:
Inherited From:

User defined ray picking algorithm instead of default triangle ray intersection

(ray: clay.Ray, renderable: clay.Renderable, out: Array) => boolean
Type:
  • function

# (readonly) triangleCount :number

Source:
Inherited From:
Type:
  • number

# (readonly) vertexCount :number

Source:
Inherited From:
Type:
  • number

# widthSegments :number

Source:
Type:
  • number

Methods

# after(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of once('after' + name)

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# applyTransform(matrix)

Source:
Inherited From:

Apply transform to geometry attributes.

Parameters:
Name Type Description
matrix clay.Matrix4

# before(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of once('before' + name)

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# build()

Source:

Build cube geometry

# createAttribute(name, type, size, semanticopt)

Source:
Inherited From:

Create a new attribute

Parameters:
Name Type Attributes Description
name string
type string
size number
semantic string <optional>

# dirty()

Source:
Inherited From:

Mark attributes and indices in geometry needs to update. Usually called after you change the data in attributes.

# dirtyAttribute(attrNameopt)

Source:
Inherited From:

Mark the attributes needs to update.

Parameters:
Name Type Attributes Description
attrName string <optional>

# dirtyIndices()

Source:
Inherited From:

Mark the indices needs to update.

# dispose(renderer)

Source:
Inherited From:

Dispose geometry data in GL context.

Parameters:
Name Type Description
renderer clay.Renderer

# error(action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of on('error')

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# generateBarycentric()

Source:
Inherited From:

Generate barycentric coordinates for wireframe draw.

# generateFaceNormals()

Source:
Inherited From:

Generate normals per face.

# generateTangents()

Source:
Inherited From:

Generate tangents attributes.

# generateUniqueVertex()

Source:
Inherited From:

Create a unique vertex for each index.

# generateVertexNormals()

Source:
Inherited From:

Generate normals per vertex.

# getAttribute(name) → {clay.GeometryBase.Attribute}

Source:
Inherited From:

Get attribute

Parameters:
Name Type Description
name string
Returns:
Type
clay.GeometryBase.Attribute

# getEnabledAttributes() → {Array.<string>}

Source:
Inherited From:

Get enabled attributes name list Attribute which has the same vertex number with position is treated as a enabled attribute

Returns:
Type
Array.<string>

# getTriangleIndices(idx, out) → {Array.<number>}

Source:
Inherited From:

Get indices of triangle at given index.

Parameters:
Name Type Description
idx number
out Array.<number>
Returns:
Type
Array.<number>

# has(name, action) → {boolean}

Source:
Inherited From:
Mixes In:

If registered the event handler

Parameters:
Name Type Description
name string
action function
Returns:
Type
boolean

# initIndicesFromArray(array)

Source:
Inherited From:

Initialize indices from an array.

Parameters:
Name Type Description
array Array

# isUniqueVertex()

Source:
Inherited From:

If vertices are not shared by different indices.

# off(action, contextopt)

Source:
Inherited From:
Mixes In:

Remove event listener

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# on(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Register event handler

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# once(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Register event, event will only be triggered once and then removed

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# removeAttribute(name)

Source:
Inherited From:

Remove attribute

Parameters:
Name Type Description
name string

# setTriangleIndices(idx, arr)

Source:
Inherited From:

Set indices of triangle at given index.

Parameters:
Name Type Description
idx number
arr Array.<number>

# success(action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of on('success')

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# trigger(name)

Source:
Inherited From:
Mixes In:

Trigger event

Parameters:
Name Type Description
name string

# updateBoundingBox()

Source:
Inherited From:

Update boundingBox of Geometry