Vertex Elements

Vertex Elements — Aspose.3D FOSS for Java

חבילה: com.aspose.threed (aspose-3d-foss 26.1.0)

VertexElement היא מחלקת הבסיס המופשטת לשכבות נתונים לכל קודקוד (או לכל מצולע, לכל קצה) המחוברות ל‑ Mesh.כל תת‑מחלקה מאחסנת סוג ספציפי של תכונה גאומטרית – נורמליות, קואורדינטות UV, צבעי קודקוד, או קבוצות החלקה.


Example

Example

ClassDescription
VertexElementAbstract 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

ClassDescription
VertexElementNormalStores per-vertex or per-corner normal vectors as Vector4 (w unused).
VertexElementUVStores texture-coordinate pairs ( Vector2 ) per vertex or per polygon corner. A mesh may carry multiple UV layers.
VertexElementVertexColorStores per-vertex or per-corner RGBA colour data as Vector4 (r, g, b, a in 0–1 range).
VertexElementTangentStores tangent vectors for normal-map shading.
VertexElementBinormalStores binormal (bitangent) vectors, perpendicular to both the normal and the tangent.
VertexElementMaterialStores per-face material index references.

מחזיר: VertexElementUV

אוחסן זוגות קואורדינטות מרקם (Vector2) לכל קודקוד או לכל פינה של פוליגון. רשת mesh עשויה לשאת שכבות UV מרובות לערוצי מרקם שונים.


VertexElementUV uv = mesh.createElementUV(
    TextureMapping.DIFFUSE,
    MappingMode.POLYGON_VERTEX,
    ReferenceMode.INDEX_TO_DIRECT
);

Example

EnumerationDescription
VertexElementTypeSemantic role: NORMAL , UV , VERTEX_COLOR , TANGENT , BINORMAL , and others.
MappingModeControls which primitive a value maps to: CONTROL_POINT , POLYGON_VERTEX , or POLYGON .
ReferenceModeControls 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());
        }
    }
}

ראה גם

 עברית