VertexElement Aspose.3D TypeScript مرجع API

الحزمة: @أسبوس/3د (v24.12.0)

VertexElement هي الفئة الأساسية المجردة لقنوات السمات المتجهة إلى القمة المرتبطة بـ Geometry.كل قناة تحتوي على مجموعة بيانات مكتوبة و mappingMode / referenceMode البيانات الوصفية التي تحكم كيف تتعلق البیانات بالهندسة الأولية. الفئات الفرعية هي: VertexElementNormal, VertexElementUV,، و VertexElementVertexColor.

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

VertexElement (قاعدة تجريدية)

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 (المركز العلوي)

تخزين إحداثيات النسيج الثنائي الأبعاد. قد تحمل الشبكة طبقات 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اقرأقناة النسيج التي ترتبط بها طبقة الأشعة فوق البنفسجية هذه.
dataFVector4[]اقرأالقيم فوق البنفسجية المعرضة كـ: FVector4 المدونات (z و w هي 0).
uvDataFVector2[]اقرأقيم الأشعة فوق البنفسجية كـ: FVector2 إدخالات (x، y فقط).

addData(data)

أضف قيم الأشعة فوق البنفسجية. FVector2[], FVector3[],، أو FVector4[].

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

VertexElementVertexColor

تخزن قيم اللون RGBA لكل عمق. المكونات في نطاق 01.

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

أضف إحداثيات الأشعة فوق البنفسجية:

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

انظر أيضاً

 العربية