Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public static void Regenerate(Entity entity)
        {
            ImpostorTexture tex = ImpostorTexture.GetTexture(null, entity);

            if (tex != null)
            {
                tex.Regenerate();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="group"></param>
        /// <param name="entity"></param>
        protected ImpostorBatch(ImpostorPage group, Entity entity)
        {
            //Render impostor texture for this entity
            mTex = ImpostorTexture.GetTexture(group, entity);

            //Create billboard set
            mBBSet = new StaticBillboardSet(group.SceneManager, group.PagedGeometry.SceneNode);
            mBBSet.SetTextureStacksAndSlices(ImpostorTexture.ImpostorPitchAngles, ImpostorTexture.ImpostorYawAngles);

            BillboardOrigin = ImpostorPage.ImpostorPivot;
            //Default the angle to 0 degrees
            mPitchIndex = -1;
            mYawIndex = -1;
            SetAngle(0.0f, 0.0f);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static ImpostorTexture GetTexture(ImpostorPage group, Entity entity)
        {
            //Search for an existing impostor texture for the given entity
            string          entityKey = ImpostorBatch.GenerateEntityKey(entity);
            ImpostorTexture texture   = null;

            if (!mSelfList.TryGetValue(entityKey, out texture))
            {
                if (group != null)
                {
                    texture = new ImpostorTexture(group, entity);
                }
            }
            return(texture);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="entity"></param>
        protected ImpostorBatch(ImpostorPage group, Entity entity)
        {
            //Render impostor texture for this entity
            mTex = ImpostorTexture.GetTexture(group, entity);

            //Create billboard set
            mBBSet = new StaticBillboardSet(group.SceneManager, group.PagedGeometry.SceneNode);
            mBBSet.SetTextureStacksAndSlices(ImpostorTexture.ImpostorPitchAngles, ImpostorTexture.ImpostorYawAngles);

            BillboardOrigin = ImpostorPage.ImpostorPivot;
            //Default the angle to 0 degrees
            mPitchIndex = -1;
            mYawIndex   = -1;
            SetAngle(0.0f, 0.0f);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="texture"></param>
        public static void RemoveTexture(ImpostorTexture texture)
        {
            string strToRemove = string.Empty;

            //Search for an existing impostor texture, in case it was already deleted
            if (mSelfList.ContainsValue(texture))
            {
                foreach (KeyValuePair <string, ImpostorTexture> kp in mSelfList)
                {
                    if (kp.Value == texture)
                    {
                        strToRemove = kp.Key;
                        break;
                    }
                }
            }
            if (strToRemove != string.Empty)
            {
                mSelfList.Remove(strToRemove);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="texture"></param>
 public static void RemoveTexture(ImpostorTexture texture)
 {
     string strToRemove = string.Empty;
     //Search for an existing impostor texture, in case it was already deleted
     if (mSelfList.ContainsValue(texture))
     {
         foreach (KeyValuePair<string, ImpostorTexture> kp in mSelfList)
         {
             if (kp.Value == texture)
             {
                 strToRemove = kp.Key;
                 break;
             }
         }
     }
     if (strToRemove != string.Empty)
         mSelfList.Remove(strToRemove);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="group"></param>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static ImpostorTexture GetTexture(ImpostorPage group, Entity entity)
 {
     //Search for an existing impostor texture for the given entity
     string entityKey = ImpostorBatch.GenerateEntityKey(entity);
     ImpostorTexture texture = null;
     if (!mSelfList.TryGetValue(entityKey, out texture))
     {
         if (group != null)
         {
             texture = new ImpostorTexture(group, entity);
         }
     }
     return texture;
 }
Ejemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 public static void RegenerateAll()
 {
     ImpostorTexture.RegenerateAll();
 }