Package jme3utilities
Class MyCamera
java.lang.Object
jme3utilities.MyCamera
Utility methods that operate on jME3 cameras and view ports. All methods
should be public and static.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic floatazimuth(com.jme3.renderer.Camera camera) Determine the azimuth angle of the specified Camera.static booleancontains(com.jme3.renderer.ViewPort viewPort, com.jme3.math.Vector2f screenXY) Test whether the bounds of the specified ViewPort contain the specified screen position.static Stringdescribe(com.jme3.renderer.Camera camera) Generate a textual description of the specified Camera.static StringdescribeMore(com.jme3.renderer.Camera camera) Generate additional textual description of a Camera.static floatdisplayAspectRatio(com.jme3.renderer.Camera camera) Determine the aspect ratio of the display.static floatfovX(com.jme3.renderer.Camera camera) Determine the horizontal field-of-view angle of the specified Camera.static floatfovY(com.jme3.renderer.Camera camera) Determine the vertical field-of-view angle of the specified Camera.static floatfrustumAspectRatio(com.jme3.renderer.Camera camera) Determine the aspect ratio of the specified camera's frustum.static booleanisFullWidth(com.jme3.renderer.Camera camera) Test whether the specified Camera has a full-width ViewPort.static List<com.jme3.renderer.ViewPort>listViewPorts(com.jme3.renderer.RenderManager renderManager, com.jme3.math.Vector2f screenXY) Enumerate all view ports that contain the specified screen position.static voidlook(com.jme3.renderer.Camera camera, com.jme3.math.Vector3f direction) Rotate the specified Camera without changing its location, setting its "up" direction automatically.static com.jme3.math.LinemouseLine(com.jme3.renderer.Camera camera, com.jme3.input.InputManager inputManager) Convert the mouse-pointer location into a line.static com.jme3.math.RaymouseRay(com.jme3.renderer.Camera camera, com.jme3.input.InputManager inputManager) Convert the mouse-pointer location into a ray.static voidsetNearFar(com.jme3.renderer.Camera camera, float newNear, float newFar) Alter a camera's near and far planes without affecting its aspect ratio or field-of-view.static voidsetYTangent(com.jme3.renderer.Camera camera, float newTangent) Alter a camera's field-of-view tangents.static floatviewAspectRatio(com.jme3.renderer.Camera camera) Determine the aspect ratio of the specified camera's viewport.static floatxDegrees(com.jme3.renderer.Camera camera) Determine the horizontal field-of-view angle of the specified Camera.static floatxTangent(com.jme3.renderer.Camera camera) Determine the horizontal field-of-view tangent of the specified Camera.static floatyDegrees(com.jme3.renderer.Camera camera) Determine the vertical field-of-view angle of the specified Camera.static floatyTangent(com.jme3.renderer.Camera camera) Determine the vertical field-of-view tangent of the specified Camera.static voidzoom(com.jme3.renderer.Camera camera, float factor) Increase a camera's field-of-view tangents by the specified factor.
-
Field Details
-
farZ
public static final float farZZ value for the far clipping plane (in screen coordinates)- See Also:
-
nearZ
public static final float nearZZ value for the near clipping plane (in screen coordinates)- See Also:
-
-
Method Details
-
azimuth
public static float azimuth(com.jme3.renderer.Camera camera) Determine the azimuth angle of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- radians east of north
-
contains
public static boolean contains(com.jme3.renderer.ViewPort viewPort, com.jme3.math.Vector2f screenXY) Test whether the bounds of the specified ViewPort contain the specified screen position.- Parameters:
viewPort- (not null, unaffected)screenXY- (in pixels, not null, unaffected)- Returns:
- true if contained, otherwise false
-
describe
Generate a textual description of the specified Camera.- Parameters:
camera- the Camera to describe (may be null, unaffected)- Returns:
- description (not null, not empty)
- See Also:
-
describeMore
Generate additional textual description of a Camera.- Parameters:
camera- the Camera to describe (not null, unaffected)- Returns:
- description (not null, not empty)
- See Also:
-
displayAspectRatio
public static float displayAspectRatio(com.jme3.renderer.Camera camera) Determine the aspect ratio of the display.- Parameters:
camera- the Camera to use (not null, unaffected)- Returns:
- width divided by height (>0)
-
fovX
public static float fovX(com.jme3.renderer.Camera camera) Determine the horizontal field-of-view angle of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- radians from the left of the frustum to the right of the frustum (≥0)
-
fovY
public static float fovY(com.jme3.renderer.Camera camera) Determine the vertical field-of-view angle of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- radians from bottom of frustum to top of frustum (≥0)
-
frustumAspectRatio
public static float frustumAspectRatio(com.jme3.renderer.Camera camera) Determine the aspect ratio of the specified camera's frustum.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- width divided by height (>0)
-
isFullWidth
public static boolean isFullWidth(com.jme3.renderer.Camera camera) Test whether the specified Camera has a full-width ViewPort.- Parameters:
camera- the Camera to test (not null, unaffected)- Returns:
- true if full width, otherwise false
-
listViewPorts
public static List<com.jme3.renderer.ViewPort> listViewPorts(com.jme3.renderer.RenderManager renderManager, com.jme3.math.Vector2f screenXY) Enumerate all view ports that contain the specified screen position.- Parameters:
screenXY- (in pixels, not null, unaffected)renderManager- (not null, aliases created)- Returns:
- a new list of pre-existing view ports
-
look
public static void look(com.jme3.renderer.Camera camera, com.jme3.math.Vector3f direction) Rotate the specified Camera without changing its location, setting its "up" direction automatically.- Parameters:
camera- the Camera to rotate (not null, modified)direction- (length>0, unaffected)
-
mouseLine
public static com.jme3.math.Line mouseLine(com.jme3.renderer.Camera camera, com.jme3.input.InputManager inputManager) Convert the mouse-pointer location into a line.- Parameters:
camera- the Camera to use (not null, unaffected)inputManager- (not null)- Returns:
- a new line in world coordinates
-
mouseRay
public static com.jme3.math.Ray mouseRay(com.jme3.renderer.Camera camera, com.jme3.input.InputManager inputManager) Convert the mouse-pointer location into a ray.- Parameters:
camera- the Camera to use (not null, unaffected)inputManager- (not null)- Returns:
- a new ray in world coordinates
-
setNearFar
public static void setNearFar(com.jme3.renderer.Camera camera, float newNear, float newFar) Alter a camera's near and far planes without affecting its aspect ratio or field-of-view.- Parameters:
camera- the Camera to alter (not null, modified)newNear- distance to the near clipping plane (<newFar, >0)newFar- distance to the far clipping plane (>newNear)
-
setYTangent
public static void setYTangent(com.jme3.renderer.Camera camera, float newTangent) Alter a camera's field-of-view tangents.- Parameters:
camera- the Camera to alter (not null, perspective projection, modified)newTangent- tangent of the vertical field-of-view half-angle (>0)
-
viewAspectRatio
public static float viewAspectRatio(com.jme3.renderer.Camera camera) Determine the aspect ratio of the specified camera's viewport.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- width divided by height (>0)
-
xDegrees
public static float xDegrees(com.jme3.renderer.Camera camera) Determine the horizontal field-of-view angle of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- the horizontal angle in degrees (>0)
-
xTangent
public static float xTangent(com.jme3.renderer.Camera camera) Determine the horizontal field-of-view tangent of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- tangent of the horizontal field-of-view half-angle (≥0)
-
yDegrees
public static float yDegrees(com.jme3.renderer.Camera camera) Determine the vertical field-of-view angle of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- the vertical angle in degrees (>0)
-
yTangent
public static float yTangent(com.jme3.renderer.Camera camera) Determine the vertical field-of-view tangent of the specified Camera.- Parameters:
camera- the Camera to analyze (not null, unaffected)- Returns:
- tangent of the vertical field-of-view half-angle (≥0)
-
zoom
public static void zoom(com.jme3.renderer.Camera camera, float factor) Increase a camera's field-of-view tangents by the specified factor.- Parameters:
camera- the Camera to alter (not null, modified)factor- the factor to reduce both field-of-view tangents (>0)
-