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

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 classでは、このメソッドは例外をスローします Error('set_indices is not implemented') 実行時に。サブクラス VertexElementFVector および VertexElementIntsTemplate 動作する実装を提供します。.

インデックス配列を置き換えます。.

setIndices(data: number[]): void

clear()

NOT IMPLEMENTED. baseクラスで VertexElement classでは、このメソッドは例外をスローします Error('clear is not implemented') 実行時に。サブクラス VertexElementFVector および VertexElementIntsTemplate 動作する実装を提供します。.

レイヤーからすべてのデータとインデックスを削除します。.

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レイヤーを持つことができます。The 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');

関連項目

 日本語