Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::Core::Model Struct Reference

Model resources define a template for a set of connected entities, with resources such as meshes, materials and textures defined. More...

#include <Model.h>

Inheritance diagram for Cogs::Core::Model:
Cogs::Core::ResourceBase

Public Member Functions

 Model ()=default
 Default constructs a Model resource.
 
 Model (const Model &other)=delete
 Disabled copy construction.
 
 Model (Model &&other) noexcept=default
 Move construct a Model from other.
 
Modeloperator= (Model &&other) noexcept=default
 Move assign a Model from other.
 
void setPartName (ModelPart &part, const StringView &name)
 
StringView getPartName (const ModelPart &part) const
 
void setPartTransform (ModelPart &part, const glm::mat4 &t)
 
const glm::mat4 & getPartTransform (const ModelPart &part) const
 
- Public Member Functions inherited from Cogs::Core::ResourceBase
 ResourceBase ()=default
 Constructs a new resource base.
 
 ResourceBase (const ResourceBase &other)=delete
 Disable trivial copies of resources.
 
ResourceBaseoperator= (const ResourceBase &other)=delete
 Disable copy-assignment of resources.
 
 ResourceBase (ResourceBase &&other)
 Move constructs a resource base from other.
 
ResourceBaseoperator= (ResourceBase &&other)
 Move assign the resource from the given ResourceBase other.
 
 ~ResourceBase ()
 Destructs the resource.
 
void setInitialized ()
 
void setChanged ()
 
bool hasChanged () const
 
void setLoading ()
 
void setLoaded ()
 
void setFailedLoad ()
 
void setActive ()
 
void setResident ()
 
void setProxy ()
 
void setKeepStorage ()
 
bool isInitialized () const
 
bool isLoaded () const
 
bool isActive () const
 
bool isResident () const
 
bool isDependency () const
 
bool isDeleted () const
 
bool isOrphaned () const
 
bool isProxy () const
 
bool hasFailedLoad () const
 
bool hasFailedActivation () const
 
bool keepStorage () const
 
void setType (ResourceTypes type)
 Set the type enumeration of the resource.
 
ResourceTypes getType () const
 Gets the type enumeration of the resource.
 
void setId (ResourceId resourceId)
 Set the resource id of the resource.
 
ResourceId getId () const
 Get the resource id of this instance.
 
void setFlag (ResourceFlags flags)
 Set the given resource flag.
 
void setFlags (ResourceFlags flags)
 
void unsetFlag (ResourceFlags flag)
 Unset the given flag.
 
bool isSet (ResourceFlags flag) const
 Check if the given flag is currently set.
 
ResourceFlags getFlags () const
 Get the current flags of the resource.
 
void attachResource (RenderResource *attachment)
 Attach the given GPU resource to the resource.
 
bool hasAttachedResource () const
 Check if the resource has an attachment.
 
RenderResourcegetAttachedResource () const
 Get the attached resource.
 
void setOwner (IResourceManager *owner)
 Sets the owner of this resource instance.
 
IResourceManagergetOwner () const
 
void setName (const StringView &name)
 Set the user friendly name of the resource.
 
StringView getName () const
 Get the name of the resource.
 
void setSource (const StringView &source)
 
StringView getSource () const
 
void increment ()
 Increments the reference count of the resource.
 
void decrement ()
 Decrement the reference count of the resource.
 
uint32_t referenceCount () const
 Get the current reference count.
 
void incrementGeneration ()
 Increment the generation count.
 
uint32_t getGeneration () const
 Get the generation count.
 
void setSlot (uint32_t slot)
 Sets the slot at which the resource is internally tracked.
 
uint32_t getSlot () const
 Gets the slot where the resource is tracked internally.
 

Public Attributes

std::vector< MeshHandlemeshes
 
std::vector< MaterialInstanceHandlematerials
 
std::vector< Geometry::BoundingBox > bounds
 
std::vector< ModelPartparts
 
PropertyStore properties
 
Skeleton skeleton
 
AnimationHandle animation
 

Additional Inherited Members

- Static Public Attributes inherited from Cogs::Core::ResourceBase
static const uint32_t NoAttachment = 0xFFFFFFFF
 Constant used to signal no attachment.
 

Detailed Description

Model resources define a template for a set of connected entities, with resources such as meshes, materials and textures defined.

Model resources are used by the ModelSystem to populate a sub-graph for a given entity with instanced contents from the model.

Every entity instance using the same Model will have unique entities, but will share Mesh, Material and Texture resources. In some cases the material instances may differ if e.g custom appearance is desired for some of the entities.

Definition at line 55 of file Model.h.

Member Function Documentation

◆ getPartName()

StringView Cogs::Core::Model::getPartName ( const ModelPart part) const
inline

Definition at line 74 of file Model.h.

◆ getPartTransform()

const glm::mat4 & Cogs::Core::Model::getPartTransform ( const ModelPart part) const
inline

Definition at line 87 of file Model.h.

◆ setPartName()

void Cogs::Core::Model::setPartName ( ModelPart part,
const StringView name 
)
inline

Definition at line 69 of file Model.h.

◆ setPartTransform()

void Cogs::Core::Model::setPartTransform ( ModelPart part,
const glm::mat4 &  t 
)
inline

Definition at line 80 of file Model.h.

Member Data Documentation

◆ animation

AnimationHandle Cogs::Core::Model::animation

Definition at line 110 of file Model.h.

◆ bounds

std::vector<Geometry::BoundingBox> Cogs::Core::Model::bounds

Definition at line 100 of file Model.h.

◆ materials

std::vector<MaterialInstanceHandle> Cogs::Core::Model::materials

Definition at line 98 of file Model.h.

◆ meshes

std::vector<MeshHandle> Cogs::Core::Model::meshes

Definition at line 97 of file Model.h.

◆ parts

std::vector<ModelPart> Cogs::Core::Model::parts

Definition at line 101 of file Model.h.

◆ properties

PropertyStore Cogs::Core::Model::properties

Definition at line 103 of file Model.h.

◆ skeleton

Skeleton Cogs::Core::Model::skeleton

Definition at line 108 of file Model.h.


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