Public API Changes in Aspose.3D 2.1.0

Contents
[ ]

Contents Summary

Adds Export of Collada Files

Using this recent version (2.1.0), developers can export Collada 3D files. In the previous version (2.0.0), we have already added its import feature, since developers can also convert a Collada file to other supported 3D file formats.

Adds Load and Save Options for 3D File Formats

We have added load and save options for each file format. They’re refactored from the original IOConfig sub-classes.

Adds Aspose.ThreeD.Formats.ColladaSaveOptions class

It defines settings on saving a Collada 3D file.

C#

 ColladaSaveOptions opts = new ColladaSaveOptions();

// generates indented XML document

opts.Indented = true;

// the style of node transformation

opts.TransformStyle = ColladaTransformStyle.Matrix;

// configure the look up paths to allow importer to find external dependencies.

opts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

Adds Aspose.ThreeD.Formats.Discreet3DSLoadOptions Class

It defines settings on loading a discreet 3DS file.

C#

 Discreet3DSLoadOptions loadOpts = new Discreet3DSLoadOptions();

// sets weather to use the transformation defined in the first frame of animation track.

loadOpts.ApplyAnimationTransform = true;

// flip the coordinate system

loadOpts.FlipCoordinateSystem = true;

// prefer to use gamma-corrected color if a 3ds file provides both original color and gamma-corrected color.

loadOpts.GammaCorrectedColor = true;

// configure the look up paths to allow importer to find external dependencies.

loadOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

Adds Aspose.ThreeD.Formats.Discreet3DSSaveOptions Class

It defines settings on saving a discreet 3DS file.

C#

 // initialize an object

Discreet3DSSaveOptions saveOpts = new Discreet3DSSaveOptions();

// the start base for generating new name for duplicated names.

saveOpts.DuplicatedNameCounterBase = 2;

// the format of the duplicated counter.

saveOpts.DuplicatedNameCounterFormat = "NameFormat";

// the separator between object's name and the duplicated counter.

saveOpts.DuplicatedNameSeparator = "Separator";

// allows to export cameras

saveOpts.ExportCamera = true;

// allows to export light

saveOpts.ExportLight = true;

// flip the coordinate system

saveOpts.FlipCoordinateSystem = true;

// prefer to use gamma-corrected color if a 3ds file provides both original color and gamma-corrected color.

saveOpts.GammaCorrectedColor = true;

// use high-precise color which each color channel will use 32bit float.

saveOpts.HighPreciseColor = true;

// configure the look up paths to allow importer to find external dependencies.

saveOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

// set the master scale

saveOpts.MasterScale = 1;

Adds Aspose.ThreeD.Formats.FBXSaveOptions Class

It defines settings on saving an FBX file.

C#

 // initialize an object

FBXSaveOptions saveOpts = new FBXSaveOptions(FileFormat.FBX7500ASCII);

// generates the legacy material properties.

saveOpts.ExportLegacyMaterialProperties = true;

// fold repeated curve data using FBX's animation reference count

saveOpts.FoldRepeatedCurveData = true;

// always generates material mapping information for geometries if the attached node contains materials.

saveOpts.GenerateVertexElementMaterial = true;

// configure the look up paths to allow importer to find external dependencies.

saveOpts.LookupPaths = new List< string > (new string[] { @"c:\temp\" });

// generates a video object for texture.

saveOpts.VideoForTexture = true;

Adds Aspose.ThreeD.Formats.ObjLoadOptions Class

It defines settings on loading an Obj file.

C#

 // initialize an object

ObjLoadOptions loadObjOpts = new ObjLoadOptions();

// import materials from external material library file

loadObjOpts.EnableMaterials = true;

// flip the coordinate system.

loadObjOpts.FlipCoordinateSystem = true;

// configure the look up paths to allow importer to find external dependencies.

loadObjOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

Adds Aspose.ThreeD.Formats.ObjSaveOptions Class

It defines settings on saving an Obj file.

C#

 // initialize an object

ObjSaveOptions saveObjOpts = new ObjSaveOptions();

// import materials from external material library file

saveObjOpts.EnableMaterials = true;

// flip the coordinate system.

saveObjOpts.FlipCoordinateSystem = true;

// configure the look up paths to allow importer to find external dependencies.

saveObjOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

// serialize W component in model's vertex position

saveObjOpts.SerializeW = true;

// generate comments for each section

saveObjOpts.Verbose = true;

Adds Aspose.ThreeD.Formats.STLLoadOptions Class

It defines settings on loading an STL file.

C#

 // initialize an object

STLLoadOptions loadSTLOpts = new STLLoadOptions();

// flip the coordinate system.

loadSTLOpts.FlipCoordinateSystem = true;

// configure the look up paths to allow importer to find external dependencies.

loadSTLOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

Adds Aspose.ThreeD.Formats.STLSaveOptions Class

It defines settings on saving an STL file.

C#

 // initialize an object

STLSaveOptions saveSTLOpts = new STLSaveOptions();

// flip the coordinate system.

saveSTLOpts.FlipCoordinateSystem = true;

// configure the look up paths to allow importer to find external dependencies.

saveSTLOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

Adds Aspose.ThreeD.Formats.U3DLoadOptions Class

It defines settings on loading a U3D file.

C#

 // initialize an object

U3DLoadOptions loadU3DOpts = new U3DLoadOptions();

// flip the coordinate system.

loadU3DOpts.FlipCoordinateSystem = true;

// configure the look up paths to allow importer to find external dependencies.

loadU3DOpts.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

Adds Aspose.ThreeD.Formats.U3DSaveOptions Class

It defines settings on saving a U3D file.

C#

 // initialize an object

U3DSaveOptions saveU3DOptions = new U3DSaveOptions();

// export normal data.

saveU3DOptions.ExportNormals = true;

// export the texture coordinates.

saveU3DOptions.ExportTextureCoordinates = true;

// export the vertex diffuse color.

saveU3DOptions.ExportVertexDiffuse = true;

// export vertex specular color

saveU3DOptions.ExportVertexSpecular = true;

// flip the coordinate system.

saveU3DOptions.FlipCoordinateSystem = true;

// configure the look up paths to allow importer to find external dependencies.

saveU3DOptions.LookupPaths = new List<string>(new string[] { @"c:\temp\" });

// compress the mesh data

saveU3DOptions.MeshCompression = true;

Adds Methods to Aspose.ThreeD.Scene Class

We have overloaded Open and Save methods in the Scene class. Developers can pass a stream object or direct file name to import/export a 3D file using the various loading/saving options.

C#

 public void Open(System.IO.Stream stream, Aspose.ThreeD.Formats.LoadOptions options);

public void Open(string fileName, Aspose.ThreeD.Formats.LoadOptions options);

public void Save(System.IO.Stream stream, Aspose.ThreeD.Formats.SaveOptions options);

public void Save(string fileName, Aspose.ThreeD.Formats.SaveOptions options);

Removal of FillDummyIndexArray Property from Aspose.ThreeD.Formats.FBXConfig Class

This property was not being used.

C#

 System.Nullable<Boolean> FillDummyIndexArray{ get;set;}

Detect the Type of a 3D File

The Detect method of the Aspose.ThreeD.FileFormat class can recognise the type of any supported 3D file.

C#

 FileFormat inputFormat = FileFormat.Detect(@"C:\ThreeD\test06\colors.fbx");

Console.WriteLine("File Format: " + inputFormat.ToString());

Adds Detect, CreateLoadOptions and CreateSaveOptions Methods in the Aspose.ThreeD.FileFormat Class

After the recognition of a 3D file type, developers can create LoadOptions and SaveOptions objects for the further manipulation tasks.

C#

 // allows to detect file format from file stream or filename

static Aspose.ThreeD.FileFormat Detect(System.IO.Stream stream, string fileName)

// allows to detect file format from filename

static Aspose.ThreeD.FileFormat Detect(string fileName)

// create default load options for this file format

Aspose.ThreeD.Formats.LoadOptions CreateLoadOptions()

// create default save options for this file format

Aspose.ThreeD.Formats.SaveOptions CreateSaveOptions()

Adds Excluded Property to Aspose.ThreeD.Entity and Aspose.ThreeD.Node Classes

It allows an entity to be removed during the export.

C#

 bool Excluded{ get;set;}

Adds Aspose.ThreeD.Render.RenderState Class and Aspose.ThreeD.Render.BlendFactor/CompareFunction/CullFaceMode/FrontFace/PolygonMode/StencilAction/StencilState Enums

The render states provide parameters for the GPU to rasterize triangles into pixels.

Adds Shader APIs

The Shader APIs define how to transform the triangles from world space into screen space and calculate the final pixel color in GPU side.

Adds an abstract class Aspose.ThreeD.Render.ShaderSource and sub class Aspose.ThreeD.Render.GLSLSource

The GLSLSource tells renderer, the source code is for OpenGL shading language, it can be compiled to Aspose.ThreeD.Render.ShaderProgram.

Adds Aspose.ThreeD.Render.ShaderException Class

The Shader related exceptions, mainly used in the shader language compiling and linking stage.

Adds Aspose.ThreeD.Render.ShaderProgram Class

It is the compiled shader program.

Add Aspose.ThreeD.Render.ShaderVariable Class

It defines the variables used in shader.

Adds an Enum Class Aspose.ThreeD.Render.VariableSemantic

It is used to identify the shader variable’s semantic, Aspose.3D renderer will automatically prepare shader variable values depends on the semantics.

Adds Buffer APIs

The buffers provide definition and data of the triangles.

Adds an Interface Aspose.ThreeD.Render.IBuffer

It is the base interface for IIndexBuffer and IVertexBuffer.

Adds Interfaces Aspose.ThreeD.Render.IIndexBuffer/IVertexBuffer

They present hardware buffers for storing the geometry indices.

Adds an Enum Aspose.ThreeD.Render.IndexDataType

The datatype of the geometry indices.

Adds Render APIs

Adds an Interface Aspose.ThreeD.Render.IRenderable

An object that supports rendering should implement this interface.

Added an Enum Aspose.ThreeD.Render.DrawOperation

The primitive type to draw.

Adds an Enum Aspose.ThreeD.Render.RenderQueueGroupId

Aspose.3D API uses render queue to manage the render workflow, this is used to submit render operation to specified render queue.

Adds Aspose.ThreeD.Render.RenderResource Class

Base class for bridging the Aspose.3D’s model API to hardware resources, this is used by Aspose.3D internally, but exposed to unleash the full power of Aspose.3D rendering.

Adds Aspose.ThreeD.Render.RenderableResource Class

A Sub class of RenderResource, but concentrate on rendering.

Adds Aspose.ThreeD.Entities.ManualEntity Class

The user should use this class to implement their own entity that supports rendering, this class encapsulates the details of rendering operations and resource management.

Adds Multiple Triangulate Methods in the Aspose.ThreeD.Entities.PolygonModifier Class

More overloads to simplify the usage of original function.

C#

 public static int[][] Triangulate(IList<[Aspose.ThreeD.Utilities.Vector4> controlPoints, IList<int[]> polygons);

public static int[][] Triangulate(IList<[Aspose.ThreeD.Utilities.Vector4> controlPoints, Int32[] polygon);

public static int[][] Triangulate(IList<Aspose.ThreeD.Utilities.Vector4> controlPoints);

Adds CreateVertexBuffer, CreateIndexBuffer, CreateTextureUnit, CreateRenderState and CreateShaderProgram Methods in the Aspose.ThreeD.Render.RenderFactory Class

C#

 public Aspose.ThreeD.Render.IVertexBuffer CreateVertexBuffer(Aspose.ThreeD.Utilities.VertexDeclaration declaration)

public Aspose.ThreeD.Render.IIndexBuffer CreateIndexBuffer()

public Aspose.ThreeD.Render.ITextureUnit CreateTextureUnit()

public Aspose.ThreeD.Render.RenderState CreateRenderState()

public Aspose.ThreeD.Render.ShaderProgram CreateShaderProgram(Aspose.ThreeD.Render.ShaderSource shaderSource, IList<Aspose.ThreeD.Utilities.VertexField> inputFields)

public Aspose.ThreeD.Render.ShaderProgram CreateShaderProgram(Aspose.ThreeD.Render.ShaderSource shaderSource, Aspose.ThreeD.Utilities.VertexDeclaration vertexDeclaration)

Adds BindRenderState, DrawIndexed, Draw and SubmitRenderTask Methods in the Aspose.ThreeD.Render.Renderer Class

C#

 public void BindRenderState(Aspose.ThreeD.Render.RenderState renderState)

public void DrawIndexed(Aspose.ThreeD.Render.DrawOperation drawOperation, Aspose.ThreeD.Render.IVertexBuffer vertexBuffer, Aspose.ThreeD.Render.IIndexBuffer indexBuffer, Int32 count)

public void Draw(Aspose.ThreeD.Render.DrawOperation drawOperation, Aspose.ThreeD.Render.IVertexBuffer vertexBuffer, Int32 first, Int32 count)

public void Draw(Aspose.ThreeD.Render.DrawOperation drawOperation, Aspose.ThreeD.Render.IVertexBuffer vertexBuffer)

public void DrawIndexed(Aspose.ThreeD.Render.DrawOperation drawOperation, Aspose.ThreeD.Render.IVertexBuffer vertexBuffer, Aspose.ThreeD.Render.IIndexBuffer indexBuffer)

public void SubmitRenderTask(Aspose.ThreeD.Render.RenderQueueGroupId groupId, Int32 priority, Aspose.ThreeD.Render.IRenderable renderableTask)

Adds RenderStage and Shader Properties in the Aspose.ThreeD.Render.Renderer Class

C#

 public RenderStage RenderStage { get; }

public Aspose.ThreeD.Render.ShaderProgram Shader{ get;set;}