Base class of an asset. More...

#include <asset.h>

Inheritance diagram for Asset:
Clonable Component SIMDAlignedType Film GeneralizedBSDF Texture TriangleMesh Film_HDR BSDF Emitter Texture_Bitmap TriangleMesh_Obj TriangleMesh_Raw BSDF_CookTorrance BSDF_Diffuse BSDF_Flesnel BSDF_Null BSDF_ReflectAll BSDF_RefractAll Light Sensor

Public Member Functions

 LM_INTERFACE_CLASS (Asset, Clonable, 2)
 
 LM_DISABLE_COPY_AND_MOVE (Asset)
 
 LM_INTERFACE_F (0, Load, bool(const PropertyNode *prop, Assets *assets, const Primitive *primitive))
 Load an asset from a property node. More...
 
 LM_INTERFACE_F (1, PostLoad, bool(const Scene *scene))
 Post processing of the asset. More...
 
- Public Member Functions inherited from Clonable
 LM_INTERFACE_CLASS (Clonable, Component, 1)
 
 LM_DISABLE_COPY_AND_MOVE (Clonable)
 
 LM_INTERFACE_F (0, Clone, void(Clonable *o))
 Clone the instalce. More...
 
- Public Member Functions inherited from SIMDAlignedType
void * operator new (std::size_t size) throw (std::bad_alloc)
 
void operator delete (void *p)
 

Detailed Description

Base class of an asset.

The base class of the asset classes. The asset is an important concept in the framework. All user-defined resources such as triangle meshes or BSDFs must inherits this class. The construction of assets are fully automated with asset management class (Assets class), which make it possible to extend your own assets consistently.

Member Function Documentation

Asset::LM_INTERFACE_F ( ,
Load  ,
bool(const PropertyNode *prop, Assets *assets, const Primitive *primitive)   
)

Load an asset from a property node.

Configure and initialize the asset by a property node given by prop. Some assets have references to the other assets, so assets is also required. Dependent asset must be loaded beforehand.

Also, some asset requires primitive information (e.g., transformation or meshes). In this case you can use information obtained from primitive.

The property node contains the tree structure below the params node in the asset definitions. For instance, the asset defined by the following configuration creates a property with two nodes 'A' and 'B'. The values can be accessed from the interfaces of PropertyNode class.

some_asset:
    interface: some_interface
    type: some_type
    params:
        A: some_value_1
        B: some_value_2
Parameters
propProperty node for the asset.
assetsAsset manager.
Return values
trueSucceeded to load.
falseFailed to load.
Asset::LM_INTERFACE_F ( ,
PostLoad  ,
bool(const Scene *scene)   
)

Post processing of the asset.

The function is called when the all primitives are loaded. If the asset needs postprocessing that requires scene information (e.g., scene bound, etc.), we can implement this function.

Parameters
sceneScene.
Return values
trueSucceeded to load.
falseFailed to load.