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 split 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}

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, a_normal)
Returns:
Vertex array
Type
Float32Array
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. If the object is supposed to be available for selecting (for example, via the pick_object method) call the update_boundings method after applying a shape key or override object bounding volumes in Blender beforehand so that the boundings can contain the object in its largest shape.
Parameters:
Name Type Description
obj Object3D Object 3D
key_name string Shape key name
value number Shape key value
Source:
Example
var m_geom = require("geometry");
var m_scenes = require("scenes");

var cube = m_scenes.get_object_by_name("Cube");
m_geom.set_shape_key_value(cube, "Key 1", 0.5);

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, a_normal)
array Float32Array The new array
Source: