Camera
Methods: com.aspose.threed (aspose-3d-foss 26.1.0)
Camera es una Entity que define un punto de vista en una escena 3D. Controla cómo la escena se proyecta en un plano de imagen 2D. Una cámara está vinculada a un Node para posicionarla y orientarla en la escena.
public class Camera extends EntityMethods
A3DObject -> SceneObject -> Entity -> Camera
Notas de implementación
En la edición FOSS de Java, el Camera la clase solo tiene constructores — no se implementan propiedades específicas de la cámara (campo de visión, plano cercano/lejos, modo de proyección).
Limitación de exportación: Las entidades de cámara son no se escriben al exportar escenas. El exportador glTF (GltfExporter) procesa solo Mesh entidades — Los nodos de cámara se omiten silenciosamente. Esto significa que una cámara adjunta a un nodo no aparecerá en ningún archivo exportado. El ejemplo “Read Camera After Import” a continuación muestra cómo leer los nombres de cámara de un archivo importado; sin embargo, escribir cámaras de nuevo a un archivo no es compatible en esta edición.
Methods
Camera()
Camera(String name)| Name | Type | Access | Description |
|---|---|---|---|
apertureMode | ApertureMode | Read | Gets the aperture mode. |
fieldOfView | double | Read | Gets the field of view. |
fieldOfViewX | double | Read | Gets the field of view x. |
fieldOfViewY | double | Read | Gets the field of view y. |
width | double | Read | Gets the width. |
height | double | Read | Gets the height. |
aspectRatio | double | Read | Gets the aspect ratio. |
magnification | Vector2 | Read | Gets the magnification. |
projectionType | ProjectionType | Read | Gets the projection type. |
rotationMode | RotationMode | Read | Gets the frustum’s orientation mode This property only works when the getTarget() is null. |
nearPlane | double | Read | Gets the frustum’s near plane distance. |
farPlane | double | Read | Gets the frustum’s far plane distance. |
aspect | double | Read | Gets the aspect ratio of the frustum @return the aspect ratio of the frustum / |
orthoHeight | double | Read | Gets the height when frustum in orthographic projection. |
up | Vector3 | Read | Gets the up direction of the camera @return the up direction of the camera / |
lookAt | Vector3 | Read | Gets the the interested position that the camera is looking at. |
direction | Vector3 | Read | Gets the direction that the camera is looking at. |
target | Node | Read | Gets the target that the camera is looking at. |
parentNode | Node | Read | Gets the parent node. |
parentNodes | ArrayList<Node> | Read | Gets the parent nodes. |
excluded | boolean | Read | Gets the excluded. |
boundingBox | BoundingBox | Read | Gets the bounding box. |
scene | Scene | Read | Gets the scene. |
name | String | Read | Gets the name. |
properties | PropertyCollection | Read | Gets the properties. |
Methods
La cámara hereda todas las propiedades de Entity y A3DObject. No se exponen propiedades específicas de formato adicionales en esta edición.
| Signature | Description |
|---|---|
Camera() | Creates a new camera instance with default name and properties |
Camera(projectionType: ProjectionType) | Calls Camera(projectionType) on this Camera instance. |
Camera(name: String) | Calls Camera(name) on this Camera instance. |
Camera(name: String, projectionType: ProjectionType) | Calls Camera(name, projectionType) on this Camera instance. |
getApertureMode() → ApertureMode | Returns the aperture mode. |
setApertureMode(value: ApertureMode) | Sets the aperture mode value. |
getFieldOfView() → double | Returns the field of view. |
setFieldOfView(value: double) | Sets the field of view value. |
getFieldOfViewX() → double | Returns the field of view x. |
setFieldOfViewX(value: double) | Sets the field of view x value. |
getFieldOfViewY() → double | Returns the field of view y. |
setFieldOfViewY(value: double) | Sets the field of view y value. |
getWidth() → double | Returns the width. |
setWidth(value: double) | Sets the width value. |
getHeight() → double | Returns the height. |
setHeight(value: double) | Sets the height value. |
getAspectRatio() → double | Returns the aspect ratio. |
setAspectRatio(value: double) | Sets the aspect ratio value. |
getMagnification() → Vector2 | Returns the magnification. |
setMagnification(value: Vector2) | Sets the magnification value. |
getProjectionType() → ProjectionType | Returns the projection type. |
setProjectionType(value: ProjectionType) | Sets the projection type value. |
getRotationMode() → RotationMode | Gets the frustum’s orientation mode This property only works when the getTarget() is null. |
setRotationMode(value: RotationMode) | Sets the frustum’s orientation mode This property only works when the getTarget() is null. |
getNearPlane() → double | Gets the frustum’s near plane distance. |
setNearPlane(value: double) | Sets the frustum’s near plane distance. |
getFarPlane() → double | Gets the frustum’s far plane distance. |
setFarPlane(value: double) | Sets the frustum’s far plane distance. |
getAspect() → double | Gets the aspect ratio of the frustum @return the aspect ratio of the frustum / |
setAspect(value: double) | Sets the aspect ratio of the frustum @param value New value / |
getOrthoHeight() → double | Gets the height when frustum in orthographic projection. |
setOrthoHeight(value: double) | Sets the height when frustum in orthographic projection. |
getUp() → Vector3 | Gets the up direction of the camera @return the up direction of the camera / |
setUp(value: Vector3) | Sets the up direction of the camera @param value New value / |
getLookAt() → Vector3 | Gets the the interested position that the camera is looking at. |
setLookAt(value: Vector3) | Sets the the interested position that the camera is looking at. |
getDirection() → Vector3 | Gets the direction that the camera is looking at. |
setDirection(value: Vector3) | Sets the direction that the camera is looking at. |
getTarget() → Node | Gets the target that the camera is looking at. |
setTarget(value: Node) | Sets the target that the camera is looking at. |
Entity() | NURBS curve is a curve represented by NURBS(Non-uniform rational basis spline), A NURBS curve is defined by its getOrder(), a set of weighted Geometry.getControlPoints() and a getKnotVectors() The w component in control point is used as control point’s weight, whatever it is a CurveDimension.TWO_DIMENSIONAL or CurveDimension.THREE_DIMENSIONAL |
getParentNode() → Node | Constructor of instance. |
setParentNode(value: Node) | The Boolean operator used in the operation to create the result mesh. |
getParentNodes() → ArrayList<Node> | Protected constructor to allow derived classes to set name. |
getExcluded() → boolean | The Boolean operator used in the operation to create the result mesh. |
setExcluded(value: boolean) | Sets the excluded value. |
getBoundingBox() → BoundingBox | The first operand of the Boolean operator. |
SceneObject() | Boolean operator allows you to apply Boolean operation on two IMeshConvertible instances. |
getScene() → Scene | Constructor of BooleanOperator. |
A3DObject() | Parameterized Cylinder. It can also be used to represent a cone when one of radiusTop/radiusBottom is zero. |
getName() → String | The segments of the curve. |
setName(name: String) | Constructs a CircleShape profile with specified radius. |
getProperties() → PropertyCollection | Initializes a new instance of Cylinder class. |
findProperty(name: String) → Property | Initializes a new instance of the Bone class. |
getProperty(name: String) → Object | Gets the transform matrix of the node in current pose. |
setProperty(name: String, value: Object) | Gets the width segments. |
removeProperty(name: String) → boolean | Gets flip coordinate system of control points/normal during importing/exporting. |
Ejemplos de uso
Adjuntar una Camera a una Escena
import com.aspose.threed.*;
Scene scene = new Scene();
Camera cam = new Camera("MainCamera");
Node node = scene.getRootNode().createChildNode("camera", cam);
node.getTransform().setTranslation(0.0, 5.0, 20.0);
scene.save("scene-with-camera.glb");Leer Camera después de la importación
import com.aspose.threed.*;
Scene scene = new Scene();
scene.open("model.glb");
for (Node node : scene.getRootNode().getChildNodes()) {
if (node.getEntity() instanceof Camera) {
Camera cam = (Camera) node.getEntity();
System.out.println("Camera: " + cam.getName());
}
}