FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SolarSystem/Scene/object3d.cpp at dev · Instand/SolarSystem · GitHub
Instand
/
SolarSystem
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
44
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SolarSystem
/
Scene
/
object3d.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
162 lines (126 loc) · 2.97 KB
Breadcrumbs
SolarSystem
/
Scene
/
object3d.cpp
Copy path
File metadata and controls
162 lines (126 loc) · 2.97 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#
include
"
object3d.h
"
#
include
<
Qt3DLogic/QFrameAction
>
#
include
<
Qt3DCore/QTransform
>
#
include
<
Qt3DRender/QGeometryRenderer
>
#
include
<
Qt3DRender/QObjectPicker
>
#
include
<
Qt3DRender/QMaterial
>
SolarSystem::Object3D::Object3D
(Qt3DCore::QNode* parent):
QEntity(parent)
{
m_frameAction =
new
Qt3DLogic::QFrameAction
(
this
);
m_transform =
new
Qt3DCore::QTransform
(
this
);
m_picker =
new
Qt3DRender::QObjectPicker
(
this
);
m_picker->
setDragEnabled
(
false
);
m_picker->
setEnabled
(
true
);
addComponent
(m_frameAction);
addComponent
(m_transform);
addComponent
(m_picker);
QObject::connect
(m_frameAction, &Qt3DLogic::QFrameAction::triggered,
this
, [
this
](
float
deltaTime) {
//
additional actions
for
(
const
auto
& elem : m_logic)
elem
(deltaTime);
update
(deltaTime);
});
}
void
SolarSystem::Object3D::update
(
float
deltaTime)
{
Q_UNUSED
(deltaTime)
baseBehaviour
();
}
void
SolarSystem::Object3D::addLogic
(SolarSystem::LogicPtr func)
{
m_logic.
push_back
(func);
}
void
SolarSystem::Object3D::clearLogic
()
{
m_logic.
clear
();
}
Qt3DCore::QTransform*
SolarSystem::Object3D::transform
()
const
{
return
m_transform;
}
Qt3DRender::QGeometryRenderer*
SolarSystem::Object3D::renderer
()
const
{
return
m_renderer;
}
Qt3DRender::QObjectPicker*
SolarSystem::Object3D::picker
()
const
{
return
m_picker;
}
Qt3DRender::QMaterial*
SolarSystem::Object3D::material
()
const
{
return
m_material;
}
SolarSystem::SolarObjects
SolarSystem::Object3D::solarType
()
const
{
return
m_solarType;
}
void
SolarSystem::Object3D::setSolarType
(SolarSystem::SolarObjects type)
{
m_solarType = type;
}
SolarSystem::SolarMaterials
SolarSystem::Object3D::materialType
()
const
{
return
m_materialType;
}
double
SolarSystem::Object3D::r
()
const
{
return
m_r;
}
void
SolarSystem::Object3D::setR
(
double
r)
{
m_r = r;
}
double
SolarSystem::Object3D::x
()
const
{
return
m_x;
}
void
SolarSystem::Object3D::setX
(
double
x)
{
m_x = x;
}
double
SolarSystem::Object3D::y
()
const
{
return
m_y;
}
void
SolarSystem::Object3D::setY
(
double
y)
{
m_y = y;
}
double
SolarSystem::Object3D::z
()
const
{
return
m_z;
}
void
SolarSystem::Object3D::setZ
(
double
z)
{
m_z = z;
}
double
SolarSystem::Object3D::roll
()
const
{
return
m_roll;
}
void
SolarSystem::Object3D::setRoll
(
double
roll)
{
m_roll = roll;
}
double
SolarSystem::Object3D::tilt
()
const
{
return
m_tilt;
}
void
SolarSystem::Object3D::setTilt
(
double
tilt)
{
m_tilt = tilt;
}
QVector3D
SolarSystem::Object3D::position
()
const
{
return
QVector3D
(
static_cast
<
float
>(m_x),
static_cast
<
float
>(m_y),
static_cast
<
float
>(m_z));
}
void
SolarSystem::Object3D::baseBehaviour
()
{
auto
matrix =
QMatrix4x4
();
matrix.
translate
(
position
());
matrix.
rotate
(
static_cast
<
float
>(m_tilt), SolarValues::tiltAxis);
matrix.
rotate
(
static_cast
<
float
>(m_roll), SolarValues::rollAxis);
matrix.
scale
(
static_cast
<
float
>(m_r));
m_transform->
setMatrix
(matrix);
}
Back
|
FazBrowse Home
|
New Git URL