setResource

Sets the resource. You can either set resources one-by-one which can be useful to add them throughout your application at various times or as a collection.

NOTE: You can also leverage the constants from the instance for valid string values.

Source:
Example
// can leverage constants
const C = $$$.constants;

$$$.setResource(C.C, camera); // camera being a THREE.js camera instance
$$$.setResource('renderer', renderer); // camera being a THREE.js renderer instance
$$$.setResource('scene', scene); // camera being a THREE.js scene instance

// or you can set all at once
$$$.setResource({
  camera,
  renderer,
  scene
});
Parameters:
Name Type Attributes Description
key string | object

The resource name or an object containing the resource key and values.

Properties
Name Type Attributes Description
camera camera <optional>

THREE.js camera instance. If not provided, the one attached to the scene will automatically be used.

renderer renderer

THREE.js renderer instance.

scene scene

THREE.js scene instance.

value object <optional>

The resource value or it's optional if first argument is an object.

Returns:
  • Chainable api by returning the instance.
Type
self