Enumerations — Aspose.3D Python API Reference

包:: aspose.threed.entities (aspose-3d-foss 26.1.0)

此页面记录了在 aspose.threed.entities 子包中。顶点元素语义的枚举(VertexElementType, MappingMode, ReferenceMode)也记录在 VertexElement 参考页面.


ProjectionType

控制所使用的投影模型 Camera.

from aspose.threed.entities import ProjectionType
ExampleExample
PERSPECTIVE对象随着远离摄像机而显得更小。这是游戏和可视化渲染的标准模式。.
ORTHOGRAPHIC对象无论距离如何都以恒定比例渲染。用于 CAD、建筑和等轴投影。.

Example

from aspose.threed import Scene
from aspose.threed.entities import Camera, ProjectionType

scene = Scene()
cam = Camera()
cam.projection_type = ProjectionType.ORTHOGRAPHIC
scene.root_node.create_child_node("cam", cam)

LightType

标识 Light 来源的类别。.

from aspose.threed.entities import LightType
ExampleExample
POINT从空间中的单一点向所有方向均匀发光。.
DIRECTIONAL发出平行光线,仿佛来自无限遥远的光源(例如,阳光)。.
SPOT在指定方向发出光锥,具有内锥角和外锥角。.
AREA二维发光表面;用于基于物理的渲染。.
VOLUME体积光源,可照亮空间中的某个区域。.

Example

from aspose.threed import Scene
from aspose.threed.entities import Light, LightType

scene = Scene()
sun = Light("Sun")
# Note: the Light class does not expose a light_type property in the
# current API surface.  LightType exists as an enum for categorisation
# but cannot be set on a Light instance directly.
scene.root_node.create_child_node("sun", sun)

TextureMapping

标识 UV 元素或纹理在表面上绑定的语义通道。.

from aspose.threed.entities import TextureMapping
ExampleExample
DIFFUSEAlbedo / 基础颜色纹理通道。最常用的通道。.
SPECULAR高光颜色或强度纹理通道。.
AMBIENT环境光颜色覆盖纹理。.
EMISSIVE自发光 / 发射纹理通道。.
NORMAL切线空间法线贴图通道。.
BUMP基于高度的凹凸贴图通道(在法线贴图成为标准之前使用)。.
OPACITYAlpha / 透明度遮罩通道。.
GLOW辉光/泛光强度纹理通道。.
REFLECTION环境反射纹理通道。.
SHADOW阴影投射纹理通道。.
SHININESSSpecular exponent / 粗糙度贴图通道。.
DISPLACEMENT几何位移贴图通道。.

Example

from aspose.threed import Scene
from aspose.threed.entities import Mesh, TextureMapping, MappingMode, ReferenceMode
from aspose.threed.utilities import Vector4

mesh = Mesh()
for v in [(0,0,0), (1,0,0), (1,1,0)]:
    mesh.control_points.append(Vector4(*v, 1.0))
mesh.create_polygon(0, 1, 2)

# Attach a UV layer for the diffuse channel
uv = mesh.create_element_uv(TextureMapping.DIFFUSE, MappingMode.CONTROL_POINT, ReferenceMode.DIRECT)

BooleanOperation

标识两个网格对象之间的构造实体几何(CSG)布尔运算类型。.

from aspose.threed.entities import BooleanOperation
ExampleExample
UNION并集:结果是两个操作数的组合体积。.
DIFFERENCE差集:第二个操作数的体积从第一个中移除。.
INTERSECTION交集:结果是两个操作数共享的体积。.

BooleanOperation 存储为由 CSG 导入器生成的节点或自定义对象的元数据。Aspose.3D 用于 Python 不提供运行时布尔求值器;该枚举描述源文件意图。.

Example

from aspose.threed import CustomObject
from aspose.threed.entities import BooleanOperation

csg_meta = CustomObject("csg_op")
csg_meta.set_property("operation", str(BooleanOperation.SUB))

VertexElementType

语义类型用于 VertexElement 层。另见:: VertexElement 参考.

from aspose.threed.entities import VertexElementType
ExampleExample
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

控制每个顶点元素值关联的几何基元。另见:: VertexElement 参考.

from aspose.threed.entities import MappingMode
ExampleExample
CONTROL_POINT每个控制点(顶点)一个值。.
POLYGON_VERTEX每个多边形角(面-顶点)一个值。.
POLYGON每个多边形一个值。.
EDGE每条边一个值。.
ALL_SAME单个值适用于整个网格。.

ReferenceMode

控制顶点元素数据数组的索引方式。另请参见:: VertexElement 参考.

from aspose.threed.entities import ReferenceMode
ExampleExample
DIRECT数据按顺序访问,无需单独的索引数组。.
INDEX数据通过单独的索引数组访问。.
INDEX_TO_DIRECT索引数组将每个映射原语映射到数据数组中的位置。.

另见

 中文