Camera.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. require('Polycode/Entity')
  2. function Camera() {
  3. if(arguments[0] != "__skip_ptr__") {
  4. this.__ptr = Polycode.Camera()
  5. }
  6. Object.defineProperties(this, {
  7. 'frustumCulling': { enumerable: true, configurable: true, get: Camera.prototype.__get_frustumCulling, set: Camera.prototype.__set_frustumCulling},
  8. 'topLeftOrtho': { enumerable: true, configurable: true, get: Camera.prototype.__get_topLeftOrtho, set: Camera.prototype.__set_topLeftOrtho},
  9. 'cameraShift': { enumerable: true, configurable: true, get: Camera.prototype.__get_cameraShift, set: Camera.prototype.__set_cameraShift}
  10. })
  11. }
  12. Camera.ORTHO_SIZE_MANUAL = 0
  13. Camera.ORTHO_SIZE_LOCK_HEIGHT = 1
  14. Camera.ORTHO_SIZE_LOCK_WIDTH = 2
  15. Camera.ORTHO_SIZE_VIEWPORT = 3
  16. Camera.PERSPECTIVE_FOV = 4
  17. Camera.PERSPECTIVE_FRUSTUM = 5
  18. Camera.MANUAL_MATRIX = 6
  19. Camera.prototype = Object.create(Entity.prototype)
  20. Camera.prototype.__get_frustumCulling = function() {
  21. return Polycode.Camera__get_frustumCulling(this.__ptr)
  22. }
  23. Camera.prototype.__set_frustumCulling = function(val) {
  24. Polycode.Camera__set_frustumCulling(this.__ptr, val)
  25. }
  26. Camera.prototype.__get_topLeftOrtho = function() {
  27. return Polycode.Camera__get_topLeftOrtho(this.__ptr)
  28. }
  29. Camera.prototype.__set_topLeftOrtho = function(val) {
  30. Polycode.Camera__set_topLeftOrtho(this.__ptr, val)
  31. }
  32. Camera.prototype.__get_cameraShift = function() {
  33. var retVal = new Vector2("__skip_ptr__")
  34. retVal.__ptr = Polycode.Camera__get_cameraShift(this.__ptr)
  35. return retVal
  36. }
  37. Camera.prototype.__set_cameraShift = function(val) {
  38. Polycode.Camera__set_cameraShift(this.__ptr, val.__ptr)
  39. }
  40. Camera.prototype.buildFrustumPlanes = function() {
  41. Polycode.Camera_buildFrustumPlanes(this.__ptr)
  42. }
  43. Camera.prototype.isSphereInFrustum = function(pos,fRadius) {
  44. return Polycode.Camera_isSphereInFrustum(this.__ptr, pos, fRadius)
  45. }
  46. Camera.prototype.isAABBInFrustum = function(aabb) {
  47. return Polycode.Camera_isAABBInFrustum(this.__ptr, aabb)
  48. }
  49. Camera.prototype.setOrthoMode = function(mode) {
  50. Polycode.Camera_setOrthoMode(this.__ptr, mode)
  51. }
  52. Camera.prototype.setOrthoSize = function(orthoSizeX,orthoSizeY) {
  53. Polycode.Camera_setOrthoSize(this.__ptr, orthoSizeX, orthoSizeY)
  54. }
  55. Camera.prototype.setFrustumMode = function(left,right,bottom,top,front,back) {
  56. Polycode.Camera_setFrustumMode(this.__ptr, left, right, bottom, top, front, back)
  57. }
  58. Camera.prototype.getOrthoMode = function() {
  59. return Polycode.Camera_getOrthoMode(this.__ptr)
  60. }
  61. Camera.prototype.getOrthoSizeX = function() {
  62. return Polycode.Camera_getOrthoSizeX(this.__ptr)
  63. }
  64. Camera.prototype.getOrthoSizeY = function() {
  65. return Polycode.Camera_getOrthoSizeY(this.__ptr)
  66. }
  67. Camera.prototype.setFOV = function(fov) {
  68. Polycode.Camera_setFOV(this.__ptr, fov)
  69. }
  70. Camera.prototype.getFOV = function() {
  71. return Polycode.Camera_getFOV(this.__ptr)
  72. }
  73. Camera.prototype.setClippingPlanes = function(nearClipPlane,farClipPlane) {
  74. Polycode.Camera_setClippingPlanes(this.__ptr, nearClipPlane, farClipPlane)
  75. }
  76. Camera.prototype.getNearClippingPlane = function() {
  77. return Polycode.Camera_getNearClippingPlane(this.__ptr)
  78. }
  79. Camera.prototype.getFarClippingPlane = function() {
  80. return Polycode.Camera_getFarClippingPlane(this.__ptr)
  81. }
  82. Camera.prototype.createProjectionMatrix = function() {
  83. var retVal = new Matrix4("__skip_ptr__")
  84. retVal.__ptr = Polycode.Camera_createProjectionMatrix(this.__ptr)
  85. return retVal
  86. }
  87. Camera.prototype.hasFilterShader = function() {
  88. return Polycode.Camera_hasFilterShader(this.__ptr)
  89. }
  90. Camera.prototype.setPostFilter = function(material) {
  91. Polycode.Camera_setPostFilter(this.__ptr, material)
  92. }
  93. Camera.prototype.setPostFilterByName = function(shaderName) {
  94. Polycode.Camera_setPostFilterByName(this.__ptr, shaderName)
  95. }
  96. Camera.prototype.removePostFilter = function() {
  97. Polycode.Camera_removePostFilter(this.__ptr)
  98. }
  99. Camera.prototype.getScreenShaderMaterial = function() {
  100. var retVal = new Material("__skip_ptr__")
  101. retVal.__ptr = Polycode.Camera_getScreenShaderMaterial(this.__ptr)
  102. return retVal
  103. }
  104. Camera.prototype.getProjectionMatrix = function() {
  105. var retVal = new Matrix4("__skip_ptr__")
  106. retVal.__ptr = Polycode.Camera_getProjectionMatrix(this.__ptr)
  107. return retVal
  108. }
  109. Camera.prototype.setCustomProjectionMatrix = function(matrix) {
  110. Polycode.Camera_setCustomProjectionMatrix(this.__ptr, matrix)
  111. }
  112. Camera.prototype.getViewport = function() {
  113. var retVal = new Rectangle("__skip_ptr__")
  114. retVal.__ptr = Polycode.Camera_getViewport(this.__ptr)
  115. return retVal
  116. }
  117. Camera.prototype.setViewport = function(viewport) {
  118. Polycode.Camera_setViewport(this.__ptr, viewport)
  119. }
  120. Camera.prototype.setOrthoSizeMode = function(orthoSizeMode) {
  121. Polycode.Camera_setOrthoSizeMode(this.__ptr, orthoSizeMode)
  122. }
  123. Camera.prototype.getOrthoSizeMode = function() {
  124. return Polycode.Camera_getOrthoSizeMode(this.__ptr)
  125. }
  126. Camera.prototype.setProjectionMode = function(mode) {
  127. Polycode.Camera_setProjectionMode(this.__ptr, mode)
  128. }
  129. Camera.prototype.getProjectionMode = function() {
  130. return Polycode.Camera_getProjectionMode(this.__ptr)
  131. }
  132. Camera.prototype.projectRayFrom2DCoordinate = function(coordinate,viewport) {
  133. var retVal = new Vector3("__skip_ptr__")
  134. retVal.__ptr = Polycode.Camera_projectRayFrom2DCoordinate(this.__ptr, coordinate, viewport)
  135. return retVal
  136. }
  137. Camera.prototype.getShaderPass = function(index) {
  138. var retVal = new ShaderPass("__skip_ptr__")
  139. retVal.__ptr = Polycode.Camera_getShaderPass(this.__ptr, index)
  140. return retVal
  141. }
  142. Camera.prototype.getNumShaderPasses = function() {
  143. return Polycode.Camera_getNumShaderPasses(this.__ptr)
  144. }