Module: textures

API to control dynamic (canvas/video) textures.

Summary

Methods

Type Definitions

Detailed Description

Methods

change_image(obj, text_name, image_path, callbackopt)

Update texture image.
Parameters:
Name Type Attributes Description
obj Object3D Object 3D
text_name String Texture name specified in Blender
image_path String Path to image (relative to the main html file)
callback TexChangingFinishCallback <optional>
Callback to be executed after changing
Source:
Example
var m_scenes  = require("scenes");
var m_tex = require("textures");

var cube = m_scenes.get_object_by_name("Cube");
m_tex.change_image(cube, "Texture", "./test.png");

get_canvas_ctx(obj, text_name) → {CanvasRenderingContext2D}

Returns canvas texture context.
Parameters:
Name Type Description
obj Object3D Object 3D
text_name String Texture name specified in Blender
Returns:
Canvas texture context
Type
CanvasRenderingContext2D
Source:
See:
Example
var m_scenes = require("scenes");
var m_tex = require("textures");

var cube = m_scenes.get_object_by_name("Cube");
var ctx = m_tex.get_canvas_ctx(cube, "Texture");

get_texture_names(obj) → {Array}

Get texture names.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Texture names array
Type
Array
Source:

pause_video(texture_name, data_idopt)

Pause video.
Parameters:
Name Type Attributes Default Description
texture_name String Texture name
data_id Number <optional>
0 ID of loaded data
Source:

play_video(texture_name, data_idopt)

Play video.
Parameters:
Name Type Attributes Default Description
texture_name String Texture name
data_id Number <optional>
0 ID of loaded data
Source:
See:

reset_video(texture_name, data_idopt)

Reset video (considering frame_offset value from Blender).
Parameters:
Name Type Attributes Default Description
texture_name String Texture name
data_id Number <optional>
0 ID of loaded data
Source:

update_canvas_ctx(obj, text_name)

Update canvas texture context.
Parameters:
Name Type Description
obj Object3D Object 3D
text_name String Texture name specified in Blender
Source:
See:
Example
var m_scenes = require("scenes");
var m_tex = require("textures");

var cube = m_scenes.get_object_by_name("Cube");
m_tex.update_canvas_ctx(cube, "Texture");

Type Definitions

TexChangingFinishCallback()

Texture changing finish callback.
Source: