2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
#include "dCommonVars.h"
|
|
|
|
#include "RakNetTypes.h"
|
|
|
|
#include "NiPoint3.h"
|
|
|
|
#include "NiQuaternion.h"
|
|
|
|
#include "Component.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
class Entity;
|
2023-02-11 03:33:30 +00:00
|
|
|
enum class ePhysicsBehaviorType : int32_t;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that represents entities that are a model, e.g. collectible models and BBB models.
|
|
|
|
*/
|
2023-06-08 15:29:17 +00:00
|
|
|
class ModelBehaviorComponent : public Component {
|
2021-12-05 17:54:36 +00:00
|
|
|
public:
|
2023-06-09 08:22:45 +00:00
|
|
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MODEL_BEHAVIOR;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-06-08 15:29:17 +00:00
|
|
|
ModelBehaviorComponent(Entity* parent);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-19 21:51:35 +00:00
|
|
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-19 21:51:35 +00:00
|
|
|
/**
|
|
|
|
* Returns the original position of the model
|
|
|
|
* @return the original position of the model
|
|
|
|
*/
|
|
|
|
const NiPoint3& GetPosition() { return m_OriginalPosition; }
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-19 21:51:35 +00:00
|
|
|
/**
|
|
|
|
* Sets the original position of the model
|
|
|
|
* @param pos the original position to set
|
|
|
|
*/
|
2023-07-06 03:37:16 +00:00
|
|
|
void SetPosition(const NiPoint3& pos) {
|
|
|
|
if (m_OriginalPosition == pos) return;
|
|
|
|
m_OriginalPosition = pos;
|
|
|
|
m_DirtyModelInfo = true;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-19 21:51:35 +00:00
|
|
|
/**
|
|
|
|
* Returns the original rotation of the model
|
|
|
|
* @return the original rotation of the model
|
|
|
|
*/
|
|
|
|
const NiQuaternion& GetRotation() { return m_OriginalRotation; }
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-19 21:51:35 +00:00
|
|
|
/**
|
|
|
|
* Sets the original rotation of the model
|
|
|
|
* @param rot the original rotation to set
|
|
|
|
*/
|
2023-07-06 03:37:16 +00:00
|
|
|
void SetRotation(const NiQuaternion& rot) {
|
|
|
|
if (m_OriginalRotation == rot) return;
|
|
|
|
m_OriginalRotation = rot;
|
|
|
|
m_DirtyModelInfo = true;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2023-02-11 03:33:30 +00:00
|
|
|
/**
|
|
|
|
* if the model info has changed
|
|
|
|
*/
|
|
|
|
bool m_DirtyModelInfo;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If the model is pickable
|
|
|
|
*/
|
|
|
|
bool m_IsPickable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the phsyics type of the model
|
|
|
|
*/
|
|
|
|
ePhysicsBehaviorType m_PhysicsType;
|
|
|
|
|
2022-07-19 21:51:35 +00:00
|
|
|
/**
|
|
|
|
* The original position of the model
|
|
|
|
*/
|
|
|
|
NiPoint3 m_OriginalPosition;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The rotation original of the model
|
|
|
|
*/
|
|
|
|
NiQuaternion m_OriginalRotation;
|
|
|
|
|
|
|
|
};
|