@@ -208,24 +208,44 @@ struct CI_API ScopedViewport : private Noncopyable {
208208};
209209
210210struct CI_API ScopedModelMatrix : private Noncopyable {
211- ScopedModelMatrix () { gl::pushModelMatrix (); }
212- ~ScopedModelMatrix () { gl::popModelMatrix (); }
211+ ScopedModelMatrix () { gl::pushModelMatrix (); }
212+ explicit ScopedModelMatrix ( const mat4 &m )
213+ {
214+ gl::pushModelMatrix ();
215+ gl::setModelMatrix ( m );
216+ }
217+ ~ScopedModelMatrix () { gl::popModelMatrix (); }
213218};
214219
215220struct CI_API ScopedViewMatrix : private Noncopyable {
216- ScopedViewMatrix () { gl::pushViewMatrix (); }
217- ~ScopedViewMatrix () { gl::popViewMatrix (); }
221+ ScopedViewMatrix () { gl::pushViewMatrix (); }
222+ explicit ScopedViewMatrix ( const mat4 &m )
223+ {
224+ gl::pushViewMatrix ();
225+ gl::setViewMatrix ( m );
226+ }
227+ ~ScopedViewMatrix () { gl::popViewMatrix (); }
218228};
219229
220230struct CI_API ScopedProjectionMatrix : private Noncopyable {
221- ScopedProjectionMatrix () { gl::pushProjectionMatrix (); }
222- ~ScopedProjectionMatrix () { gl::popProjectionMatrix (); }
231+ ScopedProjectionMatrix () { gl::pushProjectionMatrix (); }
232+ explicit ScopedProjectionMatrix ( const mat4 &m )
233+ {
234+ gl::pushProjectionMatrix ();
235+ gl::setProjectionMatrix ( m );
236+ }
237+ ~ScopedProjectionMatrix () { gl::popProjectionMatrix (); }
223238};
224239
225240// ! Preserves all matrices
226241struct CI_API ScopedMatrices : private Noncopyable {
227- ScopedMatrices () { gl::pushMatrices (); }
228- ~ScopedMatrices () { gl::popMatrices (); }
242+ ScopedMatrices () { gl::pushMatrices (); }
243+ explicit ScopedMatrices ( const Camera &cam )
244+ {
245+ gl::pushMatrices ();
246+ gl::setMatrices ( cam );
247+ }
248+ ~ScopedMatrices () { gl::popMatrices (); }
229249};
230250
231251// ! Scopes state of face culling.
0 commit comments