protected Graphics(Demo demo)
 {
     Demo = demo;
     FarPlane = 400.0f;
     FieldOfView = (float)Math.PI / 4;
     InfoText = "";
 }
示例#2
0
 public static Graphics GetGraphics(Demo demo)
 {
     Type graphicsType;
     Assembly assembly;
     switch (LibraryManager.GraphicsLibraryName)
     {
         case "SharpDX (DirectX 10)":
             assembly = Assembly.Load("DemoFramework.SharpDX");
             graphicsType = assembly.GetType("DemoFramework.SharpDX.SharpDXGraphics");
             break;
         case "SlimDX (DirectX 9)":
             assembly = Assembly.Load("DemoFramework.SlimDX");
             graphicsType = assembly.GetType("DemoFramework.SlimDX.SlimDXGraphics");
             break;
         case "OpenTK (OpenGL)":
             assembly = Assembly.Load("DemoFramework.OpenTK");
             graphicsType = assembly.GetType("DemoFramework.OpenTK.OpenTKGraphics");
             break;
         case "XNA (DirectX 9)":
             assembly = Assembly.Load("DemoFramework.Xna");
             graphicsType = assembly.GetType("DemoFramework.Xna.XnaGraphics");
             break;
         default:
             return null;
     }
     return graphicsType.InvokeMember(null, BindingFlags.CreateInstance, null, null, new[] { demo }) as Graphics;
 }
示例#3
0
 void Start()
 {
     //demo = new CollisionInterfaceDemo.CollisionInterfaceDemo();
     //demo = new BasicDemo.BasicDemo();
     //demo = new SoftDemo.SoftDemo();
     //demo = new BenchmarkDemo.BenchmarkDemo();
     //demo = new CharacterDemo.CharacterDemo();
     demo = new ConstraintDemo.ConstraintDemo();
     demo.DebugDrawMode = DebugDrawModes.DrawWireframe;
     demo.Run();
     demo.IsDebugDrawEnabled = true;
 }
示例#4
0
        public static void Initialize(Demo demo)
        {
            Application.EnableVisualStyles();

            // Check if BulletSharp exists
            try
            {
                Assembly.Load("BulletSharp");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "BulletSharp Error!");
                return;
            }

            // Load settings
            XmlElement root = GetSettingsDocumentRoot();

            XmlNodeList l = root.GetElementsByTagName("graphicsframework");
            if (l.Count == 1)
            {
                XmlElement graphics = l.Item(0) as XmlElement;
                GraphicsLibraryName = graphics.GetAttribute("value");
            }

            if (GraphicsLibraryName == null)
            {
                if (!SelectLibrary())
                {
                    return;
                }
            }

            demo.Run();
            while (ExitWithReload)
            {
                ExitWithReload = false;
                if (!SelectLibrary())
                {
                    return;
                }
                demo.Run();
            }
        }
示例#5
0
        public MeshFactory(Demo demo)
        {
            this.demo = demo;
            this.device = demo.Device;
            this.inputAssembler = device.InputAssembler;

            instanceDataDesc = new BufferDescription()
            {
                SizeInBytes = 0,
                Usage = ResourceUsage.Dynamic,
                BindFlags = BindFlags.VertexBuffer,
                CpuAccessFlags = CpuAccessFlags.Write,
                OptionFlags = ResourceOptionFlags.None,
            };

            InputElement[] elements = new InputElement[]
            {
                new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0, InputClassification.PerVertexData, 0),
                new InputElement("WORLD", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1),
                new InputElement("WORLD", 1, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1),
                new InputElement("WORLD", 2, Format.R32G32B32A32_Float, 32, 1, InputClassification.PerInstanceData, 1),
                new InputElement("WORLD", 3, Format.R32G32B32A32_Float, 48, 1, InputClassification.PerInstanceData, 1),
                new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 64, 1, InputClassification.PerInstanceData, 1)
            };
            inputLayout = new InputLayout(device, demo.GetShadowGenPass().Description.Signature, elements);

            Color c = Color.Green;
            groundColor = (uint)c.R + ((uint)c.G << 8) + ((uint)c.B << 16) + ((uint)c.A << 24);
            c = Color.Orange;
            activeColor = (uint)c.R + ((uint)c.G << 8) + ((uint)c.B << 16) + ((uint)c.A << 24);
            c = Color.OrangeRed;
            passiveColor = (uint)c.R + ((uint)c.G << 8) + ((uint)c.B << 16) + ((uint)c.A << 24);
            c = Color.LightBlue;
            softBodyColor = (uint)c.R + ((uint)c.G << 8) + ((uint)c.B << 16) + ((uint)c.A << 24);
        }
示例#6
0
 public BspToBulletConverter(Demo demo)
 {
     this.demo = demo;
 }
示例#7
0
        public MeshFactory(Demo demo)
        {
            this.demo = demo;
            this.device = demo.Device;
            this.inputAssembler = device.ImmediateContext.InputAssembler;

            instanceDataDesc = new BufferDescription()
            {
                Usage = ResourceUsage.Dynamic,
                BindFlags = BindFlags.VertexBuffer,
                CpuAccessFlags = CpuAccessFlags.Write,
                OptionFlags = ResourceOptionFlags.None,
            };

            InputElement[] elements = new InputElement[]
            {
                new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0, InputClassification.PerVertexData, 0),
                new InputElement("WORLD", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1),
                new InputElement("WORLD", 1, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1),
                new InputElement("WORLD", 2, Format.R32G32B32A32_Float, 32, 1, InputClassification.PerInstanceData, 1),
                new InputElement("WORLD", 3, Format.R32G32B32A32_Float, 48, 1, InputClassification.PerInstanceData, 1),
                new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 64, 1, InputClassification.PerInstanceData, 1)
            };
            inputLayout = new InputLayout(device, demo.GetEffectPass().Description.Signature, elements);
        }
 void RunDemo(string nm)
 {
     if (nm.Equals("BasicDemo"))
     {
         demo = new BasicDemo.BasicDemo();
     }
     if (nm.Equals("BenchmarkDemo"))
     {
         demo = new BenchmarkDemo.BenchmarkDemo();
     }
     if (nm.Equals("Box2DDemo"))
     {
         demo = new Box2DDemo.Box2DDemo();
     }
     if (nm.Equals("BspDemo"))
     {
         demo = new BspDemo.BspDemo();
     }
     if (nm.Equals("CcdPhysicsDemo"))
     {
         demo = new CcdPhysicsDemo.CcdPhysicsDemo();
     }
     if (nm.Equals("CharacterDemo"))
     {
         demo = new CharacterDemo.CharacterDemo();
     }
     if (nm.Equals("CollisionInterfaceDemo"))
     {
         demo = new CollisionInterfaceDemo.CollisionInterfaceDemo();
     }
     if (nm.Equals("ConcaveConvexCastDemo"))
     {
         demo = new ConcaveConvexCastDemo.ConcaveConvexCastDemo();
     }
     if (nm.Equals("ConcaveRaycastDemo"))
     {
         demo = new ConcaveRaycastDemo.ConcaveRaycastDemo();
     }
     if (nm.Equals("ConstraintDemo"))
     {
         demo = new ConstraintDemo.ConstraintDemo();
     }
     if (nm.Equals("ConvexDecompositionDemo"))
     {
         demo = new ConvexDecompositionDemo.ConvexDecompositionDemo();
     }
     if (nm.Equals("DistanceDemo"))
     {
         demo = new DistanceDemo.DistanceDemo();
     }
     if (nm.Equals("FeatherStoneDemo"))
     {
         demo = new FeatherStoneDemo.FeatherStoneDemo();
     }
     if (nm.Equals("GImpactTestDemo"))
     {
         demo = new GImpactTestDemo.GImpactTestDemo();
     }
     if (nm.Equals("MotorDemo"))
     {
         demo = new MotorDemo.MotorDemo();
     }
     if (nm.Equals("PendulumDemo"))
     {
         demo = new PendulumDemo.PendulumDemo();
     }
     if (nm.Equals("RagdollDemo"))
     {
         demo = new RagdollDemo.RagdollDemo();
     }
     if (nm.Equals("RollingFrictionDemo"))
     {
         demo = new RollingFrictionDemo.RollingFrictionDemo();
     }
     if (nm.Equals("SerializeDemo"))
     {
         demo = new SerializeDemo.SerializeDemo();
     }
     if (nm.Equals("SoftDemo"))
     {
         demo = new SoftDemo.SoftDemo();
     }
     if (nm.Equals("VehicleDemo"))
     {
         demo = new VehicleDemo.VehicleDemo();
     }
     demo.DebugDrawMode = DebugDrawModes.DrawWireframe;
     demo.Run();
     IsDebugDrawEnabled = false;
 }
示例#9
0
 protected Graphics(Demo demo)
 {
     Demo        = demo;
     FarPlane    = 400.0f;
     FieldOfView = (float)Math.PI / 4;
 }
示例#10
0
 public BodyPicker(Demo demo)
 {
     _demo = demo;
 }
 void Start()
 {
     //demo = new CollisionInterfaceDemo.CollisionInterfaceDemo();
     //demo = new BasicDemo.BasicDemo();
     //demo = new SoftDemo.SoftDemo();
     //demo = new BenchmarkDemo.BenchmarkDemo();
     //demo = new CharacterDemo.CharacterDemo();
     demo = new ConstraintDemo.ConstraintDemo();
     demo.DebugDrawMode = DebugDrawModes.DrawWireframe;
     demo.Run();
     demo.IsDebugDrawEnabled = true;
 }