Public API Changements dans Aspose.3D 16.11.0

Résumé du contenu

Ajoute la méthode AddEntity dans la classe Aspose.ThreeD. Noeud

Un moyen de raccourci pour ajouter une entité à un nœud.

Ajouter une entité à un nœud

 // initialize a Scene class object

Scene scene = new Scene();

// create a node

Node sphere = scene.RootNode.CreateChildNode("sphere");

// the old way to add an entity in a node

sphere.Entities.Add(new Sphere());

//the new way to add an entity in a node

sphere.AddEntity(new Sphere());

Importation et exportation de fichiers glTF

En utilisant la version récente (16.11.0) ou supérieure, les développeurs peuvent importer et exporter des fichiers glTF vers/à partir d’autres fichiers 3D pris en charge.

Ajoute Aspose.ThreeD.Formats. Classe GLTFLoadOptions

Nous avons ajouté la classe GLTFLoadOptions. Il aide à importer des fichiers glTF dans Aspose.3D API.

Retournez la coordination de la texture V/T

 Scene scene = new Scene();

GLTFLoadOptions loadOpt = new GLTFLoadOptions();

//The default value is true, usually we don't need to change it.

//Aspose.3D will automatically flip the V/T texture coordinate during load and save.

//to make sure it's compatible with Aspose.3D

loadOpt.FlipTexCoordV = true;

scene.Open("Duck.gltf", loadOpt);

Ajoute Aspose.ThreeD.Formats.GLTFSaveOptions Class

Nous avons ajouté la classe GLTFSaveOptions. Il définit les paramètres sur l’enregistrement d’un fichier glTF.

Intégrez des dépendances à l’intérieur du fichier glTF de sortie

 // the code example creates a glTF file that has a sphere, and embed all assets into the target file

// usually a glTF file comes with some dependencies, a bin file for model's vertex/indices, two .glsl files for vertex/fragment shaders

// use opt.EmbedAssets to tells the aspose.3D to export scene and embed the dependencies inside the target file.

Scene scene = new Scene();

scene.RootNode.CreateChildNode("sphere", new Sphere());

GLTFSaveOptions opt = new GLTFSaveOptions(FileContentType.ASCII);

opt.EmbedAssets = true;

scene.Save("d:\\test.gltf", opt);

Utilisez KHR_materials_Extensions pour définir les matériaux

 // the code example creates a glTF file that has a sphere, and use KHR_materials_common extensions to define the materials

// thus no GLSL files are generated.

Scene scene = new Scene();

scene.RootNode.CreateChildNode("sphere", new Sphere());

GLTFSaveOptions opt = new GLTFSaveOptions(FileContentType.ASCII);

opt.UseCommonMaterials = true;

scene.Save("d:\\test.gltf", opt);

Personnaliser le nom du fichier tampon

 // the code example creates a glTF file that has a sphere, and the buffer file that defined the model to customize the filename

Scene scene = new Scene();

scene.RootNode.CreateChildNode("sphere", new Sphere());

GLTFSaveOptions opt = new GLTFSaveOptions(FileContentType.ASCII);

opt.BufferFile = "mybuf.bin";

scene.Save("d:\\test.gltf", opt);

Crée un fichier binaire glTF à l’aide de l’extension KHR_binary_glTF

 // the code example creates a binary glTF file using KHR_binary_glTF extension

Scene scene = new Scene();

// create a child node

scene.RootNode.CreateChildNode("sphere", new Sphere());

// save 3D file

scene.Save("d:\\test.glb", FileFormat.GLTF_Binary);

Crée un fichier binaire glTF à l’aide de l’extension KHR_binary_glTF avec les options d’économie

 // the code example creates a binary glTF file using KHR_binary_glTF extension but allow you to configure the save options

Scene scene = new Scene();

// create a child node

scene.RootNode.CreateChildNode("sphere", new Sphere());

// use saving options

GLTFSaveOptions opt = new GLTFSaveOptions(FileContentType.Binary);

opt.UseCommonMaterials = true;

// save 3D file

scene.Save("d:\\test.glb", opt);

Ajoute l’entrée du format glTF dans la classe Aspose.ThreeD.FileFormat

Nous avons ajouté des entrées au format GLTF et GLTF_Binary à des fins de chargement et d’économie.

Ajoute une propriété d’extension dans la classe Aspose.ThreeD.FileFormatType

Nous avons ajouté une propriété Extension dans la classe FileFormatType pour obtenir le nom d’extension du format de fichier.

Ecrire des dépendances dans le système de fichiers réels

En utilisant la version récente (16.11.0) ou plus, les développeurs peuvent enregistrer toutes les dépendances de scène 3D dans le système de fichiers réel. Les développeurs peuvent définir le chemin d’un répertoire local, enregistrer dans l’objet MemoryFileSystem ou simplement supprimer les dépendances. La propriété FileSystem est ajoutée dans toutes les classes d’options de sauvegarde.

Ajoute Aspose.ThreeD. Services publics. Classe DummyFileSystem

Jeter l’enregistrement des fichiers matériels

 // the code example uses the DummyFileSystem, so the material files are not created.

Scene scene = new Scene();

// create a child node

scene.RootNode.CreateChildNode("sphere", new Sphere()).Material = new PhongMaterial();

// set saving options

ObjSaveOptions opt = new ObjSaveOptions();

opt.FileSystem = new DummyFileSystem();

// save 3D scene

scene.Save("d:\\test.obj", opt);

Ajoute Aspose.ThreeD. Services publics. Classe LocalFileSystem

Sauvegardez les dépendances dans le répertoire local

 // the code example uses the LocalFileSystem class to save dependencies to the local directory.

Scene scene = new Scene();

// create a child node

scene.RootNode.CreateChildNode("sphere", new Sphere()).Material = new PhongMaterial();

// set saving options

ObjSaveOptions opt = new ObjSaveOptions();

opt.FileSystem = new LocalFileSystem("E:\\");

// save 3D scene

scene.Save("d:\\test.obj", opt);

Ajoute Aspose.ThreeD. Classe Utilities.MemoryFileSystem

Sauvegardez les dépendances dans l’objet MemoryFileSystem

 // the code example uses the MemoryFileSystem to intercepts the dependencies writing.

Scene scene = new Scene();

// create a child node

scene.RootNode.CreateChildNode("sphere", new Sphere()).Material = new PhongMaterial();

// set saving options

ObjSaveOptions opt = new ObjSaveOptions();

MemoryFileSystem mfs = new MemoryFileSystem();

opt.FileSystem = mfs;

// save 3D scene

scene.Save("d:\\test.obj", opt);

//get the test.mtl file content

byte[]mtl = mfs.GetFileContent("test.mtl");

File.WriteAllBytes("material.mtl", mtl);

Ajoute la propriété FileSystem dans le Aspose.ThreeD.Formats.IOConfig Class

Nous avons ajouté une propriété FileSystem dans la classe IOConfig pour écrire des dépendances.

Ajoute une propriété FileSystem

 Aspose.ThreeD.Utilities.FileSystem FileSystem{ get;set;}