forked from XutaxKamay/css_enhanced
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmetransform.cpp
82 lines (66 loc) · 2.11 KB
/
dmetransform.cpp
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#include "movieobjects/dmetransform.h"
#include "tier0/dbg.h"
#include "datamodel/dmelementfactoryhelper.h"
#include "mathlib/vector.h"
#include "mathlib/mathlib.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Expose this class to the scene database
//-----------------------------------------------------------------------------
IMPLEMENT_ELEMENT_FACTORY( DmeTransform, CDmeTransform );
//-----------------------------------------------------------------------------
// Constructor, destructor
//-----------------------------------------------------------------------------
void CDmeTransform::OnConstruction()
{
m_Position.Init( this, "position" );
m_Orientation.Init( this, "orientation" );
}
void CDmeTransform::OnDestruction()
{
}
//-----------------------------------------------------------------------------
// FIXME: Replace this with actual methods to do editing
//-----------------------------------------------------------------------------
void CDmeTransform::SetTransform( const matrix3x4_t &transform )
{
Vector origin;
Quaternion angles;
MatrixAngles( transform, angles, origin );
m_Orientation.Set( angles );
m_Position.Set( origin );
}
void CDmeTransform::GetTransform( matrix3x4_t &transform )
{
QuaternionMatrix( m_Orientation.Get(), m_Position.Get(), transform );
}
const Vector &CDmeTransform::GetPosition() const
{
return m_Position.Get();
}
void CDmeTransform::SetPosition( const Vector &vecPosition )
{
m_Position = vecPosition;
}
const Quaternion &CDmeTransform::GetOrientation() const
{
return m_Orientation.Get();
}
void CDmeTransform::SetOrientation( const Quaternion &orientation )
{
m_Orientation = orientation;
}
CDmAttribute *CDmeTransform::GetPositionAttribute()
{
return m_Position.GetAttribute();
}
CDmAttribute *CDmeTransform::GetOrientationAttribute()
{
return m_Orientation.GetAttribute();
}