Camera.js 5.8 KB

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