|
@@ -29,7 +29,6 @@
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
*/
|
|
*/
|
|
|
-
|
|
|
|
|
package jme3test.renderer;
|
|
package jme3test.renderer;
|
|
|
|
|
|
|
|
import com.jme3.app.SimpleApplication;
|
|
import com.jme3.app.SimpleApplication;
|
|
@@ -43,7 +42,7 @@ import com.jme3.scene.Geometry;
|
|
|
|
|
|
|
|
public class TestMultiViews extends SimpleApplication {
|
|
public class TestMultiViews extends SimpleApplication {
|
|
|
|
|
|
|
|
- public static void main(String[] args){
|
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
TestMultiViews app = new TestMultiViews();
|
|
TestMultiViews app = new TestMultiViews();
|
|
|
app.start();
|
|
app.start();
|
|
|
}
|
|
}
|
|
@@ -52,7 +51,7 @@ public class TestMultiViews extends SimpleApplication {
|
|
|
// create the geometry and attach it
|
|
// create the geometry and attach it
|
|
|
Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
|
|
Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
|
|
|
teaGeom.scale(3);
|
|
teaGeom.scale(3);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
DirectionalLight dl = new DirectionalLight();
|
|
DirectionalLight dl = new DirectionalLight();
|
|
|
dl.setColor(ColorRGBA.White);
|
|
dl.setColor(ColorRGBA.White);
|
|
|
dl.setDirection(Vector3f.UNIT_XYZ.negate());
|
|
dl.setDirection(Vector3f.UNIT_XYZ.negate());
|
|
@@ -64,20 +63,20 @@ public class TestMultiViews extends SimpleApplication {
|
|
|
viewPort.setBackgroundColor(ColorRGBA.Blue);
|
|
viewPort.setBackgroundColor(ColorRGBA.Blue);
|
|
|
cam.setViewPort(.5f, 1f, 0f, 0.5f);
|
|
cam.setViewPort(.5f, 1f, 0f, 0.5f);
|
|
|
cam.setLocation(new Vector3f(3.3212643f, 4.484704f, 4.2812433f));
|
|
cam.setLocation(new Vector3f(3.3212643f, 4.484704f, 4.2812433f));
|
|
|
- cam.setRotation(new Quaternion (-0.07680723f, 0.92299235f, -0.2564353f, -0.27645364f));
|
|
|
|
|
|
|
+ cam.setRotation(new Quaternion(-0.07680723f, 0.92299235f, -0.2564353f, -0.27645364f));
|
|
|
|
|
|
|
|
// Setup second view
|
|
// Setup second view
|
|
|
- Camera cam2 = cam.clone();
|
|
|
|
|
|
|
+ Camera cam2 = cam.clone();
|
|
|
cam2.setViewPort(0f, 0.5f, 0f, 0.5f);
|
|
cam2.setViewPort(0f, 0.5f, 0f, 0.5f);
|
|
|
cam2.setLocation(new Vector3f(-0.10947256f, 1.5760219f, 4.81758f));
|
|
cam2.setLocation(new Vector3f(-0.10947256f, 1.5760219f, 4.81758f));
|
|
|
cam2.setRotation(new Quaternion(0.0010108891f, 0.99857414f, -0.04928594f, 0.020481428f));
|
|
cam2.setRotation(new Quaternion(0.0010108891f, 0.99857414f, -0.04928594f, 0.020481428f));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
ViewPort view2 = renderManager.createMainView("Bottom Left", cam2);
|
|
ViewPort view2 = renderManager.createMainView("Bottom Left", cam2);
|
|
|
view2.setClearFlags(true, true, true);
|
|
view2.setClearFlags(true, true, true);
|
|
|
view2.attachScene(rootNode);
|
|
view2.attachScene(rootNode);
|
|
|
|
|
|
|
|
// Setup third view
|
|
// Setup third view
|
|
|
- Camera cam3 = cam.clone();
|
|
|
|
|
|
|
+ Camera cam3 = cam.clone();
|
|
|
cam3.setViewPort(0f, .5f, .5f, 1f);
|
|
cam3.setViewPort(0f, .5f, .5f, 1f);
|
|
|
cam3.setLocation(new Vector3f(0.2846221f, 6.4271426f, 0.23380789f));
|
|
cam3.setLocation(new Vector3f(0.2846221f, 6.4271426f, 0.23380789f));
|
|
|
cam3.setRotation(new Quaternion(0.004381671f, 0.72363687f, -0.69015175f, 0.0045953835f));
|
|
cam3.setRotation(new Quaternion(0.004381671f, 0.72363687f, -0.69015175f, 0.0045953835f));
|
|
@@ -87,7 +86,7 @@ public class TestMultiViews extends SimpleApplication {
|
|
|
view3.attachScene(rootNode);
|
|
view3.attachScene(rootNode);
|
|
|
|
|
|
|
|
// Setup fourth view
|
|
// Setup fourth view
|
|
|
- Camera cam4 = cam.clone();
|
|
|
|
|
|
|
+ Camera cam4 = cam.clone();
|
|
|
cam4.setViewPort(.5f, 1f, .5f, 1f);
|
|
cam4.setViewPort(.5f, 1f, .5f, 1f);
|
|
|
cam4.setLocation(new Vector3f(4.775564f, 1.4548365f, 0.11491505f));
|
|
cam4.setLocation(new Vector3f(4.775564f, 1.4548365f, 0.11491505f));
|
|
|
cam4.setRotation(new Quaternion(0.02356979f, -0.74957186f, 0.026729556f, 0.66096294f));
|
|
cam4.setRotation(new Quaternion(0.02356979f, -0.74957186f, 0.026729556f, 0.66096294f));
|
|
@@ -95,5 +94,16 @@ public class TestMultiViews extends SimpleApplication {
|
|
|
ViewPort view4 = renderManager.createMainView("Top Right", cam4);
|
|
ViewPort view4 = renderManager.createMainView("Top Right", cam4);
|
|
|
view4.setClearFlags(true, true, true);
|
|
view4.setClearFlags(true, true, true);
|
|
|
view4.attachScene(rootNode);
|
|
view4.attachScene(rootNode);
|
|
|
|
|
+
|
|
|
|
|
+ //test multiview for gui
|
|
|
|
|
+ guiViewPort.getCamera().setViewPort(.5f, 1f, .5f, 1f);
|
|
|
|
|
+
|
|
|
|
|
+ // Setup second gui view
|
|
|
|
|
+ Camera guiCam2 = guiViewPort.getCamera().clone();
|
|
|
|
|
+ guiCam2.setViewPort(0f, 0.5f, 0f, 0.5f);
|
|
|
|
|
+ ViewPort guiViewPort2 = renderManager.createPostView("Gui 2", guiCam2);
|
|
|
|
|
+ guiViewPort2.setClearFlags(false, false, false);
|
|
|
|
|
+ guiViewPort2.attachScene(guiViewPort.getScenes().get(0));
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|