I can understand far near as float format (simple distance) but What are meaning for the rest ?
I mean I’v googled the explanation of frustum , and I understand what are top,bottom,left,right plans.
but WHY in float ? and how to calculate these numbers ?
They are floats because they express distances.
I.E. frustumRight is the distance from camera to right frustum plane.
For starters you will only need to use setFrustumFar.
But If you feel curious enough try setting the other frustums,one by one,and make your own observations.
/**
* <code>setFrustumPerspective</code> defines the frustum for the camera. This
* frustum is defined by a viewing angle, aspect ratio, and near/far planes
*
* @param fovY Frame of view angle along the Y in degrees.
* @param aspect Width:Height ratio
* @param near Near view plane distance
* @param far Far view plane distance
*/
public void setFrustumPerspective(float fovY, float aspect, float near, float far)
Well, actually I’m thinking about TWO functions:
1.
If you guys ever played Paper Mario on WII , you may understand the necessity of switch between 3D and 2D.
I’m thinking a first person shooting game to be played like SFC contra
For 2D here, it doesn’t mean just move the cam to the top and look down, you still have 3D effects.
I have to set cam to parallel mode( I think ) and calculate the distance and on-screen size, thus a frustums parameters must be calculated and set.
2.
Thinking abut 3D display (not VR or AR). To convert one 16:9 cam to a side-by-side 3D display, I need 2 8:9 cam each with a compressed 16:9 picture. (er ~ Do I explain clearly ? ) How to set these parameters?
Note that for #1, the frustum is far, far simpler than for a perspective camera. All you need to do is set the camera to parallel mode and set the width/height appropriately. FoV angles and all that other jazz is irrelevant to a parallel camera. For #2 I can’t answer how you’d set up such a viewport off the top of my head.
See
jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/renderer/TestParallelProjection.java
This method is used only for parallel projection. A plane can be defined by a normal vector and a constant. The constant is the shortest distance from the origin to the plane.
In the case of the frustum we know the normal, so we only need the distances to the planes.
That’s what those params are.
Use setfrustumPerspective if you don’t want parallel projection.