Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::StaticMeshFromDescription Class Reference

Creates a static mesh based on its description in JSON. More...

#include <mesh.hpp>

Inheritance diagram for ToyMaker::StaticMeshFromDescription:
ToyMaker::ResourceConstructor< StaticMesh, StaticMeshFromDescription > ToyMaker::IResourceConstructor

Public Member Functions

 StaticMeshFromDescription ()
 Creates this StaticMesh constructor.
 
- Public Member Functions inherited from ToyMaker::ResourceConstructor< StaticMesh, StaticMeshFromDescription >
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 constructor type string for this constructor.
 

Private Member Functions

std::shared_ptr< IResourcecreateResource (const nlohmann::json &methodParameters) override
 The method responsible for actually creating a StaticMesh.
 

Additional Inherited Members

- Protected Member Functions inherited from ToyMaker::ResourceConstructor< StaticMesh, StaticMeshFromDescription >
 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

Creates a static mesh based on its description in JSON.

Such a representation might look like:

{
"name": "MyMesh",
"type": "StaticMesh",
"method": "fromDescription",
"parameters": {
"vertices": [
{
"position": [-1, -1, 0, 1],
"normal": [0, 0, 1, 0],
"tangent": [1, 0, 0, 0],
"color": [1, 1, 1, 1],
"uv1": [0, 0],
"uv2": [0, 0],
"uv3": [0, 0],
},
{
"position": [1, -1, 0, 1],
"normal": [0, 0, 1, 0],
"tangent": [1, 0, 0, 0],
"color": [1, 1, 1, 1],
"uv1": [1, 0],
"uv2": [1, 0],
"uv3": [1, 0],
},
{
"position": [1, 1, 0, 1],
"normal": [0, 0, 1, 0],
"tangent": [1, 0, 0, 0],
"color": [1, 1, 1, 1],
"uv1": [1, 1],
"uv2": [1, 1],
"uv3": [1, 1],
}
],
"elements": [0, 1, 2]
}
}

Member Function Documentation

◆ createResource()

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

The method responsible for actually creating a StaticMesh.

Parameters
methodParametersThe StaticMesh's JSON description.
Returns
std::shared_ptr<IResource> A handle to the constructed StaticMesh resource.

Implements ToyMaker::IResourceConstructor.

◆ getResourceConstructorName()

static std::string ToyMaker::StaticMeshFromDescription::getResourceConstructorName ( )
inlinestatic

Gets the constructor type string for this constructor.

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

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