Prism

lumin. Prism

Represents the bounded volume within which the Scenegraph renders. Prisms are created via
the App::requestNewPrism function.

Methods

createAll(objectModelName) → {lumin.Node}

Create all objects from a loaded object model and
return them as children of newly created root Node.

Parameters:
Name Type Description
objectModelName string

The name of the object model.

Returns:

Root node containing all objects from model or nullptr if creation failed

Type
lumin.Node

createAnimationBlendSetupResourceId(a_fileName, a_absolutePathopt, a_descriptoropt, a_basePathopt) → {BigInt}

Creates animation blend setup resource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

NOTE: In case a Standard resource is already created. And a new resource is created with the same filename but instanced,
it will not overwrite the standard resource. In that case, you will have to delete that resource, and post that, create
a new instanced resource.
This is not required if you want to use an instanced resource as a standard resource.

Returns:

ID for the Resource

Type
BigInt

createAnimationResourceId(a_fileName, a_absolutePathopt, a_descriptoropt, a_basePathopt) → {BigInt}

Creates animation resource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

NOTE: In case a Standard resource is already created. And a new resource is created with the same filename but instanced,
it will not overwrite the standard resource. In that case, you will have to delete that resource, and post that, create
a new instanced resource.
This is not required if you want to use an instanced resource as a standard resource.

Returns:

ID for the Resource

Type
BigInt

createAnimationSetResourceId(a_fileName, a_absolutePathopt, a_descriptoropt, a_basePathopt) → {BigInt}

Creates animation set resource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

NOTE: In case a Standard resource is already created. And a new resource is created with the same filename but instanced,
it will not overwrite the standard resource. In that case, you will have to delete that resource, and post that, create
a new instanced resource.
This is not required if you want to use an instanced resource as a standard resource.

Returns:

ID for the Resource

Type
BigInt

createAudioNode() → {lumin.AudioNode}

Create a new AudioNode.
After calling this createAudioNode(), must call one of the AudioNode::createSoundXxxxX() methods
to create a specific type of audio node.

Returns:

New AudioNode on success; nullptr on failure.

Type
lumin.AudioNode

createDefaultText2dNode(desc, styleopt) → {lumin.Text2dNode}

Create a 2D text node using the Magic Leap UI font (regular weight).

Parameters:
Name Type Attributes Default Description
desc lumin.Text2dDesc

Information about the Text2dNode to create.

style lumin.resources.FontStyle <optional>
resources.FontStyle.kNormal

Either normal or italic style are supported.

Returns:

The new Text2dNode.

Type
lumin.Text2dNode

createFont2dResourceId(fontDesc, fontFile, a_absolutePathopt) → {BigInt}

Create a Font2dResource with the given description.

Parameters:
Name Type Attributes Default Description
fontDesc lumin.glyph.Font2dDesc

Initialization parameters for the resource. For
reasonable default values, use the DEFAULT static member.

fontFile string

The font file from which to load the glyphs. By default assumed to be a relative
path from the executable file.

a_absolutePath boolean <optional>
false

Flag that fontFile is an absolute path name, instead of a relative path.

Returns:

The new Font2dResource.

Type
BigInt

createImage2d(format, width, height) → {lumin.AssetPacker.Image2d}

Create a Image-2D data.

Parameters:
Name Type Description
format lumin.utils.Format

The format of the pixel data.

width number

The width of the image(in pixels).

height number

The height of the image(in pixels).

Returns:

Return a valid Image-2D that should be used to create Texture Resource, null otherwise.

Type
lumin.AssetPacker.Image2d

createImage3d(format, width, height, depth) → {lumin.AssetPacker.Image3d}

Create a Image-3D data.

Parameters:
Name Type Description
format lumin.utils.Format

The format of the pixel data.

width number

The width of the image(in pixels).

height number

The height of the image(in pixels).

depth number

The depth of the image(in pixels).

Returns:

Return a valid Image-3D that should be used to create Texture-3D Resource, null otherwise.

Type
lumin.AssetPacker.Image3d

createInstancedModelResourceId(a_fileName, a_maxInstances, a_absolutePathopt, a_descriptoropt, a_basePathopt) → {BigInt}

Creates instanced model resource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_maxInstances number

MaximumInstances the resource can have

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

NOTE: In case a Standard resource is already created. And a new resource is created with the same filename but instanced,
it will not overwrite the standard resource. In that case, you will have to delete that resource, and post that, create
a new instanced resource.
This is not required if you want to use an instanced resource as a standard resource.

Returns:

ID for the Resource

Type
BigInt

createLightNode() → {lumin.LightNode}

Creates directional light node

Returns:

The new LightNode

Type
lumin.LightNode

createLineNode() → {lumin.LineNode}

Create a new LineNode.

Returns:

New LineNode on success; nullptr on failure.

Type
lumin.LineNode

createLoadedFileAudioResourceId(a_fileName, a_absolutePathopt, a_descriptoropt, a_basePathopt) → {BigInt}

Creates audio resource by loading the entire audio file in the memory.
Use this method for audio files which are not too big to hog memory.
For big files you may use the createStreamedFileAudioResource method.

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

Returns:

Resource ID

Type
BigInt

createMaterialResourceId(a_fileName, a_localScopeOnlyopt, a_absolutePathopt, a_descriptoropt, a_basePathopt) → {BigInt}

Creates a MaterialResource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_localScopeOnly boolean <optional>
false

The scope of this material. When set to true the kmat's contained in the material
will not be added to the prism's list of materials for general resolve.

a_absolutePath boolean <optional>
false

Flag that a_fFileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

Returns:

resource instance

Type
BigInt

createModelAttachmentNode(modelNode, boneName) → {lumin.ModelAttachmentNode}

Create a new ModelAttachmentNode.

Parameters:
Name Type Description
modelNode lumin.ModelNode

the ModelNode to which the bone is attached

boneName string

the name of the bone

Returns:

New ModelAttachmentNode on success; nullptr on failure.

Type
lumin.ModelAttachmentNode

createModelNode(resourceId) → {lumin.ModelNode}

Create a new ModelNode.

Parameters:
Name Type Description
resourceId BigInt

optional resource Id to use for the node.

Returns:

New ModelNode on success; nullptr on failure.

Type
lumin.ModelNode

createModelResourceId(a_fileName, a_importScale, a_absolutePathopt, a_descriptoropt, a_basePathopt, a_materialScopeIdopt, a_forceMaterialScopeopt) → {BigInt}

Creates a ModelResource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_importScale number

The scale that will be applied to this resource

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

a_descriptor number <optional>
-1

optional file descriptor that points to a resource.
If passed to the resource the resource takes ownership of the File Descriptor.

a_basePath string <optional>
null

If you are loading a resource from an absolute path, and that path !=
The current process path, set this field to the equivalent base path in the other
client directory. This allows path relative dependencies to solve a fully
qualified (absolute) path outside of the current process. This value defaults to
the currently executing process root.

a_materialScopeId BigInt <optional>
INVALID_RESOURCE_ID

Optional MaterialResouce. When set the new ModelResoure will only use KMATs that
are available in this MaterialResources scope. When not set, ModelResource will resolve
KMAT's from the Prism's scope. See a_forceMaterialScope.

a_forceMaterialScope boolean <optional>
false

When optionally set the new ModelResource will only attempt to resolve KMAT's
from embedded materials, or when a_materialScopeId also from that MaterialResource.

Returns:

ID for the Resource

Type
BigInt

createNode(objectModelName, objectNameopt) → {lumin.Node}

Create a node from a loaded object model.

Parameters:
Name Type Attributes Default Description
objectModelName string

The name of the object model.

objectName string <optional>
""

The name of an object in the object model. If empty, the first object in the object model is used.

Returns:

Newly created node or nullptr if creation failed.

Type
lumin.Node

createNode() → {lumin.Node}

Creates a node of the base type, suitable for organizing a group of child nodes.

Returns:
Type
lumin.Node

createObjMtlResourceId(a_fileName, a_absolutePathopt) → {BigInt}

Creates mtl resource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

Returns:

ID for the Resource

Type
BigInt

createParticleNode(packageResource) → {lumin.ParticleNode}

Create a new ParticleNode.

Parameters:
Name Type Description
packageResource BigInt

resource Id of the particle effect package to use.

Returns:

New ParticleNode on success; nullptr on failure.

Type
lumin.ParticleNode

createParticlePackageResourceId(a_fileName, a_absolutePathopt) → {BigInt}

Creates particle package resource

Parameters:
Name Type Attributes Default Description
a_fileName string

File name of the resource to load. By default assumed to be a relative path
from the executable file.

a_absolutePath boolean <optional>
false

Flag that a_fileName is an absolute path name, instead of a relative path.

Returns:

ID for the Resource

Type
BigInt

createPlanarEGLResourceId(a_widthopt, a_heightopt) → {BigInt}

Creates a PlanarResource of given size which provides access to EGL Context and EGL Surface.

Parameters:
Name Type Attributes Default Description
a_width