TexturesModule
The TexturesModule class enables images, animation sequences, videos, colors, and other visual artifacts to be combined to form materials.

//==============================================================================
// The following example demonstrates how to access a texture in the Assets and
// assign it to a material.
//
// Project setup:
// - Insert a plane
// - Create a material
// - Import an image to use as a texture (renaming it texture0)
// - Assign the material to the plane
//==============================================================================
// Load in the required modules
const Materials = require('Materials');
const Textures = require('Textures');
// Locate the material and texture in the Assets
const material = Materials.get('defaultMaterial0');
const texture = Textures.get('texture0');
// Assign the texture to the material
material.diffuse = texture;

This module exposes no properties.

Method
Description
findFirst
findFirst(name: string): Promise<TextureBase>
Returns a promise that is resolved with the texture of a requested name or null if none was found.
See Also: Textures.findUsingPattern, Textures.getAll.
findUsingPattern
findUsingPattern(namePattern: string): Promise<Array<TextureBase>> findUsingPattern(namePattern: string, config: {limit: number}): Promise<Array<TextureBase>>
Returns a promise that is resolved with the all of the textures matching the name pattern or empty array if none was found.
Pattern format: * matches any characters sequence. \ can be used to include in pattern any of the control characters (including '\' itself)
Examples: findUsingPattern("*") will retrive all of the textures. findUsingPattern("*A") will retrieve all of the textures suffixed with 'A'. findUsingPattern("A*") will retrieve all of the textures prefixed with 'A'. findUsingPattern("*A*", {limit: 10}) will retrieve at most 10 of the textures containing 'A',
limit parameter describes if findUsingPattern should finish the search if it finds specified number of results (default is no limit). Non-positive values for limit are treated as unlimited.
See Also: Textures.getAll, Textures.findFirst.
get
get(textureName: string): TextureBase
Returns a texture object, derived from TextureBase, that is specified by textureName. An exception is thrown when the texture isn't found in the project. Possible types are:
  • CanvasTexture
  • ColorTexture
  • DeepLinkTexture
  • ExternalTexture
  • ImageTexture
  • SequenceTexture
See Also: TextureBase.name.
getAll
getAll(): Promise<Array<TextureBase>>
Returns a promise that is resolved with all of the textures.
See Also: Textures.findUsingPattern, Textures.findFirst.

Class
Description
The CameraTexture class.
The CanvasTexture class enables painting with a brush to a texture.
The ColorTexture class encapsulates a texture that has a color (including alpha channel).
The DeepLinkTexture class represents an image texture passed in via the sharing SDK.
The ExternalTexture class encapsulates a visual asset that is downloaded over the network.
The ImageTexture class encapsulates an image that may be used to form materials for rendering in the scene.
The SegmentationTexture class encapsulates a texture that will be used for image segmentation.
The SequenceTexture class is a collection of still images that form an animation.
The SourceImageRegionTexture class.
The SubTexture class exposes details of a texture in UV coordinates.
The TextureBase class describes a texture.
Last modified 2yr ago
Copy link
On this page
Example
Properties
Methods
Classes