esp::assets::managers::PhysicsAttributesManager class

Base classes

template<class AttribsPtr>
class AttributesManager
Template Class defining responsibilities for managing attributes for different types of objects, such as scenes, primitive assets, physical objects, etc.

Constructors, destructors, conversion operators

PhysicsAttributesManager(assets::ResourceManager& resourceManager, ObjectAttributesManager::ptr objectAttributesMgr)

Public functions

auto createAttributesTemplate(const std::string& physicsFilename = ESP_DEFAULT_PHYS_SCENE_CONFIG_REL_PATH, bool registerTemplate = true) -> PhysicsManagerAttributes::ptr override
Creates an instance of a physics world template described by passed string. For physics templates, this a file name. Parses global physics simulation parameters (such as timestep, gravity, simulator implementation) from the specified configuration file.
auto createDefaultAttributesTemplate(const std::string& templateName, bool registerTemplate = false) -> PhysicsManagerAttributes::ptr override
Creates a an instance of physics manager attributes template populated with default values. Assigns the templateName as the template's handle.
auto createFileBasedAttributesTemplate(const std::string& physicsFilename, bool registerTemplate) -> PhysicsManagerAttributes::ptr
Read and parse the json file physicsFileName and populate a returned physics manager attributes with appropriate data.

Protected functions

void setDefaultFileNameBasedAttributes(CORRADE_UNUSED PhysicsManagerAttributes::ptr attributes, CORRADE_UNUSED bool setFrame, CORRADE_UNUSED const std::string& meshHandle, CORRADE_UNUSED std::function<void(int)> meshTypeSetter) override
Not used by PhysicsManagerAttributes.
auto initNewAttribsInternal(PhysicsManagerAttributes::ptr newAttributes) -> PhysicsManagerAttributes::ptr override
Used Internally. Configure newly-created attributes with any default values, before any specific values are set.
void updateTemplateHandleLists(CORRADE_UNUSED int templateID, CORRADE_UNUSED const std::string& templateHandle) override
This method will perform any necessary updating that is attributesManager-specific upon template removal, such as removing a specific template handle from the list of file-based template handles in ObjectAttributesManager. This should only be called internally.
auto registerAttributesTemplateFinalize(PhysicsManagerAttributes::ptr physicsAttributesTemplate, const std::string& physicsAttributesHandle) -> int override
Add a PhysicsManagerAttributes::ptr object to the templateLibrary_.
void resetFinalize() override
Any physics-attributes-specific resetting that needs to happen on reset.
void buildCtorFuncPtrMaps() override
This function will assign the appropriately configured function pointer for the copy constructor as required by AttributesManager<PhysicsSceneAttributes::ptr>

Protected variables

ObjectAttributesManager::ptr objectAttributesMgr_
Reference to ObjectAttributesManager to give access to setting object template library using paths specified in PhysicsAttributes json.

Function documentation

PhysicsManagerAttributes::ptr esp::assets::managers::PhysicsAttributesManager::createAttributesTemplate(const std::string& physicsFilename = ESP_DEFAULT_PHYS_SCENE_CONFIG_REL_PATH, bool registerTemplate = true) override

Creates an instance of a physics world template described by passed string. For physics templates, this a file name. Parses global physics simulation parameters (such as timestep, gravity, simulator implementation) from the specified configuration file.

Parameters
physicsFilename The configuration file to parse. Defaults to the file location ESP_DEFAULT_PHYS_SCENE_CONFIG_REL_PATH set by cmake.
registerTemplate whether to add this template to the library. If the user is going to edit this template, this should be false - any subsequent editing will require re-registration. Defaults to true. If specified as true, then this function returns a copy of the registered template.
Returns a reference to the physics simulation meta data object parsed from the specified configuration file.

If a template exists with this handle, this existing template will be overwritten with the newly created one if registerTemplate is true.

PhysicsManagerAttributes::ptr esp::assets::managers::PhysicsAttributesManager::createDefaultAttributesTemplate(const std::string& templateName, bool registerTemplate = false) override

Creates a an instance of physics manager attributes template populated with default values. Assigns the templateName as the template's handle.

Parameters
templateName Name to use for the attributes handle.
registerTemplate whether to add this template to the library. If the user is going to edit this template, this should be false - any subsequent editing will require re-registration. Defaults to false. If specified as true, then this function returns a copy of the registered template.
Returns a reference to the desired template, or nullptr if fails.

If a template exists with this handle, the existing template will be overwritten with the newly created one if registerTemplate is true. This method is specifically intended to directly construct an attributes template for editing, and so defaults to false for registerTemplate

PhysicsManagerAttributes::ptr esp::assets::managers::PhysicsAttributesManager::createFileBasedAttributesTemplate(const std::string& physicsFilename, bool registerTemplate)

Read and parse the json file physicsFileName and populate a returned physics manager attributes with appropriate data.

Parameters
physicsFilename The configuration file to parse.
registerTemplate whether to add this template to the library.
Returns a reference to the physics simulation meta data object parsed from the specified configuration file, or nullptr if fails.

PhysicsManagerAttributes::ptr esp::assets::managers::PhysicsAttributesManager::initNewAttribsInternal(PhysicsManagerAttributes::ptr newAttributes) override protected

Used Internally. Configure newly-created attributes with any default values, before any specific values are set.

Parameters
newAttributes Newly created attributes.

void esp::assets::managers::PhysicsAttributesManager::updateTemplateHandleLists(CORRADE_UNUSED int templateID, CORRADE_UNUSED const std::string& templateHandle) override protected

This method will perform any necessary updating that is attributesManager-specific upon template removal, such as removing a specific template handle from the list of file-based template handles in ObjectAttributesManager. This should only be called internally.

Parameters
templateID the ID of the template to remove
templateHandle the string key of the attributes desired.

int esp::assets::managers::PhysicsAttributesManager::registerAttributesTemplateFinalize(PhysicsManagerAttributes::ptr physicsAttributesTemplate, const std::string& physicsAttributesHandle) override protected

Add a PhysicsManagerAttributes::ptr object to the templateLibrary_.

Parameters
physicsAttributesTemplate The attributes template.
physicsAttributesHandle The key for referencing the template in the templateLibrary_.
Returns The index in the templateLibrary_ of object template.