Camera
Paket: @aspose/3d (v24.12.0)
Camera bir Entity birine eklenebilen Node sahnede bir bakış açısı tanımlamak için. Hem perspektif hem de ortografik projeksiyonları destekler, özelliği tarafından kontrol edilir. projectionType Kamera parametreleri, sahne kameraları destekleyen bir formata (FBX, COLLADA, glTF) kaydedildiğinde 3D dosyasında depolanır.
export class Camera extends EntityEnumerations
A3DObject ← SceneObject ← Entity ← Camera
Enumerations
Bir sahneye perspektif bir kamera ekleyin ve frustum’ını yapılandırın.
import { Scene, Node, Camera, ProjectionType } from '@aspose/3d';
const scene = new Scene();
const camNode = scene.rootNode.createChildNode('mainCamera');
const camera = new Camera('mainCamera', ProjectionType.PERSPECTIVE);
camNode.entity = camera;
camera.nearPlane = 0.1;
camera.farPlane = 500;
camera.fieldOfView = 60;
camera.aspect = 16 / 9;
scene.save('output.gltf');
console.log(`Camera projection: ${camera.projectionType}`);
// Camera projection: PERSPECTIVE
Enumerations
| Name | Type | Access | Description |
|---|---|---|---|
name | string | Read/Write | Gets the name. |
parentNodes | any[] | Read | Gets the parent nodes. |
excluded | boolean | Read/Write | Gets the excluded. |
parentNode | any | Read/Write | Gets the parent node. |
rotationMode | any | Read/Write | Gets the rotation mode. |
nearPlane | number | Read/Write | Gets the near plane. |
farPlane | number | Read/Write | Gets the far plane. |
aspect | number | Read/Write | Gets the aspect. |
orthoHeight | number | Read/Write | Gets the ortho height. |
up | any | Read/Write | Gets the up. |
lookAt | any | Read/Write | Gets the look at. |
direction | any | Read/Write | Gets the direction. |
target | any | Read/Write | Gets the target. |
apertureMode | any | Read/Write | Gets the aperture mode. |
fieldOfView | number | Read/Write | Gets the field of view. |
fieldOfViewX | number | Read/Write | Gets the field of view x. |
fieldOfViewY | number | Read/Write | Gets the field of view y. |
width | number | Read/Write | Gets the width. |
height | number | Read/Write | Gets the height. |
aspectRatio | number | Read/Write | Gets the aspect ratio. |
magnification | any | Read/Write | Gets the magnification. |
projectionType | string | Read/Write | Gets the projection type. |
| Signature | Description |
|---|---|
| `constructor(name: string | null, projectionType: any)` |
moveForward(_distance: number) | Moves the camera forward by the specified distance |
getBoundingBox() → any | Returns the bounding box. |
getEntityRendererKey() → any | Not implemented in the FOSS edition — throws at runtime. Returns the entity renderer key. |
| `removeProperty(_prop: Property | string) → boolean` |
getProperty(_property: string) → any | Returns the value of the specified property |
setProperty(_property: string, _value: any) | Sets the property value. |
findProperty(_property: string) → `Property | null` |
Enumerations
moveForward(distance)
Kamerayı, bakış yönü boyunca verilen mesafe kadar ileri hareket ettirir.
moveForward(distance: number): voidEnumerations
distance number
İleri hareket ettirilecek mesafe. Negatif değerler kamerayı geriye doğru hareket ettirir.
Enumerations
void
Enumerations
import { Scene, Camera, ProjectionType } from '@aspose/3d';
const scene = new Scene();
const camNode = scene.rootNode.createChildNode('cam');
const camera = new Camera('cam', ProjectionType.PERSPECTIVE);
camNode.entity = camera;
camera.moveForward(10);
console.log('Camera moved forward by 10 units.');Enumerations
- Kaynakta,
Cameraşuradan miras alırEntity.Lightaynı zamanda genişletirCamera, bu da demektir kiLightnesneler tip hiyerarşisinde tüm kamera özelliklerine sahiptir; bu, ışıklar ve kameraların ortak bir temel düğüm tipini paylaştığı FBX veri modelini yansıtır. - Şunu kullanın
ProjectionTypesınıf sabitlerini (ProjectionType.PERSPECTIVE,ProjectionType.ORTHOGRAPHIC) tip güvenliği için ham dize sabitleri yerine.