MultiMaterial.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. A Material to define multiple materials for the same geometry.
  14. The geometry decides which material is used for which faces by the [page:Face3 faces materialindex].
  15. The material index corresponds with the index of the material in the [page:.materials] array.
  16. </div>
  17. <h2>Examples</h2>
  18. <div>
  19. [example:webgl_animation_skinning_morph WebGL / animation / skinning / morph]<br />
  20. [example:webgl_effects_parallaxbarrier WebGL / effect / parallaxbarrier]<br />
  21. [example:webgl_geometry_colors_blender WebGL / geometry / colors / blender]<br />
  22. [example:webgl_geometry_text_earcut WebGL / geometry / text / earcut]<br />
  23. [example:webgl_geometry_text_pnltri WebGL / geometry / text / pnltri]<br />
  24. [example:webgl_geometry_text WebGL / geometry / text]<br />
  25. [example:webgl_loader_ctm_materials WebGL / loader / ctm / materials]<br />
  26. [example:webgl_loader_json_blender WebGL / loader / json / blender]<br />
  27. [example:webgl_loader_json_objconverter WebGL / loader / json / objconverter]<br />
  28. [example:webgl_loader_mmd WebGL / loader / mmd]<br />
  29. [example:webgl_materials_cars WebGL / materials / cars]<br />
  30. [example:webgl_materials_lightmap WebGL / materials / lightmap]<br />
  31. [example:webgl_materials WebGL / materials / / ]<br />
  32. [example:webgl_nearestneighbour WebGL / nearestneighbour]<br />
  33. [example:webgl_objects_update WebGL / objects / update]<br />
  34. [example:webgl_panorama_cube WebGL / panorama / cube]<br />
  35. [example:webgl_skinning_simple WebGL / skinning / simple]
  36. </div>
  37. <code>
  38. //The following will create a cube with a different material applied to each side
  39. var materials = [
  40. new THREE.MeshBasicMaterial( { color: 0xff0000 ) } ), // right
  41. new THREE.MeshBasicMaterial( { color: 0x0000ff ) } ), // left
  42. new THREE.MeshBasicMaterial( { color: 0x00ff00 ) } ), // top
  43. new THREE.MeshBasicMaterial( { color: 0xffff00 ) } ), // bottom
  44. new THREE.MeshBasicMaterial( { color: 0x00ffff ) } ), // back
  45. new THREE.MeshBasicMaterial( { color: 0xff00ff ) } ) // front
  46. ];
  47. var cubeSidesMaterial = new THREE.MultiMaterial( materials );
  48. var cubeGeometry = new THREE.BoxBufferGeometry( 100, 100, 100, 1, 1, 1 );
  49. var cubeMesh = new THREE.Mesh( cubeGeometry, cubeSidesMaterial );
  50. scene.add( cubeMesh );
  51. </code>
  52. <h2>Constructor</h2>
  53. <h3>[name]( [page:Array materials] )</h3>
  54. <div>
  55. [page:Array materials] -- an array of [page:Material Materials] to be used in the MultiMaterial.<br /><br />
  56. Creates a new [name].
  57. </div>
  58. <h2>Properties</h2>
  59. <h3>[property:Boolean isMultiMaterial]</h3>
  60. <div>
  61. Used to check whether this or derived classes are multi materials. Default is *true*.<br /><br />
  62. You should not change this, as it used internally for optimisation.
  63. </div>
  64. <h3>[property:Array materials]</h3>
  65. <div>An array containing the materials being used by the MultiMaterial.</div>
  66. <h3>[property:String uuid]</h3>
  67. <div>
  68. [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this material instance.
  69. This gets automatically assigned, so this shouldn't be edited.
  70. </div>
  71. <h3>[property:Array visible]</h3>
  72. <div>Whether or not [page:Mesh meshes] using this material should be rendered.</div>
  73. <h2>Methods</h2>
  74. <h3>[method:MultiMaterial clone]()</h3>
  75. <div>Return a clone of this MultiMaterial.</div>
  76. <h3>[method:null toJSON]( [page:object meta] )</h3>
  77. <div>
  78. meta -- object containing metadata such as textures or images for the material.<br />
  79. Convert the material to three.js JSON format.
  80. </div>
  81. <h2>Source</h2>
  82. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  83. </body>
  84. </html>