Exemplo n.º 1
0
 /// <summary>
 /// Extension method for <see cref="IViewCamera"/> to get view matrix.
 /// </summary>
 /// <param name="camera"></param>
 /// <returns></returns>
 public static GlmNet.mat4 GetViewMat4(this IViewCamera camera)
 {
     GlmNet.vec3 position = ToVec3(camera.Position);
     GlmNet.vec3 target   = ToVec3(camera.Target);
     GlmNet.vec3 up       = ToVec3(camera.UpVector);
     GlmNet.mat4 lookAt   = GlmNet.glm.lookAt(position, target, up);
     return(lookAt);
 }
Exemplo n.º 2
0
        internal static Point ScreenToWorld(Point screenPoint, IEditorNode i)
        {
            // converts it to vec3
            GlmNet.vec3 scrPt = Utilities.PointToVec3(screenPoint);

            // project from screen to world location this point, according to the current
            // projection_view matrix.
            GlmNet.vec3 unprojectedPoint1 = GlmNet.glm.unProject(
                scrPt,
                i.GetModel(),
                Camera.Instance().GetProjectionView(),
                Camera.Instance().GetViewport());

            // converts to point
            return(new Point((int)unprojectedPoint1.x, (int)unprojectedPoint1.y));
        }
Exemplo n.º 3
0
 public vec3(vec3 v)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
 }
Exemplo n.º 4
0
 //  TODO: this is actually defined as an extension, put in the right file.
 public static mat4 rotate(float angle, vec3 v)
 {
     return(rotate(mat4.identity(), angle, v));
 }
Exemplo n.º 5
0
 public vec2(vec3 v)
 {
     this.x = v.x;
     this.y = v.y;
 }