public final class DefaultCameraModel extends AbstractNamedModelElement implements CameraModel
CameraModel| Constructor and Description |
|---|
DefaultCameraModel(java.util.function.Function<float[],float[]> viewMatrixComputer,
java.util.function.BiFunction<float[],java.lang.Float,float[]> projectionMatrixComputer)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
float[] |
computeProjectionMatrix(float[] result,
java.lang.Float aspectRatio)
Compute the projection matrix for this camera.
|
float[] |
computeViewMatrix(float[] result)
Compute the view matrix for this camera.
|
java.util.function.Supplier<float[]> |
createProjectionMatrixSupplier(java.util.function.DoubleSupplier aspectRatioSupplier)
Create the supplier of the projection matrix for this camera model.
|
java.util.function.Supplier<float[]> |
createViewMatrixSupplier()
Create the supplier of the view matrix for this camera model.
|
java.lang.String |
getInstanceName()
Returns the name of this camera model instance, suitable to be shown
to a user.
|
NodeModel |
getNodeModel()
Returns the
NodeModel that the camera is attached to |
void |
setInstanceName(java.lang.String instanceName)
Set the name of this camera model, suitable to be shown to a user
|
void |
setNodeModel(NodeModel nodeModel)
Set the
NodeModel that the camera is attached to |
getName, setNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNamepublic DefaultCameraModel(java.util.function.Function<float[],float[]> viewMatrixComputer,
java.util.function.BiFunction<float[],java.lang.Float,float[]> projectionMatrixComputer)
viewMatrixComputer - The function that computes the view matrixprojectionMatrixComputer - The function that computes the
projection matrixpublic void setInstanceName(java.lang.String instanceName)
instanceName - The instance namepublic void setNodeModel(NodeModel nodeModel)
NodeModel that the camera is attached tonodeModel - The NodeModel that the camera is attached topublic java.lang.String getInstanceName()
CameraModelname, this method
will return a string that also contains information about the node
that this camera instance is attached to.getInstanceName in interface CameraModelpublic NodeModel getNodeModel()
CameraModelNodeModel that the camera is attached togetNodeModel in interface CameraModelNodeModelpublic float[] computeViewMatrix(float[] result)
CameraModelnull or does
not have a length of 16, then a new array with length 16 will be
created and returned.computeViewMatrix in interface CameraModelresult - The result arraypublic float[] computeProjectionMatrix(float[] result,
java.lang.Float aspectRatio)
CameraModelnull or does
not have a length of 16, then a new array with length 16 will be
created and returned.computeProjectionMatrix in interface CameraModelresult - The result arrayaspectRatio - An optional aspect ratio that should be used.
If this is null, then the aspect ratio of the
camera will be used.public java.util.function.Supplier<float[]> createViewMatrixSupplier()
CameraModelcreateViewMatrixSupplier in interface CameraModelpublic java.util.function.Supplier<float[]> createProjectionMatrixSupplier(java.util.function.DoubleSupplier aspectRatioSupplier)
CameraModelCameraModel was
created for is neither "perspective" nor
"orthographic",
then the supplier will print an error message and return
the identity matrix.createProjectionMatrixSupplier in interface CameraModelaspectRatioSupplier - The optional supplier for the aspect
ratio of the camera. If this is null, then the
aspect ratio of the camera will be used.Copyright © 2022. All Rights Reserved.