#include <AssetDatabase.hpp>
|
static void | init () |
|
static void | shutdown () |
|
static void | readSerialiationFile (string fullPath) |
|
static void | createSerializationFile (shared_ptr< Asset > asset, string filename) |
|
static void | loadAllMetaFiles () |
|
template<class T > |
static shared_ptr< T > | getAsset (string name) |
|
static shared_ptr< Asset > | getAsset (unsigned int assetID) |
|
template<typename T > |
static void | assignCurrentID (T asset, string name) |
|
template<typename T > |
static void | assignCurrentID (T asset) |
|
static shared_ptr< Asset > | tryLoadAsset (string file, string extension) |
|
static shared_ptr< Shader > | createShader (string name, string vsFilename, string fsFilename) |
|
static shared_ptr< Material > | createMaterial (string name, shared_ptr< Shader > shader) |
|
static shared_ptr< PhysicsMaterial > | createPhysicsMaterial (string name, float friction, float dynamicFriction, float restitution) |
|
static shared_ptr< Mesh > | createMeshFromFBX (string filename) |
|
static shared_ptr< Mesh > | createMeshFromOBJ (string filename) |
|
static shared_ptr< Mesh > | createMesh (vector< MeshVertex > vertex, vector< unsigned short > triangles) |
|
static shared_ptr< Sound > | createSound (string filename) |
|
static shared_ptr< Texture > | createTexture (string filename) |
|
static shared_ptr< Font > | createFont (string filename, int fontSize) |
|
AssetDatabase is a static class that creates and holds all user Assets (exceptions are the assets used by the system). The idea is to simulate Unity's Asset folder, making sure that whenever a file is added, it's automatically loaded.
template<typename T >
void AssetDatabase::assignCurrentID |
( |
T |
asset, |
|
|
string |
name |
|
) |
| |
|
static |
assignCurrentID. Increments the primary key and add the Asset to the maps with the proper name.
template<typename T >
void AssetDatabase::assignCurrentID |
( |
T |
asset | ) |
|
|
static |
assignCurrentID. Increments the primary key and add the Asset to the maps. Uses the assetID as the name
shared_ptr< Font > AssetDatabase::createFont |
( |
string |
filename, |
|
|
int |
fontSize |
|
) |
| |
|
static |
Create Font from .ttf file.
shared_ptr< Material > AssetDatabase::createMaterial |
( |
string |
filename, |
|
|
shared_ptr< Shader > |
shader |
|
) |
| |
|
static |
Create material from a shader. Several materials can have the same shader but different properties, such as textures and colors.
shared_ptr< Mesh > AssetDatabase::createMesh |
( |
vector< MeshVertex > |
vertex, |
|
|
vector< unsigned short > |
triangles |
|
) |
| |
|
static |
Create mesh from list of vertice data and triangles
shared_ptr< Mesh > AssetDatabase::createMeshFromFBX |
( |
string |
filename | ) |
|
|
static |
Create mesh from .fbx files
shared_ptr< Mesh > AssetDatabase::createMeshFromOBJ |
( |
string |
filename | ) |
|
|
static |
Create mesh from .obj files
shared_ptr< PhysicsMaterial > AssetDatabase::createPhysicsMaterial |
( |
string |
name, |
|
|
float |
friction, |
|
|
float |
dynamicFriction, |
|
|
float |
restitution |
|
) |
| |
|
static |
Create a physics material that can be used to specify behaviour of shapes in the physics scene
void AssetDatabase::createSerializationFile |
( |
shared_ptr< Asset > |
asset, |
|
|
string |
filename |
|
) |
| |
|
static |
createSerializationFile. Create a meta-file for an asset (Serialize an asset)
shared_ptr< Shader > AssetDatabase::createShader |
( |
string |
filename, |
|
|
string |
vsFilename, |
|
|
string |
fsFilename |
|
) |
| |
|
static |
Create shader from a vertex shader and a fragment shader. Name is the name of the newly created shader
shared_ptr< Sound > AssetDatabase::createSound |
( |
string |
filename | ) |
|
|
static |
Create empty mesh. Used for FontMeshes that dynamicaly create the mesh Create Sound asset from file.
Create Sound asset from file.
shared_ptr< Texture > AssetDatabase::createTexture |
( |
string |
filename | ) |
|
|
static |
Create Texture from file. Only supported file is .png in the moment.
template<class T >
static shared_ptr<T> AssetDatabase::getAsset |
( |
string |
name | ) |
|
|
inlinestatic |
Search on the database for the asset with name==filename.
shared_ptr< Asset > AssetDatabase::getAsset |
( |
unsigned int |
assetID | ) |
|
|
static |
Search on the database for the asset with assetID==assetID.
Search on the database for the asset with assetID==Asset.assetID.
void AssetDatabase::init |
( |
| ) |
|
|
static |
init. Function that initializes the class.
Initialize the Mesh Importer
void AssetDatabase::loadAllMetaFiles |
( |
| ) |
|
|
static |
Once serialization is done and working, the AssetDatabase should not reload all files everytime. It should load only the Asset Description (.meta<->.desc) file and check if it's up to date
Once serialization is done and working, the AssetDatabase should not reload all files everytime. It should load only the Asset Description (.meta//.desc) file and check if it's up to date. This function loads all the meta-files existing in the CommonData folder
void AssetDatabase::readSerialiationFile |
( |
string |
fullPath | ) |
|
|
static |
readSerialiationFile. Loads an asset from a description file (Deserialize an asset)
readSerialiationFile. Loads an asset from a description file.
void AssetDatabase::shutdown |
( |
| ) |
|
|
static |
shutdown. Releases allocated memmory
Shutdown the Mesh Importer
shared_ptr< Asset > AssetDatabase::tryLoadAsset |
( |
string |
file, |
|
|
string |
extension |
|
) |
| |
|
static |
tryLoadAsset. Delegates the file to the appropriate loader.
The documentation for this class was generated from the following files:
- /Users/guilherme_cunha/Dev/GITHUB/GUInity/Source/AssetDatabase.hpp
- /Users/guilherme_cunha/Dev/GITHUB/GUInity/Source/AssetDatabase.cpp