ImageUtils.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <div class="desc">A Helper class to ease the loading of images of different types.</div>
  12. <h2>Properties</h2>
  13. <h3>[property:string crossOrigin]</h3>
  14. <div>
  15. The crossOrigin string to implement CORS for loading the image from a different domain that allows CORS.
  16. </div>
  17. <h2>Methods</h2>
  18. <h3>[method:DataTexture generateDataTexture]([page:Number width], [page:Number height], [page:Number color])</h3>
  19. <div>
  20. width -- The width of the texture. <br />
  21. height -- The height of the texture. <br />
  22. color -- The hexadecimal value of the color.
  23. </div>
  24. <div>
  25. Generates a texture of a single color. It is a DataTexture with format, RGBFormat.
  26. </div>
  27. <h3>[method:CompressedTexture parseDDS]([page:String buffer], [page:boolean loadMipmaps])</h3>
  28. <div>
  29. buffer -- A string containing the data of the dds. <br />
  30. loadMipmaps -- A boolean to indicate if you need to load the mipmaps. Default is True.
  31. </div>
  32. <div>
  33. Parses a DDS Image from the string into a CompressedTexture.
  34. </div>
  35. <h3>[method:Texture loadTexture]([page:String url], [page:UVMapping mapping], [page:Function onLoad], [page:Function onError])</h3>
  36. <div>
  37. url -- the url of the texture<br />
  38. mapping -- Can be an instance of [page:UVMapping THREE.UVMapping], [page:CubeReflectionMapping THREE.CubeReflectionMapping] or [page:SphericalReflectionMapping THREE.SphericalReflectionMapping]. Describes how the image is applied to the object.<br />Use undefined instead of null as a default value. See mapping property of [page:Texture texture] for more details. <br/>
  39. onLoad -- callback function<br />
  40. onError -- callback function
  41. </div>
  42. <div>
  43. A helper function to generates a [page:Texture THREE.Texture] from an image URL. Provides a load and error
  44. callback.
  45. </div>
  46. <h3>[method:canvas getNormalMap]([page:Image image], [page:Float depth])</h3>
  47. <div>
  48. image -- A loaded image element <br />
  49. depth -- The depth of the normal map. Defaults to between -1 and 1.
  50. </div>
  51. <div>
  52. Translates an image element into a normal map with the range (-1, -1, -1) to (1, 1, 1) multiplied by the depth.
  53. Returns a canvas element.
  54. </div>
  55. <h3>[method:CubeTexture loadTextureCube]([page:Array array], [page:Textures mapping], [page:function onLoad], [page:function onError])</h3>
  56. <div>
  57. array -- An array of 6 images <br />
  58. mapping -- Either [page:Textures THREE.CubeReflectionMapping] or [page:Textures THREE.CubeRefractionMapping]<br />
  59. onLoad -- callback <br />
  60. onError -- callback
  61. </div>
  62. <div>
  63. Creates a [page:CubeTexture] from 6 images.<br /><br />
  64. The images are loaded in the following order where p is positiive and n is negative: [ px, nx, py, ny, pz, nz ].
  65. See [page:CubeTexture] for an example in code.
  66. </div>
  67. <h2>Source</h2>
  68. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  69. </body>
  70. </html>