Base class of an asset. More...
#include <asset.h>
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 | ( | 0 | , |
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
-
prop Property node for the asset. assets Asset manager.
- Return values
-
true Succeeded to load. false Failed to load.
Asset::LM_INTERFACE_F | ( | 1 | , |
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
-
scene Scene.
- Return values
-
true Succeeded to load. false Failed to load.