CreateBoundingSphere() public méthode

Implicitly initializes the bounding sphere. Calculates the bounding sphere automatically
public CreateBoundingSphere ( ) : void
Résultat void
Exemple #1
0
        /// <summary>
        /// Loads / imports hair from the given file with given format.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="path"></param>
        public static Hair Import(HairFormat format, string path, HairImportSettings importSettings = null)
        {
            if (importSettings == null)
            {
                importSettings = HairImportSettings.standard;
            }

            // Get hair format impl
            IHairFormat formatImpl = format.GetFormatImplementation();

            // Create new hair object
            Hair hair = new Hair();

            // Open the binary reader
            BinaryReader reader = new BinaryReader(File.Open(path, FileMode.Open));

            // Import the hair data
            HairMesh[] hairMeshes = null;
            try
            {
                hairMeshes = formatImpl.Import(reader, path, hair, importSettings);
            }
            finally
            {
                reader.Close();
            }
            reader.Close();

            // Validity check
            if (hairMeshes.Length > 4)
            {
                throw new IndexOutOfRangeException("TressFX only supports up to 4 hair meshes, the file you tried to import had " + hairMeshes.Length);
            }

            // Set all meshes
            for (int i = 0; i < hairMeshes.Length; i++)
            {
                hair.SetHairMesh(i, hairMeshes[i]);
            }

            hair.CreateBoundingSphere();

            // We're done :>
            return(hair);
        }
Exemple #2
0
        /// <summary>
        /// Loads / imports hair from the given file with given format.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="path"></param>
        public static Hair Import(HairFormat format, string path, HairImportSettings importSettings = null)
        {
            if (importSettings == null)
                importSettings = HairImportSettings.standard;

            // Get hair format impl
            IHairFormat formatImpl = format.GetFormatImplementation();

            // Create new hair object
            Hair hair = new Hair();

            // Open the binary reader
            BinaryReader reader = new BinaryReader(File.Open(path, FileMode.Open));

            // Import the hair data
            HairMesh[] hairMeshes = null;
            try
            {
                hairMeshes = formatImpl.Import(reader, path, hair, importSettings);
            }
            finally
            {
                reader.Close();
            }
            reader.Close();

            // Validity check
            if (hairMeshes.Length > 4)
                throw new IndexOutOfRangeException("TressFX only supports up to 4 hair meshes, the file you tried to import had " + hairMeshes.Length);

            // Set all meshes
            for (int i = 0; i < hairMeshes.Length; i++)
                hair.SetHairMesh(i, hairMeshes[i]);

            hair.CreateBoundingSphere();

            // We're done :>
            return hair;
        }