forked from abertay-cmp404/virtual_vita
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVirtualMarker.cpp
More file actions
39 lines (29 loc) · 752 Bytes
/
VirtualMarker.cpp
File metadata and controls
39 lines (29 loc) · 752 Bytes
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
#include "VirtualMarker.h"
VirtualMarker::VirtualMarker () :
VirtualObject (),
active(false),
markerID(0),
rotation(0.0f),
rotationalAccelaration(0.0f)
{
marker_transform.SetIdentity ();
}
bool VirtualMarker::Update ( float frame_time )
{
// clamp the markers to the table
velocity_.set_z ( 0.0f );
VirtualObject::Update ( frame_time );
rotationalAccelaration *= 0.9f;
rotation += rotationalAccelaration;
gef::Matrix44 scale;
scale.Scale ( scale_ );
gef::Matrix44 rotate;
rotate.RotationZ ( rotation );
gef::Matrix44 transform = rotate;
transform.SetTranslation ( position_ );
marker_transform = transform;
transform = scale * rotate;
transform.SetTranslation ( position_ );
set_transform ( transform );
return true;
}