VertexElement — Aspose.3D TypeScript API Reference

패키지: @aspose/3d (v24.12.0)

VertexElement 는 per-vertex 속성 채널이 부착되는 추상 기본 클래스입니다 Geometry.각 채널은 형식이 지정된 데이터 배열과 mappingMode / referenceMode 데이터가 기하학 프리미티브와 어떻게 연관되는지를 제어하는 메타데이터를 포함합니다. 서브클래스는 다음과 같습니다: VertexElementNormal, VertexElementUV, 및 VertexElementVertexColor.

import { VertexElement, VertexElementNormal, VertexElementUV, VertexElementVertexColor } from '@aspose/3d';

ImageRenderOptions

export abstract class VertexElement implements IIndexedVertexElement

ImageRenderOptions

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

ImageRenderOptions mappingModeMappingMode.CONTROL_POINT; 기본값 referenceModeReferenceMode.DIRECT.

ImageRenderOptions

ImageRenderOptionsImageRenderOptionsImageRenderOptionsImageRenderOptions
vertexElementTypeVertexElementType읽기이 레이어의 의미 유형입니다.
namestring읽기/쓰기이 레이어에 대한 선택적 라벨입니다.
mappingModeMappingMode읽기/쓰기각 값이 연관되는 기하학 프리미티브를 제어합니다.
referenceModeReferenceMode읽기/쓰기값이 직접 주소 지정되는지 인덱스 배열을 통해 주소 지정되는지를 제어합니다.
indicesnumber[]읽기인덱스 배열 IndexToDirect 레퍼런스 모드.

ImageRenderOptions

setIndices(data)

NOT IMPLEMENTED. 기본 클래스에서 VertexElement 클래스, 이 메서드는 예외를 발생시킵니다 Error('set_indices is not implemented') 런타임에. 서브클래스는 VertexElementFVectorVertexElementIntsTemplate 작동하는 구현을 제공합니다.

인덱스 배열을 교체합니다.

setIndices(data: number[]): void

clear()

NOT IMPLEMENTED. 기본 클래스에서 VertexElement 클래스, 이 메서드는 예외를 발생시킵니다 Error('clear is not implemented') 런타임에. 서브클래스는 VertexElementFVectorVertexElementIntsTemplate 작동하는 구현을 제공합니다.

레이어의 모든 데이터와 인덱스를 제거합니다.

clear(): void

VertexElementNormal

표면 노멀 벡터를 저장합니다. 올바른 조명을 위해 대부분의 렌더러가 노멀 데이터를 필요로 합니다.

export class VertexElementNormal extends VertexElementFVector

ImageRenderOptions

VertexElementVertexElementFVectorVertexElementNormal

ImageRenderOptions

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

vertexElementType 는 다음으로 고정됩니다 VertexElementType.NORMAL.


VertexElementUV

2D 텍스처 좌표를 저장합니다. 메시는 다양한 텍스처 채널을 위해 여러 UV 레이어를 가질 수 있습니다. 해당 textureMapping 속성은 채널의 용도를 식별합니다.

export class VertexElementUV extends VertexElementFVector

ImageRenderOptions

VertexElementVertexElementFVectorVertexElementUV

ImageRenderOptions

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

기본값은 TextureMapping.DIFFUSE 일 때 textureMapping 이다 null.

추가 속성

ImageRenderOptionsImageRenderOptionsImageRenderOptionsImageRenderOptions
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

ImageRenderOptions

VertexElementVertexElementFVectorVertexElementVertexColor

ImageRenderOptions

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

vertexElementType 은(는) 다음으로 고정됩니다 VertexElementType.VERTEX_COLOR.


ImageRenderOptions

삼각형 메시에 노멀을 추가합니다:

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

참고

 한국어