VertexElement — Aspose.3D TypeScript API Reference
بسته بندی : آکاایران / 3D (۲۰۱۴ و ۱۲۰)
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
constructor(
elementType: VertexElementType,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)Default mappingMode است MappingMode.CONTROL_POINT;• فاکتور referenceMode است ReferenceMode.DIRECT.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
vertexElementType | VertexElementType | Read | نوع سمی از این لایه. |
name | string | خواندن / نوشتن | برچسب های انتخابی برای این لایه. |
mappingMode | MappingMode | خواندن / نوشتن | کنترل که جغرافیای ابتدایی هر ارزش با آن مرتبط است. |
referenceMode | ReferenceMode | خواندن / نوشتن | بررسی می کند که آیا ارزش ها به طور مستقیم یا از طریق یک شاخص مورد توجه قرار می گیرند. |
indices | number[] | Read | شاخص برای IndexToDirect حالت مرجع. |
Methods
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 VertexElementFVector { }Inheritance
VertexElement → VertexElementFVector → VertexElementNormal
Constructor
new VertexElementNormal(
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)vertexElementType به طور ثابت برای VertexElementType.NORMAL.
VertexElementUV
یک ماسه می تواند چندین لایه UV را برای کانال های مختلف بافت حمل کند. textureMapping این موضوع هدف کانال را مشخص می کند.
export class VertexElementUV extends VertexElementFVector { }Inheritance
VertexElement → VertexElementFVector → VertexElementUV
Constructor
new VertexElementUV(
textureMapping: TextureMapping | null = null,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)ضعف ها به TextureMapping.DIFFUSE زمانی که textureMapping است null.
ویژگی اضافی
| Property | Type | Access | Description |
|---|---|---|---|
textureMapping | TextureMapping | Read | کانال بافت این لایه UV مرتبط است. |
data | FVector4[] | Read | UV در معرض آن قرار می گیرد. FVector4 در این مطلب به بررسی می پردازیم که :Z و W 0). |
uvData | FVector2[] | Read | UV ارزش ها به عنوان FVector2 در این مطلب به چند نکته اشاره می کنیم: x، y فقط. |
addData(data)
اضافه کردن ارزش های UV. پذیرش FVector2[], FVector3[],یا FVector4[].
addData(data: FVector2[] | FVector3[] | FVector4[]): voidVertexElementVertexColor
مقادیر رنگ RGBA برای هر رأس را ذخیره میکند. مؤلفهها در بازهٔ ۰ تا ۱ قرار دارند.
export class VertexElementVertexColor extends VertexElementFVector { }Inheritance
VertexElement → VertexElementFVector → VertexElementVertexColor
Constructor
new VertexElementVertexColor(
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)vertexElementType به طور ثابت برای VertexElementType.VERTEX_COLOR.
Examples
اضافه کردن استاندارد به یک ماسه مثلث:
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');