Imran Rafique March 15, 2016one Comment

Read Universal 3D Document, Create Vertex Element and Embed Raw Texture Data to FBX using Aspose.3D for .NET 1.3.0

Read Universal 3D Document, Create Vertex Element and Embed Raw Texture Data to FBX using Aspose.3D for .NET 1.3.0

March 15, 2016
Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.3D for NET APIs

We’re pleased to announce the availability of new version 1.3.0 of the Aspose.3D for .NET API and let our community know about the progress. This new version has better performance than previous. It allows developers to load a Universal 3D document and get the internal elements programmatically. Probably, we’ll add support of exporting a Universal 3D document to other supported formats in the next version. Our product team is working hard to cover all aspects of the Universal 3D format. It also allows developers, to embed the raw content to the texture of FBX, create a vertex element by passing reference and mapping modes, and initialize Vector4 object by passing Vector3 class object. Besides this, we have changed certain namespaces and classes’ names following the coding guidelines widely accepted by Microsoft .NET developers because it improves readability and makes sense in the context in which it is used.

Load a Universal 3D File and Get Internal Elements

In the Aspose.3D API, we have implemented a Universal 3D file reader, which allows developers to load and get the internal elements of the U3D (Universal 3D) file in the same way as with other supported formats. This article explains how to load all supported 3D files: Read an Existing 3D Scene

Create Vertex Element by assigning Reference and Mapping Modes

Previously, the CreateElement and CreateElementUV methods of the Mesh class were creating the vertex element without assigning the reference and mapping modes. Developers were setting MappingMode and ReferenceMode properties of the VertexElementNode class object using separate lines of code. Using the version 1.3.0 and later, developers would be able to set these properties at once while calling the CreateElement and CreateElementUV methods of the Mesh class which makes code shorter.

Sample code [.NET, C#]

// call CreateElement method of the Mesh object
VertexElementNormal elementNormal = mesh.CreateElement(VertexElementType.Normal) as VertexElementNormal;
// Specify normal per control point.
elementNormal.MappingMode = MappingMode.ControlPoint;
// The data is directly referenced.
elementNormal.ReferenceMode = ReferenceMode.Direct;

The new alternative approach:

// call overloaded CreateElement method of the Mesh object
VertexElementNormal elementNormal = mesh.CreateElement(VertexElementType.Normal, MappingMode.ControlPoint, ReferenceMode.Direct) as VertexElementNormal;

This help topic shows how developers set up surface normal or UV on the cube: Set Up Normals or UV on the Cube

Embed Raw Content Data inside the Texture for FBX

The Content property has added to the Texture class to embed the raw content data inside the texture for FBX document. It allows developers to get or set the binary content of the texture by loading texture from the external file. It is optional and specific to the FBX format.

Sample code [.NET, C#]

// initialize Texture class object
Texture texture = new Texture();
// set file name
texture.FileName = "embedded-texture.png";
// set binary content
texture.Content = File.ReadAllBytes("c:\\test.png");

This help topic shows how developers embed texture in the material of a 3D object: Add Material to the Cube

Public API Changes

The following API changes in the new version are also worth noting:

  • Namespace Aspose.ThreeD.Animations has been changed to Aspose.ThreeD.Animation

  • Class Aspose.ThreeD.Animations.Animation has been changed to Aspose.ThreeD.Animation.AnimationNode

  • Namespace Aspose.ThreeD.IO has been changed to Aspose.ThreeD.Formats

  • Namespace Aspose.ThreeD.Utils has changed to Aspose.ThreeD.Utilities

  • Added a Decompose method in Matrix4 class – It is a mathematical utility function used to decompose an affine transformation matrix.

  • Added a new constructor in Vector4 class to receive a Vector3 object parameter – It makes easier to construct a Vector4 based on the Vector3. The fourth value of the Vector4 presents plane w and its default value is 1.

  • Added a Content property in Texture class – It allows to embed raw texture data inside the Texture instance for FBX documents.

  • The Universal3D option is added in the FileFormat enum.

  • The new overloads for Geometry.CreateElement and Geometry.CreateElementUV are added – It allows developers to create a new vertex element and assign reference and mapping modes at once, to make code shorter.

Aspose.3D for .NET Resources

The following resources will help you work with Aspose.3D for .NET:

We hope you’ll enjoy this new release that save time and efforts. The API is quite simple and developers can use it in application easily.

Join the Conversation

1 Comment

Leave a comment

Posted inAspose.3D Product Family, Imran.Rafique
 

Related Articles