properties.ts 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. module INSPECTOR {
  2. export const PROPERTIES = {
  3. /** Format the given object :
  4. * If a format function exists, returns the result of this function.
  5. * If this function doesn't exists, return the object type instead */
  6. format : (obj:any) => {
  7. let type = Helpers.GET_TYPE(obj) || 'type_not_defined';
  8. if (PROPERTIES[type] && PROPERTIES[type].format) {
  9. return PROPERTIES[type].format(obj);
  10. } else {
  11. return Helpers.GET_TYPE(obj);
  12. }
  13. },
  14. 'type_not_defined' : {
  15. properties : [],
  16. format: () => ''
  17. },
  18. 'Vector2' : {
  19. type: BABYLON.Vector2,
  20. properties: ['x', 'y'],
  21. format: (vec : BABYLON.Vector2) => {return `x:${Helpers.Trunc(vec.x)}, y:${Helpers.Trunc(vec.y)}`;}
  22. },
  23. 'Vector3' : {
  24. type: BABYLON.Vector3,
  25. properties: ['x', 'y', 'z'],
  26. format: (vec : BABYLON.Vector3) => {return `x:${Helpers.Trunc(vec.x)}, y:${Helpers.Trunc(vec.y)}, z:${Helpers.Trunc(vec.z)}`}
  27. },
  28. 'Color3' : {
  29. type: BABYLON.Color3,
  30. properties : ['r', 'g', 'b'],
  31. format: (color: BABYLON.Color3) => { return `R:${color.r}, G:${color.g}, B:${color.b}`}
  32. },
  33. 'Quaternion' : {
  34. type: BABYLON.Quaternion,
  35. properties : ['x', 'y', 'z', 'w']
  36. },
  37. 'Size' : {
  38. type: BABYLON.Size,
  39. properties :['width', 'height'],
  40. format: (size:BABYLON.Size) => { return `Size - w:${Helpers.Trunc(size.width)}, h:${Helpers.Trunc(size.height)}`}
  41. },
  42. 'Texture' : {
  43. type: BABYLON.Texture,
  44. properties :[
  45. 'hasAlpha',
  46. 'level',
  47. 'name',
  48. 'wrapU',
  49. 'wrapV',
  50. 'uScale',
  51. 'vScale',
  52. 'uAng',
  53. 'vAng',
  54. 'wAng',
  55. 'uOffset',
  56. 'vOffset'
  57. ],
  58. format: (tex:BABYLON.Texture) => { return tex.name}
  59. },
  60. 'ArcRotateCamera' : {
  61. type: BABYLON.ArcRotateCamera,
  62. properties : [
  63. 'alpha',
  64. 'beta',
  65. 'radius',
  66. 'angularSensibilityX',
  67. 'angularSensibilityY',
  68. 'target',
  69. 'lowerAlphaLimit',
  70. 'lowerBetaLimit',
  71. 'upperAlphaLimit',
  72. 'upperBetaLimit',
  73. 'lowerRadiusLimit',
  74. 'upperRadiusLimit',
  75. 'pinchPrecision',
  76. 'wheelPrecision',
  77. 'allowUpsideDown',
  78. 'checkCollisions'
  79. ]
  80. },
  81. 'Scene' : {
  82. type: BABYLON.Scene,
  83. properties:[
  84. 'actionManager',
  85. 'activeCamera',
  86. 'ambientColor',
  87. 'clearColor',
  88. 'forceWireframe',
  89. 'forcePointsCloud',
  90. 'forceShowBoundingBoxes',
  91. 'useRightHandedSystem',
  92. 'hoverCursor',
  93. 'cameraToUseForPointers',
  94. 'fogEnabled',
  95. 'fogColor',
  96. 'fogDensity',
  97. 'fogStart',
  98. 'fogEnd',
  99. 'shadowsEnabled',
  100. 'lightsEnabled',
  101. 'collisionsEnabled',
  102. 'gravity',
  103. 'meshUnderPointer',
  104. 'pointerX',
  105. 'pointerY',
  106. 'uid'
  107. ]
  108. },
  109. 'Mesh': {
  110. type: BABYLON.Mesh,
  111. properties : [
  112. 'name',
  113. 'position',
  114. 'rotation',
  115. 'rotationQuaternion',
  116. 'absolutePosition',
  117. 'material',
  118. 'actionManager',
  119. 'visibility',
  120. 'isVisible',
  121. 'isPickable',
  122. 'renderingGroupId',
  123. 'receiveShadows',
  124. 'renderOutline',
  125. 'outlineColor',
  126. 'outlineWidth',
  127. 'renderOverlay',
  128. 'overlayColor',
  129. 'overlayAlpha',
  130. 'hasVertexAlpha',
  131. 'useVertexColors',
  132. 'layerMask',
  133. 'alwaysSelectAsActiveMesh',
  134. 'ellipsoid',
  135. 'ellipsoidOffset',
  136. 'edgesWidth',
  137. 'edgesColor',
  138. 'checkCollisions',
  139. 'hasLODLevels'
  140. ],
  141. format : (m:BABYLON.Mesh) : string => {return m.name;}
  142. },
  143. 'StandardMaterial' : {
  144. type: BABYLON.StandardMaterial,
  145. properties : [
  146. 'name',
  147. 'alpha',
  148. 'alphaMode',
  149. 'wireframe',
  150. 'isFrozen',
  151. 'zOffset',
  152. 'ambientColor',
  153. 'emissiveColor',
  154. 'diffuseColor',
  155. 'specularColor',
  156. 'specularPower',
  157. 'useAlphaFromDiffuseTexture',
  158. 'linkEmissiveWithDiffuse',
  159. 'useSpecularOverAlpha',
  160. 'diffuseFresnelParameters',
  161. 'opacityFresnelParameters',
  162. 'reflectionFresnelParameters',
  163. 'refractionFresnelParameters',
  164. 'emissiveFresnelParameters',
  165. 'diffuseTexture',
  166. 'emissiveTexture',
  167. 'specularTexture',
  168. 'ambientTexture',
  169. 'bumpTexture',
  170. 'lightMapTexture',
  171. 'opacityTexture',
  172. 'reflectionTexture',
  173. 'refractionTexture'
  174. ],
  175. format : (mat:BABYLON.StandardMaterial) : string => {return mat.name;}
  176. },
  177. 'PrimitiveAlignment':{
  178. type: BABYLON.PrimitiveAlignment,
  179. properties:['horizontal', 'vertical']
  180. },
  181. 'PrimitiveThickness':{
  182. type: BABYLON.PrimitiveThickness,
  183. properties:['topPixels', 'leftPixels', 'rightPixels', 'bottomPixels']
  184. },
  185. 'BoundingInfo2D':{
  186. type: BABYLON.BoundingInfo2D,
  187. properties:['radius','center', 'extent']
  188. },
  189. 'SolidColorBrush2D':{
  190. type: BABYLON.SolidColorBrush2D,
  191. properties:['color']
  192. },
  193. 'GradientColorBrush2D':{
  194. type: BABYLON.GradientColorBrush2D,
  195. properties:['color1', 'color2', 'translation', 'rotation', 'scale']
  196. },
  197. 'PBRMaterial' : {
  198. type: BABYLON.PBRMaterial,
  199. properties: [
  200. 'name',
  201. 'albedoColor',
  202. 'albedoTexture',
  203. 'opacityTexture',
  204. 'reflectionTexture',
  205. 'emissiveTexture',
  206. 'bumpTexture',
  207. 'lightmapTexture',
  208. 'opacityFresnelParameters',
  209. 'emissiveFresnelParameters',
  210. 'linkEmissiveWithAlbedo',
  211. 'useLightmapAsShadowmap',
  212. 'useAlphaFromAlbedoTexture',
  213. 'useSpecularOverAlpha',
  214. 'useAutoMicroSurfaceFromReflectivityMap',
  215. 'useLogarithmicDepth',
  216. 'reflectivityColor',
  217. 'reflectivityTexture',
  218. 'reflectionTexture',
  219. 'reflectionColor',
  220. 'alpha',
  221. 'linkRefractionWithTransparency',
  222. 'indexOfRefraction',
  223. 'microSurface',
  224. 'useMicroSurfaceFromReflectivityMapAlpha',
  225. 'directIntensity',
  226. 'emissiveIntensity',
  227. 'specularIntensity',
  228. 'environmentIntensity',
  229. 'cameraExposure',
  230. 'cameraContrast',
  231. 'cameraColorGradingTexture',
  232. 'cameraColorCurves'
  233. ]
  234. }
  235. }
  236. }