API Documentation

for 0.0.1
Show:

EdgesMesh Class

EdgesMesh class creates a hiddenline fashioned Mesh from any other Mesh. "Hard" edges only will be visible. he result is different from when a Mesh material is set to wireframe, as all the segment will not be visible. All the coplanar segment are erased here in a new geometry that is rendered with a "line" type material.

Constructor

EdgesMesh

(
  • params
)

Parameters:

  • params Object

    parameters this can contains the same parameters than Mesh class

    • mesh Mesh

      The existing Mesh to use for generate a new edge only Mesh (geometry and material)

Methods

attachMaterial

(
  • material
)

Attach the material to this mesh. The material must have been created before calling this method

Parameters:

clear

()

Clears this mesh's geometry, that is vertices, faces and faceVertexUvs

computeNormals

()

compute Face and Vertex Normals for the current geometry

constructArc

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [radius=1] Number optional

      the arc radius in world unit

    • [width=0.2] Number optional

      the arc width (or weight, distance between the exterior segments and the center) in world unit

    • [segments=32] Number optional

      the segments number (detail level)

    • [startAngle=0] Number optional

      0 and Math.PI*2 are at 3 o'clock, value is counter clock-wise

    • [endAngle=Math.PI*2] Number optional

      0 and Math.PI*2 are at 3 o'clock, value is counter clock-wise

    • [color=Color.white] Color optional
    • [center=Vector3.zero] Number optional

constructBox

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [width=1] Number optional

      the box width in world unit

    • [height=1] Number optional

      the box height in world unit

    • [depth=1] Number optional

      the box depth in world unit

    • [segments=1] Number optional

      tesselation size for all sides

    • [widthSegments=1] Number optional

      horizontal tesselation size, overrides segments parameters for this side

    • [heightSegments=1] Number optional

      vertical tesselation size, overrides segments parameters for this side

    • [depthSegments=1] Number optional

      depth tesselation size, overrides segments parameters for this side

constructCircle

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [radius=1] Number optional

      the circle radius in world unit

    • [segments=32] Number optional

      horizontal tesselation size

    • [thetaStart=0] Number optional

      vertical angle start of the circle

    • [thetaLength=Math.PI] Number optional

      vertical length of the circle

constructCube

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [size=1] Number optional

      the cube dimensions in world unit

    • [segments=1] Number optional

      tesselation size for all sides

    • [widthSegments=1] Number optional

      horizontal tesselation size, overrides segments parameters for this side

    • [heightSegments=1] Number optional

      vertical tesselation size, overrides segments parameters for this side

    • [depthSegments=1] Number optional

      depth tesselation size, overrides segments parameters for this side

constructCustom

(
  • params
)

Construct an empty and unfinished Mesh for which a geometry must be constructed. Once filled with vertices, constructMesh method must be called, or a method generating a complete Mesh must be used (i.e generateFillMesh)

Parameters:

  • params Object

    Parameters object, given by the constructor.

constructCylinder

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [radius=1] Number optional

      the cylinder top and bottom radius in world unit

    • [radiusTop=1] Number optional

      the cylinder top radius in world unit

    • [radiusBottom=1] Number optional

      the cylinder bottom radius in world unit

    • [height=1] Number optional

      the cylinder height in world unit

    • [radiusSegments=32] Number optional

      horizontal tesselation size

    • [heightSegments=1] Number optional

      vertical tesselation size

    • [openEnded=false] Number optional

      close the ends of the shape or not

    • [thetaStart=0] Number optional

      vertical angle start of the cylinder

    • [thetaLength=Math.PI*2] Number optional

      vertical length of the cylinder

constructIcosahedron

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [radius=1] Number optional

      the icosahedron radius in world unit

    • [detail=0] Number optional

      the icosahedron number of points (tesselation and "roundness")

constructLine

(
  • params
)

Inherited from Mesh but overwritten in src/js/Mobilizing/shape/Mesh.js:222

Geometry and resulting point method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [point=Vector3(0, 0, 0)] Number optional

      the point 3D coordinates

constructMesh

()

Call this method to construct a custom mesh

constructNode

()

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

A node is an empty 3D object. It has no geometry, but has a tansform, therefore it can be used to create the root element for grouping objects. In Mobilizing, transforms represents a kind of invisible coordinate axis that can be tansformed in space. We use it to construct parent/child relationships, like in object.transform.addChild(otherObject.transform)

constructOctahedron

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [radius=1] Number optional

      the octahedron radius in world unit

    • [detail=0] Number optional

      the octahedron number of points (tesselation and "roundness")

constructPlane

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [width=1] Number optional

      the plane width in world unit

    • [height=1] Number optional

      the plane height in world unit

    • [segments=1] Number optional

      tesselation size for all sides

    • [widthSegments=1] Number optional

      horizontal tesselation size, overrides segments parameters for this side

    • [heightSegments=1] Number optional

      vertical tesselation size, overrides segments parameters for this side

constructQuad

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [point1=Vector2(-1, 1)] Number optional

      upper left point

    • [point2=Vector2( 1, 1)] Number optional

      upper right point

    • [point3=Vector2( 1, -1)] Number optional

      lower right point

    • [point4=Vector2(-1, -1)] Number optional

      lower left point

constructSphere

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [radius=1] Number optional

      the sphere radius in world unit

    • [segments=8] Number optional

      tesselation size for all axis

    • [widthSegments=8] Number optional

      horizontal tesselation size

    • [heightSegments=8] Number optional

      vertical tesselation size

    • [phiStart=0] Number optional

      horizontal angle start of the sphere

    • [phiLength=Math.PI*2] Number optional

      horizontal length of the sphere

    • [thetaStart=0] Number optional

      vertical angle start of the sphere

    • [thetaLength=Math.PI] Number optional

      vertical length of the sphere

constructSprite

()

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

constructText

(
  • params
)

Geometry and resulting mesh method, you should not use directly this method as it is used internally by the constructor. This documentation only aims to help you identify the possibles parameters for a particular shape.

3D Text is created from a typeface represented in JSON, please use facetype.js to generate a JSON from a font file. The generated JSON must be loader with a Loader.load.JSON() method and passed to the constructor.

Parameters:

  • params Object

    Parameters object, given by the constructor.

    • [text="text"] Number optional

      the text string

    • [fontSize=1] Number optional

      the text font height

    • [height=1] Number optional

      the glyph extrusion height (or visually speaking, depth). 0 to have flat letters.

    • [segments=5] Number optional

      the text details and tesselation

    • font Number

      the text font to use. Must be a json generated from facetype.js

createArc

(
  • center
  • radius
  • segments
  • startAngle
  • endAngle
  • color
  • texture
  • width
  • uvScale
)

createArc

Parameters:

  • center Number
  • radius Number
  • segments Number
  • startAngle Number
  • endAngle Number
  • color Color
  • texture Texture
  • width Number
  • uvScale Number

createCircle

(
  • center
  • radius
  • segments
  • color
  • texture
  • width
  • uvScale
)

createCircle

Parameters:

  • center Number
  • radius Number
  • segments Number
  • color Color
  • texture Texture
  • width Number
  • uvScale Number

createDisc

(
  • center
  • radius
  • segments
  • color
  • texture
)

createDisc

Parameters:

  • center Number
  • radius Number
  • segments Number
  • color Color
  • texture Texture

createDiscSector

(
  • center
  • radius
  • segments
  • startAngle
  • endAngle
  • color
  • texture
)

createDiscSector

Parameters:

  • center Number
  • radius Number
  • segments Number
  • startAngle Number
  • endAngle Number
  • color Color
  • texture Texture

erase

()

Erase this mesh's geometry and material from memory

generateFillMesh

()

Generate the mesh for the given vertices and generates flat uvs for it. Usefull for 2D shapes

generateFlatUVs

()

Generate the flat uvs for this mesh.

genereateMesh

()

genereate a mesh from already made geometry and material

getBoundingBox

() Object

Compute and returns the bounding box of the current geometry or Node, which is an object made of 2 Vector3.

Returns:

Object:

boundingBox object {min: new Vector3, max: new Vector3}

getBoundingSphere

() Object

Compute and returns the bounding sphere of the current geometry or Node, which is an object with a radius :

Returns:

Object:

boundingSphere object {radius: number}

getCenter

() Vector3

Returns the center of the geometry (vertices) based on boundingbox

Returns:

Vector3:

vector3 of the current geometry center

getIntersectionsPoints

(
  • mesh
)
Array

Compute the intersection points between a plane and a mesh !Works ONLY if this mesh is "plane" primitive made!

Parameters:

  • mesh Mesh

    the mesh to use for the intersections computation

Returns:

Array:

an array of object as {vertex: Vector3, uv: Vector2};

getUVFromIntersectionPoint

(
  • point
  • p1
  • p2
  • p3
  • uv1
  • uv2
  • uv3
)
Vector2 private

getUVFromIntersectionPoint

Parameters:

Returns:

Vector2:

Uvs

getUVs

(
  • index
)
Array

Get the UV of this mesh geometry

Parameters:

  • index Integer

    of the UV to get

Returns:

Array:

uvs

getVertexColors

() Array

Get the vertexColors of this mesh geometry's vertices

Returns:

Array:

colors

getVertices

() Object

Get the vertices of this mesh geometry

Returns:

Object:

vertices

getVisible

() Boolean

Get the visibility of this mesh

Returns:

Boolean:

value visible or not

pushFace

(
  • i1
  • i2
  • i3
)

Adds a face to the current geometry

Parameters:

  • i1 Integer

    Face Index to add

  • i2 Integer

    Face Index to add

  • i3 Integer

    Face Index to add

pushNormal

(
  • n1
  • n2
  • n3
)

Adds a UV to the current geometry

Parameters:

pushQuad

(
  • v1
  • v2
  • v3
  • v4
  • uv1
  • uv2
  • uv3
  • uv3
)

Adds a Quad to the current geometry

Parameters:

  • v1 Vector3

    vertex coordinates of the Quad

  • v2 Vector3

    vertex coordinates of the Quad

  • v3 Vector3

    vertex coordinates of the Quad

  • v4 Vector3

    vertex coordinates of the Quad

  • uv1 Vector2

    uv coordinates to add

  • uv2 Vector2

    uv coordinates to add

  • uv3 Vector2

    uv coordinates to add

  • uv3 Vector2

    uv coordinates to add

pushTriangle

(
  • v1
  • v2
  • v3
)

Adds a triangle to the current geometry

Parameters:

  • v1 Vector3

    vertex coordinates of the triangle

  • v2 Vector3

    vertex coordinates of the triangle

  • v3 Vector3

    vertex coordinates of the triangle

pushUV

(
  • uv1
  • uv2
  • uv3
)

Adds a UV to the current geometry

Parameters:

pushVertex

(
  • v
)

Adds a vertex to the current geometry

Parameters:

setCastShadow

(
  • enabled
)

setCastShadow

Parameters:

  • enabled Boolean

setCenter

(
  • x
  • y
  • z
)

Defines the position of the geometry's center (NOT the transform!).

Parameters:

  • x Number

    x coordinate

  • y Number

    y coordinate

  • z Number

    z coordinate

setMaterial

(
  • material
)

Sets this Mesh material. Be warned that this method requiers to build a new mesh, so it can be slow on update. Better use it in setup.

Parameters:

  • material Material | | String

    the new material to set (if String used, one of "phong", "lambert", "basic")

setPointOfIntersection

(
  • line
  • plane
  • intersectionPoint
)
Object private

setPointOfIntersection

Parameters:

  • line Object

    three.js line

  • plane Object

    three.js plane

  • intersectionPoint Object

    object to be used to store the resulting Vector3

Returns:

Object:

description

setReceiveShadow

(
  • enabled
)

setReceiveShadow

Parameters:

  • enabled Boolean

setRotationX

(
  • value
)

Set the rotation around x axis of the vertices (not the transform!)

Parameters:

  • value Float

    Rotation value in degree

setRotationY

(
  • value
)

Set the rotation around y axis of the vertices (not the transform!)

Parameters:

  • value Float

    Rotation value in degree

setRotationZ

(
  • value
)

Set the rotation around z axis of the vertices (not the transform!)

Parameters:

  • value Float

    Rotation value in degree

setScale

(
  • number|Vector3|Vector2
  • Number
  • Number
)

Set the scale of the geometry (vertices) - this is not like scaling the transform. Shouldn't be done in loop. Polymorphic : can take various agruments of various types. Possible arguments number is 1, 2 or 3.

Parameters:

  • number|Vector3|Vector2 Float | Vector3 | Vector2

    Value for the new scale of the geometry. If a Vector3 is given, its x, y, z will be used for the scale x, y, z. If a Vector2 is given, its x, y will be used for the scale x and y, but z will be 1. If a number is given, it will be the scale x.

  • Number Float

    Value for the new y scale of the geometry.

  • Number Float

    Value for the new z scale of the geometry.

setTranslation

(
  • value
  • value
  • value
)

Set the translation along all axis of the vertices (not the transform!)

Parameters:

  • value Float

    x value

  • value Float

    y value

  • value Float

    z value

setUVs

(
  • index
  • uvs
)

Set the UV of this mesh geometry

Parameters:

  • index Integer
  • uvs Array

setVertexColors

(
  • colors
)

Set the vertexColors of this mesh geometry's vertices

Parameters:

  • colors Array

setVertices

(
  • vertices
)

Set the vertices of this mesh geometry

Parameters:

  • vertices Object

setVisible

(
  • value
)

Set the visibility of this mesh

Parameters:

  • value Boolean

    visible or not

updateMaterial

() private

Updates this mesh material

updateMesh

()

updateMesh

updateStrokeMesh

(
  • inflateValue
)

Utils to regenerate the stroke Mesh when already existing

Parameters:

  • inflateValue Number

    stroke width