osrviewport.adoc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. = osrviewport
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. :relfileprefix: ../../../
  6. :imagesdir: ../../..
  7. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  8. == OSRViewPort
  9. 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.
  10. To initialize the OSRViewPort you can call one of the 3 standard constructors as shown in the <<jme3/contributions/tonegodgui/quickstart#,Quick Start Guide>>.
  11. *Constructor 1:*
  12. [source,java]
  13. ----
  14. /** Parameters:
  15. * Screen screen,
  16. * String UID,
  17. * Vector2f position
  18. */
  19. OSRViewPort vp = new OSRViewPort(screen, “vp”, new Vector2f(15, 15));
  20. ----
  21. *Constructor 2:*
  22. [source,java]
  23. ----
  24. /** Additional Parameter:
  25. * Vector2f dimensions */
  26. OSRViewPort vp = new OSRViewPort(screen, “vp”, new Vector2f(15, 15),
  27. new Vector2f(150, 150)
  28. );
  29. ----
  30. *Constructor 3:*
  31. [source,java]
  32. ----
  33. /** Additional Parameters:
  34. * Vector4f resizeBorders,
  35. * String defaultImg
  36. */
  37. OSRViewPort vp = new OSRViewPort(screen, “vp”, new Vector2f(15, 15), new Vector2f(150, 150),
  38. new Vector4f(0,0,0,0),
  39. "imagePathToOverlayImage"
  40. );
  41. ----
  42. Once initialized, you will want to active the OSRBridge for off-screen rendering of your new scene:
  43. [source,java]
  44. ----
  45. vp.setOSRBridge(Node newScene, int renderWidth, int renderHeight);
  46. ----
  47. === The ViewPort’s Camera control methods:
  48. [source,java]
  49. ----
  50. vp.setUseCameraControlRotate(boolean rotateEnabled); // enable/disable rotation control
  51. vp.setUseCameraControlZoom(boolean zoomEnabled); // enable/disable zoom control
  52. vp.setCameraDistance(float distance);
  53. vp.setCameraHorizonalRotation(float angleInRads);
  54. vp.setCameraVerticalRotation(float angleInRads);
  55. vp.setCameraMinDistance(float distance);
  56. vp.setCameraMaxDistance(float distance);
  57. vp.setCameraMinVerticalRotation(float angleInRads);
  58. vp.setCameraMaxVerticalRotation(float angleInRads);
  59. ----
  60. === Other methods:
  61. [source,java]
  62. ----
  63. vp.setBackgroundColor(ColorRGBA color); // ViewPort is transparent by default
  64. ----