esp::metadata::attributes::AbstractPrimitiveAttributes class

attributes describing primitve render/collision objects - abstract class without pure virtual methods

Base classes

class AbstractAttributes
Base class for all implemented attributes. Inherits from esp::core::managedContainers::AbstractFileBasedManagedObject so the attributes can be managed by a esp::core::managedContainers::ManagedContainer.

Derived classes

class CapsulePrimitiveAttributes
attributes describing primitive capsule objects
class ConePrimitiveAttributes
class CubePrimitiveAttributes
class CylinderPrimitiveAttributes
class IcospherePrimitiveAttributes
class UVSpherePrimitiveAttributes

Constructors, destructors, conversion operators

AbstractPrimitiveAttributes(bool isWireframe, int primObjType, const std::string& primObjClassName, const std::string& attributesClassKey)
~AbstractPrimitiveAttributes() defaulted override

Public functions

void setHandle(const std::string&) override
auto getIsWireframe() const -> bool
void setUseTextureCoords(bool useTextureCoords)
auto getUseTextureCoords() const -> bool
void setUseTangents(bool tangents)
auto getUseTangents() const -> bool
void setNumRings(int rings)
auto getNumRings() const -> int
void setNumSegments(int segments)
auto getNumSegments() const -> int
void setHalfLength(double halfLength)
auto getHalfLength() const -> double
auto getPrimObjClassName() const -> std::string
auto getPrimObjType() const -> int
The integer representation of the esp::metadata::PrimObjTypes this primitive represents,.
auto isValidTemplate() -> bool virtual
This will determine if the stated template has the required quantities needed to instantiate a primitive properly of desired type. AbstractPrimitiveAttributes is never valid for any primitive - should be overridden in prim-specific class.
void buildHandle()
Handle for primitive attribute-based templates should reflect the parameters used to construct the primitive, and so should only be set internally or when relevant values are set manually.
auto parseStringIntoConfig(const std::string& configString) -> bool
This will parse the passed candidate object template handle, treated as a configuration string, and populate the appropriate values.
auto getSimplifiedHandle() const -> std::string override
PrimitiveAssetAttributes handles are already simplified, and embed no path info.

Protected functions

auto getObjectInfoHeaderInternal() const -> std::string override
Retrieve a comma-separated string holding the header values for the info returned for this managed object, type-specific.
auto getObjectInfoInternal() const -> std::string override
Retrieve a comma-separated informational string about the contents of this managed object.
auto isValueMultipleOfDivisor(int val, int div) -> bool
Verifies that val is larger than, and a multiple of, divisor div.
auto getBoolDispStr(bool val) const -> std::string
auto getValueForConfigKey(const std::string& key, const std::string& configStr) -> std::string
auto getBoolForConfigKey(const std::string& key, const std::string& configStr) -> bool
auto setIntFromConfigKey(const std::string& key, const std::string& configStr, const std::function<void(int)>& setter) -> bool
auto setDoubleFromConfigKey(const std::string& key, const std::string& configStr, const std::function<void(double)>& setter) -> bool
auto buildHandleDetail() -> std::string pure virtual
auto parseStringIntoConfigDetail(const std::string& configString) -> bool pure virtual

Function documentation

bool esp::metadata::attributes::AbstractPrimitiveAttributes::isValidTemplate() virtual

This will determine if the stated template has the required quantities needed to instantiate a primitive properly of desired type. AbstractPrimitiveAttributes is never valid for any primitive - should be overridden in prim-specific class.

Returns whether or not the template holds valid data for desired primitive type.

bool esp::metadata::attributes::AbstractPrimitiveAttributes::parseStringIntoConfig(const std::string& configString)

This will parse the passed candidate object template handle, treated as a configuration string, and populate the appropriate values.

Parameters
configString The configuration string to parse.
Returns Whether the parsing has succeeded or not (might fail with inappropriate formatting for object type.)

bool esp::metadata::attributes::AbstractPrimitiveAttributes::isValueMultipleOfDivisor(int val, int div) protected

Verifies that val is larger than, and a multiple of, divisor div.

Parameters
val the value to check
div

the divsior (value to verify is greater than and a multiple of)

  • will be either 2 or 4 for primitives value checking
Returns whether check passes