/
MD5ModelNode.h
82 lines (62 loc) · 2.2 KB
/
MD5ModelNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
#include "MD5Model.h"
#include "modelskin.h"
#include "itraceable.h"
#include "scene/Node.h"
#include "render/VectorLightList.h"
namespace md5 {
class MD5ModelNode :
public scene::Node,
public model::ModelNode,
public SelectionTestable,
public LitObject,
public SkinnedModel,
public ITraceable
{
private:
MD5ModelPtr _model;
LightList* _lightList;
typedef std::vector<render::lib::VectorLightList> SurfaceLightLists;
SurfaceLightLists _surfaceLightLists;
// The name of this model's skin
std::string _skin;
public:
MD5ModelNode(const MD5ModelPtr& model);
virtual ~MD5ModelNode();
// ModelNode implementation
const model::IModel& getIModel() const override;
model::IModel& getIModel() override;
bool hasModifiedScale() override;
void lightsChanged();
// returns the contained model
void setModel(const MD5ModelPtr& model);
const MD5ModelPtr& getModel() const;
// Bounded implementation
virtual const AABB& localAABB() const override;
virtual std::string name() const override;
Type getNodeType() const override;
// SelectionTestable implementation
void testSelect(Selector& selector, SelectionTest& test) override;
// Traceable implementation
bool getIntersection(const Ray& ray, Vector3& intersection) override;
// LitObject implementation
bool intersectsLight(const RendererLight& light) const override;
void insertLight(const RendererLight& light) override;
void clearLights() override;
// Renderable implementation
void renderSolid(RenderableCollector& collector, const VolumeTest& volume) const override;
void renderWireframe(RenderableCollector& collector, const VolumeTest& volume) const override;
void setRenderSystem(const RenderSystemPtr& renderSystem) override;
std::size_t getHighlightFlags() override
{
return Highlight::NoHighlight; // models are never highlighted themselves
}
// Returns the name of the currently active skin
virtual std::string getSkin() const override;
void skinChanged(const std::string& newSkinName) override;
private:
void render(RenderableCollector& collector, const VolumeTest& volume,
const Matrix4& localToWorld, const IRenderEntity& entity) const;
};
typedef std::shared_ptr<MD5ModelNode> MD5ModelNodePtr;
} // namespace md5