templates.json 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. [
  2. {
  3. "label" : "Create a sphere",
  4. "documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
  5. "insertText" : "var sphere = BABYLON.MeshBuilder.CreateSphere(\"${1:sphere}\", {diameter: ${2:1}}, scene);",
  6. "language" : "javascript"
  7. },
  8. {
  9. "label" : "Create a box",
  10. "documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
  11. "insertText" : "var box = BABYLON.MeshBuilder.CreateBox(\"${1:box}\", {size: ${2:1}}, scene);",
  12. "language" : "javascript"
  13. },
  14. {
  15. "label" : "Create a cylinder",
  16. "documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
  17. "insertText" : "var cylinder = BABYLON.MeshBuilder.CreateCylinder(\"${1:cylinder}\", {height: ${2:2}, diameter: ${3:1}}, scene);",
  18. "language" : "javascript"
  19. },
  20. {
  21. "label" : "Create a ground plane",
  22. "documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
  23. "insertText" : "var ground = BABYLON.MeshBuilder.CreateGround(\"${1:ground}\", {width: ${2:6}, height: ${3:6}}, scene);",
  24. "language" : "javascript"
  25. },
  26. {
  27. "label" : "Create a point light",
  28. "documentation" : "https://doc.babylonjs.com/babylon101/lights#the-point-light",
  29. "insertText" : "var pointLight = new BABYLON.PointLight(\"${1:pointLight}\", new BABYLON.Vector3(${2:0},${3:5},${4:0}), scene);",
  30. "language" : "javascript"
  31. },
  32. {
  33. "label" : "Create a directional light",
  34. "documentation" : "https://doc.babylonjs.com/babylon101/lights#the-directional-light",
  35. "insertText" : "var dirLight = new BABYLON.DirectionalLight(\"${1:dirLight}\", new BABYLON.Vector3(${2:0.25},${3:-1},${4:-0.25}), scene);",
  36. "language" : "javascript"
  37. },
  38. {
  39. "label" : "Create a spot light",
  40. "documentation" : "https://doc.babylonjs.com/babylon101/lights#the-spot-light",
  41. "insertText" : "var spotLight = new BABYLON.SpotLight(\"${1:spotLight}\", new BABYLON.Vector3(${2:0}, ${3:30}, ${4:-10}), new BABYLON.Vector3(${5:0}, ${6:-1}, ${7:0}), ${8:Math.PI / 3}, ${9:2}, scene);",
  42. "language" : "javascript"
  43. },
  44. {
  45. "label" : "Create a hemispheric light",
  46. "documentation" : "https://doc.babylonjs.com/babylon101/lights#the-hemispheric-light",
  47. "insertText" : "var hemiLight = new BABYLON.HemisphericLight(\"${1:hemiLight}\", new BABYLON.Vector3(${2:0}, ${3:1}, ${4:0}), scene);",
  48. "language" : "javascript"
  49. },
  50. {
  51. "label" : "Load a Node Material from snippet w/callback",
  52. "documentation" : "https://doc.babylonjs.com/how_to/node_material#loading-from-a-file-saved-from-the-node-material-editor",
  53. "insertText" : "BABYLON.NodeMaterial.ParseFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene).then(nodeMaterial => {\n ${2:mesh_to_apply_node_material_to}.material = nodeMaterial;\n});",
  54. "language" : "javascript"
  55. },
  56. {
  57. "label" : "Show the Inspector",
  58. "documentation" : "https://doc.babylonjs.com/features/playground_debuglayer",
  59. "insertText" : "scene.debugLayer.show({\n embedMode:true\n});",
  60. "language" : "javascript"
  61. },
  62. {
  63. "label" : "Create an Arc Rotate Camera w/Degrees",
  64. "documentation" : "https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera",
  65. "insertText" : "var camera = new BABYLON.ArcRotateCamera(\"${1:camera}\", BABYLON.Tools.ToRadians(${2:90}), BABYLON.Tools.ToRadians(${3:65}), ${4:10}, ${5:BABYLON.Vector3.Zero()}, scene);",
  66. "language" : "javascript"
  67. },
  68. {
  69. "label" : "Create an Arc Rotate Camera w/Radians",
  70. "documentation" : "https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera",
  71. "insertText" : "var camera = new BABYLON.ArcRotateCamera(\"${1:camera}\", ${2:0}, ${3:Math.PI/2}, ${4:10}, ${5:BABYLON.Vector3.Zero()}, scene);",
  72. "language" : "javascript"
  73. },
  74. {
  75. "label" : "Import a Mesh w/callback",
  76. "documentation" : "https://doc.babylonjs.com/resources/external_pg_assets",
  77. "insertText" : "BABYLON.SceneLoader.ImportMesh(\"${1:meshName}\", \"${2:url to the mesh parent directory}\", \"${3:Mesh filename.fileextension}\", scene, function(newMeshes){\n\n});",
  78. "language" : "javascript"
  79. },
  80. {
  81. "label" : "Setup a shadow generator",
  82. "documentation" : "https://doc.babylonjs.com/babylon101/shadows",
  83. "insertText" : "var shadowGenerator = new BABYLON.ShadowGenerator(${1:size}, ${2:the_light_source});\nshadowGenerator.getShadowMap().renderList.push(${3:the_mesh_that_casts_a_shadow});\n${4:mesh_that_receives_the_shadow}.receiveShadows = true;",
  84. "language" : "javascript"
  85. }
  86. ]