Blader door onze producten
Aspose.3D for .NET 22.5 Mitteilung hinweise
Diese Seite enthält Versions hinweise für Aspose.3D for .NET 22.5.
Verbesserungen und Änderungen
Schlüssel | Zusammenfassung | Kategorie |
---|---|---|
THREEDNET-1149 | Mesh-Triangulat unterstützt Vertex Element UserData nicht mit Mapping-Modus Polygon/Polygon Vertex | Neues Feature |
THREEDNET-1148 | Unterstützung von Vertex Element UserData in TriMesh hinzufügen | Neues Feature |
THREEDNET-1138 | Erlauben Sie den Export von Vertex Element UserData an glTF | Neues Feature |
THREEDNET-1119 | Unterstützung für GLTF Custom Vertex Attribute | Neues Feature |
API Änderungen
Aktualisiert den Objekt typ von Dictionary<String, Object>
auf object
in der Klasse Aspose.ThreeD.Entities.VertexElementUserData
:
/// <summary>
/// The user data attached in this element
/// </summary>
public object Data { get; set; }
Wenn der alte Code mehrere Daten in VertexElementUserData
anhängt, sollten Sie jetzt mehrere VertexElementUserData
verwenden.
Mit diesen Änderungen API können wir die Konvertierung von VertexElementUserData
in TriMesh
unterstützen oder sogar in glTF exportiert werden:
Beispiel code:
//Manually define a cube
Vector4[]controlPoints = new Vector4[]{
new Vector4( -5.0, 0.0, 5.0, 1.0),
new Vector4( 5.0, 0.0, 5.0, 1.0),
new Vector4( 5.0, 10.0, 5.0, 1.0),
new Vector4( -5.0, 10.0, 5.0, 1.0),
new Vector4( -5.0, 0.0, -5.0, 1.0),
new Vector4( 5.0, 0.0, -5.0, 1.0),
new Vector4( 5.0, 10.0, -5.0, 1.0),
new Vector4( -5.0, 10.0, -5.0, 1.0)
};
// Initialize mesh object
Mesh mesh = new Mesh();
// Add control points to the mesh
mesh.ControlPoints.AddRange(controlPoints);
// Create polygons to mesh
// Front face (Z+)
mesh.CreatePolygon(new int[]{ 0, 1, 2, 3 });
// Right side (X+)
mesh.CreatePolygon(new int[]{ 1, 5, 6, 2 });
// Back face (Z-)
mesh.CreatePolygon(new int[]{ 5, 4, 7, 6 });
// Left side (X-)
mesh.CreatePolygon(new int[]{ 4, 0, 3, 7 });
// Bottom face (Y-)
mesh.CreatePolygon(new int[]{ 0, 4, 5, 1 });
// Top face (Y+)
mesh.CreatePolygon(new int[]{ 3, 2, 6, 7 });
//create a user data to store face id for each face, this is done by specifying MappingMode to Polygon
var userData = (VertexElementUserData)mesh.CreateElement(VertexElementType.UserData, MappingMode.Polygon, ReferenceMode.Direct); ;
//The name of the UserData will be used as the field's name
userData.Name = "__FACE_ID";
userData.Data = new double[]{
0,1,2,3,4,5
};
var triMesh = TriMesh.FromMesh(mesh);
Console.WriteLine("TriMesh:");
foreach(var vtx in triMesh)
{
Console.WriteLine(vtx);
}
Die Ausgabe ist:
TriMesh:
Position = (-5,0,5), __FACE_ID = 0
Position = (5,0,5), __FACE_ID = 0
Position = (5,10,5), __FACE_ID = 0
Position = (5,10,5), __FACE_ID = 0
Position = (-5,10,5), __FACE_ID = 0
Position = (5,0,5), __FACE_ID = 1
Position = (5,0,-5), __FACE_ID = 1
Position = (5,10,-5), __FACE_ID = 1
Position = (5,10,-5), __FACE_ID = 1
Position = (5,10,5), __FACE_ID = 1
Position = (5,0,-5), __FACE_ID = 2
Position = (-5,0,-5), __FACE_ID = 2
Position = (-5,10,-5), __FACE_ID = 2
Position = (-5,10,-5), __FACE_ID = 2
Position = (5,10,-5), __FACE_ID = 2
Position = (-5,0,-5), __FACE_ID = 3
Position = (-5,0,5), __FACE_ID = 3
Position = (-5,10,5), __FACE_ID = 3
Position = (-5,10,5), __FACE_ID = 3
Position = (-5,10,-5), __FACE_ID = 3
Position = (-5,0,5), __FACE_ID = 4
Position = (-5,0,-5), __FACE_ID = 4
Position = (5,0,-5), __FACE_ID = 4
Position = (5,0,-5), __FACE_ID = 4
Position = (5,0,5), __FACE_ID = 4
Position = (-5,10,5), __FACE_ID = 5
Position = (5,10,5), __FACE_ID = 5
Position = (5,10,-5), __FACE_ID = 5
Position = (5,10,-5), __FACE_ID = 5
Position = (-5,10,-5), __FACE_ID = 5