Files
BlitzNext/Runtime/blitz3d/meshmodel.hpp
T

67 lines
1.4 KiB
C++
Raw Normal View History

2019-01-18 21:26:42 +01:00
#pragma once
#include <vector>
2019-01-18 15:55:06 +01:00
#include "model.hpp"
#include "surface.hpp"
2014-01-31 08:23:00 +13:00
class MeshCollider;
2019-01-19 18:30:15 +01:00
struct Collision;
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
class MeshModel : public Model {
public:
2019-01-18 21:26:42 +01:00
typedef std::vector<Surface*> SurfaceList;
2014-01-31 08:23:00 +13:00
MeshModel();
2019-01-18 17:04:17 +01:00
MeshModel(const MeshModel& t);
2014-01-31 08:23:00 +13:00
~MeshModel();
//Entity interface
2019-01-18 17:04:17 +01:00
virtual MeshModel* getMeshModel()
{
return this;
}
virtual Entity* clone()
{
return new MeshModel(*this);
}
2014-01-31 08:23:00 +13:00
//Object interface
2019-01-18 17:04:17 +01:00
virtual bool collide(const Line& line, float radius, Collision* curr_coll, const Transform& t);
2014-01-31 08:23:00 +13:00
//Model interface
2019-01-18 17:04:17 +01:00
virtual void setRenderBrush(const Brush& b);
virtual bool render(const RenderContext& rc);
virtual void renderQueue(int type);
2014-01-31 08:23:00 +13:00
//boned mesh!
void createBones();
//MeshModel interface
2019-01-18 17:04:17 +01:00
Surface* createSurface(const Brush& b);
void setCullBox(const Box& box);
void updateNormals();
void flipTriangles();
void transform(const Transform& t);
void paint(const Brush& b);
void add(const MeshModel& t);
void optimize();
2014-01-31 08:23:00 +13:00
//accessors
2019-01-18 17:04:17 +01:00
const SurfaceList& getSurfaces() const;
Surface* findSurface(const Brush& b) const;
bool intersects(const MeshModel& m) const;
MeshCollider* getCollider() const;
const Box& getBox() const;
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
private:
2014-01-31 08:23:00 +13:00
struct Rep;
2019-01-18 17:04:17 +01:00
Rep* rep;
int brush_changes;
Brush render_brush;
2019-01-18 21:26:42 +01:00
std::vector<Brush> brushes;
2014-01-31 08:23:00 +13:00
2019-01-18 21:26:42 +01:00
std::vector<Surface::Bone> surf_bones;
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
MeshModel& operator=(const MeshModel&);
2014-01-31 08:23:00 +13:00
};