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 IIndexedVertexElement

Enumerations

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

EnumerationsEnumerationsEnumerationsEnumerations
vertexElementTypeVertexElementTypeokunurBu katmanın anlamsal türü.
namestringokunur/yazılırBu katman için isteğe bağlı etiket.
mappingModeMappingModeokunur/yazılırHer değerin hangi geometri primitive’iyle ilişkili olduğunu kontrol eder.
referenceModeReferenceModeokuma/yazmaDeğerlerin doğrudan mı yoksa bir indeks dizisi aracılığıyla mı adreslendiğini kontrol eder.
indicesnumber[]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[]): void

clear()

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(): void

VertexElementNormal

Yüzey normal vektörlerini depolar. Normal verileri, doğru aydınlatma için çoğu render tarafından gereklidir.

export class VertexElementNormal extends VertexElementFVector

Enumerations

VertexElementVertexElementFVectorVertexElementNormal

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 VertexElementFVector

Enumerations

VertexElementVertexElementFVectorVertexElementUV

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

EnumerationsEnumerationsEnumerationsEnumerations
textureMappingTextureMappingokunurBu UV katmanının ilişkili olduğu doku kanalı.
dataFVector4[]okunurUV değerleri olarak sunulur FVector4 girdiler (z ve w are 0).
uvDataFVector2[]okuUV 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[]): void

VertexElementVertexColor

Her köşe için RGBA renk değerlerini depolar. Bileşenler 0–1 aralığındadır.

export class VertexElementVertexColor extends VertexElementFVector

Enumerations

VertexElementVertexElementFVectorVertexElementVertexColor

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

Ayrıca Bakınız

 Türkçe