ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches

A constructor method for StaticModels that loads such a model from its model file (w/ extensions such as .fbx, .obj, .gltf, and so on). More...

#include <model.hpp>

Inheritance diagram for ToyMaker::StaticModelFromFile:
ToyMaker::ResourceConstructor< StaticModel, StaticModelFromFile > ToyMaker::IResourceConstructor

Public Member Functions

 StaticModelFromFile ()
 Creates a StaticModelFromFile object.
Public Member Functions inherited from ToyMaker::ResourceConstructor< StaticModel, StaticModelFromFile >
std::string getResourceConstructorName_ () const override
 Gets the resource constructor type string of the constructor.
Public Member Functions inherited from ToyMaker::IResourceConstructor
virtual ~IResourceConstructor ()=default
 Destroys this resource constructor (when the application is terminated.).

Static Public Member Functions

static std::string getResourceConstructorName ()
 Gets the resource constructor type string for this constructor.

Private Member Functions

std::shared_ptr< IResourcecreateResource (const nlohmann::json &methodParameters) override
 Creates a StaticModel resource based on its parameters.

Additional Inherited Members

Protected Member Functions inherited from ToyMaker::ResourceConstructor< StaticModel, StaticModelFromFile >
 ResourceConstructor (int explicitlyInitializeMe)
 Construct a new ResourceConstructor object.
Protected Member Functions inherited from ToyMaker::IResourceConstructor
 IResourceConstructor ()=default
 Construct a new IResourceConstructor object.
Static Protected Member Functions inherited from ToyMaker::IResourceConstructor
template<typename TResource, typename TResourceConstructor>
static void RegisterResourceConstructor ()
 Registers this resource constructor against its respective ResourceFactory during static initialization.

Detailed Description

A constructor method for StaticModels that loads such a model from its model file (w/ extensions such as .fbx, .obj, .gltf, and so on).

Such a resource's description in JSON might look like:

{
"method": "fromFile",
"name": "EagleModel_One",
"parameters": {
"path": "data/models/UrEagle.obj",
"material_overrides": {
"0": [
{
"name": "colorMultiplier",
"type": "vec4",
"value": [0.05, 0.05, 0.05, 1.0]
}
],
"1": [
{
"name": "colorMultiplier",
"type": "vec4",
"value": [0.05, 0.05, 0.05, 1.0]
}
]
}
},
"type": "StaticModel"
}

Where the path property is required and the material_overrides property may be left unspecified. The number next to each material override represents the index of the mesh whose material is being overridden.

Member Function Documentation

◆ createResource()

std::shared_ptr< IResource > StaticModelFromFile::createResource ( const nlohmann::json & methodParameters)
overrideprivatevirtual

Creates a StaticModel resource based on its parameters.

Parameters
methodParametersThe parameters associated with this model object.
Returns
std::shared_ptr<IResource> A reference to the constructed resource.

Implements ToyMaker::IResourceConstructor.

◆ getResourceConstructorName()

std::string ToyMaker::StaticModelFromFile::getResourceConstructorName ( )
inlinestatic

Gets the resource constructor type string for this constructor.

Returns
std::string This object's resource constructor type string.

The documentation for this class was generated from the following files:
  • ToyMaker_Main/include/toymaker/engine/model.hpp
  • ToyMaker_Main/src/model.cpp