4
4
5
5
namespace FinalEngine . ECS . Components . Core ;
6
6
7
+ using System . ComponentModel ;
7
8
using System . Numerics ;
8
9
9
10
/// <summary>
10
- /// Provides a component that represents the translation, rotation and scale of an entity.
11
+ /// Provides a component that represents the translation, rotation and scale of an entity.
11
12
/// </summary>
12
- /// <seealso cref="IEntityComponent" />
13
+ /// <seealso cref="IEntityComponent"/>
14
+ [ Category ( "Core" ) ]
13
15
public sealed class TransformComponent : IEntityComponent
14
16
{
15
17
/// <summary>
16
- /// Initializes a new instance of the <see cref="TransformComponent"/> class.
18
+ /// Initializes a new instance of the <see cref="TransformComponent"/> class.
17
19
/// </summary>
18
20
public TransformComponent ( )
19
21
{
@@ -23,100 +25,100 @@ public TransformComponent()
23
25
}
24
26
25
27
/// <summary>
26
- /// Gets a normalized vector representing the negative Z-axis of the transform in world space.
28
+ /// Gets a normalized vector representing the negative Z-axis of the transform in world space.
27
29
/// </summary>
28
30
/// <value>
29
- /// The normalized vector representing the Z-axis of the transform in world space..
31
+ /// The normalized vector representing the Z-axis of the transform in world space..
30
32
/// </value>
31
33
public Vector3 Backward
32
34
{
33
35
get { return Vector3 . Normalize ( Vector3 . Transform ( - Vector3 . UnitZ , this . Rotation ) ) ; }
34
36
}
35
37
36
38
/// <summary>
37
- /// Gets a normalized vector representing the negative Y-axis of the transform in world space.
39
+ /// Gets a normalized vector representing the negative Y-axis of the transform in world space.
38
40
/// </summary>
39
41
/// <value>
40
- /// The normalized vector representing the negative Y-axis of the transform in world space.
42
+ /// The normalized vector representing the negative Y-axis of the transform in world space.
41
43
/// </value>
42
44
public Vector3 Down
43
45
{
44
46
get { return Vector3 . Normalize ( Vector3 . Transform ( - Vector3 . UnitY , this . Rotation ) ) ; }
45
47
}
46
48
47
49
/// <summary>
48
- /// Gets a normalized vector representing the Z-axis of the transform in world space.
50
+ /// Gets a normalized vector representing the Z-axis of the transform in world space.
49
51
/// </summary>
50
52
/// <value>
51
- /// The normalized vector representing the Z-axis of the transform in world space..
53
+ /// The normalized vector representing the Z-axis of the transform in world space..
52
54
/// </value>
53
55
public Vector3 Forward
54
56
{
55
57
get { return Vector3 . Normalize ( Vector3 . Transform ( Vector3 . UnitZ , this . Rotation ) ) ; }
56
58
}
57
59
58
60
/// <summary>
59
- /// Gets a normalized vector representing the negative X-axis of the transform in world space.
61
+ /// Gets a normalized vector representing the negative X-axis of the transform in world space.
60
62
/// </summary>
61
63
/// <value>
62
- /// The normalized vector representing the negative X-axis of the transform in world space.
64
+ /// The normalized vector representing the negative X-axis of the transform in world space.
63
65
/// </value>
64
66
public Vector3 Left
65
67
{
66
68
get { return Vector3 . Normalize ( Vector3 . Transform ( - Vector3 . UnitX , this . Rotation ) ) ; }
67
69
}
68
70
69
71
/// <summary>
70
- /// Gets or sets the position of the transform.
72
+ /// Gets or sets the position of the transform.
71
73
/// </summary>
72
74
/// <value>
73
- /// The position of the transform.
75
+ /// The position of the transform.
74
76
/// </value>
75
77
public Vector3 Position { get ; set ; }
76
78
77
79
/// <summary>
78
- /// Gets a normalized vector representing the X-axis of the transform in world space.
80
+ /// Gets a normalized vector representing the X-axis of the transform in world space.
79
81
/// </summary>
80
82
/// <value>
81
- /// The normalized vector representing the negative X-axis of the transform in world space.
83
+ /// The normalized vector representing the negative X-axis of the transform in world space.
82
84
/// </value>
83
85
public Vector3 Right
84
86
{
85
87
get { return Vector3 . Normalize ( Vector3 . Transform ( Vector3 . UnitX , this . Rotation ) ) ; }
86
88
}
87
89
88
90
/// <summary>
89
- /// Gets or sets the rotation of this transform.
91
+ /// Gets or sets the rotation of this transform.
90
92
/// </summary>
91
93
/// <value>
92
- /// The rotation of this transform.
94
+ /// The rotation of this transform.
93
95
/// </value>
94
96
public Quaternion Rotation { get ; set ; }
95
97
96
98
/// <summary>
97
- /// Gets or sets the scale.
99
+ /// Gets or sets the scale.
98
100
/// </summary>
99
101
/// <value>
100
- /// The scale.
102
+ /// The scale.
101
103
/// </value>
102
104
public Vector3 Scale { get ; set ; }
103
105
104
106
/// <summary>
105
- /// Gets a normalized vector representing the Y-axis of the transform in world space.
107
+ /// Gets a normalized vector representing the Y-axis of the transform in world space.
106
108
/// </summary>
107
109
/// <value>
108
- /// The normalized vector representing the negative Y-axis of the transform in world space.
110
+ /// The normalized vector representing the negative Y-axis of the transform in world space.
109
111
/// </value>
110
112
public Vector3 Up
111
113
{
112
114
get { return Vector3 . Normalize ( Vector3 . Transform ( Vector3 . UnitY , this . Rotation ) ) ; }
113
115
}
114
116
115
117
/// <summary>
116
- /// Creates the transformation matrix for this transform.
118
+ /// Creates the transformation matrix for this transform.
117
119
/// </summary>
118
120
/// <returns>
119
- /// The newly create <see cref="Matrix4x4"/> that represents the transformation matrix for this transform.
121
+ /// The newly create <see cref="Matrix4x4"/> that represents the transformation matrix for this transform.
120
122
/// </returns>
121
123
public Matrix4x4 CreateTransformationMatrix ( )
122
124
{
@@ -126,27 +128,27 @@ public Matrix4x4 CreateTransformationMatrix()
126
128
}
127
129
128
130
/// <summary>
129
- /// Creates the view matrix for this transform.
131
+ /// Creates the view matrix for this transform.
130
132
/// </summary>
131
133
/// <param name="cameraUp">
132
- /// The camera up vector.
134
+ /// The camera up vector.
133
135
/// </param>
134
136
/// <returns>
135
- /// The newly created <see cref="Matrix4x4"/> that represents the view matrix for this transform.
137
+ /// The newly created <see cref="Matrix4x4"/> that represents the view matrix for this transform.
136
138
/// </returns>
137
139
public Matrix4x4 CreateViewMatrix ( Vector3 cameraUp )
138
140
{
139
141
return Matrix4x4 . CreateLookAt ( this . Position , this . Position + this . Forward , cameraUp ) ;
140
142
}
141
143
142
144
/// <summary>
143
- /// Rotates this transform on the specified <paramref name="axis"/> by the specified <paramref name="radians"/>.
145
+ /// Rotates this transform on the specified <paramref name="axis"/> by the specified <paramref name="radians"/>.
144
146
/// </summary>
145
147
/// <param name="axis">
146
- /// The axis to rotate.
148
+ /// The axis to rotate.
147
149
/// </param>
148
150
/// <param name="radians">
149
- /// The radians that represents the amount to rotate by.
151
+ /// The radians that represents the amount to rotate by.
150
152
/// </param>
151
153
public void Rotate ( Vector3 axis , float radians )
152
154
{
@@ -155,13 +157,13 @@ public void Rotate(Vector3 axis, float radians)
155
157
}
156
158
157
159
/// <summary>
158
- /// Translates this transform in the specified <paramref name="direction"/> by the specified <paramref name="amount"/>.
160
+ /// Translates this transform in the specified <paramref name="direction"/> by the specified <paramref name="amount"/>.
159
161
/// </summary>
160
162
/// <param name="direction">
161
- /// The direction to translate.
163
+ /// The direction to translate.
162
164
/// </param>
163
165
/// <param name="amount">
164
- /// The amount to translate.
166
+ /// The amount to translate.
165
167
/// </param>
166
168
public void Translate ( Vector3 direction , float amount )
167
169
{
0 commit comments