示例#1
0
        private void Copy(BillBoard other)
        {
            m_sTexture = other.m_sTexture;

            m_fRadius = other.m_fRadius;

            // create the vertices for the box
            m_Corners = other.m_Corners;

            m_bValid = true;
        }
示例#2
0
        public static void Add(float north, float east, float altitude, string sName,
                               string sTextureName, float fWidth, float fHeight)
        {
            BillBoard obj;

            if (sTextureName.CompareTo(m_sLastTexture) == 0)
            {
                BillBoard lastObject = (BillBoard)m_List[m_List.Count - 1];
                obj = new BillBoard(sName, lastObject);
            }
            else
            {
                obj = new BillBoard(sName, sTextureName, fWidth, fHeight);
            }
            m_sLastTexture = sTextureName;

            float height = CGameEngine.Ground.TerrainHeight(east, north);

            if (altitude < height)
            {
                altitude = height;
            }

            obj.m_vPosition.X = east;
            obj.m_vPosition.Y = altitude;
            obj.m_vPosition.Z = north;

            try
            {
                m_List.Add(obj);

                CGameEngine.QuadTree.AddObject((Object3D)obj);
            }
            catch (DirectXException d3de)
            {
                Console.AddLine("Unable to add billboard " + sName);
                Console.AddLine(d3de.ErrorString);
            }
            catch (Exception e)
            {
                Console.AddLine("Unable to add billboard " + sName);
                Console.AddLine(e.Message);
            }
        }
示例#3
0
        /// <summary>
        ///  Display the latest game frame
        /// </summary>
        public void Render(  )
        {
            m_Camera.Render();

            m_QuadTree.Cull(m_Camera);

            GameLights.CheckCulling(m_Camera);

            // test code
            Model ownship = (Model)GetObject("car1");

            if (ownship != null && ownship.IsCulled)
            {
                Console.AddLine("ownship culled at " + ownship.North + " " + ownship.East + " H " + ownship.Heading);
            }

            GameLights.DeactivateLights();

            if (m_Skybox != null)
            {
                m_Skybox.Render(m_Camera);
            }

            GameLights.SetupLights();

            if (m_Terrain != null)
            {
                m_Terrain.Render(m_Camera);
            }

            BillBoard.RenderAll(m_Camera);

            foreach (Object3D obj in m_Objects)
            {
                if (!obj.IsCulled)
                {
                    obj.Render(m_Camera);
                }
            }
        }
示例#4
0
 public BillBoard(string sName, BillBoard other) : base(sName)
 {
     m_sName = sName;
     Copy(other);
 }