Lephisto/src/collider/geom.h
2018-02-22 21:10:45 +00:00

32 lines
914 B
C++

#pragma once
#include "../matrix4x4.h"
#include "../vector3.h"
class GeomTree;
class isect_t;
class CollisionContact;
class Geom {
public:
Geom(GeomTree*);
void MoveTo(const matrix4x4d& m);
void MoveTo(const matrix4x4d& m, const vector3d pos);
const matrix4x4d& GetInvTransform(void) { return m_invOrient; }
const matrix4x4d& GetTransform(void) { return m_orient[m_orientIdx]; }
void Enable(void) { m_active = true; }
void Disable(void) {m_active = false; }
bool IsEnabled(void) { return m_active; }
GeomTree* GetGeomTree(void) { return m_geomtree; }
void Collide(Geom* b, 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;
GeomTree* m_geomtree;
void* m_data;
};