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 IIndexedVertexElementEnumerations
constructor(
elementType: VertexElementType,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)Enumerations mappingMode هي MappingMode.CONTROL_POINT; الافتراضي referenceMode هي ReferenceMode.DIRECT.
Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
vertexElementType | VertexElementType | قراءة | النوع الدلالي لهذه الطبقة. |
name | string | قراءة/كتابة | علامة اختيارية لهذه الطبقة. |
mappingMode | MappingMode | قراءة/كتابة | يتحكم في الشكل الهندسي الأساسي الذي يرتبط به كل قيمة. |
referenceMode | ReferenceMode | قراءة/كتابة | يتحكم فيما إذا كانت القيم تُعالج مباشرةً أو عبر مصفوفة فهرسة. |
indices | number[] | قراءة | مصفوفة الفهرسة لـ IndexToDirect وضع الإشارة. |
Enumerations
setIndices(data)
NOT IMPLEMENTED. على القاعدة VertexElement الفئة، هذه الطريقة تطرح Error('set_indices is not implemented') أثناء التشغيل. الفئات الفرعية VertexElementFVector و VertexElementIntsTemplate توفر تنفيذات عاملة.
استبدل مصفوفة الفهارس.
setIndices(data: number[]): voidclear()
NOT IMPLEMENTED. على القاعدة VertexElement الفئة، هذه الطريقة تطرح Error('clear is not implemented') أثناء التشغيل. الفئات الفرعية VertexElementFVector و VertexElementIntsTemplate قدّم تنفيذات عاملة.
أزل جميع البيانات والفهارس من الطبقة.
clear(): voidVertexElementNormal
يخزن متجهات السطح العادية. البيانات العادية مطلوبة من قبل معظم عارضات الرسوم للحصول على إضاءة صحيحة.
export class VertexElementNormal extends VertexElementFVectorEnumerations
VertexElement → VertexElementFVector → VertexElementNormal
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 VertexElementFVectorEnumerations
VertexElement → VertexElementFVector → VertexElementUV
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.
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
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 VertexElementFVectorEnumerations
VertexElement → VertexElementFVector → VertexElementVertexColor
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');