ResourceManager Class

Extends Object3D
Module: Resources

Resource manager is used to manage available resources used by objects

The resource manager is used to extend the Program object and is not designed to be used as a standalone

The manager is used to manage the following types of resources:

  • Images
  • Videos
  • Audio
  • Fonts
  • Textures
  • Materials
  • Geometries

Methods

addAudio

(
  • audio
)

Add audio to audio list.

Parameters:

addFont

(
  • font
)

Add font to fonts list.

Parameters:

addMaterial

(
  • material
)

Add material to materials list.

Parameters:

  • material Material

    Material to be added

addResource

(
  • Resource
)

Add resource to resources manager.

Parameters:

addTexture

(
  • texture
)

Add texture to texture list.

Parameters:

getAudioByName

(
  • name
)
Audio

Get audio by name.

Parameters:

  • name String

Returns:

Audio:

Audio if found, else null

getFontByName

(
  • name
)
Font

Get font by name.

Parameters:

  • name String

Returns:

Font:

Font if found, else null

getImageByName

(
  • name
)
Image

Get image by name.

Parameters:

  • name String

    Image name

Returns:

Image:

Image if found else null

getMaterialByName

(
  • name
)
Material

Get material by its name.

Parameters:

  • name String

    Material name

Returns:

Material:

Material if found else null

getResourceByName

(
  • name
)
Resource

Get resource by name.

Parameters:

  • name String

    Resource name

Returns:

Resource:

Resource if found else null

getTextureByName

(
  • name
)
Texture

Get texture by name.

Parameters:

  • name String

    Texture name.

Returns:

Texture:

Texture is found else null.

getVideoByName

(
  • name
)
Video

Get video by name.

Parameters:

  • name String

    Video name

Returns:

Video:

Video if found else null

removeAudio

(
  • audio
  • defaultAudio
)

Remove audio.

Parameters:

removeFont

(
  • font
  • defaultFont
)

Remove font from font list.

Parameters:

removeImage

(
  • image
)

Remove image.

Parameters:

removeMaterial

(
  • material
  • defaultMaterial
  • defaultMaterialSprite
)

Remove material from materials list, also receives default material used to replace.

Parameters:

  • material Material

    Material to be removed from manager.

  • defaultMaterial Material

    Default mesh material to replace objects mesh materials.

  • defaultMaterialSprite Material

    Defaul sprite material.

removeResource

(
  • resource
)

Remove resource from font list.

Parameters:

removeTexture

(
  • texture
  • defaultTexture
)
Texture

Remove texture from textures list (also receives default used to replace).

Parameters:

Returns:

Texture:

Texture if found, else null

removeVideo

(
  • video
)

Remove video.

Parameters:

retrieveResources

(
  • object
  • manager
)
static

Retrieve a list with all the resource in a object.

Searches the object and all its children for resource and adds them to resource manager.

Parameters:

  • object THREE.Object3D

    Object to search for resources.

  • manager ResourceManager

    Resource manager.

Properties

audio

Array

Audio.

fonts

Array

Fonts.

geometries

Array

Geometries.

images

Array

Images.

materials

Array

Materials.

resources

Array

Resources.

shapes

Array

Shapes.

textures

Array

Textures.

videos

Array

Videos.