a_asset: a_asset

Description Usage Arguments Details Value

View source: R/asset.R

Description

Create an A-Frame asset

Usage

1
2
a_asset(id = "", src, .parts = NULL, .tag = "a-asset-item",
  .inline = FALSE)

Arguments

id

an an id to be used by the asset item in the asset block. #id will be used to refernce the asset in component configuratuion.

src

the location of the asset

.parts

the location(s) of files referred to in the 'src' file that need to be served with it. Examples are '.bin' files that accompany glTF models or texture images that accompany '.mtl' files. These are referred to in 'src' by relative paths, so must reside at or below the same directory as 'src'.

.tag

the tag text to use in the asset block. Defaults to 'a-asset-item'. Another common choices is "img" for images.

.inline

boolean signifying if the asset is to be specified inline with the entity. If true, the containing A-Frame scene does not wait for the asset to load.

Details

This function is used to create an asset that will be loaded before an A-Frame scene loads in the browser. Assets are typically models, images, videos, and audio files. The asset object understands there may be two references to the asset: one in the <a-assets> block and the second refernce in a component configuratuion. It knows how to render itself for both of these differnt contexts. It can also be called with 'inline=TRUE' which has the effect of omitting it from the <a-assets> block and inserting a direct link into the component configuration.

Assets in the <a-assets> block are loaded before the scene is rendered. This can delay the scene at a blank white page while they are fetched. Assets defined inline do not delay scene rendering.

Assets can be located on local disk, or at remote URLs. The asset declaration will examine the 'src' parameter to see if it conforms to known URL conventions. If so r2vr will not attempt to serve the asset, but it will generate the required references to is in the output scene.

Value

an asset object.


MilesMcBain/r2vr documentation built on Dec. 8, 2018, 10:13 a.m.