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

Enumerations

export abstract class VertexElement implements IIndexedVertexElement

Enumerations

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

Enumerations mappingMode هي MappingMode.CONTROL_POINT; الافتراضي referenceMode هي ReferenceMode.DIRECT.

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
vertexElementTypeVertexElementTypeقراءةالنوع الدلالي لهذه الطبقة.
namestringقراءة/كتابةعلامة اختيارية لهذه الطبقة.
mappingModeMappingModeقراءة/كتابةيتحكم في الشكل الهندسي الأساسي الذي يرتبط به كل قيمة.
referenceModeReferenceModeقراءة/كتابةيتحكم فيما إذا كانت القيم تُعالج مباشرةً أو عبر مصفوفة فهرسة.
indicesnumber[]قراءةمصفوفة الفهرسة لـ IndexToDirect وضع الإشارة.

Enumerations

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

Enumerations

VertexElementVertexElementFVectorVertexElementNormal

Enumerations

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

vertexElementType مُثَبَّت على VertexElementType.NORMAL.


A3DObject, SceneObject, Entity — الفئات الأساسية الجذرية المشتركة بين جميع كائنات @aspose/3d

يخزن إحداثيات النسيج ثنائية الأبعاد. قد يحمل النموذج عدة طبقات UV لقنوات نسيج مختلفة. الـ textureMapping الخاصية تحدد غرض القناة.

export class VertexElementUV extends VertexElementFVector

Enumerations

VertexElementVertexElementFVectorVertexElementUV

Enumerations

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

القيمة الافتراضية هي TextureMapping.DIFFUSE عند textureMapping هو null.

تمثل فئة Transform تحويلًا محليًا مرفقًا بـ Node، وتوفر خصائص translation و rotation و scale.

EnumerationsEnumerationsEnumerationsEnumerations
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

Enumerations

VertexElementVertexElementFVectorVertexElementVertexColor

Enumerations

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

vertexElementType مُثَبَّت على VertexElementType.VERTEX_COLOR.


Enumerations

إضافة المتجهات العمودية إلى شبكة مثلثية:

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

انظر أيضًا

 العربية