Camera
Methods: aspose.threed.entities (aspose-3d-foss)
Camera 은 Entity 3D 장면에서 시점을 정의하는 요소입니다. 장면이 2D 이미지 평면에 투영되는 방식을 제어합니다. 카메라는 Node 장면 내에서 위치와 방향을 지정합니다.
class Camera(Entity):Methods
A3DObject → SceneObject → Entity → Camera
구현 참고 사항
aspose-3d-foss의 이번 버전에서는 Camera 클래스는 선언 스텁. 오직 projection_type 그리고 name 기능적으로 저장되고 검색할 수 있습니다. 다른 모든 속성 (near_plane, far_plane, field_of_view, aspect_ratio, 등)은 설정자가 아무 동작도 하지 않으며; 할당된 값은 유지되지 않습니다. 이러한 속성을 다시 읽어오면 할당된 내용과 관계없이 클래스 기본값이 반환됩니다.
3D 파일(glTF, FBX)에서 카메라 데이터를 가져올 때, projection_type 가 올바르게 구문 분석됩니다. 형식이 장면 그래프 메타데이터로 저장하는 경우 다른 카메라 속성도 사용할 수 있습니다.
Methods
Camera(name: str = None, projection_type: str = "PERSPECTIVE")| 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, projection_type) | |
move_forward(distance: float) | Moves the camera forward by the specified distance |
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) | Removes a custom property identified by the given property object |
remove_property(property_name: str) | |
get_property(property: str) | Retrieves the value of a custom property by its identifier |
set_property(property: str, value) | Sets the property value. |
find_property(property: str) | Searches for a custom property and returns it if found |
사용 예시
Methods: 이 버전에서는, 오직 projection_type 는 기능적으로 저장됩니다. 속성 할당은 near_plane, far_plane, field_of_view, 및 aspect_ratio 오류 없이 수락되지만 지속되지 않습니다.
원근 카메라
from aspose.threed import Scene
from aspose.threed.entities import Camera
from aspose.threed.entities import ProjectionType
scene = Scene()
# projection_type is stored and saved
cam = Camera("MainCamera", ProjectionType.PERSPECTIVE)
node = scene.root_node.create_child_node("camera", cam)
# Position the camera using node transform (this does persist)
node.transform.set_translation(0.0, 5.0, 20.0)
scene.save("scene-with-camera.glb")직교 카메라
from aspose.threed import Scene, FileFormat
from aspose.threed.entities import Camera, ProjectionType
scene = Scene()
# Only projection_type is retained; other property assignments are no-ops
cam = Camera("OrthoCamera", ProjectionType.ORTHOGRAPHIC)
scene.root_node.create_child_node("ortho_cam", cam)
scene.save("ortho-scene.glb", FileFormat.GLTF)가져온 후 카메라 읽기
from aspose.threed import Scene
from aspose.threed.entities import Camera
scene = Scene()
scene.open("model.glb")
for node in scene.root_node.child_nodes:
if isinstance(node.entity, Camera):
cam = node.entity
# projection_type is reliably populated; other numeric properties
# return default values (0.0 / 1.0) regardless of file content
print(f"Camera '{cam.name}': {cam.projection_type}")