Esempio n. 1
0
        public GeometryDrawer(Vector3 position)
        {
            //NEW CODE
            //create the quad
            geometry = new QuadGeometry();

            //setup the world matrix
            worldMatrix = Matrix.CreateTranslation(position);

            //create a lighting shader with some average looking lighting :-)
            MaterialShader material       = new MaterialShader();
            Vector3        lightDirection = new Vector3(0.5f, 1, -0.5f);    //a less dramatic direction

            material.Lights = new MaterialLightCollection();
            material.Lights.AmbientLightColour = Color.DarkGoldenrod.ToVector3() * 0.5f;
            material.Lights.AddDirectionalLight(false, -lightDirection, Color.WhiteSmoke);
            material.SpecularColour      = Color.LightYellow.ToVector3();       //with a nice sheen
            material.UsePerPixelSpecular = true;

            this.shader = material;
        }
		public GeometryDrawer(Vector3 position)
		{
			//NEW CODE
			//create the quad
			this.geometry = new QuadGeometry();

			//setup the world matrix
			this.worldMatrix = Matrix.CreateTranslation(position);

			//create a lighting shader with some average looking lighting :-)
			var material = new MaterialShader();
			material.SpecularColour = Color.LightYellow.ToVector3();//with a nice sheen

			var lightDirection = new Vector3(0.5f,1,-0.5f); //a less dramatic direction

			var lights = new MaterialLightCollection();
			lights.AmbientLightColour = Color.DarkGoldenrod.ToVector3() * 0.5f;
			lights.CreateDirectionalLight(-lightDirection, Color.WhiteSmoke);

			material.LightCollection = lights;

			this.shader = material;
		}