|
@ -10,7 +10,7 @@ using Vec2 = math::Vec2; |
|
|
using LineKind = simulation::LineKind; |
|
|
using LineKind = simulation::LineKind; |
|
|
|
|
|
|
|
|
using ball_info = int; |
|
|
using ball_info = int; |
|
|
using line_info = void; |
|
|
using line_info = int; |
|
|
using ball_type = simulation::Ball<ball_info>; |
|
|
using ball_type = simulation::Ball<ball_info>; |
|
|
using line_type = simulation::Line<line_info>; |
|
|
using line_type = simulation::Line<line_info>; |
|
|
using simu_type = simulation::Simulation<ball_info, line_info>; |
|
|
using simu_type = simulation::Simulation<ball_info, line_info>; |
|
@ -19,18 +19,24 @@ using note_info = Vec2; |
|
|
using note_type = Note<note_info>; |
|
|
using note_type = Note<note_info>; |
|
|
using beat_type = Beat<note_info>; |
|
|
using beat_type = Beat<note_info>; |
|
|
|
|
|
|
|
|
|
|
|
// Pretty unuseful in server
|
|
|
struct AbstractLine { |
|
|
struct AbstractLine { |
|
|
math::Vec2 starting_point; |
|
|
math::Vec2 starting_point; |
|
|
math::Vec2 end_point; |
|
|
math::Vec2 end_point; |
|
|
|
|
|
|
|
|
|
|
|
int ID; |
|
|
int line_kind; |
|
|
int line_kind; |
|
|
|
|
|
|
|
|
const float hsize = 5.0f; |
|
|
static constexpr float hsize = 5.0f; |
|
|
|
|
|
|
|
|
AbstractLine() = default; |
|
|
AbstractLine() = default; |
|
|
|
|
|
AbstractLine(AbstractLine const&) = default; |
|
|
|
|
|
AbstractLine& operator=(AbstractLine const&) = default; |
|
|
|
|
|
|
|
|
AbstractLine(math::Vec2 starting_point, math::Vec2 end_point, int line_kind) |
|
|
AbstractLine(math::Vec2 starting_point, math::Vec2 end_point, int line_kind, int ID) |
|
|
: starting_point(starting_point) |
|
|
: starting_point(starting_point) |
|
|
, end_point(end_point) |
|
|
, end_point(end_point) |
|
|
|
|
|
, ID(ID) |
|
|
, line_kind(line_kind) |
|
|
, line_kind(line_kind) |
|
|
{} |
|
|
{} |
|
|
|
|
|
|
|
@ -42,16 +48,16 @@ struct AbstractLine { |
|
|
|
|
|
|
|
|
if(line_kind == simulation::kOneWay){ |
|
|
if(line_kind == simulation::kOneWay){ |
|
|
std::vector<line_type> ret; |
|
|
std::vector<line_type> ret; |
|
|
ret.emplace_back(starting_point + hsize*normal, end_point + hsize*normal, lk); |
|
|
ret.emplace_back(starting_point + hsize*normal, end_point + hsize*normal, lk, ID); |
|
|
ret.emplace_back(end_point + hsize*normal, end_point + hsize*dir, lk); |
|
|
ret.emplace_back(end_point + hsize*normal, end_point + hsize*dir, lk, ID); |
|
|
ret.emplace_back(end_point + hsize*dir, end_point - hsize*normal, lk); |
|
|
ret.emplace_back(end_point + hsize*dir, end_point - hsize*normal, lk, ID); |
|
|
ret.emplace_back(end_point - hsize*normal, starting_point - hsize*normal, lk); |
|
|
ret.emplace_back(end_point - hsize*normal, starting_point - hsize*normal, lk, ID); |
|
|
ret.emplace_back(starting_point - hsize*normal, starting_point - hsize*dir, lk); |
|
|
ret.emplace_back(starting_point - hsize*normal, starting_point - hsize*dir, lk, ID); |
|
|
ret.emplace_back(starting_point - hsize*dir, starting_point + hsize*normal, lk); |
|
|
ret.emplace_back(starting_point - hsize*dir, starting_point + hsize*normal, lk, ID); |
|
|
return ret; |
|
|
return ret; |
|
|
} else { |
|
|
} else { |
|
|
std::vector<line_type> ret; |
|
|
std::vector<line_type> ret; |
|
|
ret.emplace_back(starting_point, end_point, lk); |
|
|
ret.emplace_back(starting_point, end_point, lk, ID); |
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -61,6 +67,7 @@ BOOST_FUSION_ADAPT_STRUCT( |
|
|
AbstractLine, |
|
|
AbstractLine, |
|
|
(::math::Vec2, starting_point) |
|
|
(::math::Vec2, starting_point) |
|
|
(::math::Vec2, end_point) |
|
|
(::math::Vec2, end_point) |
|
|
|
|
|
(int, ID) |
|
|
(int, line_kind) |
|
|
(int, line_kind) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -94,12 +101,14 @@ BOOST_FUSION_ADAPT_STRUCT( |
|
|
struct cheap_line_type { |
|
|
struct cheap_line_type { |
|
|
IntVec2 starting_point; |
|
|
IntVec2 starting_point; |
|
|
IntVec2 end_point; |
|
|
IntVec2 end_point; |
|
|
|
|
|
int ID; |
|
|
int line_kind; |
|
|
int line_kind; |
|
|
|
|
|
|
|
|
cheap_line_type() = default; |
|
|
cheap_line_type() = default; |
|
|
cheap_line_type(AbstractLine const & l) |
|
|
cheap_line_type(AbstractLine const & l) |
|
|
: starting_point(l.starting_point) |
|
|
: starting_point(l.starting_point) |
|
|
, end_point(l.end_point) |
|
|
, end_point(l.end_point) |
|
|
|
|
|
, ID(l.ID) |
|
|
, line_kind(l.line_kind) |
|
|
, line_kind(l.line_kind) |
|
|
{} |
|
|
{} |
|
|
}; |
|
|
}; |
|
@ -108,5 +117,6 @@ BOOST_FUSION_ADAPT_STRUCT( |
|
|
cheap_line_type, |
|
|
cheap_line_type, |
|
|
(IntVec2, starting_point) |
|
|
(IntVec2, starting_point) |
|
|
(IntVec2, end_point) |
|
|
(IntVec2, end_point) |
|
|
|
|
|
(int, ID) |
|
|
(int, line_kind) |
|
|
(int, line_kind) |
|
|
) |
|
|
) |
|
|