VertexElement — Aspose.3D TypeScript API Reference

חבילה : תגית: 3D / 3d (הופנה מהדף 24.0)

VertexElement הוא הכיתה הבסיסית אבסטרטית עבור ערוצי אקריפטים per-vertex הקשורים ל Geometry.כל ערוץ מחזיק מעמד נתונים מסוג ו mappingMode / referenceMode נתונים מטאוגרפיים שמשלבים כיצד הנתונים קשורים לגיאומטריה פרימיטיביות.התכונות הבאות הן: VertexElementNormal, VertexElementUV, ו VertexElementVertexColor.

import { VertexElement, VertexElementNormal, VertexElementUV, VertexElementVertexColor } from '@aspose/3d';

מבנה אובססיבי (abstract base)

export abstract class VertexElement implements IIndexedVertexElement { }

מבנה

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

דוגמנית mappingMode הוא MappingMode.CONTROL_POINT;• דפדפן referenceMode הוא ReferenceMode.DIRECT.

נכסים

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

שיטות

setIndices(data)

NOT IMPLEMENTED. על בסיס VertexElement שיטה זו, השיטה הזו מוציאה Error('set_indices is not implemented') תגית: סובייקטים VertexElementFVector ו VertexElementIntsTemplate להציע יישומים מעשיים.

להחליף את המגוון של האינדקס.

setIndices(data: number[]): void

clear()

NOT IMPLEMENTED. על בסיס VertexElement שיטה זו, השיטה הזו מוציאה Error('clear is not implemented') תגית: סובייקטים VertexElementFVector ו VertexElementIntsTemplate להציע יישומים מעשיים.

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

clear(): void

VertexElementNormal

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

export class VertexElementNormal extends VertexElementFVector { }

מורשת

VertexElementVertexElementFVectorVertexElementNormal

מבנה

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

vertexElementType קבועים ל VertexElementType.NORMAL.


VertexElementUV

מסך 2D יכול לשאת שכבות UV מרובות עבור ערוצי טקסטור שונים. textureMapping המשמעות היא שהמטרה של הערוץ.

export class VertexElementUV extends VertexElementFVector { }

מורשת

VertexElementVertexElementFVectorVertexElementUV

מבנה

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

חסרונות ל TextureMapping.DIFFUSE כאשר textureMapping הוא null.

מאפיין נוסף

נכסיםסוגגישהתיאור
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 { }

מורשת

VertexElementVertexElementFVectorVertexElementVertexColor

מבנה

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

vertexElementType קבועים ל VertexElementType.VERTEX_COLOR.


דוגמאות

הוסף נורמליים לרשת משולשים:

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

ראה גם

 עברית