public override void CreateShape(EntityType type, Point?where = null) { state = State.CreatingShape; shapeType = type; newShapeType = type; switch (type) { case EntityType.Actor: shapeOutline = ActorShape.GetOutline(Style.CurrentStyle); break; case EntityType.UseCase: shapeOutline = UseCaseShape.GetOutline(Style.CurrentStyle); break; case EntityType.Comment: shapeOutline = CommentShape.GetOutline(Style.CurrentStyle); break; case EntityType.SystemBoundary: shapeOutline = SystemBoundaryShape.GetOutline(Style.CurrentStyle); break; } shapeOutline.Location = where ?? new Point((int)mouseLocation.X, (int)mouseLocation.Y); Redraw(); }
public override Actor GetTouchedActor() { WheelContact data = _wheelShape.GetContact(); ActorShape shape = data.Shape; return(shape != null ? shape.Actor : null); }
private void DrawShape(ActorShape shape, GraphicDevice device) { Matrix scale; if (shape is BoxShape) { BoxShape boxShape = (BoxShape)shape; scale = Matrix.Scale(boxShape.Dimensions); Effect.Input.World = scale * boxShape.GlobalPose; DrawMesh(_box, device); } else if (shape is SphereShape) { SphereShape sphereShape = (SphereShape)shape; scale = Matrix.Scale(new Vector3(sphereShape.Radius)); Effect.Input.World = scale * shape.GlobalPose; DrawMesh(_sphere, device); } else if (shape is PlaneShape) { scale = Matrix.Scale(Engine.Scene.ActiveCamera.ZFar, 0, Engine.Scene.ActiveCamera.ZFar); Effect.Input.World = scale * shape.GlobalPose; DrawMesh(_box, device); } else if (shape is WheelShape) { WheelShape wheel = (WheelShape)shape; Effect.Input.World = Matrix.Scale(wheel.Radius, 0, wheel.Radius) * Matrix.RotationZ(Numerics.PIover2) * Matrix.RotationY(wheel.SteerAngle) * shape.GlobalPose; DrawMesh(_cylindre, device); } else if (shape is CapsuleShape) { CapsuleShape capsuleShape = (CapsuleShape)shape; float radius = capsuleShape.Radius; float height = capsuleShape.Height; Effect.Input.World = Matrix.Translate(0, -0.5f, 0) * Matrix.Scale(radius, radius, radius) * Matrix.Translate(0, height * 0.5f, 0) * shape.GlobalPose; DrawMeshPart(_capsule, _capsule.Layers[0], device); Effect.Input.World = Matrix.Translate(0, 0.5f, 0) * Matrix.Scale(radius, radius, radius) * Matrix.Translate(0, -(height * 0.5f), 0) * shape.GlobalPose; DrawMeshPart(_capsule, _capsule.Layers[2], device); Effect.Input.World = Matrix.Scale(radius, height, radius) * shape.GlobalPose; DrawMeshPart(_capsule, _capsule.Layers[1], device); } else if (shape is TriangleMeshShape) { TriangleMesh tmesh = ((TriangleMeshShape)shape).Mesh; var mesh = (Mesh)tmesh.GraphicMesh; if (mesh != null) { Effect.Input.World = shape.GlobalPose; DrawMesh(mesh, device); } } }
//public Render GetRender() //{ // return Engine.GetRender<Actor>(); //} //public void Draw(SceneNode node, Render render, PixelClipping clipping = PixelClipping.None) //{ // var actorRender = (Render<Actor>)render; // if (actorRender != null) // { // actorRender.Draw(this); // } //} protected void AddShape(ActorShape shape) { shapes.Add(shape.Name, shape); }
public abstract void SetShapePairFlags(ActorShape shape1, ActorShape shape2, ContactPairFlag flags);