diff --git a/rogueviz/smoothcam.cpp b/rogueviz/smoothcam.cpp index b8c507a2..96ba38dd 100644 --- a/rogueviz/smoothcam.cpp +++ b/rogueviz/smoothcam.cpp @@ -8,22 +8,65 @@ // to add: insert positions? split/merge segments? improved join? +namespace rogueviz { +namespace smoothcam { +struct frame { + string title; + cell *where; + transmatrix sView; + transmatrix V; + transmatrix ori; + ld front_distance, up_distance; + ld interval; + map params; + }; + +struct animation { + cell *start_cell; + transmatrix start; + ld start_interval; + vector frames; + }; + +} +} + namespace hr { -using pcell = cell*; + using pcell = cell*; -inline void hread(hstream& hs, transmatrix& h) { for(int i=0; i(mapstream::cellids[c]); + } + + static void hread(hstream& hs, pcell& c) { + int32_t at = hs.get(); + c = mapstream::cellbyid[at]; + } + + static void hread(hstream& hs, transmatrix& h) { for(int i=0; i(mapstream::cellids[c]); } -inline void hread(hstream& hs, pcell& c) { - int32_t at = hs.get(); - c = mapstream::cellbyid[at]; - } - +namespace rogueviz { + namespace smoothcam { string smooth_camera_help = @@ -39,23 +82,6 @@ string smooth_camera_help = "as the actual position, while Y-X will be the first derivative. Thus, for example, " "placing two equal positions with interval 0 will force the camera to smoothly stop."; -struct frame { - string title; - cell *where; - transmatrix sView; - transmatrix V; - transmatrix ori; - ld front_distance, up_distance; - ld interval; - }; - -struct animation { - cell *start_cell; - transmatrix start; - ld start_interval; - vector frames; - }; - map > labels; map > > traces; @@ -606,22 +632,6 @@ void generate_trace() { send(); } -void hwrite(hstream& hs, const animation& anim) { - hwrite(hs, anim.start_cell, anim.start, anim.start_interval, anim.frames); - } - -void hread(hstream& hs, animation& anim) { - hread(hs, anim.start_cell, anim.start, anim.start_interval, anim.frames); - } - -void hwrite(hstream& hs, const frame& frame) { - hwrite(hs, frame.title, frame.where, frame.sView, frame.V, frame.ori, frame.front_distance, frame.up_distance, frame.interval); - } - -void hread(hstream& hs, frame& frame) { - hread(hs, frame.title, frame.where, frame.sView, frame.V, frame.ori, frame.front_distance, frame.up_distance, frame.interval); - } - bool draw_labels(cell *c, const shiftmatrix& V) { if(view_labels) for(auto& p: labels[c]) queuestr(V * rgpushxto0(p.first), .1, p.second, 0xFFFFFFFF, 1);