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 IIndexedVertexElement

Properties

constructor(
  elementType: VertexElementType,
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

Properties mappingMode הוא MappingMode.CONTROL_POINT; ברירת מחדל referenceMode הוא ReferenceMode.DIRECT.

Properties

PropertiesPropertiesPropertiesProperties
vertexElementTypeVertexElementTypeקריאהסוג סמנטי של השכבה הזו.
namestringקריאה/כתיבהתווית אופציונלית לשכבה זו.
mappingModeMappingModeקריאה/כתיבהשולט באיזה פרימיטיב גאומטרי משוייך כל ערך.
referenceModeReferenceModeקריאה/כתיבהשולט האם הערכים נגישים ישירות או דרך מערך אינדקס.
indicesnumber[]קריאהמערך אינדקס עבור IndexToDirect מצב הפנייה.

Properties

setIndices(data)

NOT IMPLEMENTED. בבסיס VertexElement מחלקה, שיטה זו זורקת Error('set_indices is not implemented') בזמן ריצה. המחלקות המשניות VertexElementFVector ו VertexElementIntsTemplate מספקות מימושים עובדים.

Aspose.Cells הפנייה ל‑API קוד פתוח לכל הפלטפורמות הנתמכות. בחר את הפלטפורמה שלך כדי לעיין במחלקות, במתודות ובמאפיינים.

setIndices(data: number[]): void

clear()

NOT IMPLEMENTED. בבסיס VertexElement מחלקה, שיטה זו זורקת Error('clear is not implemented') בזמן ריצה. המחלקות המשניות VertexElementFVector ו VertexElementIntsTemplate מספקות מימושים עובדים.

הסר את כל הנתונים והאינדקסים מהשכבה.

clear(): void

VertexElementNormal

מאחסן וקטורי נורמל של פני השטח. נתוני נורמל נדרשים ברוב הרנדררים לתאורה נכונה.

export class VertexElementNormal extends VertexElementFVector

Properties

VertexElementVertexElementFVectorVertexElementNormal

Properties

new VertexElementNormal(
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

vertexElementType קבוע ל VertexElementType.NORMAL.


מחזיר: VertexElementUV

מאחסן קואורדינטות מרקם דו‑ממדיות. רשת יכולה לשאת מספר שכבות UV לערוצים שונים של מרקם. ה textureMapping המאפיין מזהה את מטרת הערוץ.

export class VertexElementUV extends VertexElementFVector

Properties

VertexElementVertexElementFVectorVertexElementUV

Properties

new VertexElementUV(
  textureMapping: TextureMapping | null = null,
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

ברירת מחדל היא TextureMapping.DIFFUSE כאשר textureMapping הוא null.

מחזיר: Mesh; רשת חדשה המכילה רק משולשים.

PropertiesPropertiesPropertiesProperties
textureMappingTextureMappingקראערוץ המרקם שהשכבה הזו של UV משויכת אליו.
dataFVector4[]קראערכי UV נחשפים כ FVector4 רשומות (z ו‑w הם 0).
uvDataFVector2[]נקראערכי UV כ FVector2 רשומות (x, y בלבד).

addData(data)

הוסף ערכי UV. מקבל FVector2[], FVector3[], או FVector4[].

addData(data: FVector2[] | FVector3[] | FVector4[]): void

VertexElementVertexColor

מאחסן ערכי צבע RGBA לכל קודקוד. הרכיבים בטווח 0–1.

export class VertexElementVertexColor extends VertexElementFVector

Properties

VertexElementVertexElementFVectorVertexElementVertexColor

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');

ראה גם

 עברית