38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
#include "../matrix4x4.h"
|
|
#include "../vector3.h"
|
|
|
|
class GeomTree;
|
|
class isect_t;
|
|
class CollisionContact;
|
|
class Sphere;
|
|
|
|
class Geom {
|
|
public:
|
|
Geom(GeomTree*);
|
|
void MoveTo(const matrix4x4d& m);
|
|
void MoveTo(const matrix4x4d& m, const vector3d pos);
|
|
const matrix4x4d& GetInvTransform(void) const { return m_invOrient; }
|
|
const matrix4x4d& GetTransform(void) const { return m_orient[m_orientIdx]; }
|
|
matrix4x4d GetRotation(void) const;
|
|
vector3d GetPosition(void) const;
|
|
void Enable(void) { m_active = true; }
|
|
void Disable(void) {m_active = false; }
|
|
bool IsEnabled(void) { return m_active; }
|
|
bool HasMoved(void) { return m_moved; }
|
|
GeomTree* GetGeomTree(void) { return m_geomtree; }
|
|
void Collide(Geom* b, void(*callback)(CollisionContact*));
|
|
void CollideSphere(Sphere& sphere, void (*callback)(CollisionContact*));
|
|
void SetUserData(void* d) { m_data = d; }
|
|
void* GetUserData(void) { return m_data; }
|
|
private:
|
|
/* double-buffer position so we can keep previous position. */
|
|
matrix4x4d m_orient[2], m_invOrient;
|
|
int m_orientIdx;
|
|
bool m_active;
|
|
bool m_moved;
|
|
GeomTree* m_geomtree;
|
|
void* m_data;
|
|
};
|
|
|