VertexElement — Aspose.3D Python API Reference
חבילה: aspose.threed.entities (aspose-3d-foss 26.1.0)
VertexElement היא המחלקה הבסיסית המופשטת לכל שכבות הנתונים לכל קודקוד שניתן לצרף ל‑ Geometry אובייקט. כל שכבה מחזיקה במערך של ערכי נתונים יחד עם mapping_mode ו reference_mode מטא‑נתונים המתארים כיצד הנתונים ממופים על הגאומטריה הבסיסית. תתי‑מחלקות מותאמות ל‑normals, UV coordinates, vertex colours, tangents, binormals, ו‑smoothing groups.
Properties
from aspose.threed.entities import VertexElementProperties
VertexElement
Properties
| Properties | Properties | Properties | Properties |
|---|---|---|---|
vertex_element_type | VertexElementType | קריאה | סוג סמנטי של שכבה זו (למשל,., NORMAL, UV, VERTEX_COLOR). |
name | str | קריאה/כתיבה | שם אופציונלי לשכבה זו. |
mapping_mode | MappingMode | קריאה/כתיבה | שולט באיזה פרימיטיב גאומטרי משויך כל ערך נתון. |
reference_mode | ReferenceMode | קריאה/כתיבה | שולט האם הערכים נגישים ישירות או דרך מערך אינדקסים. |
indices | list[int] | קריאה | מערך אינדקסים המשמש כאשר reference_mode הוא INDEX_TO_DIRECT. |
data | list[FVector4] | קרא | ערכי נתונים גולמיים מאוחסנים כ FVector4 רשומות (זמין ב VertexElementFVector תתי‑מחלקות). |
Properties
| Properties | Properties | Properties |
|---|---|---|
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 VertexElementNormalProperties
VertexElement → VertexElementFVector → VertexElementNormal
Properties
VertexElementNormal(name="", mapping_mode=None, reference_mode=None)vertex_element_type קבוע ל VertexElementType.NORMAL.
מחזיר: VertexElementUV
מאחסן קואורדינטות מרקם UV. רשת (mesh) יכולה לשאת מספר שכבות UV לערוצים מרקם שונים.
from aspose.threed.entities import VertexElementUVProperties
VertexElement → VertexElementFVector → VertexElementUV
Properties
VertexElementUV(texture_mapping=None, name="", mapping_mode=None, reference_mode=None)| Properties | Properties | Properties |
|---|---|---|
texture_mapping | TextureMapping | ערוץ המרקם שהשכבה UV משרתת. ברירת מחדל היא TextureMapping.DIFFUSE. |
מחזיר: Mesh; רשת חדשה המכילה רק משולשים.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
texture_mapping | TextureMapping | קריאה | ערוץ המרקם שהשכבה UV משויכת אליו. |
add_data(data)
הוסף נתוני קואורדינטות UV. מקבל list[Vector2], list[Vector3], list[FVector2], list[FVector3], או list[FVector4]. כל הערכים נשמרים פנימית כ FVector4 עם רכיבים שאינם בשימוש מוגדרים ל 0.0.
VertexElementVertexColor
מאחסן ערכי צבע RGBA לכל קודקוד בטווח 0–1.
from aspose.threed.entities import VertexElementVertexColorProperties
VertexElement → VertexElementFVector → VertexElementVertexColor
Properties
VertexElementVertexColor(name="", mapping_mode=None, reference_mode=None)vertex_element_type קבוע ל VertexElementType.VERTEX_COLOR.
VertexElementTangent
מאחסן וקטורי tangent לכל קודקוד או לכל פינה, המשמשים ברינדור מפת נורמל.
from aspose.threed.entities import VertexElementTangentProperties
VertexElement → VertexElementFVector → VertexElementTangent
vertex_element_type קבוע ל VertexElementType.TANGENT.
VertexElementBinormal
מאחסן וקטורי binormal (bitangent) לכל קודקוד או לכל פינה, משלים VertexElementTangent למיפוי נורמל במרחב הטנג’נט.
from aspose.threed.entities import VertexElementBinormalProperties
VertexElement → VertexElementFVector → VertexElementBinormal
vertex_element_type קבוע ל VertexElementType.BINORMAL.
VertexElementSmoothingGroup
מאחסן מזהי קבוצות החלקה שלמים לכל פוליגון. נטען מקבצי OBJ שמכילים s הצהרות.
from aspose.threed.entities import VertexElementSmoothingGroupProperties
VertexElement → VertexElementIntsTemplate → VertexElementSmoothingGroup
vertex_element_type קבוע ל VertexElementType.SMOOTHING_GROUP.
ספירת VertexElementType
מזהה את התפקיד הסמנטי של שכבת אלמנט קודקוד.
from aspose.threed.entities import VertexElementType| Properties | Properties |
|---|---|
NORMAL | וקטורי נורמל משטח. |
UV | קואורדינטות UV של מרקם. |
VERTEX_COLOR | צבע RGBA לכל קודקוד. |
TANGENT | וקטורי טנג’נט למיפוי נורמל. |
BINORMAL | וקטורי בינורמל (ביטנג’נט). |
SMOOTHING_GROUP | מזהי קבוצות החלקה שלמים לכל פוליגון. |
MATERIAL | אינדקס חומר לכל פוליגון. |
POLYGON_GROUP | אינדקס קיבוץ פוליגונים. |
VERTEX_CREASE | משקלי קימורים של קודקודי תת-חלוקה. |
EDGE_CREASE | משקלי קימורים של קצוות תת-חלוקה. |
USER_DATA | נתונים שרירותיים המוגדרים על ידי המשתמש. |
VISIBILITY | דגלי נראות לכל אלמנט. |
SPECULAR | צבע או עוצמת השיקוף. |
WEIGHT | משקלי ערבוב לעור. |
HOLE | דגלי חורים בפוליגון. |
ספירת MappingMode
BooleanOperation נשמר כנתוני‑מטא על צמתים שמיוצרים על‑ידי מייבאי CSG. @aspose/3d אינו מבצע הערכה בוליאנית בזמן ריצה; המנוי מתאר כוונה שתועד בקובץ המקור.
from aspose.threed.entities import MappingMode| Properties | Properties |
|---|---|
CONTROL_POINT | ערך אחד לכל נקודת שליטה (קודקוד). |
POLYGON_VERTEX | ערך אחד לכל פינת מצולע (פאה-קודקוד). |
POLYGON | ערך אחד לכל מצולע. |
EDGE | ערך אחד לכל קצה. |
ALL_SAME | ערך יחיד חל על כל הרשת. |
ספירת ReferenceMode
שולט באופן שבו מערך הנתונים מאונדקס.
from aspose.threed.entities import ReferenceMode| Properties | Properties |
|---|---|
DIRECT | הנתונים נגישים באופן רציף ללא מערך אינדקסים נפרד. |
INDEX | הנתונים נגישים דרך מערך אינדקסים נפרד. |
INDEX_TO_DIRECT | מערך אינדקסים ממפה כל פרימיטיב מיפוי למיקום במערך הנתונים. |
Properties
הצמד שכבת נורמל לרשת (מיפוי 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")