Beispiel #1
0
 public static EditorObject GetObjectFromScreenPoint(Vec2 pt, out Vec3 hitPos, bool includeFrozen, EditorObjectSelection ignore)
 {
     EditorObject result;
     using (PhysEntityVector vector = PhysEntityVector.Create())
     {
         ignore.GetPhysEntities(vector);
         result = new EditorObject(Binding.FCE_ObjectManager_GetObjectFromScreenPoint(pt.X, pt.Y, out hitPos.X, out hitPos.Y, out hitPos.Z, includeFrozen, vector.Pointer));
     }
     return result;
 }
 protected override void OnPaint(float dt, Vec2 pos)
 {
     base.OnPaint(dt, pos);
     if (this.m_painting == ToolPaint.PaintingMode.Plus)
     {
         TerrainManipulator.SetHeight(pos, this.m_height, this.m_brush);
         return;
     }
     TerrainManipulator.Average(pos, this.m_brush);
 }
Beispiel #3
0
 public static EditorObject GetObjectFromScreenPoint(Vec2 pt, out Vec3 hitPos, bool includeFrozen, EditorObject ignore)
 {
     PhysEntityVector vector = PhysEntityVector.Null;
     if (ignore.IsValid)
     {
         vector = PhysEntityVector.Create();
         ignore.GetPhysEntities(vector);
     }
     EditorObject result = new EditorObject(Binding.FCE_ObjectManager_GetObjectFromScreenPoint(pt.X, pt.Y, out hitPos.X, out hitPos.Y, out hitPos.Z, includeFrozen, vector.Pointer));
     if (vector.IsValid)
     {
         vector.Dispose();
     }
     return result;
 }
Beispiel #4
0
 protected override void OnPaint(float dt, Vec2 pos)
 {
     base.OnPaint(dt, pos);
     int num;
     if (Control.ModifierKeys != Keys.Control)
     {
         num = this.m_paramCollection.Value;
         if (num == -1)
         {
             return;
         }
         CollectionInventory.Entry collectionEntryFromId = CollectionManager.GetCollectionEntryFromId(num);
         if (!collectionEntryFromId.IsValid)
         {
             return;
         }
     }
     else
     {
         num = CollectionManager.EmptyCollectionId;
     }
     CollectionManipulator.Paint(pos, num, this.m_brush);
 }
Beispiel #5
0
 public void InsertPoint(Vec2 point, int index)
 {
     Binding.FCE_Spline_InsertPoint(this.m_splinePtr, point.X, point.Y, index);
 }
 public static void Paint(Vec2 center, int id, PaintBrush brush)
 {
     Binding.FCE_Collection_Paint(center.X, center.Y, id, brush.Pointer);
 }
 protected override void OnPaint(float dt, Vec2 pos)
 {
     base.OnPaint(dt, pos);
     TerrainManipulator.Erosion(pos, this.m_radius.Value, this.m_density.Value, this.m_deformation.Value, this.m_channelDepth.Value, this.m_randomness.Value);
 }
Beispiel #8
0
 public static void GetWorldRayFromScreenPoint(Vec2 screenPoint, out Vec3 raySrc, out Vec3 rayDir)
 {
     Binding.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 #9
0
 public bool Start()
 {
     this.m_dragStart = Editor.Viewport.NormalizedMousePos;
     base.AcquireInput();
     return true;
 }
 public static float GetAverageHeight(Vec2 center, PaintBrush brush)
 {
     return Binding.FCE_Terrain_GetAverageHeight(center.X, center.Y, brush.Pointer);
 }
 public static void RaiseLower(Vec2 center, float amount, PaintBrush brush)
 {
     Binding.FCE_Terrain_RaiseLower(center.X, center.Y, amount, brush.Pointer);
 }
 public static void Smooth(Vec2 center, PaintBrush brush)
 {
     Binding.FCE_Terrain_Smooth(center.X, center.Y, brush.Pointer);
 }
 public static void Average(Vec2 center, PaintBrush brush)
 {
     Binding.FCE_Terrain_Average(center.X, center.Y, brush.Pointer);
 }
Beispiel #14
0
 public bool HitTestSegments(Vec2 center, float radius, out int hitIndex, out Vec2 hitPos)
 {
     return Binding.FCE_Spline_HitTestSegments(this.m_splinePtr, center.X, center.Y, radius, out hitIndex, out hitPos.X, out hitPos.Y);
 }
 public static void Ramp(Vec2 ptStart, Vec2 ptEnd, float radius, float hardness)
 {
     Binding.FCE_Terrain_Ramp(ptStart.X, ptStart.Y, ptEnd.X, ptEnd.Y, radius, hardness);
 }
Beispiel #16
0
 public bool HitTestPoints(Vec2 point, float penWidth, float hitWidth, out int hitIndex, out Vec2 hitPos)
 {
     return Binding.FCE_Spline_HitTestPoints(this.m_splinePtr, point.X, point.Y, penWidth, hitWidth, out hitIndex, out hitPos.X, out hitPos.Y);
 }
Beispiel #17
0
 public static ObjectInventory.Entry GetEntryFromScreenPoint(Vec2 screenPoint)
 {
     return new ObjectInventory.Entry(Binding.FCE_ObjectLegoBox_GetEntryFromScreenPoint(screenPoint.X, screenPoint.Y));
 }
Beispiel #18
0
 public static void ApplyScreenDeltaToWorldPos(Vec2 screenDelta, ref Vec3 worldPos)
 {
     Vec3 vec = Camera.FrontVector;
     if ((double)Math.Abs(vec.X) < 0.001 && (double)Math.Abs(vec.Y) < 0.001)
     {
         vec = Camera.UpVector;
     }
     Vec2 vec2 = -vec.XY;
     vec2.Normalize();
     Vec2 vec3 = new Vec2(-vec2.Y, vec2.X);
     float num = (float)((double)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 #19
0
 public static bool RayCastTerrainFromScreenPoint(Vec2 screenPoint, out Vec3 hitPos)
 {
     Vec3 raySrc;
     Vec3 rayDir;
     Editor.GetWorldRayFromScreenPoint(screenPoint, out raySrc, out rayDir);
     float num;
     return Editor.RayCastTerrain(raySrc, rayDir, out hitPos, out num);
 }
Beispiel #20
0
 public static bool RayCastPhysicsFromScreenPoint(Vec2 screenPoint, out Vec3 hitPos)
 {
     Vec3 raySrc;
     Vec3 rayDir;
     Editor.GetWorldRayFromScreenPoint(screenPoint, out raySrc, out rayDir);
     float num;
     return Editor.RayCastPhysics(raySrc, rayDir, EditorObject.Null, out hitPos, out num);
 }
 public static void SetHeight(Vec2 center, float height, PaintBrush brush)
 {
     Binding.FCE_Terrain_SetHeight(center.X, center.Y, height, brush.Pointer);
 }
Beispiel #22
0
 public void AddPoint(Vec2 point)
 {
     Binding.FCE_Spline_AddPoint(this.m_splinePtr, point.X, point.Y);
 }
 public static void Terrace(Vec2 center, float height, float falloff, PaintBrush brush)
 {
     Binding.FCE_Terrain_Terrace(center.X, center.Y, height, falloff, brush.Pointer);
 }
 protected override void OnPaint(float dt, Vec2 pos)
 {
     base.OnPaint(dt, pos);
     float num = this.m_strength.Value * 40f * dt;
     TerrainManipulator.Noise(pos, (this.m_painting == ToolPaint.PaintingMode.Plus) ? num : (-num), this.m_brush);
 }
 public static void Erosion(Vec2 center, float radius, float density, float deformation, float channelDepth, float randomness)
 {
     Binding.FCE_Terrain_Erosion(center.X, center.Y, radius, density, deformation, channelDepth, randomness);
 }
Beispiel #26
0
 private bool GetCapturePos(out Vec2 normalizedMousePos)
 {
     Point position = Cursor.Position;
     Point pt = Editor.Viewport.PointToClient(position);
     Rectangle clientRectangle = Editor.Viewport.ClientRectangle;
     if (clientRectangle.Contains(pt))
     {
         normalizedMousePos = new Vec2((float)pt.X / (float)clientRectangle.Width, (float)pt.Y / (float)clientRectangle.Height);
         return true;
     }
     normalizedMousePos = default(Vec2);
     return false;
 }
 public static void Noise(Vec2 center, float amount, PaintBrush brush)
 {
     Binding.FCE_Terrain_Noise(center.X, center.Y, amount, brush.Pointer);
 }
Beispiel #28
0
 protected virtual void OnPaint(float dt, Vec2 pos)
 {
 }
Beispiel #29
0
 public static float GetHeightAtWithWater(Vec2 point)
 {
     return Binding.FCE_TerrainManager_GetHeightAtWithWater(point.X, point.Y);
 }
Beispiel #30
0
            public override bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs)
            {
                switch (mouseEvent)
                {
                case Editor.MouseEvent.MouseUp:
                    base.ReleaseInput();
                    break;

                case Editor.MouseEvent.MouseMoveDelta:
                    {
                        Vec3 rotationAxis = this.m_rotationAxis;
                        Vec2 xZ = Camera.Axis.ConvertFromWorld(rotationAxis).XZ;
                        xZ.Normalize();
                        xZ.Rotate90CW();
                        Vec2 v = new Vec2((float)mouseEventArgs.X, (float)(-(float)mouseEventArgs.Y));
                        float num = Vec2.Dot(xZ, v);
                        float angle;
                        if (!this.m_snap)
                        {
                            angle = num * 0.025f;
                        }
                        else
                        {
                            this.m_rotationDelta += num;
                            float num2 = (float)Math.IEEERemainder((double)this.m_rotationDelta, 25.0);
                            angle = (this.m_rotationDelta - num2) / 25f * MathUtils.Deg2Rad(this.m_snapSize);
                            this.m_rotationDelta = num2;
                        }
                        this.m_context.m_selection.LoadState();
                        switch (this.m_context.m_paramAxisType.Value)
                        {
                        case AxisType.Local:
                            this.m_context.m_selection.Rotate(angle, rotationAxis, this.m_rotationPivot, false);
                            break;

                        case AxisType.World:
                            if (this.m_context.m_selection.Count > 1)
                            {
                                this.m_context.m_selection.RotateCenter(angle, rotationAxis);
                            }
                            else
                            {
                                this.m_context.m_selection.Rotate(angle, rotationAxis, this.m_rotationPivot, false);
                            }
                            break;
                        }
                        this.m_context.m_selection.SaveState();
                        this.m_context.m_selection.SnapToClosestObjects();
                        this.m_context.UpdateSelection();
                        break;
                    }
                }
                return false;
            }