Advertisement
Guest User

Untitled

a guest
May 29th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. // Create a Viewer
  2. var viewer = new BIMSURFER.Viewer(null, "myDiv", {}, false);
  3.  
  4. // -------------- Camera -------------------------
  5.  
  6. // Create a Camera
  7. var camera = new BIMSURFER.Camera(viewer, {
  8. eye: [0, 40, -40]
  9. });
  10.  
  11. // -------------- Controls -------------------------
  12.  
  13. // Create a Camera Orbit control
  14. var orbit = new BIMSURFER.Orbit(viewer, { camera: camera });
  15.  
  16. // -------------- Lights -------------------------
  17.  
  18. // Create an AmbientLight
  19. var ambientLight = new BIMSURFER.AmbientLight(viewer, {
  20. color: [0.7, 0.7, 0.7]
  21. });
  22.  
  23. // Create a DirLight
  24. var dirLight1 = new BIMSURFER.DirLight(viewer, {
  25. color: [0.6, 0.9, 0.9],
  26. dir: [1.0, 0.0, 0.0],
  27. space: "view"
  28. });
  29.  
  30. // Create a DirLight
  31. var dirLight2 = new BIMSURFER.DirLight(viewer, {
  32. color: [0.6, 0.9, 0.9],
  33. dir: [-0.5, 0.0, -1.0],
  34. space: "view"
  35. });
  36.  
  37. // -------------- Geometries -------------------------
  38.  
  39. // Create a box Geometry
  40. // Geometry defaults to a 2x2x2 box when no vertex or index arrays are specified
  41. var geometry = new BIMSURFER.Geometry(viewer, {
  42. id: "myGeometry"
  43. });
  44.  
  45. // -------------- Objects -------------------------
  46.  
  47. // Create some Objects
  48. // Share the box Geometry among them
  49.  
  50. var object1 = new BIMSURFER.Object(viewer, {
  51. type: "IfcRoof",
  52. geometries: [ geometry ],
  53. matrix: BIMSURFER.math.translationMat4v([-8, 0, -8])
  54. });
  55.  
  56. var object2 = new BIMSURFER.Object(viewer, {
  57. type: "IfcDistributionFlowElement",
  58. geometries: [ geometry ],
  59. matrix: BIMSURFER.math.translationMat4v([8, 0, -8])
  60. });
  61.  
  62. var object3 = new BIMSURFER.Object(viewer, {
  63. type: "IfcDistributionFlowElement",
  64. geometries: [ geometry ],
  65. matrix: BIMSURFER.math.translationMat4v([-8, 0, 8])
  66. });
  67.  
  68. var object4 = new BIMSURFER.Object(viewer, {
  69. type: "IfcRoof",
  70. geometries: [ geometry ],
  71. matrix: BIMSURFER.math.translationMat4v([8, 0, 8])
  72. });
  73.  
  74. // Create a Selection that initially selects two of our Objects
  75.  
  76. var selection = new BIMSURFER.Selection(viewer, {
  77. objects: [object1, object2 ]
  78. });
  79.  
  80. // Apply an XRay effect to the Selection, which will cause the selected
  81. // objects to appear opaque and all other Objects transparent
  82.  
  83. var xray = new BIMSURFER.XRay(viewer, {
  84. selection: selection
  85. });
  86.  
  87. // Add a third Object to the Selection, causing the XRay to now render
  88. // that Object as opaque also
  89.  
  90. selection.addObjects([object3]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement