Camera
Methods: aspose.threed.entities (aspose-3d-foss)
Camera は Entity 3Dシーンにおける視点を定義します。シーンが2D画像平面に投影される方法を制御します。カメラは a に取り付けられます。 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, etc.) はセッターがノーオプで、割り当てられた値は保持されません。これらのプロパティを読み戻すと、割り当てられた内容に関係なくクラスのデフォルト値が返されます。.
3Dファイル(glTF、FBX)からカメラデータをインポートする際、 projection_type 正しく解析されます。フォーマットがシーングラフメタデータとして保存している場合、他のカメラ属性も利用可能です。.
Methods
Camera(name: str = None, projection_type: str = "PERSPECTIVE")| Methods | Methods | Methods | Methods |
|---|---|---|---|
name | `str | None` | None |
projection_type | str | "PERSPECTIVE" | 初期投影タイプ。使用 ProjectionType.PERSPECTIVE または ProjectionType.ORTHOGRAPHIC. |
Methods
| Methods | Methods | Methods |
|---|---|---|
projection_type | str | 投影モード:: "PERSPECTIVE" または "ORTHOGRAPHIC". 設定は ProjectionType 定数。. |
near_plane | float | 近クリッピング平面までの距離。この距離より近いジオメトリは描画されません。デフォルト 0.1. |
far_plane | float | 遠クリッピング平面までの距離。この距離より遠いジオメトリは描画されません。デフォルト 1000.0. |
field_of_view | float | 垂直視野角(度単位、パースペクティブカメラのみ)。デフォルト 0.0. |
field_of_view_x | float | 水平視野角(度単位)。デフォルト 0.0. |
field_of_view_y | float | 垂直視野角(度単位、同じく field_of_view). デフォルト 0.0. |
aspect_ratio | float | 出力画像の幅高さ比。デフォルト 1.0. |
ortho_height | float | 正射影ビュー体の高さ(ワールド単位、正射影カメラのみ)。デフォルト 100.0. |
name | str | カメラオブジェクトの名前。. |
使用例
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}")