i6engine
1.0
|
Tells the engine what model/mesh to use when rendering the GameObject. For creating a MeshAppearanceComponent, these keys are possible:
Name | Required | Type | Description | Public |
---|---|---|---|---|
mesh | yes | std::string | mesh file | yes |
visibility | no | bool | is this mesh visible or not, default is true | yes |
pos | yes | Vec3 | relative position to SceneNode | yes |
rot | yes | Vec3 | relative rotation to SceneNode | yes |
scale | yes | Vec3 | relative scale to SceneNode | yes |
material | no | std::string | optional change of the material on the mesh | yes |
shadowCasting | no | bool | defines whether a mesh casts shadows or not, default is true | yes |
#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/components/MeshAppearanceComponent.h>
Public Member Functions | |
MeshAppearanceComponent (const int64_t id, const attributeMap ¶ms) | |
Constructor of the component. More... | |
~MeshAppearanceComponent () | |
Destructor. More... | |
Vec3 | getPosition () const |
returns the position of the mesh More... | |
void | setVisibility (const bool visible) |
Sets the GameObject's visibility. More... | |
void | setMesh (const std::string &meshName) |
Sets the GameObject's mesh. More... | |
void | setCustomParameter (uint32_t num, const Vec4 &value) |
Sets a parameter for a shader script. More... | |
bool | getVisibility () const |
Gets the GameObject's visibility. More... | |
std::string | getMesh () const |
Gets the GameObject's mesh name. More... | |
void | setMaterial (const std::string &materialName) |
sets the material of the meshEntity to the given material More... | |
void | playAnimation (const std::string &anim, bool looping, double offsetPercent) |
plays given animation More... | |
void | setAnimationSpeed (double animationSpeed) |
set animation speed for current animation More... | |
void | stopAnimation () |
stops current animation More... | |
attributeMap | synchronize () const override |
synchronizes the Components state More... | |
std::string | getTemplateName () const override |
returns the name this template was registered with More... | |
std::vector< componentOptions > | getComponentOptions () override |
returns a vector containing all options of the Component being readable and writeable in the editor More... | |
void | drawBoundingBox (const Vec3 &colour) const |
shows the bounding box of this mesh in given colour More... | |
void | removeBoundingBox () const |
removes the bounding box of this mesh More... | |
void | attachGameObjectToBone (const api::GOPtr &go, const std::string &boneName) |
attaches a GameObject to a bone of this mesh More... | |
void | detachGameObjectFromBone (const api::GOPtr &go, const std::string &boneName) |
detaches a GameObject from a bone More... | |
void | addAnimationFrameEvent (uint64_t frameTime, const std::function< void(void)> &func) const |
adds an event being triggered, when a specified frame time of the animation is reached note that all events are removed when another animation is played! More... | |
Transform | getBoneTransform (const std::string &name) const |
returns the Transform for one bone More... | |
void | setShadowCasting (bool enabled) |
enables or disables shadow casting for this mesh More... | |
Public Member Functions inherited from i6e::api::Component | |
Component () | |
Constructor for Component. More... | |
Component (const int64_t id, const attributeMap ¶ms) | |
Constructor for Component. More... | |
virtual | ~Component () |
Destructor of Component. Must be implemented in derived class. More... | |
void | setOwnerGO (const WeakGOPtr &objGo) |
Sets the GameObject that owns this Component. More... | |
GOPtr | getOwnerGO () |
Get the GameObject that owns this Component. More... | |
uint32_t | getComponentID () const |
Returns the component identification string. More... | |
uint32_t | getFamilyID () const |
Returns the family identification string. More... | |
std::string | getIdentifier () const |
Returns the family identification string. More... | |
virtual void | Tick () |
Components can have Tick method like normal Subsystems this method is called by the ObjectController during every Tick if the component registered itself at the ObjectFacade. More... | |
void | setDie () const |
component will be deleted soon More... | |
int64_t | getID () const |
returns the id of the component More... | |
virtual void | News (const GameMessage::Ptr &msg) |
Receives messages for this component override this function, if you expect messages. More... | |
void | setSync (bool b) |
sets whether this object has to be synchronized or not More... | |
bool | getSync () const |
void | enableTicking (bool allowTicking) const |
triggers doEnableTicking threadsafe More... | |
void | setSelf (const WeakComPtr &self) |
sets weak_ptr on self for registration of ticker More... | |
std::vector< ComPtr > | getSubComponents () const |
returns all SubComponents attached to this Component More... | |
Friends | |
class | modules::MeshComponent |
Additional Inherited Members | |
Static Public Member Functions inherited from i6e::api::Component | |
template<typename T > | |
static ComPtr | createC (const int64_t id, const attributeMap ¶ms) |
Protected Member Functions inherited from i6e::api::Component | |
void | addTicker () |
adds this component to ticklist More... | |
void | removeTicker () |
removes this component from ticklist More... | |
void | doEnableTicking (bool allowTicking) |
sets ticking status for this Component per default all Components are allowed to tick and calling addTicker will start ticking, but in some cases, e.g. for level editor, ticking has to be disabled and just a few components are allowed to tick More... | |
Protected Attributes inherited from i6e::api::Component | |
int64_t | _objOwnerID |
ID of the GameObject that owns this Component. More... | |
WeakGOPtr | _objOwnerGO |
Owning GameObject. More... | |
uint32_t | _objComponentID |
Component ID of the Component. More... | |
uint32_t | _objFamilyID |
Family ID of the Component. More... | |
std::vector< ComPtr > | _subComps |
vector containing the other componetns of the same type if this is the dispatcher component More... | |
std::string | _identifier |
identifies the subcomponent More... | |
int64_t | _id |
id of this component More... | |
bool | _sync |
WeakComPtr | _self |
a weak_ptr on the own shared_ptr More... | |
bool | _tickingAllowed |
status if this object is allowed to tick or not More... | |
bool | _wantsToTick |
stores if a Component which isn't allowed to tick want to tick, so it can start ticking when ticking will be allowed More... | |
bool | _isTicking |
stores whether this Component is actually ticking More... | |
Tells the engine what model/mesh to use when rendering the GameObject. For creating a MeshAppearanceComponent, these keys are possible:
Name | Required | Type | Description | Public |
---|---|---|---|---|
mesh | yes | std::string | mesh file | yes |
visibility | no | bool | is this mesh visible or not, default is true | yes |
pos | yes | Vec3 | relative position to SceneNode | yes |
rot | yes | Vec3 | relative rotation to SceneNode | yes |
scale | yes | Vec3 | relative scale to SceneNode | yes |
material | no | std::string | optional change of the material on the mesh | yes |
shadowCasting | no | bool | defines whether a mesh casts shadows or not, default is true | yes |
Definition at line 65 of file MeshAppearanceComponent.h.
i6e::api::MeshAppearanceComponent::MeshAppearanceComponent | ( | const int64_t | id, |
const attributeMap & | params | ||
) |
Constructor of the component.
Sets visibility and ID
i6e::api::MeshAppearanceComponent::~MeshAppearanceComponent | ( | ) |
Destructor.
void i6e::api::MeshAppearanceComponent::addAnimationFrameEvent | ( | uint64_t | frameTime, |
const std::function< void(void)> & | func | ||
) | const |
adds an event being triggered, when a specified frame time of the animation is reached note that all events are removed when another animation is played!
void i6e::api::MeshAppearanceComponent::attachGameObjectToBone | ( | const api::GOPtr & | go, |
const std::string & | boneName | ||
) |
attaches a GameObject to a bone of this mesh
void i6e::api::MeshAppearanceComponent::detachGameObjectFromBone | ( | const api::GOPtr & | go, |
const std::string & | boneName | ||
) |
detaches a GameObject from a bone
void i6e::api::MeshAppearanceComponent::drawBoundingBox | ( | const Vec3 & | colour | ) | const |
shows the bounding box of this mesh in given colour
Transform i6e::api::MeshAppearanceComponent::getBoneTransform | ( | const std::string & | name | ) | const |
returns the Transform for one bone
|
overridevirtual |
returns a vector containing all options of the Component being readable and writeable in the editor
Implements i6e::api::Component.
|
inline |
Gets the GameObject's mesh name.
Gets the GameObject's mesh name
Definition at line 132 of file MeshAppearanceComponent.h.
|
inline |
returns the position of the mesh
Definition at line 84 of file MeshAppearanceComponent.h.
|
inlineoverridevirtual |
returns the name this template was registered with
Implements i6e::api::Component.
Definition at line 159 of file MeshAppearanceComponent.h.
|
inline |
Gets the GameObject's visibility.
Gets the GameObject's visibility
Definition at line 123 of file MeshAppearanceComponent.h.
void i6e::api::MeshAppearanceComponent::playAnimation | ( | const std::string & | anim, |
bool | looping, | ||
double | offsetPercent | ||
) |
plays given animation
void i6e::api::MeshAppearanceComponent::removeBoundingBox | ( | ) | const |
removes the bounding box of this mesh
void i6e::api::MeshAppearanceComponent::setAnimationSpeed | ( | double | animationSpeed | ) |
set animation speed for current animation
void i6e::api::MeshAppearanceComponent::setCustomParameter | ( | uint32_t | num, |
const Vec4 & | value | ||
) |
Sets a parameter for a shader script.
The parameter is set for all SubEntities of this mesh.
num | The number, the parameter has in the shader script. |
value | The Value to set the parameter to. |
void i6e::api::MeshAppearanceComponent::setMaterial | ( | const std::string & | materialName | ) |
sets the material of the meshEntity to the given material
void i6e::api::MeshAppearanceComponent::setMesh | ( | const std::string & | meshName | ) |
Sets the GameObject's mesh.
Sets the mesh of the component and sends message to MessagingController
[in] | meshName | Name of the mesh of the component |
void i6e::api::MeshAppearanceComponent::setShadowCasting | ( | bool | enabled | ) |
enables or disables shadow casting for this mesh
void i6e::api::MeshAppearanceComponent::setVisibility | ( | const bool | visible | ) |
Sets the GameObject's visibility.
Sets the visibility of the component and sends message to MessagingController
[in] | visible | Visibility of the component (true/false) |
void i6e::api::MeshAppearanceComponent::stopAnimation | ( | ) |
stops current animation
|
overridevirtual |
synchronizes the Components state
Implements i6e::api::Component.
|
friend |
Definition at line 66 of file MeshAppearanceComponent.h.