VertexElement — Aspose.3D Python API Reference
パッケージ: aspose.threed.entities (aspose-3d-foss 26.1.0)
VertexElement は、オブジェクトにアタッチできるすべての頂点ごとのデータレイヤーの抽象基底クラスです Geometry オブジェクトです。各レイヤーは、データ値の配列を保持し、 mapping_mode と reference_mode メタデータは、データが基礎ジオメトリにどのようにマッピングされるかを記述します。サブクラスは、法線、UV座標、頂点カラー、タンジェント、バイノーマル、スムージンググループ用に特化しています。.
Methods
from aspose.threed.entities import VertexElementMethods
VertexElement
Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
vertex_element_type | VertexElementType | Read | このレイヤーのセマンティックタイプ(例:., NORMAL, UV, VERTEX_COLOR). |
name | str | Read/Write | このレイヤーの任意の名前。. |
mapping_mode | MappingMode | Read/Write | 各データ値がどのジオメトリプリミティブに関連付けられるかを制御します。. |
reference_mode | ReferenceMode | 読み取り/書き込み | 値が直接アドレス指定されるか、インデックス配列を介してアドレス指定されるかを制御します。. |
indices | list[int] | 読み取り | インデックス配列は次の場合に使用されます reference_mode です INDEX_TO_DIRECT. |
data | list[FVector4] | 読み取り | 生データ値は次の形式で保存されます FVector4 エントリ(利用可能な VertexElementFVector サブクラス)。. |
Methods
| Methods | Methods | Methods |
|---|---|---|
set_data(data) | None | データ配列を置き換えます。受け入れるのは list[FVector2], list[FVector3],、または list[FVector4]; 値は正規化されます FVector4 内部的に。. |
set_indices(data) | None | インデックス配列を整数のリストに置き換えます。. |
clear() | None | レイヤーからすべてのデータ値とインデックスを削除します。. |
copy_to(target) | None | データとインデックスを別の VertexElementFVector インスタンス。. |
VertexElementNormal
表面法線ベクトルを格納します。法線データは通常、レンダラーがライティング計算に使用します。.
from aspose.threed.entities import VertexElementNormalMethods
VertexElement → VertexElementFVector → VertexElementNormal
Methods
VertexElementNormal(name="", mapping_mode=None, reference_mode=None)vertex_element_type は固定されています VertexElementType.NORMAL.
Returns: VertexElementUV
UV テクスチャ座標を格納します。メッシュは異なるテクスチャチャンネル用に複数の UV レイヤーを持つことができます。.
from aspose.threed.entities import VertexElementUVMethods
VertexElement → VertexElementFVector → VertexElementUV
Methods
VertexElementUV(texture_mapping=None, name="", mapping_mode=None, reference_mode=None)| Methods | Methods | Methods |
|---|---|---|
texture_mapping | TextureMapping | このUVレイヤーが提供するテクスチャチャンネルです。デフォルトは TextureMapping.DIFFUSE. |
StlLoadOptions
| Methods | Methods | Methods | Methods |
|---|---|---|---|
texture_mapping | TextureMapping | 読み取り | このUVレイヤーが関連付けられているテクスチャチャンネルです。. |
add_data(data)
UV座標データを追加します。受け付けるのは list[Vector2], list[Vector3], list[FVector2], list[FVector3],、または list[FVector4].。すべての値は内部的に次のように格納されます FVector4 未使用のコンポーネントは次のように設定されます 0.0.
VertexElementVertexColor
0〜1 の範囲で頂点ごとの RGBA カラー値を格納します。.
from aspose.threed.entities import VertexElementVertexColorMethods
VertexElement → VertexElementFVector → VertexElementVertexColor
Methods
VertexElementVertexColor(name="", mapping_mode=None, reference_mode=None)vertex_element_type は固定されています VertexElementType.VERTEX_COLOR.
VertexElementTangent
頂点またはコーナーごとのタンジェントベクトルを格納し、ノーマルマップのレンダリングに使用されます。.
from aspose.threed.entities import VertexElementTangentMethods
VertexElement → VertexElementFVector → VertexElementTangent
vertex_element_type は固定されています VertexElementType.TANGENT.
VertexElementBinormal
頂点ごとまたはコーナーごとのバイノーマル(ビタンジェント)ベクトルを格納し、 VertexElementTangent 接線空間ノーマルマッピング用です。.
from aspose.threed.entities import VertexElementBinormalMethods
VertexElement → VertexElementFVector → VertexElementBinormal
vertex_element_type は固定されています VertexElementType.BINORMAL.
VertexElementSmoothingGroup
ポリゴンごとの整数スムージンググループIDを格納します。次のを含むOBJファイルから読み込まれます s 宣言です。.
from aspose.threed.entities import VertexElementSmoothingGroupMethods
VertexElement → VertexElementIntsTemplate → VertexElementSmoothingGroup
vertex_element_type は固定されています VertexElementType.SMOOTHING_GROUP.
VertexElementType 列挙型
頂点要素レイヤーのセマンティックな役割を識別します。.
from aspose.threed.entities import VertexElementType| Methods | Methods |
|---|---|
NORMAL | 表面法線ベクトル。. |
UV | テクスチャ UV 座標。. |
VERTEX_COLOR | 頂点ごとの RGBA カラー。. |
TANGENT | ノーマルマッピング用接線ベクトル。. |
BINORMAL | バイノーマル(ビタンジェント)ベクトル。. |
SMOOTHING_GROUP | ポリゴンごとのスムージンググループ整数 ID。. |
MATERIAL | ポリゴンごとのマテリアルインデックス。. |
POLYGON_GROUP | ポリゴンのグルーピングインデックス。. |
VERTEX_CREASE | サブディビジョン頂点クレース重み。. |
EDGE_CREASE | サブディビジョンエッジクレース重み。. |
USER_DATA | 任意のユーザー定義データ。. |
VISIBILITY | 要素ごとの可視性フラグ。. |
SPECULAR | 鏡面の色または強度。. |
WEIGHT | スキニング用のブレンドウェイト。. |
HOLE | ポリゴンの穴フラグ。. |
MappingMode 列挙型
各頂点要素の値がどのジオメトリプリミティブに関連付けられるかを制御します。.
from aspose.threed.entities import MappingMode| Methods | Methods |
|---|---|
CONTROL_POINT | 制御点(頂点)ごとの1つの値。. |
POLYGON_VERTEX | ポリゴンのコーナー(フェイス頂点)ごとの1つの値。. |
POLYGON | ポリゴンごとの1つの値。. |
EDGE | エッジごとの1つの値。. |
ALL_SAME | 単一の値がメッシュ全体に適用されます。. |
ReferenceMode 列挙型
データ配列のインデックス付け方法を制御します。.
from aspose.threed.entities import ReferenceMode| Methods | Methods |
|---|---|
DIRECT | データは別個のインデックス配列なしで順次アクセスされます。. |
INDEX | データは別個のインデックス配列を介してアクセスされます。. |
INDEX_TO_DIRECT | インデックス配列は、各マッピングプリミティブをデータ配列内の位置にマッピングします。. |
Methods
メッシュに法線レイヤーをアタッチする(DIRECT マッピング)::
from aspose.threed import Scene
from aspose.threed.entities import Mesh, VertexElementType, MappingMode, ReferenceMode, VertexElementNormal
from aspose.threed.utilities import Vector4, FVector4
mesh = Mesh()
mesh.control_points.append(Vector4(0.0, 0.0, 0.0, 1.0))
mesh.control_points.append(Vector4(1.0, 0.0, 0.0, 1.0))
mesh.control_points.append(Vector4(0.5, 1.0, 0.0, 1.0))
mesh.create_polygon(0, 1, 2)
normals: VertexElementNormal = mesh.create_element(
VertexElementType.NORMAL,
MappingMode.CONTROL_POINT,
ReferenceMode.DIRECT,
)
normals.set_data([
FVector4(0.0, 0.0, 1.0, 0.0),
FVector4(0.0, 0.0, 1.0, 0.0),
FVector4(0.0, 0.0, 1.0, 0.0),
])
scene = Scene()
scene.root_node.create_child_node("tri", mesh)
scene.save("triangle_normals.glb")UV 座標をアタッチする(INDEX_TO_DIRECT マッピング)::
from aspose.threed import Scene
from aspose.threed.entities import Mesh, TextureMapping, MappingMode, ReferenceMode
from aspose.threed.utilities import Vector4, FVector4
mesh = Mesh()
for x, z in [(0, 0), (1, 0), (1, 1), (0, 1)]:
mesh.control_points.append(Vector4(float(x), 0.0, float(z), 1.0))
mesh.create_polygon(0, 1, 2, 3)
uv = mesh.create_element_uv(
TextureMapping.DIFFUSE,
MappingMode.POLYGON_VERTEX,
ReferenceMode.INDEX_TO_DIRECT,
)
uv.set_data([
FVector4(0.0, 0.0, 0.0, 0.0),
FVector4(1.0, 0.0, 0.0, 0.0),
FVector4(1.0, 1.0, 0.0, 0.0),
FVector4(0.0, 1.0, 0.0, 0.0),
])
uv.set_indices([0, 1, 2, 3])
scene = Scene()
scene.root_node.create_child_node("quad", mesh)
scene.save("quad_uv.glb")