Browse our Products
Aspose.3D for .NET 23.4 Release Notes
Improvements and Changes
Key | Summary | Category |
---|---|---|
THREEDNET-1359 | Exporting to OBJ - Image/texture files not copied to OBJ directory | Task |
THREEDNET-1361 | Decouple the dependency of System.Drawing | Task |
THREEDNET-1360 | Allow export PBR material definition and normal mapping in OBJ exporter | Improvement |
THREEDNET-1357 | Missing material and texture when loading obj file | Bug fixing |
THREEDNET-1358 | When importing an obj file, ControlPoints encountered an error reading data and read it as normal vector data | Bug fixing |
API changes
Since 23.4, System.Drawing is no longer needed, types used from System.Drawing are now replaced by existing types which provide similar features:
Old Type | New Type | Description |
---|---|---|
System.Drawing.Imaging.ImageFormat | System.String | Uses image file extension name to represent image format, supported image formats are based on texture codec. |
System.Drawing.Size | Aspose.ThreeD.Utilities.Vector2 | |
System.Drawing.Point | Aspose.ThreeD.Utilities.Vector2 | |
System.Drawing.Color | Aspose.ThreeD.Utilities.Vector3 | |
System.Drawing.Rectangle | Aspose.ThreeD.Utilities.Rect | |
System.Drawing.Bitmap | Aspose.ThreeD.Render.TextureData |
Added members to class Aspose.ThreeD.Formats.SaveOptions:
/// <summary>
/// Try to copy textures used in scene to output directory.
/// </summary>
bool ExportTextures{ get;set;}
Sample code
Export the scene into obj file and export the texture files:
Scene scene = Scene.FromFile("input.glb"); | |
var opt = new ObjSaveOptions(); | |
opt.ExportTextures = true; | |
scene.Save("output.obj", opt); |
Removed class Aspose.ThreeD.Shading.RenderingAPI
Removed class Aspose.ThreeD.Shading.ShadingLanguage
These were obsoleted for months and removed by schedule.
Added class Aspose.ThreeD.Render.ITextureCodec
Added class Aspose.ThreeD.Render.ITextureDecoder
Added class Aspose.ThreeD.Render.ITextureEncoder
Added class Aspose.ThreeD.Render.TextureCodec
In Aspose.3D 23.4, we’ve removed dependency of System.Drawing, so texture decoding will be done in external codec, we provide sample codes to integrate Aspose.3D with external image encoders/decoders, in most cases texture codec is not needed.
Added class Aspose.ThreeD.Render.PixelMapMode
Added class Aspose.ThreeD.Render.PixelMapping
Added members to class Aspose.ThreeD.Render.TextureData:
/// <summary>
/// Map all pixels for read/write
/// </summary>
/// <param name="mapMode">Map mode</param>
/// <returns>Returns a mapping object, it should be disposed when no longer needed.</returns>
public Aspose.ThreeD.Render.PixelMapping MapPixels(Aspose.ThreeD.Render.PixelMapMode mapMode)
/// <summary>
/// Map all pixels for read/write in given pixel format
/// </summary>
/// <param name="mapMode">Map mode</param>
/// <param name="format">Pixel format</param>
/// <returns>Returns a mapping object, it should be disposed when no longer needed.</returns>
public Aspose.ThreeD.Render.PixelMapping MapPixels(Aspose.ThreeD.Render.PixelMapMode mapMode, Aspose.ThreeD.Render.PixelFormat format)
/// <summary>
/// Map pixels addressed by rect for reading/writing in given pixel format
/// </summary>
/// <param name="rect">The area of pixels to be accessed</param>
/// <param name="mapMode">Map mode</param>
/// <param name="format">Pixel format</param>
/// <returns>Returns a mapping object, it should be disposed when no longer needed.</returns>
/// <exception cref="NotSupportedException"></exception>
public Aspose.ThreeD.Render.PixelMapping MapPixels(Aspose.ThreeD.Utilities.Rect rect, Aspose.ThreeD.Render.PixelMapMode mapMode, Aspose.ThreeD.Render.PixelFormat format)
Sample code
Map the pixels from TextureData for reading or writing, external texture codec can use these to encode or decode image.
This is a replacement for System.Drawing.Bitmap’s pixel operations.
var tex = new TextureData(128, 128, PixelFormat.A8R8G8B8); | |
using (var mapping = tex.MapPixels(PixelMapMode.WriteOnly)) | |
{ | |
var pixels = mapping.Data; | |
var p = 0; | |
for(var y = 0; y < 128; y++) | |
{ | |
for (var x = 0; x < 128; x++) | |
{ | |
pixels[p + 0] = 255;//alpha | |
pixels[p + 1] = 255;//red | |
pixels[p + 2] = 0;//green | |
pixels[p + 3] = 0;//blue | |
p += 4;//next pixel | |
} | |
} | |
} | |
tex.Save("red.png");//save to png file(Need codec registered) |
Added members to class Aspose.ThreeD.Render.TextureData:
/// <summary>
/// Transform pixel's layout to new pixel format.
/// </summary>
/// <param name="pixelFormat">Destination pixel format</param>
/// <exception cref="NotSupportedException">When the source or destination pixel format is not supported</exception>
public void TransformPixelFormat(Aspose.ThreeD.Render.PixelFormat pixelFormat)
Sample code
Transform internal pixel format in TextureData to specified format:
var tex = TextureData.FromFile("test.png"); | |
tex.TransformPixelFormat(PixelFormat.G8);//now the texture data only contains green channel in pixel. |
Removed members from class Aspose.ThreeD.Render.TextureData:
public static Aspose.ThreeD.Render.TextureData FromBitmap(System.Drawing.Bitmap bitmap)
public System.Drawing.Bitmap ToBitmap()
When System.Drawing.Bitmap is no longer used in Aspose.ThreeD, these methods are no longer needed.