/// <summary>
        ///
        /// </summary>
        /// <param name="meshName"></param>
        private void PrepareEntity(string meshName)
        {
            if (objectEntity != null)
            {
                ClearEntity();
            }

            // load mesh if necessary
            originalMesh = (Mesh)MeshManager.Instance.GetByName(meshName);

            // load mesh with shadow buffer so we can do fast reads
            if (originalMesh == null)
            {
                originalMesh = (Mesh)MeshManager.Instance.Load(
                    meshName,
                    BufferUsage.StaticWriteOnly,
                    BufferUsage.StaticWriteOnly,
                    true, true, 1);

                if (originalMesh == null)
                {
                    throw new Exception(string.Format("Can't find mesh named '{0}'.", meshName));
                }
            }

            PrepareClonedMesh();

            // create a new entity based on the cloned mesh
            objectEntity = scene.CreateEntity(ENTITY_NAME, MESH_NAME);

            // setting the material here propogates it down to cloned sub entites, no need to clone them
            objectEntity.MaterialName = material.Name;

            Pass pass = material.GetTechnique(0).GetPass(0);

            // add original sub mesh texture layers after the new cube map recently added
            for (int i = 0; i < clonedMesh.SubMeshCount; i++)
            {
                SubMesh   subMesh   = clonedMesh.GetSubMesh(i);
                SubEntity subEntity = objectEntity.GetSubEntity(i);

                // does this mesh have its own material set?
                if (subMesh.IsMaterialInitialized)
                {
                    string   matName = subMesh.MaterialName;
                    Material subMat  = MaterialManager.Instance.GetByName(matName);

                    if (subMat != null)
                    {
                        subMat.Load();

                        // Clone the sub entities material
                        Material cloned     = subMat.Clone(string.Format("CubeMapTempMaterial#{0}", i));
                        Pass     clonedPass = cloned.GetTechnique(0).GetPass(0);

                        // add global texture layers to the existing material of the entity
                        for (int j = 0; j < pass.NumTextureUnitStages; j++)
                        {
                            TextureUnitState orgLayer = pass.GetTextureUnitState(j);
                            TextureUnitState newLayer = clonedPass.CreateTextureUnitState(orgLayer.TextureName);
                            orgLayer.CopyTo(newLayer);
                            newLayer.SetColorOperationEx(currentLbx);
                        }

                        // set the new material for the subentity and cache it
                        subEntity.MaterialName = cloned.Name;
                        clonedMaterials.Add(cloned);
                    }
                }
            }

            // attach the entity to the scene
            objectNode.AttachObject(objectEntity);

            // update noise if currently set to on
            if (noiseOn)
            {
                UpdateNoise();
            }
        }