CubeTextureLoader.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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],
  49. [param:Function onProgress], [param:Function onError] )
  50. </h3>
  51. <p>
  52. [page:String urls] — array of 6 urls to images, one for each side of the
  53. CubeTexture. The urls should be specified in the following order: pos-x,
  54. neg-x, pos-y, neg-y, pos-z, neg-z. They can also be
  55. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].<br />
  56. Note that, by convention, cube maps are specified in a coordinate system
  57. in which positive-x is to the right when looking up the positive-z axis --
  58. in other words, using a left-handed coordinate system. Since three.js uses
  59. a right-handed coordinate system, environment maps used in three.js will
  60. have pos-x and neg-x swapped.<br />
  61. [page:Function onLoad] (optional) — Will be called when load completes.
  62. The argument will be the loaded [page:CubeTexture texture].<br />
  63. [page:Function onProgress] (optional) — This callback function is
  64. currently not supported.<br />
  65. [page:Function onError] (optional) — Will be called when load errors.<br />
  66. </p>
  67. <p>
  68. Begin loading from url and pass the loaded [page:CubeTexture texture] to
  69. onLoad. The method also returns a new texture object which can directly be
  70. used for material creation.
  71. </p>
  72. <h2>Source</h2>
  73. <p>
  74. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  75. </p>
  76. </body>
  77. </html>