2013-09-09 00:18:36 +01:00
|
|
|
#pragma once
|
2013-09-30 19:32:14 +01:00
|
|
|
#ifndef _GTAOBJECT_HPP_
|
|
|
|
#define _GTAOBJECT_HPP_
|
2013-09-09 00:18:36 +01:00
|
|
|
|
2013-12-20 14:03:32 +00:00
|
|
|
#include <engine/GTATypes.hpp>
|
|
|
|
#include <loaders/LoaderIDE.hpp>
|
|
|
|
#include <loaders/LoaderIPL.hpp>
|
2013-09-09 00:18:36 +01:00
|
|
|
#include <glm/gtc/quaternion.hpp>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class GTAAIController;
|
|
|
|
class Model;
|
2013-09-11 00:26:13 +01:00
|
|
|
class Animator;
|
2013-09-09 00:18:36 +01:00
|
|
|
|
|
|
|
class GTAEngine;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The GTAObject struct
|
|
|
|
* Stores data that is relevant to all types of objects.
|
|
|
|
*/
|
|
|
|
struct GTAObject
|
|
|
|
{
|
|
|
|
glm::vec3 position;
|
|
|
|
glm::quat rotation;
|
|
|
|
|
|
|
|
Model* model; /// Cached pointer to Object's Model.
|
|
|
|
|
|
|
|
GTAEngine* engine;
|
|
|
|
|
2013-09-11 00:26:13 +01:00
|
|
|
Animator* animator; /// Object's animator.
|
2013-12-06 21:25:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Health value
|
|
|
|
*/
|
|
|
|
float mHealth;
|
2013-09-09 00:18:36 +01:00
|
|
|
|
|
|
|
GTAObject(GTAEngine* engine, const glm::vec3& pos, const glm::quat& rot, Model* model)
|
2013-12-06 21:25:34 +00:00
|
|
|
: position(pos), rotation(rot), model(model), engine(engine), animator(nullptr), mHealth(0.f) {}
|
2013-12-12 02:55:31 +00:00
|
|
|
|
|
|
|
virtual ~GTAObject() {};
|
2013-09-09 00:18:36 +01:00
|
|
|
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
Instance,
|
|
|
|
Character,
|
|
|
|
Vehicle
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual Type type() = 0;
|
|
|
|
|
|
|
|
virtual void setPosition(const glm::vec3& pos);
|
|
|
|
|
|
|
|
virtual glm::vec3 getPosition() const;
|
2013-09-09 04:04:21 +01:00
|
|
|
|
|
|
|
virtual glm::quat getRotation() const;
|
2013-12-06 21:25:34 +00:00
|
|
|
|
|
|
|
struct DamageInfo
|
|
|
|
{
|
|
|
|
enum DamageType
|
|
|
|
{
|
|
|
|
Explosion,
|
|
|
|
Burning,
|
|
|
|
Bullet,
|
|
|
|
Physics
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* World position of damage
|
|
|
|
*/
|
|
|
|
glm::vec3 damageLocation;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* World position of the source (used for direction)
|
|
|
|
*/
|
|
|
|
glm::vec3 damageSource;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Magnitude of destruction
|
|
|
|
*/
|
|
|
|
float hitpoints;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of the damage
|
|
|
|
*/
|
|
|
|
DamageType type;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual bool takeDamage(const DamageInfo& damage) { return false; };
|
2013-09-09 00:18:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GTAOBJECTS_HPP
|