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 IIndexedVertexElementImageRenderOptions
constructor(
elementType: VertexElementType,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)ImageRenderOptions mappingMode は MappingMode.CONTROL_POINT;;デフォルト referenceMode は ReferenceMode.DIRECT.
ImageRenderOptions
| ImageRenderOptions | ImageRenderOptions | ImageRenderOptions | ImageRenderOptions |
|---|---|---|---|
vertexElementType | VertexElementType | 読み取り | このレイヤーのセマンティックタイプ。. |
name | string | 読み取り/書き込み | このレイヤーのオプションラベル。. |
mappingMode | MappingMode | 読み取り/書き込み | 各値が関連付けられるジオメトリプリミティブを制御します。. |
referenceMode | ReferenceMode | 読み取り/書き込み | 値が直接アドレス指定されるか、インデックス配列を介してアドレス指定されるかを制御します。. |
indices | number[] | 読み取り | インデックス配列(対象) IndexToDirect 参照モード。. |
ImageRenderOptions
setIndices(data)
NOT IMPLEMENTED. ベース上で VertexElement classでは、このメソッドは例外をスローします Error('set_indices is not implemented') 実行時に。サブクラス VertexElementFVector および VertexElementIntsTemplate 動作する実装を提供します。.
インデックス配列を置き換えます。.
setIndices(data: number[]): voidclear()
NOT IMPLEMENTED. baseクラスで VertexElement classでは、このメソッドは例外をスローします Error('clear is not implemented') 実行時に。サブクラス VertexElementFVector および VertexElementIntsTemplate 動作する実装を提供します。.
レイヤーからすべてのデータとインデックスを削除します。.
clear(): voidVertexElementNormal
表面法線ベクトルを格納します。正しいライティングのために、ほとんどのレンダラが法線データを必要とします。.
export class VertexElementNormal extends VertexElementFVectorImageRenderOptions
VertexElement → VertexElementFVector → VertexElementNormal
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 VertexElementFVectorImageRenderOptions
VertexElement → VertexElementFVector → VertexElementUV
ImageRenderOptions
new VertexElementUV(
textureMapping: TextureMapping | null = null,
name: string = '',
mappingMode: MappingMode | null = null,
referenceMode: ReferenceMode | null = null,
)デフォルトは TextureMapping.DIFFUSE 条件が textureMapping です null.
追加プロパティ
| ImageRenderOptions | ImageRenderOptions | ImageRenderOptions | ImageRenderOptions |
|---|---|---|---|
textureMapping | TextureMapping | 読み取り | このUVレイヤーが関連付けられているテクスチャチャンネルです。. |
data | FVector4[] | 読み取り | UV値は次のように公開されます FVector4 エントリ (z と w は 0). |
uvData | FVector2[] | 読み取り | UV値は FVector2 エントリ (x, y のみ)。. |
addData(data)
UV 値を追加します。受け付けます FVector2[], FVector3[], または FVector4[].
addData(data: FVector2[] | FVector3[] | FVector4[]): voidVertexElementVertexColor
頂点ごとの RGBA カラー値を格納します。各コンポーネントは 0〜1 の範囲です。.
export class VertexElementVertexColor extends VertexElementFVectorImageRenderOptions
VertexElement → VertexElementFVector → VertexElementVertexColor
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');