2013-09-09 01:18:36 +02:00
|
|
|
#pragma once
|
2014-06-06 16:22:26 +02:00
|
|
|
#ifndef _OBJECTINSTANCE_HPP_
|
|
|
|
#define _OBJECTINSTANCE_HPP_
|
2014-02-28 12:23:51 +01:00
|
|
|
#include <engine/GameObject.hpp>
|
2014-06-11 22:00:53 +02:00
|
|
|
#include <btBulletDynamicsCommon.h>
|
2013-09-09 01:18:36 +02:00
|
|
|
|
|
|
|
/**
|
2014-06-06 16:22:26 +02:00
|
|
|
* @struct InstanceObject
|
|
|
|
* A simple object instance
|
2013-09-09 01:18:36 +02:00
|
|
|
*/
|
2014-06-06 16:22:26 +02:00
|
|
|
struct InstanceObject : public GameObject
|
2013-09-09 01:18:36 +02:00
|
|
|
{
|
|
|
|
glm::vec3 scale;
|
2014-06-11 22:00:53 +02:00
|
|
|
btRigidBody* body = nullptr;
|
2013-11-26 17:14:13 +01:00
|
|
|
std::shared_ptr<ObjectData> object;
|
2014-07-02 00:04:23 +02:00
|
|
|
InstanceObject* LODinstance;
|
2014-06-11 22:00:53 +02:00
|
|
|
std::shared_ptr<DynamicObjectData> dynamics;
|
2014-06-15 02:34:13 +02:00
|
|
|
float _collisionHeight;
|
2014-06-16 02:29:36 +02:00
|
|
|
bool _enablePhysics;
|
2013-09-09 01:18:36 +02:00
|
|
|
|
2014-07-02 00:04:23 +02:00
|
|
|
InstanceObject(GameWorld* engine,
|
2013-09-09 01:18:36 +02:00
|
|
|
const glm::vec3& pos,
|
|
|
|
const glm::quat& rot,
|
2014-06-06 13:18:32 +02:00
|
|
|
ModelHandle* model,
|
2013-09-09 01:18:36 +02:00
|
|
|
const glm::vec3& scale,
|
2013-11-26 17:14:13 +01:00
|
|
|
std::shared_ptr<ObjectData> obj,
|
2014-07-02 00:04:23 +02:00
|
|
|
InstanceObject *lod,
|
2014-06-11 22:00:53 +02:00
|
|
|
std::shared_ptr<DynamicObjectData> dyn
|
2013-09-09 02:40:30 +02:00
|
|
|
);
|
2014-08-01 16:48:11 +02:00
|
|
|
~InstanceObject();
|
2013-09-09 01:18:36 +02:00
|
|
|
|
|
|
|
Type type() { return Instance; }
|
2014-06-15 02:34:13 +02:00
|
|
|
|
|
|
|
void tick(float dt);
|
2014-07-25 04:30:44 +02:00
|
|
|
|
2014-08-01 16:48:11 +02:00
|
|
|
void changeModel(std::shared_ptr<ObjectData> incoming);
|
|
|
|
|
2014-07-25 04:30:44 +02:00
|
|
|
virtual void setRotation(const glm::quat& r);
|
2013-12-06 22:25:34 +01:00
|
|
|
|
2014-06-11 22:00:53 +02:00
|
|
|
virtual bool takeDamage(const DamageInfo& damage);
|
2013-09-09 01:18:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|