PointLightShadow.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html lang="ar">
  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 class="rtl">
  10. [page:LightShadow] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. يتم استخدام هذا داخليًا من قبل [page:PointLight PointLights] لحساب
  14. الظلال.
  15. </p>
  16. <h2>مثال الكود</h2>
  17. <code>
  18. //Create a WebGLRenderer and turn on shadows in the renderer
  19. const renderer = new THREE.WebGLRenderer();
  20. renderer.shadowMap.enabled = true;
  21. renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
  22. //Create a PointLight and turn on shadows for the light
  23. const light = new THREE.PointLight( 0xffffff, 1, 100 );
  24. light.position.set( 0, 10, 4 );
  25. light.castShadow = true; // default false
  26. scene.add( light );
  27. //Set up shadow properties for the light
  28. light.shadow.mapSize.width = 512; // default
  29. light.shadow.mapSize.height = 512; // default
  30. light.shadow.camera.near = 0.5; // default
  31. light.shadow.camera.far = 500; // default
  32. //Create a sphere that cast shadows (but does not receive them)
  33. const sphereGeometry = new THREE.SphereGeometry( 5, 32, 32 );
  34. const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } );
  35. const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
  36. sphere.castShadow = true; //default is false
  37. sphere.receiveShadow = false; //default
  38. scene.add( sphere );
  39. //Create a plane that receives shadows (but does not cast them)
  40. const planeGeometry = new THREE.PlaneGeometry( 20, 20, 32, 32 );
  41. const planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } )
  42. const plane = new THREE.Mesh( planeGeometry, planeMaterial );
  43. plane.receiveShadow = true;
  44. scene.add( plane );
  45. //Create a helper for the shadow camera (optional)
  46. const helper = new THREE.CameraHelper( light.shadow.camera );
  47. scene.add( helper );
  48. </code>
  49. <h2>المنشئ (Constructor)</h2>
  50. <h3>[name]( )</h3>
  51. <p>
  52. ينشئ [name] جديدًا. لا يُقصد من هذا الاتصال مباشرة - هو
  53. يتم استدعاؤه داخليًا من قبل [page:PointLight].
  54. </p>
  55. <h2>الخصائص (Properties)</h2>
  56. <p>
  57. انظر الفئة الأساسية [page:LightShadow LightShadow] للخصائص المشتركة.
  58. </p>
  59. <h3>[property:Boolean isPointLightShadow]</h3>
  60. <p>علامة للقراءة فقط للتحقق مما إذا كان الكائن المعطى هو من نوع [name].</p>
  61. <h2>الطرق (Methods)</h2>
  62. <p>انظر الفئة الأساسية [page:LightShadow LightShadow] للطرق المشتركة.</p>
  63. <h3>
  64. [method:undefined updateMatrices]( [param:Light light], [param:number viewportIndex])
  65. </h3>
  66. <p>
  67. تحديث المصفوفات للكاميرا والظل ، يستخدم داخليًا من قبل المصور. <br /><br />
  68. light -- الضوء الذي يتم تقديم الظل له. <br />
  69. viewportIndex -- يحسب المصفوفة لهذا viewport
  70. </p>
  71. <h2>المصدر (Source)</h2>
  72. <p>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js]
  74. </p>
  75. </body>
  76. </html>