Vertex Elements — Aspose.3D FOSS for Java
חבילה: com.aspose.threed (aspose-3d-foss 26.1.0)
VertexElement היא מחלקת הבסיס המופשטת לשכבות נתונים לכל קודקוד (או לכל מצולע, לכל קצה) המחוברות ל‑ Mesh.כל תת‑מחלקה מאחסנת סוג ספציפי של תכונה גאומטרית – נורמליות, קואורדינטות UV, צבעי קודקוד, או קבוצות החלקה.
Example
Example
| Class | Description |
|---|---|
VertexElement | Abstract base for all vertex element types. Carries getMappingMode() , getReferenceMode() , and a data list. |
VertexElementNormal
אוחסן וקטור נורמל אחד לכל קודקוד או לכל פינת מצולע, בהתאם ל‑ getMappingMode(). ערכי הנתונים הם Vector4 מופעים עם w לא בשימוש.
import com.aspose.threed.*;
VertexElement normals = mesh.createElement(
VertexElementType.NORMAL,
MappingMode.CONTROL_POINT,
ReferenceMode.DIRECT
);Example
| Class | Description |
|---|---|
VertexElementNormal | Stores per-vertex or per-corner normal vectors as Vector4 (w unused). |
VertexElementUV | Stores texture-coordinate pairs ( Vector2 ) per vertex or per polygon corner. A mesh may carry multiple UV layers. |
VertexElementVertexColor | Stores per-vertex or per-corner RGBA colour data as Vector4 (r, g, b, a in 0–1 range). |
VertexElementTangent | Stores tangent vectors for normal-map shading. |
VertexElementBinormal | Stores binormal (bitangent) vectors, perpendicular to both the normal and the tangent. |
VertexElementMaterial | Stores per-face material index references. |
מחזיר: VertexElementUV
אוחסן זוגות קואורדינטות מרקם (Vector2) לכל קודקוד או לכל פינה של פוליגון. רשת mesh עשויה לשאת שכבות UV מרובות לערוצי מרקם שונים.
VertexElementUV uv = mesh.createElementUV(
TextureMapping.DIFFUSE,
MappingMode.POLYGON_VERTEX,
ReferenceMode.INDEX_TO_DIRECT
);Example
| Enumeration | Description |
|---|---|
VertexElementType | Semantic role: NORMAL , UV , VERTEX_COLOR , TANGENT , BINORMAL , and others. |
MappingMode | Controls which primitive a value maps to: CONTROL_POINT , POLYGON_VERTEX , or POLYGON . |
ReferenceMode | Controls indexing: DIRECT or INDEX_TO_DIRECT . |
VertexElementVertexColor
אוחסן נתוני צבע RGBA לכל קודקוד או לכל פינה כ Vector4 (r, g, b, a בטווח 0–1).
Example
הצבה VertexElementType
מזהה את התפקיד הסמנטי של שכבת אלמנט קודקוד.
import com.aspose.threed.*;הצבה MappingMode
שולט באיזה פרימיטיב גאומטרי משוייך כל ערך של אלמנט קודקוד.
הצבה ReferenceMode
שולט באופן שבו מערך נתוני אלמנט הקודקוד מאונדקס.
Example
import com.aspose.threed.Scene;
import com.aspose.threed.*;
Scene scene = Scene.fromFile("model.obj");
for (Node node : scene.getRootNode().getChildNodes()) {
if (node.getEntity() instanceof Mesh) {
Mesh mesh = (Mesh) node.getEntity();
for (VertexElement ve : mesh.getVertexElements()) {
System.out.println(" Element: " + ve.getVertexElementType()
+ " mapping=" + ve.getMappingMode()
+ " ref=" + ve.getReferenceMode());
}
}
}