예제 #1
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  = TSO.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)
            {
                instance.Texture = content.AvatarTextures.Get(binding.TextureTypeID, binding.TextureFileID);
            }

            instance.Mesh.Transform(Skeleton.RootBone);

            if (GPUMode)
            {
                instance.Mesh.StoreOnGPU(GPUDevice);
            }
            Bindings.Add(instance);
            return(instance);
        }
예제 #2
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.Clone(),
             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...
 }
예제 #3
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);
 }
예제 #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 = TSO.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)
            {
                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;
        }
예제 #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);
 }