Light

Methods: aspose.threed.entities (aspose-3d-foss)

Light 은(는) an Entity 3D 장면에 광원을 추가하는 것입니다. Like Camera, 이것은 에 부착됩니다 a Node 그 위치와 방향을 제어합니다.

class Light(Camera):

Methods

A3DObjectSceneObjectEntityCameraLight

Light 는(은) 로부터 상속받습니다 Camera. 현재 릴리스에서는, the Light class 자체는 상속받은 것 외에 추가 속성을 노출하지 않습니다 beyond those inherited from Camera 그리고 Entity. 그 LightType enum은 조명을 분류하기 위해 존재하지만, 없습니다 light_type 속성은 Light 클래스.


Methods

Light(name: str = None)
MethodsMethodsMethodsMethods
name`strNone`None

Methods

MethodsMethodsMethods
namestr조명 객체의 이름 (상속받은 A3DObject).

Light 또한 모든 것을 상속합니다 Camera 속성 (near_plane, far_plane, 등), 비록 이것들은 광원 객체에 의미가 없지만. 참고: the Light 클래스는 a 를 노출하지 않는다 light_type 현재 API 표면에 있는 속성.


LightType 값

from aspose.threed.entities import LightType
MethodsMethodsMethods
LightType.POINT"POINT"단일 지점에서 모든 방향으로 균등하게 빛을 방출합니다.
LightType.DIRECTIONAL"DIRECTIONAL"무한히 먼 광원(예: 햇빛)에서 나오는 평행 광선.
LightType.SPOT"SPOT"원뿔형 빔; 위치와 방향이 중요합니다.
LightType.AREA"AREA"직사각형 영역에서 방출되는 빛.
LightType.VOLUME"VOLUME"볼류메트릭/글로벌 일루미네이션 라이트.

사용 예시

포인트 라이트

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

scene = Scene()

light = Light("PointLight")
node = scene.root_node.create_child_node("light", light)
node.transform.set_translation(0.0, 10.0, 0.0)

scene.save("lit-scene.glb", FileFormat.GLTF)

디렉셔널 라이트

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

scene = Scene()

sun = Light("Sun")
node = scene.root_node.create_child_node("sun", sun)
# Direction is controlled by the node's rotation
node.transform.set_euler_angles(-45.0, 30.0, 0.0)  # degrees

scene.save("directional-light.glb")

Camera와 Light를 모두 추가

from aspose.threed import Scene, FileFormat
from aspose.threed.entities import Camera, Light, LightType, ProjectionType

scene = Scene()

# Camera
cam = Camera("Cam", ProjectionType.PERSPECTIVE)
cam.field_of_view = 60.0
cam_node = scene.root_node.create_child_node("camera", cam)
cam_node.transform.set_translation(0.0, 5.0, 15.0)

# Directional light
light = Light("DirLight")
light_node = scene.root_node.create_child_node("light", light)
light_node.transform.set_euler_angles(-30.0, 45.0, 0.0)

scene.save("camera-and-light.glb", FileFormat.GLTF)

가져온 씬에서 라이트 열거

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

scene = Scene()
scene.open("model.glb")

def find_lights(node, depth=0):
    if isinstance(node.entity, Light):
        print(f"{'  ' * depth}Light: {node.name}")
    for child in node.child_nodes:
        find_lights(child, depth + 1)

find_lights(scene.root_node)

또 보기

 한국어