VertexElement — Aspose.3D TypeScript API Reference
חבילה: @aspose/3d (v24.12.0)
VertexElement היא המחלקה הבסיסית המופשטת לערוצי תכונות פר-קודקוד המחוברים ל- Geometry. כל ערוץ מחזיק במערך נתונים בעל טיפוס ו mappingMode / referenceMode מטא-נתונים השולטים כיצד הנתונים מתייחסים לפרימיטיבים גאומטריים. תתי-המחלקות הן: VertexElementNormal, VertexElementUV, ו VertexElementVertexColor.
import { VertexElement, VertexElementNormal, VertexElementUV, VertexElementVertexColor } from '@aspose/3d';Properties
export abstract class VertexElement implements IIndexedVertexElementProperties
constructor(
elementType: VertexElementType,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)Properties mappingMode הוא MappingMode.CONTROL_POINT; ברירת מחדל referenceMode הוא ReferenceMode.DIRECT.
Properties
| Properties | Properties | Properties | Properties |
|---|---|---|---|
vertexElementType | VertexElementType | קריאה | סוג סמנטי של השכבה הזו. |
name | string | קריאה/כתיבה | תווית אופציונלית לשכבה זו. |
mappingMode | MappingMode | קריאה/כתיבה | שולט באיזה פרימיטיב גאומטרי משוייך כל ערך. |
referenceMode | ReferenceMode | קריאה/כתיבה | שולט האם הערכים נגישים ישירות או דרך מערך אינדקס. |
indices | number[] | קריאה | מערך אינדקס עבור IndexToDirect מצב הפנייה. |
Properties
setIndices(data)
NOT IMPLEMENTED. בבסיס VertexElement מחלקה, שיטה זו זורקת Error('set_indices is not implemented') בזמן ריצה. המחלקות המשניות VertexElementFVector ו VertexElementIntsTemplate מספקות מימושים עובדים.
Aspose.Cells הפנייה ל‑API קוד פתוח לכל הפלטפורמות הנתמכות. בחר את הפלטפורמה שלך כדי לעיין במחלקות, במתודות ובמאפיינים.
setIndices(data: number[]): voidclear()
NOT IMPLEMENTED. בבסיס VertexElement מחלקה, שיטה זו זורקת Error('clear is not implemented') בזמן ריצה. המחלקות המשניות VertexElementFVector ו VertexElementIntsTemplate מספקות מימושים עובדים.
הסר את כל הנתונים והאינדקסים מהשכבה.
clear(): voidVertexElementNormal
מאחסן וקטורי נורמל של פני השטח. נתוני נורמל נדרשים ברוב הרנדררים לתאורה נכונה.
export class VertexElementNormal extends VertexElementFVectorProperties
VertexElement → VertexElementFVector → VertexElementNormal
Properties
new VertexElementNormal(
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)vertexElementType קבוע ל VertexElementType.NORMAL.
מחזיר: VertexElementUV
מאחסן קואורדינטות מרקם דו‑ממדיות. רשת יכולה לשאת מספר שכבות UV לערוצים שונים של מרקם. ה textureMapping המאפיין מזהה את מטרת הערוץ.
export class VertexElementUV extends VertexElementFVectorProperties
VertexElement → VertexElementFVector → VertexElementUV
Properties
new VertexElementUV(
textureMapping: TextureMapping | null = null,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)ברירת מחדל היא TextureMapping.DIFFUSE כאשר textureMapping הוא null.
מחזיר: Mesh; רשת חדשה המכילה רק משולשים.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
textureMapping | TextureMapping | קרא | ערוץ המרקם שהשכבה הזו של UV משויכת אליו. |
data | FVector4[] | קרא | ערכי UV נחשפים כ FVector4 רשומות (z ו‑w הם 0). |
uvData | FVector2[] | נקרא | ערכי UV כ FVector2 רשומות (x, y בלבד). |
addData(data)
הוסף ערכי UV. מקבל FVector2[], FVector3[], או FVector4[].
addData(data: FVector2[] | FVector3[] | FVector4[]): voidVertexElementVertexColor
מאחסן ערכי צבע RGBA לכל קודקוד. הרכיבים בטווח 0–1.
export class VertexElementVertexColor extends VertexElementFVectorProperties
VertexElement → VertexElementFVector → VertexElementVertexColor
Properties
new VertexElementVertexColor(
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)vertexElementType קבוע ל VertexElementType.VERTEX_COLOR.
Properties
הוסף נורמליים לרשת משולשים:
import { Scene, Mesh, Vector4, VertexElementType, MappingMode, ReferenceMode, FVector4 } from '@aspose/3d';
const mesh = new Mesh();
mesh.controlPoints.push(new Vector4(0, 0, 0, 1));
mesh.controlPoints.push(new Vector4(1, 0, 0, 1));
mesh.controlPoints.push(new Vector4(0.5, 1, 0, 1));
mesh.createPolygon(0, 1, 2);
const normals = mesh.createElement(
VertexElementType.NORMAL,
MappingMode.CONTROL_POINT,
ReferenceMode.DIRECT,
);
normals.setData([
new FVector4(0, 0, 1, 0),
new FVector4(0, 0, 1, 0),
new FVector4(0, 0, 1, 0),
]);
const scene = new Scene();
scene.rootNode.createChildNode('tri', mesh);
scene.save('triangle_normals.glb');הוסף קואורדינטות UV:
import { Scene, Mesh, Vector4, TextureMapping, MappingMode, ReferenceMode, FVector2 } from '@aspose/3d';
const mesh = new Mesh();
for (const [x, z] of [[0,0],[1,0],[1,1],[0,1]]) {
mesh.controlPoints.push(new Vector4(x, 0, z, 1));
}
mesh.createPolygon(0, 1, 2, 3);
const uv = mesh.createElementUV(TextureMapping.DIFFUSE, MappingMode.CONTROL_POINT, ReferenceMode.DIRECT);
uv.addData([
new FVector2(0, 0),
new FVector2(1, 0),
new FVector2(1, 1),
new FVector2(0, 1),
]);
const scene = new Scene();
scene.rootNode.createChildNode('quad', mesh);
scene.save('quad_uv.glb');