ImageUtils.html 3.1 KB

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