Example #1
0
        public override void Initialize()
        {
            graphicsDevice = Services.GetServiceAs <IGraphicsDeviceService>().GraphicsDevice;

            triggerMaterial   = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Purple, 0.77f), 1);
            staticMaterial    = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Red, 0.77f), 1);
            dynamicMaterial   = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Green, 0.77f), 1);
            kinematicMaterial = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Blue, 0.77f), 1);
            characterMaterial = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Yellow, 0.77f), 1);
        }
Example #2
0
        public DebugShapeRenderer(GraphicsDevice device, Scene scene)
        {
            graphicsDevice = device;
            this.scene     = scene;
            material       = CreateMaterial(graphicsDevice);
            SetColor(Color.AdjustSaturation(Color.Red, 0.77f), 1);

            //rasterizer = RasterizerState.New(graphicsDevice, new RasterizerStateDescription(CullMode.None) { FillMode = FillMode.Wireframe });

            //material.Parameters.Set(Graphics.Effect.RasterizerStateKey, rasterizer);
        }
Example #3
0
        private static Material CreateMaterial(GraphicsDevice device)
        {
            var material = Material.New(device, new MaterialDescriptor
            {
                Attributes =
                {
                    Diffuse      = new MaterialDiffuseMapFeature(new ComputeColor()),
                    DiffuseModel = new MaterialDiffuseLambertModelFeature(),
                    Emissive     = new MaterialEmissiveMapFeature(new ComputeColor())
                }
            });

            var color = Color.AdjustSaturation(Color.Red, 0.77f);

            // set the color to the material
            material.Passes[0].Parameters.Set(MaterialKeys.DiffuseValue, new Color4(color).ToColorSpace(device.ColorSpace));
            material.Passes[0].Parameters.Set(MaterialKeys.EmissiveIntensity, 1);
            material.Passes[0].Parameters.Set(MaterialKeys.EmissiveValue, new Color4(color).ToColorSpace(device.ColorSpace));

            return(material);
        }
Example #4
0
        public PhysicsDebugShapeRendering(GraphicsDevice device)
        {
            graphicsDevice = device;

            triggerMaterial   = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Purple, 0.77f), 1);
            staticMaterial    = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Red, 0.77f), 1);
            dynamicMaterial   = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Green, 0.77f), 1);
            kinematicMaterial = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Blue, 0.77f), 1);
            characterMaterial = PhysicsDebugShapeMaterial.Create(graphicsDevice, Color.AdjustSaturation(Color.Yellow, 0.77f), 1);

            rasterizer = RasterizerState.New(graphicsDevice, new RasterizerStateDescription(CullMode.None)
            {
                FillMode = FillMode.Wireframe
            });

            triggerMaterial.Parameters.Set(Effect.RasterizerStateKey, rasterizer);
            staticMaterial.Parameters.Set(Effect.RasterizerStateKey, rasterizer);
            dynamicMaterial.Parameters.Set(Effect.RasterizerStateKey, rasterizer);
            kinematicMaterial.Parameters.Set(Effect.RasterizerStateKey, rasterizer);
            characterMaterial.Parameters.Set(Effect.RasterizerStateKey, rasterizer);
        }
Example #5
0
        public override void Initialize()
        {
            graphicsDevice = Services.GetSafeServiceAs <IGraphicsDeviceService>().GraphicsDevice;

            foreach (var typeObject in Enum.GetValues(typeof(ComponentType)))
            {
                var type = (ComponentType)typeObject;
                componentTypeDefaultMaterial[type]     = PhysicsDebugShapeMaterial.CreateDefault(graphicsDevice, Color.AdjustSaturation(componentTypeColor[type], 0.77f), 1);
                componentTypeStaticPlaneMaterial[type] = componentTypeDefaultMaterial[type];
                componentTypeHeightfieldMaterial[type] = PhysicsDebugShapeMaterial.CreateHeightfieldMaterial(graphicsDevice, Color.AdjustSaturation(componentTypeColor[type], 0.77f), 1);
                // TODO enable this once material is implemented.
                // ComponentTypeStaticPlaneMaterial[type] = PhysicsDebugShapeMaterial.CreateStaticPlane(graphicsDevice, Color.AdjustSaturation(ComponentTypeColor[type], 0.77f), 1);
            }
        }