示例#1
0
 /// <summary>
 /// Constructs a new line.
 /// </summary>
 /// <param name="colorA">Initial color of the first vertex of the line.</param>
 /// <param name="colorB">Initial color of the second vertex of the line.</param>
 /// <param name="drawer">System responsible for drawing this line.</param>
 public Line(Color colorA, Color colorB, LineDrawer drawer)
 {
     this.drawer = drawer;
     drawer.GetNewLineIndex(out IndexA);
     IndexB = IndexA + 1;
     drawer.vertices[IndexA].Position = Vector3.Zero;
     drawer.vertices[IndexA].Color = colorA;
     drawer.vertices[IndexB].Position = Vector3.Zero;
     drawer.vertices[IndexB].Color = colorB;
 }
示例#2
0
 public ActorContainer(Space space, ModelDrawer modelDrawer, LineDrawer constraintDrawer, LightDrawer lightDrawer)
 {
     _space = space;
     _meshes = new List<LPPMesh>();
     _deleteList = new List<Actor>();
     _actors = new List<Actor>();
     _components = new List<Component>();
     _modelDrawer = modelDrawer;
     _constraintDrawer = constraintDrawer;
     _lightDrawer = lightDrawer;
     _actorDictionary = new Dictionary<string, Actor>();
     Content = Game1.thegame.Content;
 }
 public DisplayEllipseSwingLimit(EllipseSwingLimit constraint, LineDrawer drawer)
     : base(drawer, constraint)
 {
     axis = new Line(Color.Red, Color.Red, drawer);
     myLines.Add(axis);
     //Create the lines that represent the outline of the limit.
     limitLines = new Line[limitFacetCount * 2];
     for (int i = 0; i < limitFacetCount; i++)
     {
         limitLines[i * 2]     = new Line(Color.DarkRed, Color.DarkRed, drawer);
         limitLines[i * 2 + 1] = new Line(Color.DarkRed, Color.DarkRed, drawer);
     }
     myLines.AddRange(limitLines);
 }
示例#4
0
        public DisplayLinearAxisLimit(LinearAxisLimit constraint, LineDrawer drawer)
            : base(drawer, constraint)
        {
            aToConnection = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            bToConnection = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            error         = new Line(Color.Red, Color.Red, drawer);

            //Corners
            axis = new Line(Color.DarkBlue, Color.DarkBlue, drawer);

            myLines.Add(aToConnection);
            myLines.Add(bToConnection);
            myLines.Add(error);
            myLines.Add(axis);
        }
        public DisplayRevoluteLimit(RevoluteLimit constraint, LineDrawer drawer)
            : base(drawer, constraint)
        {
            topRight    = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            top         = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            topLeft     = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            bottomRight = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            bottom      = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            bottomLeft  = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            middle      = new Line(Color.DarkBlue, Color.DarkBlue, drawer);
            testAxis    = new Line(Color.DarkRed, Color.DarkRed, drawer);

            myLines.Add(topRight);
            myLines.Add(top);
            myLines.Add(topLeft);
            myLines.Add(bottomRight);
            myLines.Add(bottom);
            myLines.Add(bottomLeft);
            myLines.Add(middle);
            myLines.Add(testAxis);
        }
        protected override void Initialize()
        {
            ModelDrawer = new InstancedModelDrawer(this);

            ConstraintDrawer = new LineDrawer(this);
            ConstraintDrawer.DisplayTypes.Add(typeof(GrabSpring), typeof(DisplayGrabSpring));
            ConstraintDrawer.DisplayTypes.Add(typeof(MotorizedGrabSpring), typeof(DisplayMotorizedGrabSpring));

            ContactDrawer = new ContactDrawer(this);
            BoundingBoxDrawer = new BoundingBoxDrawer(this);
            SimulationIslandDrawer = new SimulationIslandDrawer(this);

            base.Initialize();
        }
 protected SolverDisplayObject(LineDrawer drawer, T lineObject)
     : base(drawer, lineObject)
 {
 }
 protected LineDisplayObjectBase(LineDrawer drawer)
 {
     Drawer          = drawer;
     myLinesReadOnly = new ReadOnlyCollection <Line>(myLines);
 }
 protected LineDisplayObjectBase(LineDrawer drawer)
 {
     Drawer = drawer;
     myLinesReadOnly = new ReadOnlyCollection<Line>(myLines);
 }
示例#10
0
 /// <summary>
 /// Constructs a new line.
 /// </summary>
 /// <param name="positionA">Initial position of the first vertex of the line.</param>
 /// <param name="positionB">Initial position of the second vertex of the line.</param>
 /// <param name="colorA">Initial color of the first vertex of the line.</param>
 /// <param name="colorB">Initial color of the second vertex of the line.</param>
 /// <param name="drawer">System responsible for drawing this line.</param>
 public Line(Vector3 positionA, Vector3 positionB, Color colorA, Color colorB, LineDrawer drawer)
 {
     this.drawer = drawer;
     drawer.GetNewLineIndex(out IndexA);
     IndexB = IndexA + 1;
     drawer.vertices[IndexA].Position = positionA;
     drawer.vertices[IndexA].Color    = colorA;
     drawer.vertices[IndexB].Position = positionB;
     drawer.vertices[IndexB].Color    = colorB;
 }
示例#11
0
文件: Game1.cs 项目: slicedpan/demo
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Manager = new Manager(this, graphics, "Default");
            Manager.AutoCreateRenderTarget = true;
            Manager.Initialize();

            ModelDrawer = new BruteModelDrawer(this);
            ConstraintDrawer = new LineDrawer(this);
            LightDrawer = new LightDrawer(this);
            space = new Space();
            space.ForceUpdater.Gravity = new Vector3(0.0f, -10.0f, 0.0f);
            Actors = new ActorContainer(space, ModelDrawer, ConstraintDrawer, LightDrawer);

            base.Initialize();
        }