彩票走势图

计算机辅助设计控件Aspose.3D最新版v20.4全新上线!新增Linux渲染支持

原创|产品更新|编辑:李显亮|2020-04-10 11:17:53.140|阅读 328 次

概述:Aspose.3D更新至最新版v20.4,添加Linux渲染支持 ,添加轨道运动控制,添加A3DW格式的线路支持,欢迎下载体验。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

Aspose.3D for .NET是功能丰富的游戏软件和计算机辅助设计(CAD)API,用于处理3D文档格式,无需任何3D建模和渲染软件依赖。同时支持Discreet3DS、WavefrontOBJ、FBX(ASCII,二进制)、STL(ASCII,二进制)、Universal3D、Collada、glTF、GLB、PLY、DirectX、Google Draco文件格式等。开发人员可以轻松地创建,阅读,转换,修改和控制3D文档格式的内容。

近日,Aspose.3D迎来了2020年4月更新,新增Linux渲染支持 ,添加轨道运动控制,添加A3DW格式的线路支持,具体更新如下: >>点击下载Aspose.3D v20.4

具体更新内容

key 概述 类别
THREEDNET-663   添加Linux渲染支持 新功能
THREEDNET-661   使用自定义VertexDeclaration获取数据 增强功能
THREEDNET-652    添加轨道运动控制 增强功能
THREEDNET-653    添加A3DW格式的线路支持。 增强功能
THREEDNET-655    添加TriMesh的渲染支持 增强功能
THREEDNET-656    Web渲染器中的灯光渲染不正确 Bug修复

公共API的更改

▲将成员添加到Aspose.ThreeD.Utilities.Vertex类
/// <summary>
/// Read the vector4 field
/// </summary>
/// <param name="field">The field with a Vector4/FVector4 data type</param>
/// <returns></returns>
publicAspose.ThreeD.Utilities.Vector4 ReadVector4(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the vector4 field
/// </summary>
/// <param name="field">The field with a Vector4/FVector4 data type</param>
/// <returns></returns>
publicAspose.ThreeD.Utilities.FVector4 ReadFVector4(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the vector3 field
/// </summary>
/// <param name="field">The field with a Vector3/FVector3 data type</param>
/// <returns></returns>
publicAspose.ThreeD.Utilities.Vector3 ReadVector3(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the vector3 field
/// </summary>
/// <param name="field">The field with a Vector3/FVector3 data type</param>
/// <returns></returns>
publicAspose.ThreeD.Utilities.FVector3 ReadFVector3(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the vector2 field
/// </summary>
/// <param name="field">The field with a Vector2/FVector2 data type</param>
/// <returns></returns>
publicAspose.ThreeD.Utilities.Vector2 ReadVector2(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the vector2 field
/// </summary>
/// <param name="field">The field with a Vector2/FVector2 data type</param>
/// <returns></returns>
publicAspose.ThreeD.Utilities.FVector2 ReadFVector2(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the double field
/// </summary>
/// <param name="field">The field with a float/double compatible data type</param>
/// <returns></returns>
publicdoubleReadDouble(Aspose.ThreeD.Utilities.VertexField field)
 
 
/// <summary>
/// Read the double field
/// </summary>
/// <param name="field">The field with a float/double compatible data type</param>
/// <returns></returns>
publicfloatReadFloat(Aspose.ThreeD.Utilities.VertexField field)

用法示例:

Scene s = new Scene(@"test.stl");
var mesh = (Mesh)s.RootNode.ChildNodes[0].Entity;
 
//create a VertexDeclaration so we can get the TriMesh with memory layout exactly we want.
var vd = new VertexDeclaration();
 
var pos = vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Position);
var normal = vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Normal);
var uv = vd.AddField(VertexFieldDataType.FVector2, VertexFieldSemantic.UV);
 
//construct the TriMesh using specified vertex layout
var m = TriMesh.FromMesh(vd, mesh);
//print each vertex's position, normal and uv
foreach(var vtx in m)
{
    var v_pos = vtx.ReadVector3(pos);
    var v_normal = vtx.ReadVector3(normal);
    var v_uv = vtx.ReadVector2(uv);
        Console.WriteLine($"({v_pos}), ({v_uv}), ({v_normal})");
}
▲向Aspose.ThreeD.Entities.TriMesh类添加成员

如果您的TriMesh实例带有不确定的内存布局,则可以使用此方法来构造具有确切所需的内存布局的新实例。

/// <summary>
/// Copy the <see cref="TriMesh"/> from input with new vertex layout
/// </summary>
/// <param name="input">The input TriMesh for copying</param>
/// <param name="vd">The new vertex delcaration of the output TriMesh</param>
/// <returns>A new TriMesh instance with new vertex declaration.</returns>
publicstaticAspose.ThreeD.Entities.TriMesh CopyFrom(Aspose.ThreeD.Entities.TriMesh input, Aspose.ThreeD.Utilities.VertexDeclaration vd)


用法示例:

Scene s = new Scene(@"test.STL");
var mesh = (Mesh)s.RootNode.ChildNodes[0].Entity;
var originalTriMesh = TriMesh.FromMesh(mesh);
 
//If the original TriMesh's memory layout is not what you wanted, you can use CopyFrom to get a new instance
//with specified memory layout
 
var vd = new VertexDeclaration();
var pos = vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Position);
var normal = vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Normal);
var uv = vd.AddField(VertexFieldDataType.FVector2, VertexFieldSemantic.UV);
var m = TriMesh.CopyFrom(originalTriMesh, vd);
foreach(var vtx in m)
{
    //Field's offset in vertex can be retrieved by VertexField.Offset 
    var v_pos = vtx.ReadVector3(pos);
    var v_normal = vtx.ReadVector3(normal);
    var v_uv = vtx.ReadVector2(uv);
        Console.WriteLine($"({v_pos}), ({v_uv}), ({v_normal})");
}
▲向Aspose.ThreeD.Entities.TriMesh类添加成员

使用此方法,您可以像反序列化一样轻松地从字节数组重建TriMesh实例。

/// <summary>
/// Create TriMesh from raw data
/// </summary>
/// <param name="vd">Vertex declaration, must contains at least one field.</param>
/// <param name="vertices">The input vertex data, the minimum length of the vertices must be greater or equal to vertex declaration's size</param>
/// <param name="indices">The triangle indices</param>
/// <param name="generateVertexMapping">Generate <see cref="Vertex"/> for each vertex, which is not necessary for just serialization/deserialization.</param>
/// <returns>The <see cref="TriMesh"/> instance that encapsulated the input byte array.</returns>
/// <remarks>The returned TriMesh will not copy the input byte array for performance, external changes on the array will be reflected to this instance.</remarks>
publicstaticAspose.ThreeD.Entities.TriMesh FromRawData(Aspose.ThreeD.Utilities.VertexDeclaration vd,byte[] vertices,int[] indices, bool generateVertexMapping)


用法示例:

Scene s = new Scene(@"test.STL");
var mesh = (Mesh)s.RootNode.ChildNodes[0].Entity;
var vd = new VertexDeclaration();
var pos = vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Position);
var normal = vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Normal);
var uv = vd.AddField(VertexFieldDataType.FVector2, VertexFieldSemantic.UV);
 
var originalTriMesh = TriMesh.FromMesh(vd, mesh);
 
//If the original TriMesh's memory layout is not what you wanted, you can use CopyFrom to get a new instance
//with specified memory layout
byte[] verticesInBytes = originalTriMesh.VerticesToArray();
int[] indices;
originalTriMesh.IndicesToArray(out indices);
var m = TriMesh.FromRawData(vd, verticesInBytes, indices, true);
 
foreach(var vtx in m)
{
    //Field's offset in vertex can be retrieved by VertexField.Offset 
    var v_pos = vtx.ReadVector3(pos);
    var v_normal = vtx.ReadVector3(normal);
    var v_uv = vtx.ReadVector2(uv);
    Console.WriteLine($"({v_pos}), ({v_uv}), ({v_normal})");
}



还想要更多吗?您可以点击阅读【2019 · Aspose最新资源整合】查找需要的教程资源。如果您有任何疑问或需求,请随时,我们很高兴为您提供查询和咨询
标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP