コード例 #1
0
        public GeometryDrawer(Vector3 position)
        {
            //create the quad
            geometry = new DynamicQuadGeometry();

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

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

            material.Lights = new MaterialLightCollection();
            material.Lights.AddDirectionalLight(false, -lightDirection, Color.WhiteSmoke);
            material.SpecularColour = Color.LightYellow.ToVector3() * 0.5f;

            //Note: To use vertex colours with a MaterialShader, UseVertexColour has to be set to true
            material.UseVertexColour = true;

            this.shader = material;
        }
コード例 #2
0
		public GeometryDrawer(Vector3 position)
		{
			//create the quad
			geometry = new DynamicQuadGeometry();

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

			//create a basic lighting shader with some average looking lighting :-)
			MaterialShader material = new MaterialShader();
			material.SpecularColour = Color.LightYellow.ToVector3() * 0.5f;

			Vector3 lightDirection = new Vector3(-1, -1, -1); //a dramatic direction

			//Note: To use vertex colours with a MaterialShader, UseVertexColour has to be set to true
			material.UseVertexColour = true;

			//create a directional light
			MaterialLightCollection lights = new MaterialLightCollection();
			lights.CreateDirectionalLight(-lightDirection, Color.WhiteSmoke);

			material.LightCollection = lights;

			this.shader = material;
		}