Beispiel #1
0
 public Vec2 this[int index]
 {
     get
     {
         Vec2 vec = new Vec2();
         FCE_Spline_GetPoint(this.m_splinePtr, index, out vec.X, out vec.Y);
         return vec;
     }
     set
     {
         FCE_Spline_SetPoint(this.m_splinePtr, index, value.X, value.Y);
     }
 }
Beispiel #2
0
 public static void DrawScreenRectangleOutlined(RectangleF rect, float z, float penWidth, Color color)
 {
     SizeF size = rect.Size;
     Vec2 vec = new Vec2(rect.X + (size.Width / 2f), rect.Y + (size.Height / 2f));
     FCE_Draw_ScreenRectangleOutlined(vec.X, vec.Y, z, size.Width, size.Height, penWidth, ((float)color.R) / 255f, ((float)color.G) / 255f, ((float)color.B) / 255f, ((float)color.A) / 255f);
 }
Beispiel #3
0
 public static void DrawScreenCircleOutlined(Vec2 center, float z, float radius, float penWidth, Color color)
 {
     FCE_Draw_ScreenCircleOutlined(center.X, center.Y, z, radius, penWidth, ((float)color.R) / 255f, ((float)color.G) / 255f, ((float)color.B) / 255f, ((float)color.A) / 255f);
 }
Beispiel #4
0
 public void AddPoint(Vec2 point)
 {
     FCE_Spline_AddPoint(this.m_splinePtr, point.X, point.Y);
 }
Beispiel #5
0
 public void InsertPoint(Vec2 point, int index)
 {
     FCE_Spline_InsertPoint(this.m_splinePtr, point.X, point.Y, index);
 }
Beispiel #6
0
 public static float Dot(Vec2 v1, Vec2 v2)
 {
     return ((v1.X * v2.X) + (v1.Y * v2.Y));
 }
Beispiel #7
0
 public bool HitTestSegments(Vec2 center, float radius, out int hitIndex, out Vec2 hitPos)
 {
     return FCE_Spline_HitTestSegments(this.m_splinePtr, center.X, center.Y, radius, out hitIndex, out hitPos.X, out hitPos.Y);
 }
Beispiel #8
0
 public static bool RayCastTerrainFromScreenPoint(Vec2 screenPoint, out Vec3 hitPos)
 {
     Vec3 vec;
     Vec3 vec2;
     float num;
     GetWorldRayFromScreenPoint(screenPoint, out vec, out vec2);
     return RayCastTerrain(vec, vec2, out hitPos, out num);
 }
        private void Viewport_MouseMove(object sender, MouseEventArgs e)
        {
            if (!this.CaptureMouse)
            {
                this.m_normalizedMousePos = new Vec2(((float)e.X) / ((float)base.ClientSize.Width), ((float)e.Y) / ((float)base.ClientSize.Height));
                Editor.OnMouseEvent(Editor.MouseEvent.MouseMove, e);
            }
            else if (true)
            {
                Point point = base.PointToScreen(new Point(base.Width / 2, base.Height / 2));
                int x = Cursor.Position.X - point.X;
                int y = Cursor.Position.Y - point.Y;
                if ((x != 0) || (y != 0))
                {
                    switch (this.CameraMode)
                    {
                        case CameraModes.Lookaround:
                            Camera.Rotate((EditorSettings.InvertMouseView ? ((float)y) : ((float)-y)) * 0.005f, 0f, -x * 0.005f);
                            break;

                        case CameraModes.Panning:
                            Camera.Position += (Vec3)(((Camera.RightVector * x) * 0.125f) + ((Camera.UpVector * (EditorSettings.InvertMousePan ? ((float)y) : ((float)-y))) * 0.125f));
                            break;

                        default:
                            Editor.OnMouseEvent(Editor.MouseEvent.MouseMoveDelta, new MouseEventArgs(e.Button, e.Clicks, x, y, e.Delta));
                            break;
                    }
                    Cursor.Position = point;
                }
            }
        }
Beispiel #10
0
 public static void GetWorldRayFromScreenPoint(Vec2 screenPoint, out Vec3 raySrc, out Vec3 rayDir)
 {
     FCE_Editor_GetWorldRayFromScreenPoint(screenPoint.X, screenPoint.Y, out raySrc.X, out raySrc.Y, out raySrc.Z, out rayDir.X, out rayDir.Y, out rayDir.Z);
 }
Beispiel #11
0
 public static bool RayCastPhysicsFromScreenPoint(Vec2 screenPoint, out Vec3 hitPos)
 {
     Vec3 vec;
     Vec3 vec2;
     float num;
     GetWorldRayFromScreenPoint(screenPoint, out vec, out vec2);
     return RayCastPhysics(vec, vec2, EditorObject.Null, out hitPos, out num);
 }
Beispiel #12
0
 public static bool GetScreenPointFromWorldPos(Vec3 worldPos, out Vec2 screenPoint, bool clipped)
 {
     bool flag = FCE_Editor_GetScreenPointFromWorldPos(worldPos.X, worldPos.Y, worldPos.Z, out screenPoint.X, out screenPoint.Y);
     if (flag && clipped)
     {
     screenPoint.X = Math.Min(Math.Max(0f, screenPoint.X), 1f);
     screenPoint.Y = Math.Min(Math.Max(0f, screenPoint.Y), 1f);
     }
     return flag;
 }
Beispiel #13
0
 public static bool GetScreenPointFromWorldPos(Vec3 worldPos, out Vec2 screenPoint)
 {
     return GetScreenPointFromWorldPos(worldPos, out screenPoint, false);
 }
Beispiel #14
0
 // Methods
 public static void ApplyScreenDeltaToWorldPos(Vec2 screenDelta, ref Vec3 worldPos)
 {
     Vec3 frontVector = Camera.FrontVector;
     if ((Math.Abs(frontVector.X) < 0.001) && (Math.Abs(frontVector.Y) < 0.001))
     {
     frontVector = Camera.UpVector;
     }
     Vec2 vec2 = -(frontVector.XY);
     vec2.Normalize();
     Vec2 vec3 = new Vec2(-vec2.Y, vec2.X);
     float num = (float) ((Vec3.Dot(worldPos - Camera.Position, Camera.FrontVector) * Math.Tan((double) Camera.HalfFOV)) * 2.0);
     worldPos.X += ((num * screenDelta.X) * vec3.X) + ((num * screenDelta.Y) * vec2.X);
     worldPos.Y += ((num * screenDelta.X) * vec3.Y) + ((num * screenDelta.Y) * vec2.Y);
 }
Beispiel #15
0
 public static void DrawTerrainSquare(Vec2 center, float radius, float penWidth, Color color, float zOrder)
 {
     FCE_Draw_Terrain_Square(center.X, center.Y, radius, penWidth, ((float)color.R) / 255f, ((float)color.G) / 255f, ((float)color.B) / 255f, ((float)color.A) / 255f, zOrder);
 }
Beispiel #16
0
 public bool HitTestPoints(Vec2 point, float penWidth, float hitWidth, out int hitIndex, out Vec2 hitPos)
 {
     return FCE_Spline_HitTestPoints(this.m_splinePtr, point.X, point.Y, penWidth, hitWidth, out hitIndex, out hitPos.X, out hitPos.Y);
 }
 public void MoveSelection(Vec2 delta)
 {
     FCE_SplineController_MoveSelection(this.m_controllerPtr, delta.X, delta.Y);
 }
Beispiel #18
0
 static Vec2()
 {
     Zero = new Vec2(0f, 0f);
 }