Camera.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. require('Polycode/Entity')
  2. function Camera(parentScene) {
  3. if(arguments[0] != "__skip_ptr__") {
  4. this.__ptr = Polycode.Camera(parentScene)
  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.prototype = Object.create(Entity.prototype);
  13. Camera.prototype.__get_frustumCulling = function() {
  14. return Polycode.Camera__get_frustumCulling(this.__ptr)
  15. }
  16. Camera.prototype.__set_frustumCulling = function(val) {
  17. Polycode.Camera__set_frustumCulling(this.__ptr, val)
  18. }
  19. Camera.prototype.__get_topLeftOrtho = function() {
  20. return Polycode.Camera__get_topLeftOrtho(this.__ptr)
  21. }
  22. Camera.prototype.__set_topLeftOrtho = function(val) {
  23. Polycode.Camera__set_topLeftOrtho(this.__ptr, val)
  24. }
  25. Camera.prototype.__get_cameraShift = function() {
  26. var retVal = new Vector2()
  27. retVal.__ptr = Polycode.Camera__get_cameraShift(this.__ptr)
  28. return retVal
  29. }
  30. Camera.prototype.__set_cameraShift = function(val) {
  31. Polycode.Camera__set_cameraShift(this.__ptr, val.__ptr)
  32. }
  33. Camera.prototype.buildFrustumPlanes = function() {
  34. Polycode.Camera_buildFrustumPlanes(this.__ptr)
  35. }
  36. Camera.prototype.isSphereInFrustum = function(pos,fRadius) {
  37. return Polycode.Camera_isSphereInFrustum(this.__ptr, pos, fRadius)
  38. }
  39. Camera.prototype.isAABBInFrustum = function(aabb) {
  40. return Polycode.Camera_isAABBInFrustum(this.__ptr, aabb)
  41. }
  42. Camera.prototype.setOrthoMode = function(mode) {
  43. Polycode.Camera_setOrthoMode(this.__ptr, mode)
  44. }
  45. Camera.prototype.setOrthoSize = function(orthoSizeX,orthoSizeY) {
  46. Polycode.Camera_setOrthoSize(this.__ptr, orthoSizeX, orthoSizeY)
  47. }
  48. Camera.prototype.setFrustumMode = function(left,right,bottom,top,front,back) {
  49. Polycode.Camera_setFrustumMode(this.__ptr, left, right, bottom, top, front, back)
  50. }
  51. Camera.prototype.getOrthoMode = function() {
  52. return Polycode.Camera_getOrthoMode(this.__ptr)
  53. }
  54. Camera.prototype.getOrthoSizeX = function() {
  55. return Polycode.Camera_getOrthoSizeX(this.__ptr)
  56. }
  57. Camera.prototype.getOrthoSizeY = function() {
  58. return Polycode.Camera_getOrthoSizeY(this.__ptr)
  59. }
  60. Camera.prototype.setFOV = function(fov) {
  61. Polycode.Camera_setFOV(this.__ptr, fov)
  62. }
  63. Camera.prototype.getFOV = function() {
  64. return Polycode.Camera_getFOV(this.__ptr)
  65. }
  66. Camera.prototype.setClippingPlanes = function(nearClipPlane,farClipPlane) {
  67. Polycode.Camera_setClippingPlanes(this.__ptr, nearClipPlane, farClipPlane)
  68. }
  69. Camera.prototype.getNearClippingPlane = function() {
  70. return Polycode.Camera_getNearClippingPlane(this.__ptr)
  71. }
  72. Camera.prototype.getFarClippingPlane = function() {
  73. return Polycode.Camera_getFarClippingPlane(this.__ptr)
  74. }
  75. Camera.prototype.setParentScene = function(parentScene) {
  76. Polycode.Camera_setParentScene(this.__ptr, parentScene.__ptr)
  77. }
  78. Camera.prototype.getParentScene = function() {
  79. var retVal = new Scene()
  80. retVal.__ptr = Polycode.Camera_getParentScene(this.__ptr)
  81. return retVal
  82. }
  83. Camera.prototype.createProjectionMatrix = function() {
  84. var retVal = new Matrix4()
  85. retVal.__ptr = Polycode.Camera_createProjectionMatrix(this.__ptr)
  86. return retVal
  87. }
  88. Camera.prototype.hasFilterShader = function() {
  89. return Polycode.Camera_hasFilterShader(this.__ptr)
  90. }
  91. Camera.prototype.drawFilter = function(targetBuffer) {
  92. Polycode.Camera_drawFilter(this.__ptr, targetBuffer)
  93. }
  94. Camera.prototype.setPostFilter = function(material) {
  95. Polycode.Camera_setPostFilter(this.__ptr, material)
  96. }
  97. Camera.prototype.setPostFilterByName = function(shaderName) {
  98. Polycode.Camera_setPostFilterByName(this.__ptr, shaderName)
  99. }
  100. Camera.prototype.removePostFilter = function() {
  101. Polycode.Camera_removePostFilter(this.__ptr)
  102. }
  103. Camera.prototype.getScreenShaderMaterial = function() {
  104. var retVal = new Material()
  105. retVal.__ptr = Polycode.Camera_getScreenShaderMaterial(this.__ptr)
  106. return retVal
  107. }
  108. Camera.prototype.Clone = function(deepClone,ignoreEditorOnly) {
  109. var retVal = new Entity()
  110. retVal.__ptr = Polycode.Camera_Clone(this.__ptr, deepClone, ignoreEditorOnly)
  111. return retVal
  112. }
  113. Camera.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
  114. Polycode.Camera_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
  115. }
  116. Camera.prototype.getProjectionMatrix = function() {
  117. var retVal = new Matrix4()
  118. retVal.__ptr = Polycode.Camera_getProjectionMatrix(this.__ptr)
  119. return retVal
  120. }
  121. Camera.prototype.setCustomProjectionMatrix = function(matrix) {
  122. Polycode.Camera_setCustomProjectionMatrix(this.__ptr, matrix)
  123. }
  124. Camera.prototype.getViewport = function() {
  125. var retVal = new Rectangle()
  126. retVal.__ptr = Polycode.Camera_getViewport(this.__ptr)
  127. return retVal
  128. }
  129. Camera.prototype.setViewport = function(viewport) {
  130. Polycode.Camera_setViewport(this.__ptr, viewport)
  131. }
  132. Camera.prototype.setOrthoSizeMode = function(orthoSizeMode) {
  133. Polycode.Camera_setOrthoSizeMode(this.__ptr, orthoSizeMode)
  134. }
  135. Camera.prototype.getOrthoSizeMode = function() {
  136. return Polycode.Camera_getOrthoSizeMode(this.__ptr)
  137. }
  138. Camera.prototype.setProjectionMode = function(mode) {
  139. Polycode.Camera_setProjectionMode(this.__ptr, mode)
  140. }
  141. Camera.prototype.getProjectionMode = function() {
  142. return Polycode.Camera_getProjectionMode(this.__ptr)
  143. }
  144. Camera.prototype.projectRayFrom2DCoordinate = function(coordinate,viewport) {
  145. var retVal = new Vector3()
  146. retVal.__ptr = Polycode.Camera_projectRayFrom2DCoordinate(this.__ptr, coordinate, viewport)
  147. return retVal
  148. }
  149. Camera.prototype.renderFullScreenQuad = function(drawBuffer,shaderPass) {
  150. Polycode.Camera_renderFullScreenQuad(this.__ptr, drawBuffer.__ptr, shaderPass)
  151. }
  152. Camera.prototype.getShaderPass = function(index) {
  153. var retVal = new ShaderPass()
  154. retVal.__ptr = Polycode.Camera_getShaderPass(this.__ptr, index)
  155. return retVal
  156. }
  157. Camera.prototype.getNumShaderPasses = function() {
  158. return Polycode.Camera_getNumShaderPasses(this.__ptr)
  159. }