-
Notifications
You must be signed in to change notification settings - Fork 0
/
Laser.h
54 lines (46 loc) · 1.4 KB
/
Laser.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
#ifndef LASER_H_
#define LASER_H_
#include "entity/FixedGeometry.h"
#include "assets/AssetManager.h"
#include "assets/Buffer.h"
#include "assets/Shader.h"
#include "entity/SceneGraph.h"
#include "util/AnimationHelper.h"
using namespace anengine;
class Laser : public FixedGeometry
{
static StaticAsset<VertexBuffer> myVertexBuffer;
AssetRef<Texture> myTextureRef;
Asset<Texture> myTexture;
protected:
static StaticAsset<Program> LaserProgram;
virtual void OnDraw(FrameTime elapsed);
virtual void OnNewProgram();
virtual void OnCreate();
virtual void OnDestroy();
virtual AssetRef<VertexBuffer> GetGeometry(AssetManager *manager)
{
return myVertexBuffer.Get(manager);
}
virtual void OnPropertyChanged(const PropertyInfo *info, bool implicit);
public:
static PropertyInfo LengthProperty;
Property<real> Length;
Laser(const AssetRef<Texture> &texture)
: myTextureRef(texture), Length(&LengthProperty, this)
{
}
virtual ~Laser() { }
};
class LaserAnimationData : public AnimationHelper::AnimationData
{
public:
LaserAnimationData(Laser *animated, real length, real speed,
AnimationHelper::AnimationCurve curve)
: AnimationData(length*speed, curve), Animated(animated), Length(length) { }
virtual ~LaserAnimationData() { }
Laser *Animated;
real Length;
virtual void Update(real t);
};
#endif