Light
Methods: aspose.threed.entities (aspose-3d-foss)
Light एक है Entity जो 3D दृश्य में एक प्रकाश स्रोत जोड़ता है। जैसा कि Camera, यह एक Node जिससे उसकी स्थिति और दिशा नियंत्रित की जा सके।.
class Light(Camera):Methods
A3DObject → SceneObject → Entity → Camera → Light
Light से विरासत में प्राप्त करता है Camera. वर्तमान रिलीज़ में, Light क्लास स्वयं उन विरासत में प्राप्त गुणों से परे अतिरिक्त प्रॉपर्टीज़ को उजागर नहीं करती Camera और Entity. यह LightType lights को वर्गीकृत करने के लिए enum मौजूद है लेकिन कोई नहीं है light_type पर प्रॉपर्टी Light क्लास।.
Methods
Light(name: str = None)| Name | Type | Access | Description |
|---|---|---|---|
name | str | Read/Write | Gets or sets the name. |
parent_nodes | `` | Read | Gets the parent nodes. |
excluded | bool | Read/Write | Gets or sets the excluded. |
parent_node | `` | Read/Write | Gets or sets the parent node. |
rotation_mode | `` | Read/Write | Gets or sets the rotation mode. |
near_plane | float | Read/Write | Gets or sets the near plane. |
far_plane | float | Read/Write | Gets or sets the far plane. |
aspect | float | Read/Write | Gets or sets the aspect. |
ortho_height | float | Read/Write | Gets or sets the ortho height. |
up | `` | Read/Write | Gets or sets the up. |
look_at | `` | Read/Write | Gets or sets the look at. |
direction | `` | Read/Write | Gets or sets the direction. |
target | `` | Read/Write | Gets or sets the target. |
aperture_mode | `` | Read/Write | Gets or sets the aperture mode. |
field_of_view | float | Read/Write | Gets or sets the field of view. |
field_of_view_x | float | Read/Write | Gets or sets the field of view x. |
field_of_view_y | float | Read/Write | Gets or sets the field of view y. |
width | float | Read/Write | Gets or sets the width. |
height | float | Read/Write | Gets or sets the height. |
aspect_ratio | float | Read/Write | Gets or sets the aspect ratio. |
magnification | `` | Read/Write | Gets or sets the magnification. |
projection_type | str | Read/Write | Gets or sets the projection type. |
scene | `` | Read/Write | Gets or sets the scene. |
properties | PropertyCollection | Read | Gets the properties. |
Methods
| Signature | Description |
|---|---|
__init__(name: str, light_type) | |
move_forward(distance: float) | |
get_bounding_box() | Returns the bounding box. |
get_entity_renderer_key() | Not implemented in the FOSS edition — throws at runtime. Returns the entity renderer key. |
remove_property(property) | |
get_property(property: str) | |
set_property(property: str, value) | Sets the property value. |
find_property(property: str) |
Light भी सभी को विरासत में लेता है Camera प्रॉपर्टीज़ (near_plane, far_plane, आदि), हालांकि ये light ऑब्जेक्ट्स के लिए अर्थपूर्ण नहीं हैं। नोट: the Light class एक को एक्सपोज़ नहीं करती है light_type प्रॉपर्टी वर्तमान API सतह में।.
LightType मान
from aspose.threed.entities import LightType| Methods | Methods | Methods |
|---|---|---|
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")एक साथ कैमरा और लाइट जोड़ें
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)