properties.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /// <reference path="../../dist/preview release/babylon.d.ts"/>
  2. module INSPECTOR {
  3. export var PROPERTIES = {
  4. /** Format the given object :
  5. * If a format function exists, returns the result of this function.
  6. * If this function doesn't exists, return the object type instead */
  7. format: (obj: any): any => {
  8. let type = Helpers.GET_TYPE(obj) || 'type_not_defined';
  9. if ((<any>PROPERTIES)[type] && (<any>PROPERTIES)[type].format) {
  10. return (<any>PROPERTIES)[type].format(obj);
  11. } else {
  12. return Helpers.GET_TYPE(obj);
  13. }
  14. },
  15. 'type_not_defined': {
  16. properties: new Array(),
  17. format: () => ''
  18. },
  19. 'Vector2': {
  20. type: BABYLON.Vector2,
  21. format: (vec: BABYLON.Vector2) => { return `x:${Helpers.Trunc(vec.x)}, y:${Helpers.Trunc(vec.y)}`; }
  22. },
  23. 'Vector3': {
  24. type: BABYLON.Vector3,
  25. format: (vec: BABYLON.Vector3) => { return `x:${Helpers.Trunc(vec.x)}, y:${Helpers.Trunc(vec.y)}, z:${Helpers.Trunc(vec.z)}` }
  26. },
  27. 'Color3': {
  28. type: BABYLON.Color3,
  29. format: (color: BABYLON.Color3) => { return `R:${color.r.toPrecision(2)}, G:${color.g.toPrecision(2)}, B:${color.b.toPrecision(2)}` },
  30. slider: {
  31. r: { min: 0, max: 1, step: 0.01 },
  32. g: { min: 0, max: 1, step: 0.01 },
  33. b: { min: 0, max: 1, step: 0.01 }
  34. }
  35. },
  36. 'Color4': {
  37. type: BABYLON.Color4,
  38. format: (color: BABYLON.Color4) => { return `R:${color.r}, G:${color.g}, B:${color.b}` },
  39. slider: {
  40. r: { min: 0, max: 1, step: 0.01 },
  41. g: { min: 0, max: 1, step: 0.01 },
  42. b: { min: 0, max: 1, step: 0.01 }
  43. }
  44. },
  45. 'Quaternion': {
  46. type: BABYLON.Quaternion
  47. },
  48. 'Size': {
  49. type: BABYLON.Size,
  50. format: (size: BABYLON.Size) => { return `Size - w:${Helpers.Trunc(size.width)}, h:${Helpers.Trunc(size.height)}` }
  51. },
  52. 'Texture': {
  53. type: BABYLON.Texture,
  54. format: (tex: BABYLON.Texture) => { return tex.name }
  55. },
  56. 'RenderTargetTexture': {
  57. type: BABYLON.RenderTargetTexture
  58. },
  59. 'DynamicTexture': {
  60. type: BABYLON.DynamicTexture
  61. },
  62. 'BaseTexture': {
  63. type: BABYLON.BaseTexture
  64. },
  65. 'CubeTexture': {
  66. type: BABYLON.CubeTexture
  67. },
  68. 'HDRCubeTexture': {
  69. type: BABYLON.HDRCubeTexture
  70. },
  71. 'Sound': {
  72. type: BABYLON.Sound
  73. },
  74. 'ArcRotateCamera': {
  75. type: BABYLON.ArcRotateCamera,
  76. slider: {
  77. alpha: { min: 0, max: 2 * Math.PI, step: 0.01 },
  78. beta: { min: -Math.PI, max: Math.PI, step: 0.01 },
  79. fov: { min: 0, max: 180, step: 1 }
  80. }
  81. },
  82. 'FreeCamera': {
  83. type: BABYLON.FreeCamera,
  84. slider: {
  85. fov: { min: 0, max: 180, step: 1 }
  86. }
  87. },
  88. 'Scene': {
  89. type: BABYLON.Scene,
  90. },
  91. 'TransformNode': {
  92. type: BABYLON.TransformNode,
  93. format: (m: BABYLON.TransformNode): string => { return m.name; }
  94. },
  95. 'AbstractMesh': {
  96. type: BABYLON.AbstractMesh,
  97. format: (m: BABYLON.AbstractMesh): string => { return m.name; }
  98. },
  99. 'Mesh': {
  100. type: BABYLON.Mesh,
  101. format: (m: BABYLON.Mesh): string => { return m.name; },
  102. slider: {
  103. visibility: { min: 0, max: 1, step: 0.1 }
  104. }
  105. },
  106. 'StandardMaterial': {
  107. type: BABYLON.StandardMaterial,
  108. format: (mat: BABYLON.StandardMaterial): string => { return mat.name; },
  109. slider: {
  110. alpha: { min: 0, max: 1, step: 0.01 }
  111. }
  112. },
  113. 'PBRMaterial': {
  114. type: BABYLON.PBRMaterial,
  115. slider: {
  116. alpha: { min: 0, max: 1, step: 0.01 }
  117. }
  118. },
  119. 'PhysicsImpostor': {
  120. type: BABYLON.PhysicsImpostor
  121. },
  122. 'ImageProcessingConfiguration': {
  123. type: BABYLON.ImageProcessingConfiguration
  124. },
  125. 'ColorCurves': {
  126. type: BABYLON.ColorCurves
  127. }
  128. }
  129. }