Holds a mesh and texture for an avatar.
Esempio n. 1
0
 /// <summary>
 /// Removes a Binding instance from this avatar.
 /// </summary>
 /// <param name="instance">The Binding instance to remove.</param>
 /// <param name="dispose">Should the binding be disposed?</param>
 protected void RemoveBinding(AvatarBindingInstance instance, bool dispose)
 {
     lock (Bindings)
     {
         Bindings.Remove(instance);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Adds a Binding instance to this avatar.
        /// </summary>
        /// <param name="binding">The Binding instance to add.</param>
        /// <returns>An AvatarBindingInstance instance.</returns>
        protected AvatarBindingInstance AddBinding(Binding binding)
        {
            var content  = FSO.Content.Content.Get();
            var instance = new AvatarBindingInstance();

            instance.Mesh = content.AvatarMeshes.Get(binding.MeshTypeID, binding.MeshFileID);

            /*if (instance.Mesh != null)
             * {
             *  //We make a copy so we can modify it, most of the variables
             *  //are kept as pointers because we only change a few locals
             *  //per sim, the rest are global
             *  instance.Mesh = instance.Mesh.Clone();
             * }*/

            if (binding.TextureFileID > 0 && binding.TextureFileID != 4992)
            {
                instance.Texture = content.AvatarTextures.Get(binding.TextureTypeID, binding.TextureFileID);
            }

            instance.Mesh.Prepare(Skeleton.RootBone);

            if (GPUMode)
            {
                instance.Mesh.StoreOnGPU(GPUDevice);
            }
            Bindings.Add(instance);
            return(instance);
        }
Esempio n. 3
0
 public Avatar(Avatar old)
 {
     this.BaseSkeleton = old.BaseSkeleton.Clone();
     this.Skeleton     = old.BaseSkeleton.Clone();
     for (int i = 0; i < old.Bindings.Count(); i++)
     {
         AvatarBindingInstance oldb = old.Bindings[i];
         Bindings.Add(new AvatarBindingInstance()
         {
             Mesh    = oldb.Mesh,
             Texture = oldb.Texture
         });
     }
     for (int i = 0; i < old.Accessories.Count(); i++)
     {
         this.Accessories.Add(old.Accessories.Keys.ElementAt(i), old.Accessories.Values.ElementAt(i));
     } //just shallow copy the binding and accessory list, as the data inside isn't going to change any time soon...
 }
Esempio n. 4
0
        /// <summary>
        /// Adds a Binding instance to this avatar.
        /// </summary>
        /// <param name="binding">The Binding instance to add.</param>
        /// <returns>An AvatarBindingInstance instance.</returns>
        protected AvatarBindingInstance AddBinding(Binding binding)
        {
            var content  = FSO.Content.Content.Get();
            var instance = new AvatarBindingInstance();

            instance.Mesh = content.AvatarMeshes.Get(binding.MeshTypeID, binding.MeshFileID);

            if (binding.MeshName != null)
            {
                instance.Mesh    = content.AvatarMeshes.Get(binding.MeshName);
                instance.Texture = content.AvatarTextures.Get(binding.TextureName ?? instance.Mesh.TextureName);
            }
            else
            {
                instance.Mesh    = content.AvatarMeshes.Get(binding.MeshTypeID, binding.MeshFileID);
                instance.Texture = content.AvatarTextures.Get(binding.TextureTypeID, binding.TextureFileID);
            }

            if (instance.Mesh == null)
            {
                instance.Mesh = content.TS1AvatarMeshes.Get(binding.MeshTypeID, binding.MeshFileID);
            }

            if (instance.Texture == null)
            {
                instance.Texture = content.TS1AvatarTextures.Get(binding.TextureFileID);
            }

            instance.Mesh.Prepare(Skeleton.RootBone);

            if (GPUMode)
            {
                instance.Mesh.StoreOnGPU(GPUDevice);
            }
            Bindings.Add(instance);
            return(instance);
        }
Esempio n. 5
0
 /// <summary>
 /// Removes a Binding instance from this avatar.
 /// </summary>
 /// <param name="instance">The Binding instance to remove.</param>
 /// <param name="dispose">Should the binding be disposed?</param>
 protected void RemoveBinding(AvatarBindingInstance instance, bool dispose)
 {
     Bindings.Remove(instance);
 }
Esempio n. 6
0
        /// <summary>
        /// Adds a Binding instance to this avatar.
        /// </summary>
        /// <param name="binding">The Binding instance to add.</param>
        /// <returns>An AvatarBindingInstance instance.</returns>
        protected AvatarBindingInstance AddBinding(Binding binding)
        {
            var content = FSO.Content.Content.Get();
            var instance = new AvatarBindingInstance();
            instance.Mesh = content.AvatarMeshes.Get(binding.MeshTypeID, binding.MeshFileID);

            /*if (instance.Mesh != null)
            {
                //We make a copy so we can modify it, most of the variables
                //are kept as pointers because we only change a few locals
                //per sim, the rest are global
                instance.Mesh = instance.Mesh.Clone();
            }*/

            if (binding.TextureFileID > 0 && binding.TextureFileID != 4992)
            {
                instance.Texture = content.AvatarTextures.Get(binding.TextureTypeID, binding.TextureFileID);
            }

            instance.Mesh.Prepare(Skeleton.RootBone);

            if (GPUMode)
            {
                instance.Mesh.StoreOnGPU(GPUDevice);
            }
            Bindings.Add(instance);
            return instance;
        }