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 meant to be used as a standalone.

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:

ResourceContainer

()

Constructor method for a resource container object.

The container is used to store the following types of resources:

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

searchObject

(
  • object
  • manager
  • target
)
ResourceContainer static

Searches the object and all its children for resources that still dont exist in the resource manager.

Stores them in a resource container object that is returned.

Parameters:

  • object THREE.Object3D

    Object to search for resources.

  • manager ResourceManager

    Resource manager object.

  • target ResourceContainer

    Optional resource container object that can be used to store the found resources.

Returns:

ResourceContainer:

Object with the new resources found in the object.

Properties

audio

Array

Audio.

fonts

Array

Fonts.

geometries

Array

Geometries.

images

Array

Images.

materials

Array

Materials.

resources

Array

Resources.

shapes

Array

Shapes.

skeletons

Array

Skeletons.

textures

Array

Textures.

videos

Array

Videos.