File tree 4 files changed +26
-5
lines changed
4 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,13 @@ class Multiplexer:
256
256
auto l = lock ();
257
257
return m_Units.empty ();
258
258
}
259
+ void sync () {
260
+ while (true ){
261
+ if (empty ())
262
+ return ;
263
+ boost::this_thread::yield ();
264
+ };
265
+ }
259
266
size_t buffered () const {
260
267
auto l = lock ();
261
268
return m_Buffered;
Original file line number Diff line number Diff line change @@ -291,10 +291,11 @@ class Animation:
291
291
m_Frames.clear ();
292
292
}
293
293
void finish (){
294
- process ();
295
294
if (!m_Frames.empty ()) {
296
- m_Current = m_Frames.back ().value ();
295
+ auto current = m_Frames.back ().value ();
296
+ process ();
297
297
m_Frames.clear ();
298
+ m_Current = current;
298
299
}
299
300
}
300
301
void stop (T position) {
Original file line number Diff line number Diff line change @@ -607,6 +607,14 @@ namespace kit
607
607
c.erase (std::remove (ENTIRE (c), o), c.end ());
608
608
}
609
609
610
+ template <class T , class ...Args>
611
+ std::future<T> make_future (Args&&... args)
612
+ {
613
+ std::promise<T> tmp;
614
+ tmp.set_value (std::forward<Args>(args)...);
615
+ return tmp.get_future ();
616
+ }
617
+
610
618
template <class T , class ... Args>
611
619
std::unique_ptr<T> make_unique (Args&&... args)
612
620
{
Original file line number Diff line number Diff line change @@ -101,11 +101,16 @@ namespace Matrix {
101
101
f[10 ]=v[2 ];
102
102
f[15 ]=1 .0f ;
103
103
}
104
- // assuming uniform scale
105
- inline float uniform_scale (glm::mat4& m) {
106
- float * f = glm::value_ptr (m);
104
+
105
+ inline float uniform_scale (const glm::mat4& m) {
106
+ const float * f = glm::value_ptr (m);
107
107
return f[0 ];
108
108
}
109
+ inline glm::vec3 scale (const glm::mat4& m) {
110
+ const float * f = glm::value_ptr (m);
111
+ return glm::vec3 (f[0 ], f[5 ], f[10 ]);
112
+ }
113
+
109
114
// inline float average_scale(glm::mat4& m) {
110
115
// float* f = glm::value_ptr(m);
111
116
// return (f[0] + f[5] + f[10]) / 3.0f;
You can’t perform that action at this time.
0 commit comments