Loading...
Searching...
No Matches
scene Class Reference

Main class to assemble glTF components into a scene. More...

#include <foamGltfScene.H>

Public Member Functions

 scene ()
 Default construct.
template<class Type>
label addField (const Type &fld, const word &name, const label target=-1)
 Returns accessor index.
template<class Type>
label addMesh (const Type &fld, const word &name)
 Returns index of last mesh.
template<class Type>
label addFieldToMesh (const Type &fld, const word &name, const label meshId)
 Returns accessor index.
label addColourToMesh (const vectorField &fld, const word &name, const label meshId, const scalarField &alpha=scalarField::null())
 Add a colour field to the mesh, optionally with an alpha channel.
label createAnimation (const word &name)
 Returns index of last animation.
void addToAnimation (const label animationi, const label inputId, const label outputId, const label meshId, const string &interpolation="LINEAR")
 Add to existing animation.
void write (const fileName &outputFile)
 Write to file pair (.gltf, .bin).
void write (Ostream &os)
 Write JSON (.gltf) to stream with auxiliary binary data (.bin).
template<class Type>
Foam::label addField (const Type &fld, const word &name, const label target)
template<class Type>
Foam::label addMesh (const Type &fld, const word &name)
template<class Type>
Foam::label addFieldToMesh (const Type &fld, const word &name, const label meshi)

Detailed Description

Main class to assemble glTF components into a scene.

Note
Implements the glTF v2 specification
Source files

Definition at line 64 of file foamGltfScene.H.

Constructor & Destructor Documentation

◆ scene()

scene ( )

Default construct.

Definition at line 27 of file foamGltfScene.C.

Member Function Documentation

◆ addField() [1/2]

template<class Type>
label addField ( const Type & fld,
const word & name,
const label target = -1 )

Returns accessor index.

References fld(), and Foam::name().

Referenced by addFieldToMesh(), and addMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMesh() [1/2]

template<class Type>
label addMesh ( const Type & fld,
const word & name )

Returns index of last mesh.

References fld(), and Foam::name().

Here is the call graph for this function:

◆ addFieldToMesh() [1/2]

template<class Type>
label addFieldToMesh ( const Type & fld,
const word & name,
const label meshId )

Returns accessor index.

References alpha, fld(), Foam::name(), Field< scalar >::null(), and os().

Here is the call graph for this function:

◆ addColourToMesh()

Foam::label addColourToMesh ( const vectorField & fld,
const word & name,
const label meshId,
const scalarField & alpha = scalarField::null() )

Add a colour field to the mesh, optionally with an alpha channel.

A constant alpha value can be specified as a field of size 1.

Returns
accessor index
Parameters
fldRGB colour field
alphaAlpha channel

Definition at line 60 of file foamGltfScene.C.

References alpha, Foam::glTF::ARRAY_BUFFER, fld(), Foam::glTF::key(), Foam::name(), and tmp< T >::New().

Here is the call graph for this function:

◆ createAnimation()

Foam::label createAnimation ( const word & name)

Returns index of last animation.

Definition at line 110 of file foamGltfScene.C.

References Foam::name().

Here is the call graph for this function:

◆ addToAnimation()

void addToAnimation ( const label animationi,
const label inputId,
const label outputId,
const label meshId,
const string & interpolation = "LINEAR" )

Add to existing animation.

Definition at line 117 of file foamGltfScene.C.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ write() [1/2]

void write ( const fileName & outputFile)

Write to file pair (.gltf, .bin).

Definition at line 155 of file foamGltfScene.C.

References Foam::isDir(), Foam::mkDir(), os(), fileName::path(), fileName::replace_ext(), and write().

Here is the call graph for this function:

◆ write() [2/2]

void write ( Ostream & os)

Write JSON (.gltf) to stream with auxiliary binary data (.bin).

Definition at line 172 of file foamGltfScene.C.

References IOstreamOption::BINARY, Foam::decrIndent(), Foam::endl(), forAll, Foam::incrIndent(), Foam::indent(), fileName::name(), Foam::nl, os(), fileName::replace_ext(), and OFstream::stdStream().

Here is the call graph for this function:

◆ addField() [2/2]

template<class Type>
Foam::label addField ( const Type & fld,
const word & name,
const label target )

Definition at line 22 of file foamGltfSceneTemplates.C.

References fld(), and Foam::name().

Here is the call graph for this function:

◆ addMesh() [2/2]

template<class Type>
Foam::label addMesh ( const Type & fld,
const word & name )

Definition at line 52 of file foamGltfSceneTemplates.C.

References addField(), Foam::glTF::ARRAY_BUFFER, fld(), Foam::glTF::key(), and Foam::name().

Here is the call graph for this function:

◆ addFieldToMesh() [2/2]

template<class Type>
Foam::label addFieldToMesh ( const Type & fld,
const word & name,
const label meshi )

Definition at line 65 of file foamGltfSceneTemplates.C.

References addField(), fld(), and Foam::name().

Here is the call graph for this function:

The documentation for this class was generated from the following files: