CommonUtilities.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // module( "CommonUtilities" );
  2. function aBox( name ) {
  3. var width = 100;
  4. var height = 100;
  5. var depth = 100;
  6. var widthSegments = 1;
  7. var heightSegments = 1;
  8. var depthSegments = 1;
  9. var geometry = new THREE.BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );
  10. var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
  11. mesh.name = name || "Box 1";
  12. return mesh;
  13. }
  14. function aSphere( name ) {
  15. var width = 100;
  16. var height = 100;
  17. var depth = 100;
  18. var widthSegments = 1;
  19. var heightSegments = 1;
  20. var depthSegments = 1;
  21. var geometry = new THREE.SphereGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );
  22. var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
  23. mesh.name = name || "Sphere 1";
  24. return mesh;
  25. }
  26. function aPointlight( name ) {
  27. var object = new THREE.PointLight( 54321, 1.0, 0.0, 1.0 );
  28. object.name = name || "PointLight 1";
  29. return object;
  30. }
  31. function aPerspectiveCamera( name ) {
  32. var object = new THREE.PerspectiveCamera( 50.1, 0.4, 1.03, 999.05 );
  33. object.name = name || "PerspectiveCamera 1";
  34. return object;
  35. }
  36. function getScriptCount( editor ) {
  37. var scriptsKeys = Object.keys( editor.scripts );
  38. var scriptCount = 0;
  39. for ( var i = 0; i < scriptsKeys.length; i++ ) {
  40. scriptCount += editor.scripts[ scriptsKeys[i] ].length;
  41. }
  42. return scriptCount;
  43. }