yufeih / Nine.Graphics

A real-time rendering library
MIT License
42 stars 8 forks source link

Cameras #5

Open erictuvesson opened 9 years ago

erictuvesson commented 9 years ago

How should we handle cameras? Adding a Matrix parameter to IRenderer.Draw(...) ?

And OpenTK doesn't support System.Numerics.Vector's for GL.UniformMatrix4(...) . So we either have to convert the matrices or use unsafe code like OpenTK.

yufeih commented 9 years ago

Adding a Matrix parameter to IRenderer.Draw(...) ?

Yeah, but we'll need Matrix3x2 for 2D cameras and two Matrix4x4 (view and projection) for 3D cameras. This cannot be added to IRenderer<T>, so we'll first remove the IRenderer<T> interface and add the parameters to SpriteRenderer.Draw and ModelRenderer.Draw methods.

So we either have to convert the matrices or use unsafe code

WP8/Silverlight prevents the use of unsafe code. Now that our target is corefx/Windows 10, unsafe code can be used for performance sensitive code path.

yufeih commented 9 years ago

OpenTK is also discussing using System.Numerics.Vectors https://github.com/opentk/opentk/issues/245 , so the problem will go away when everything works on top of the same vector library.