123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- = osrviewport
- :author:
- :revnumber:
- :revdate: 2016/03/17 20:48
- :relfileprefix: ../../../
- :imagesdir: ../../..
- ifdef::env-github,env-browser[:outfilesuffix: .adoc]
- == OSRViewPort
- The OSRViewPort allows you to create a movable, resizable ViewPort with the ability to control the camera's rotation and zoom features via mouse input.
- To initialize the OSRViewPort you can call one of the 3 standard constructors as shown in the <<jme3/contributions/tonegodgui/quickstart#,Quick Start Guide>>.
- *Constructor 1:*
- [source,java]
- ----
- /** Parameters:
- * Screen screen,
- * String UID,
- * Vector2f position
- */
-
- OSRViewPort vp = new OSRViewPort(screen, “vp”, new Vector2f(15, 15));
- ----
- *Constructor 2:*
- [source,java]
- ----
- /** Additional Parameter:
- * Vector2f dimensions */
-
- OSRViewPort vp = new OSRViewPort(screen, “vp”, new Vector2f(15, 15),
- new Vector2f(150, 150)
- );
- ----
- *Constructor 3:*
- [source,java]
- ----
- /** Additional Parameters:
- * Vector4f resizeBorders,
- * String defaultImg
- */
-
- OSRViewPort vp = new OSRViewPort(screen, “vp”, new Vector2f(15, 15), new Vector2f(150, 150),
- new Vector4f(0,0,0,0),
- "imagePathToOverlayImage"
- );
- ----
- Once initialized, you will want to active the OSRBridge for off-screen rendering of your new scene:
- [source,java]
- ----
- vp.setOSRBridge(Node newScene, int renderWidth, int renderHeight);
- ----
- === The ViewPort’s Camera control methods:
- [source,java]
- ----
- vp.setUseCameraControlRotate(boolean rotateEnabled); // enable/disable rotation control
- vp.setUseCameraControlZoom(boolean zoomEnabled); // enable/disable zoom control
-
- vp.setCameraDistance(float distance);
- vp.setCameraHorizonalRotation(float angleInRads);
- vp.setCameraVerticalRotation(float angleInRads);
- vp.setCameraMinDistance(float distance);
- vp.setCameraMaxDistance(float distance);
- vp.setCameraMinVerticalRotation(float angleInRads);
- vp.setCameraMaxVerticalRotation(float angleInRads);
- ----
- === Other methods:
- [source,java]
- ----
- vp.setBackgroundColor(ColorRGBA color); // ViewPort is transparent by default
- ----
|