CubeTextureLoader.html 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. [name] can be used to load cube maps. The loader returns an instance of [page:CubeTexture] and expects the cube map to
  14. be defined as six separate images representing the sides of a cube. Other cube map definitions like vertical and horizontal cross,
  15. column and row layouts are not supported.
  16. </p>
  17. <p>
  18. The loaded [page:CubeTexture] is in sRGB color space. Meaning the [page:Texture.colorSpace colorSpace]
  19. property is set to `THREE.SRGBColorSpace` by default.
  20. </p>
  21. <h2>Code Example</h2>
  22. <code>
  23. const scene = new THREE.Scene();
  24. scene.background = new THREE.CubeTextureLoader()
  25. .setPath( 'textures/cubeMaps/' )
  26. .load( [
  27. 'px.png',
  28. 'nx.png',
  29. 'py.png',
  30. 'ny.png',
  31. 'pz.png',
  32. 'nz.png'
  33. ] );
  34. </code>
  35. <h2>Examples</h2>
  36. <p>
  37. [example:webgl_materials_cubemap materials / cubemap]<br />
  38. [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic]<br />
  39. [example:webgl_materials_cubemap_refraction materials / cubemap / refraction]
  40. </p>
  41. <h2>Constructor</h2>
  42. <h3>[name]( [param:LoadingManager manager] )</h3>
  43. <p>
  44. [page:LoadingManager manager] — The [page:LoadingManager loadingManager]
  45. for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
  46. Creates a new [name].
  47. </p>
  48. <h2>Properties</h2>
  49. <p>See the base [page:Loader] class for common properties.</p>
  50. <h2>Methods</h2>
  51. <p>See the base [page:Loader] class for common methods.</p>
  52. <h3>
  53. [method:CubeTexture load]( [param:String urls], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
  54. </h3>
  55. <p>
  56. [page:String urls] — array of 6 urls to images, one for each side of the
  57. CubeTexture. The urls should be specified in the following order: pos-x,
  58. neg-x, pos-y, neg-y, pos-z, neg-z. They can also be
  59. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].<br />
  60. Note that, by convention, cube maps are specified in a coordinate system
  61. in which positive-x is to the right when looking up the positive-z axis --
  62. in other words, using a left-handed coordinate system. Since three.js uses
  63. a right-handed coordinate system, environment maps used in three.js will
  64. have pos-x and neg-x swapped.<br />
  65. [page:Function onLoad] (optional) — Will be called when load completes.
  66. The argument will be the loaded [page:CubeTexture texture].<br />
  67. [page:Function onProgress] (optional) — This callback function is
  68. currently not supported.<br />
  69. [page:Function onError] (optional) — Will be called when load errors.<br />
  70. </p>
  71. <p>
  72. Begin loading from url and pass the loaded [page:CubeTexture texture] to
  73. onLoad. The method also returns a new texture object which can directly be
  74. used for material creation.
  75. </p>
  76. <h2>Source</h2>
  77. <p>
  78. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  79. </p>
  80. </body>
  81. </html>