remove quat and little clean up math

This commit is contained in:
2019-12-18 19:25:23 +07:00
parent 36f516ab1c
commit 1fac2791d1
44 changed files with 218 additions and 1328 deletions

View File

@@ -13,7 +13,7 @@ namespace
};
struct renderer_rotator {
v3f axis;
v3f delta;
};
class game_system final : public systems::update_system {
@@ -68,16 +68,13 @@ namespace
[&event](const ecs::const_entity&, const node_rotator&, actor& act){
const node_iptr node = act.node();
if ( node ) {
node->rotation(make_rad(event.time));
node->rotation(event.time);
}
});
owner.for_joined_components<renderer_rotator, renderer>(
[&event](const ecs::const_entity&, const renderer_rotator& rot, renderer& r){
const q4f q = math::make_quat_from_axis_angle(
make_rad(event.time),
rot.axis);
r.rotation(q);
r.rotation(r.rotation() + rot.delta * event.dt);
});
}
};
@@ -114,7 +111,7 @@ namespace
the<world>().instantiate(
prefab,
scene_i.component<actor>()->node(),
make_trs2(v2f{0,50.f}, radf::zero(), v2f{20.f}));
make_trs2(v2f{0,50.f}, 0.f, v2f{20.f}));
}
{
@@ -147,7 +144,7 @@ namespace
for ( std::size_t j = 0; j < 5; ++j ) {
t2f trans{
{-80.f + j * 40.f, -200.f + i * 40.f},
radf::zero(),
0.f,
{2.f,2.f}};
gobject inst = the<world>().instantiate(
prefab_a,
@@ -159,7 +156,7 @@ namespace
.component<node_rotator>()
.component<actor>(node::create(make_trs2(
v2f{20.f,0.f},
radf::zero(),
0.f,
v2f{0.3f,0.3f})));
the<world>().instantiate(