coastline 0.0.4
Loading...
Searching...
No Matches
coastline::RenderModel Class Reference

A converted model on the GPU: its meshes, its parts, and its animations. More...

#include <scenerenderer.h>

Public Member Functions

 ~RenderModel ()
 Release model resources and its shared document reference before GPU device destruction.
 RenderModel (const RenderModel &)=delete
 Prevent copying model resources and animation progress.
RenderModel & operator= (const RenderModel &)=delete
 Prevent assignment of model resources and animation progress.
const std::vector< VertexAnimationInfo > & Animations () const
std::array< float, 3 > Centre () const
float Radius () const
std::span< const std::array< float, 3 > > Positions () const
void SetVariant (int variant)
 Pick the palette variant the images with variants show in the draws of the model until the next call.

Static Public Member Functions

static std::unique_ptr< RenderModel > Load (SceneRenderer &renderer, const std::filesystem::path &path, const ModelOptions &options={})
 Read a glTF document of the import and upload its images and vertices.
static std::unique_ptr< RenderModel > Load (std::shared_ptr< RenderDocument > document, const ModelOptions &options={})
 Take the parts of a document already read, painting the images of its materials in the colour of the options when no model of the document has taken that colour before.

Friends

class SceneRenderer

Detailed Description

A converted model on the GPU: its meshes, its parts, and its animations.

Constructor & Destructor Documentation

◆ ~RenderModel()

coastline::RenderModel::~RenderModel ( )

Release model resources and its shared document reference before GPU device destruction.

◆ RenderModel()

coastline::RenderModel::RenderModel ( const RenderModel & )
delete

Prevent copying model resources and animation progress.

Member Function Documentation

◆ Load() [1/2]

std::unique_ptr< RenderModel > coastline::RenderModel::Load ( SceneRenderer & renderer,
const std::filesystem::path & path,
const ModelOptions & options = {} )
static

Read a glTF document of the import and upload its images and vertices.

Parameters
rendererThe renderer that draws the model.
pathThe glTF document.
optionsWhat of the document the model takes, and how.
Returns
The model, or nothing with the reason logged.

◆ Load() [2/2]

std::unique_ptr< RenderModel > coastline::RenderModel::Load ( std::shared_ptr< RenderDocument > document,
const ModelOptions & options = {} )
static

Take the parts of a document already read, painting the images of its materials in the colour of the options when no model of the document has taken that colour before.

Parameters
documentThe document.
optionsThe node, the paint, the parts, whether the model may draw nothing, the cycle type, and whether the model draws the palette variants of the document.
Returns
The model, or nothing with the reason logged.

◆ operator=()

RenderModel & coastline::RenderModel::operator= ( const RenderModel & )
delete

Prevent assignment of model resources and animation progress.

◆ Animations()

const std::vector< VertexAnimationInfo > & coastline::RenderModel::Animations ( ) const
Returns
The animations of the vertices of the model.

◆ Centre()

std::array< float, 3 > coastline::RenderModel::Centre ( ) const
Returns
The centre of what the model draws, in the units of its document.

◆ Radius()

float coastline::RenderModel::Radius ( ) const
Returns
The radius of what the model draws, in the units of its document.

◆ Positions()

std::span< const std::array< float, 3 > > coastline::RenderModel::Positions ( ) const
Returns
The position of each vertex the first mesh of the model indexes, in the units of its document, where the meshes of a car share their vertices.

◆ SetVariant()

void coastline::RenderModel::SetVariant ( int variant)

Pick the palette variant the images with variants show in the draws of the model until the next call.

Parameters
variantThe variant, from 0 to the variants of the options of the model.

◆ SceneRenderer

friend class SceneRenderer
friend

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