ShaderMaterial.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. [page:Material] &rarr;
  11. <h1>[name]</h1>
  12. <div class="desc">Material rendered with custom shaders</div>
  13. <h2>Example</h2>
  14. <code>
  15. var material = new THREE.ShaderMaterial( {
  16. uniforms: {
  17. time: { type: "f", value: 1.0 },
  18. resolution: { type: "v2", value: new THREE.Vector2() }
  19. },
  20. vertexShader: document.getElementById( 'vertexShader' ).textContent,
  21. fragmentShader: document.getElementById( 'fragmentShader' ).textContent
  22. } );
  23. </code>
  24. <h2>Constructor</h2>
  25. <h3>[name]([page:Object parameters])</h3>
  26. <div>
  27. parameters -- An object containing various parameters setting up shaders and their uniforms.
  28. </div>
  29. <h2>Properties</h2>
  30. <h3>.[page:object uniforms]</h3>
  31. <div>
  32. Uniforms defined inside GLSL shader code.
  33. </div>
  34. <h3>.[page:string fragmentShader]</h3>
  35. <div>
  36. Fragment shader GLSL code. This is the actual code for the shader. In the example above the code is retrieved from DOM elements emnbedded directly in the page although other methods can be used including specifying a string directly.
  37. </div>
  38. <h3>.[page:string vertexShader]</h3>
  39. <div>
  40. Vertex shader GLSL code. This is the actual code for the shader. In the example above the code is retrieved from DOM elements embedded directly in the page although other methods can be used including specifying a string directly.
  41. </div>
  42. <h3>.[page:boolean morphTargets]</h3>
  43. <div>
  44. todo
  45. </div>
  46. <h3>.[page:boolean lights]</h3>
  47. <div>
  48. todo
  49. </div>
  50. <h3>.[page:boolean morphNormals]</h3>
  51. <div>
  52. todo
  53. </div>
  54. <h3>.[page:boolean wireframe]</h3>
  55. <div>
  56. todo
  57. </div>
  58. <h3>.[page:number vertexColors]</h3>
  59. <div>
  60. todo
  61. </div>
  62. <h3>.[page:boolean skinning]</h3>
  63. <div>
  64. todo
  65. </div>
  66. <h3>.[page:boolean fog]</h3>
  67. <div>
  68. todo
  69. </div>
  70. <h3>.[page:object attributes]</h3>
  71. <div>
  72. todo
  73. </div>
  74. <h3>.[page:number shading]</h3>
  75. <div>
  76. todo
  77. </div>
  78. <h3>.[page:number linewidth]</h3>
  79. <div>
  80. todo
  81. </div>
  82. <h3>.[page:number wireframeLinewidth]</h3>
  83. <div>
  84. todo
  85. </div>
  86. <h3>.[page:object defines]</h3>
  87. <div>
  88. todo
  89. </div>
  90. <h2>Methods</h2>
  91. <h2>Source</h2>
  92. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  93. </body>
  94. </html>