CubeTextureLoader.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Loader] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. Class for loading a [page:CubeTexture CubeTexture]. This uses the
  14. [page:ImageLoader] internally for loading files.
  15. </p>
  16. <h2>Code Example</h2>
  17. <code>
  18. const scene = new THREE.Scene();
  19. scene.background = new THREE.CubeTextureLoader()
  20. .setPath( 'textures/cubeMaps/' )
  21. .load( [
  22. 'px.png',
  23. 'nx.png',
  24. 'py.png',
  25. 'ny.png',
  26. 'pz.png',
  27. 'nz.png'
  28. ] );
  29. </code>
  30. <h2>Examples</h2>
  31. <p>
  32. [example:webgl_materials_cubemap materials / cubemap]<br />
  33. [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic]<br />
  34. [example:webgl_materials_cubemap_refraction materials / cubemap / refraction]
  35. </p>
  36. <h2>Constructor</h2>
  37. <h3>[name]( [param:LoadingManager manager] )</h3>
  38. <p>
  39. [page:LoadingManager manager] — The [page:LoadingManager loadingManager]
  40. for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
  41. Creates a new [name].
  42. </p>
  43. <h2>Properties</h2>
  44. <p>See the base [page:Loader] class for common properties.</p>
  45. <h2>Methods</h2>
  46. <p>See the base [page:Loader] class for common methods.</p>
  47. <h3>
  48. [method:CubeTexture load]( [param:String urls], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
  49. </h3>
  50. <p>
  51. [page:String urls] — array of 6 urls to images, one for each side of the
  52. CubeTexture. The urls should be specified in the following order: pos-x,
  53. neg-x, pos-y, neg-y, pos-z, neg-z. They can also be
  54. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].<br />
  55. Note that, by convention, cube maps are specified in a coordinate system
  56. in which positive-x is to the right when looking up the positive-z axis --
  57. in other words, using a left-handed coordinate system. Since three.js uses
  58. a right-handed coordinate system, environment maps used in three.js will
  59. have pos-x and neg-x swapped.<br />
  60. [page:Function onLoad] (optional) — Will be called when load completes.
  61. The argument will be the loaded [page:CubeTexture texture].<br />
  62. [page:Function onProgress] (optional) — This callback function is
  63. currently not supported.<br />
  64. [page:Function onError] (optional) — Will be called when load errors.<br />
  65. </p>
  66. <p>
  67. Begin loading from url and pass the loaded [page:CubeTexture texture] to
  68. onLoad. The method also returns a new texture object which can directly be
  69. used for material creation.
  70. </p>
  71. <h2>Source</h2>
  72. <p>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  74. </p>
  75. </body>
  76. </html>