Module: geometry

Low-level geometry API. Enable the "Dynamic geometry" checkbox for the objects to allow geometry modification.

Summary

Methods

Detailed Description

Methods

check_shape_keys(obj) → {Boolean}

Check if object has got shape keys.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
Boolean
Source:

draw_line(obj, positions, is_splitopt)

Draw a line.
Parameters:
Name Type Attributes Default Description
obj Object3D Line object
positions Float32Array Line points [X0,Y0,Z0,X1,Y1,Z1...] in the local space of the given line object.
is_split Boolean <optional>
false True - draw a splitted line (points specified in pairs), false - draw continuous line
Source:
Example
var m_geom = require("geometry");
var m_scenes = require("scenes");

var empty = m_scenes.get_object_by_name("Empty");
var points = new Float32Array([0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0]); // draw a triangle
m_geom.draw_line(empty, points);

extract_index_array(obj, mat_name) → {Uint16Array|Uint32Array}

Extract the array of triangulated face indices from the given object.
Parameters:
Name Type Description
obj Object3D Object 3D
mat_name String Material name
Returns:
Array of triangle indices
Type
Uint16Array | Uint32Array
Source:

extract_vertex_array(obj, mat_name, attrib_name) → {Float32Array|Int16Array|Uint8Array}

Extract the vertex array from the object.
Parameters:
Name Type Description
obj Object3D Object 3D
mat_name String Material name
attrib_name String Attribute name (a_position, a_tbn_quat)
Returns:
Vertex array
Type
Float32Array | Int16Array | Uint8Array
Source:

get_shape_key_value(obj, key_name) → {Number}

Return shape key current value.
Parameters:
Name Type Description
obj Object3D Object 3D
key_name String Shape key name
Returns:
value Shape key value
Type
Number
Source:

get_shape_keys_names(obj) → {Array.<String>}

Return all available shape keys names.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Array of animation names
Type
Array.<String>
Source:

override_geometry(obj, mat_name, ibo_array, positions_array, smooth_normals)

Override geometry for the given object.
Parameters:
Name Type Description
obj Object3D Object 3D
mat_name String Material name
ibo_array Uint16Array | Uint32Array Array of triangle indices
positions_array Float32Array New vertex positions array
smooth_normals Boolean Enable normals smoothing
Source:

set_shape_key_value(obj, key_name, value)

Apply shape key to the object.
Parameters:
Name Type Description
obj Object3D Object 3D
key_name String Shape key name
value Number Shape key value
Source:

update_vertex_array(obj, mat_name, attrib_name, array)

Update the vertex array for the given object.
Parameters:
Name Type Description
obj Object3D Object 3D
mat_name String Material name
attrib_name String Attribute name (a_position, a_tbn_quat)
array Float32Array | Int16Array | Uint8Array The new array
Source: