Camera
Methods: aspose.threed.entities (aspose-3d-foss)
Camera ist ein Entity die einen Blickpunkt in einer 3D‑Szene definiert. Sie steuert, wie die Szene auf eine 2D‑Bildebene projiziert wird. Eine Kamera ist an einem Node zur Positionierung und Ausrichtung in der Szene.
class Camera(Entity):Methods
A3DObject → SceneObject → Entity → Camera
Implementierungshinweise
In dieser Ausgabe von aspose-3d-foss ist die Camera Klasse ein Deklarations-Stub. projection_type Nur name undnear_plane, far_plane, field_of_view, aspect_ratio,werden funktional gespeichert und können abgerufen werden. Alle anderen Eigenschaften ( , usw.) haben Setter, die keine Wirkung haben; die zugewiesenen Werte werden nicht behalten. Das Auslesen dieser Eigenschaften liefert den Klassenstandardwert, unabhängig davon, was zugewiesen wurde.
Beim Importieren von Kameradaten aus einer 3D-Datei (glTF, FBX) wird die projection_type korrekt geparst. Weitere Kameraattribute sind verfügbar, wenn das Format sie als Szenengraph-Metadaten speichert.
Methods
Camera(name: str = None, projection_type: str = "PERSPECTIVE")| Methods | Methods | Methods | Methods |
|---|---|---|---|
name | `str | None` | None |
projection_type | str | "PERSPECTIVE" | Initialer Projektionstyp. Verwenden ProjectionType.PERSPECTIVE oder ProjectionType.ORTHOGRAPHIC. |
Methods
| Methods | Methods | Methods |
|---|---|---|
projection_type | str | Projektionsmodus: "PERSPECTIVE" oder "ORTHOGRAPHIC". Festlegen mit ProjectionType Konstanten. |
near_plane | float | Abstand zur nahen Clipping-Ebene. Geometrie, die näher liegt, wird nicht gerendert. Standard 0.1. |
far_plane | float | Abstand zur fernen Clipping-Ebene. Geometrie, die weiter entfernt liegt, wird nicht gerendert. Standard 1000.0. |
field_of_view | float | Vertikales Sichtfeld in Grad (nur perspektivische Kameras). Standard 0.0. |
field_of_view_x | float | Horizontales Sichtfeld in Grad. Standard 0.0. |
field_of_view_y | float | Vertikales Sichtfeld in Grad (wie field_of_view). Standard 0.0. |
aspect_ratio | float | Breite‑zu‑Höhe‑Verhältnis des Ausgabebildes. Standard 1.0. |
ortho_height | float | Höhe des orthografischen Sichtvolumens in Welteinheiten (nur orthografische Kameras). Standard 100.0. |
name | str | Name des Kameraobjekts. |
Verwendungsbeispiele
Methods: In dieser Ausgabe ist nur projection_type ist funktional gespeichert. Eigenschaftszuweisungen für near_plane, far_plane, field_of_view, und aspect_ratio werden ohne Fehler akzeptiert, aber nicht gespeichert.
Perspektivkamera
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")Orthografische Kamera
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)Kamera nach Import auslesen
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}")