VertexElement — Aspose.3D TypeScript API Reference
Paket: @aspose/3d (v24.12.0)
VertexElement bir …‘ye eklenmiş per-vertex öznitelik kanalları için soyut temel sınıftır Geometry.Her kanal tiplenmiş bir veri dizisi ve mappingMode / referenceMode verinin geometri primitive’leriyle nasıl ilişkili olduğunu kontrol eden meta veriler. Alt sınıflar şunlardır: VertexElementNormal, VertexElementUV, ve 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 şudur MappingMode.CONTROL_POINT; varsayılan referenceMode şudur ReferenceMode.DIRECT.
Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
vertexElementType | VertexElementType | okunur | Bu katmanın anlamsal türü. |
name | string | okunur/yazılır | Bu katman için isteğe bağlı etiket. |
mappingMode | MappingMode | okunur/yazılır | Her değerin hangi geometri primitive’iyle ilişkili olduğunu kontrol eder. |
referenceMode | ReferenceMode | okuma/yazma | Değerlerin doğrudan mı yoksa bir indeks dizisi aracılığıyla mı adreslendiğini kontrol eder. |
indices | number[] | okuma | İndeks dizisi için IndexToDirect referans modu. |
Enumerations
setIndices(data)
NOT IMPLEMENTED. Temel üzerinde VertexElement sınıf, bu yöntem fırlatır Error('set_indices is not implemented') çalışma zamanında. Alt sınıflar VertexElementFVector ve VertexElementIntsTemplate çalışan uygulamaları sağlar.
İndeks dizisini değiştir.
setIndices(data: number[]): voidclear()
NOT IMPLEMENTED. Temel üzerinde VertexElement sınıf, bu yöntem fırlatır Error('clear is not implemented') çalışma zamanında. Alt sınıflar VertexElementFVector ve VertexElementIntsTemplate çalışan uygulamaları sağlar.
Katmandan tüm veri ve indeksleri kaldır.
clear(): voidVertexElementNormal
Yüzey normal vektörlerini depolar. Normal verileri, doğru aydınlatma için çoğu render tarafından gereklidir.
export class VertexElementNormal extends VertexElementFVectorEnumerations
VertexElement → VertexElementFVector → VertexElementNormal
Enumerations
new VertexElementNormal(
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)vertexElementType şu şekilde sabitlenir VertexElementType.NORMAL.
VertexElementUV
2B doku koordinatlarını depolar. Bir ağ, farklı doku kanalları için birden fazla UV katmanı taşıyabilir. Bu textureMapping özellik, kanal amacını tanımlar.
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,
)Varsayılanı TextureMapping.DIFFUSE olduğunda textureMapping dır null.
Ek özellik
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
textureMapping | TextureMapping | okunur | Bu UV katmanının ilişkili olduğu doku kanalı. |
data | FVector4[] | okunur | UV değerleri olarak sunulur FVector4 girdiler (z ve w are 0). |
uvData | FVector2[] | oku | UV değerleri olarak FVector2 girişler (yalnızca x, y). |
addData(data)
UV değerlerini ekle. Kabul eder FVector2[], FVector3[], ya da FVector4[].
addData(data: FVector2[] | FVector3[] | FVector4[]): voidVertexElementVertexColor
Her köşe için RGBA renk değerlerini depolar. Bileşenler 0–1 aralığındadır.
export class VertexElementVertexColor extends VertexElementFVectorEnumerations
VertexElement → VertexElementFVector → VertexElementVertexColor
Enumerations
new VertexElementVertexColor(
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)vertexElementType şu değere sabitlenir VertexElementType.VERTEX_COLOR.
Enumerations
Üçgen mesh’e normal ekle:
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 koordinatları ekle:
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');