BillboardActor.cs

using System;

using System.Collections.Generic;

using System.Drawing;

using System.Text;

 

using Microsoft.MapPoint.Rendering3D;

using Microsoft.MapPoint.Rendering3D.GraphicsProxy;

using Microsoft.MapPoint.Rendering3D.Steps.Actors;

using Microsoft.MapPoint.Geometry.VectorMath;

 

namespace VirtualEarth3DSamplePlugins.Billboard

{

    class BillboardActor : Microsoft.MapPoint.Rendering3D.Steps.Actors.Actor

    {

        private SpriteGraphicsObject billboard;

        private Texture texture;

 

        #region Constructor

        public BillboardActor(LatLonAlt position)

        {

            this.texture = Texture.FromResource(this.GetType().Assembly, "VirtualEarth3DSamplePlugins.Billboard.Flower.png");

 

            this.billboard = new SpriteGraphicsObject();

            this.billboard.Texture = this.texture;

            this.billboard.Mode = SpriteMode.Billboard;

            this.billboard.Scale = new Vector2D(1000, 1000);

            this.billboard.Color = Color.White;

            this.billboard.AlphaEnable = true;

            this.billboard.Position = position.GetVector();

        }

        #endregion

        #region Overrides

        public override void Render(Microsoft.MapPoint.Rendering3D.Scene.SceneState sceneState)

        {

            RenderQueues renderQueues = sceneState.GetData<RenderQueues>();

 

            renderQueues.AddAlphaRenderable(0, this.billboard);

        }

        #endregion

    }

}