SpotLightShadow.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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:SpotLight SpotLights] لحساب
  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 SpotLight and turn on shadows for the light
  23. const light = new THREE.SpotLight( 0xffffff );
  24. light.castShadow = true; // default false
  25. scene.add( light );
  26. //Set up shadow properties for the light
  27. light.shadow.mapSize.width = 512; // default
  28. light.shadow.mapSize.height = 512; // default
  29. light.shadow.camera.near = 0.5; // default
  30. light.shadow.camera.far = 500; // default
  31. light.shadow.focus = 1; // 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. <p>
  51. ينشئ المنشئ [param:PerspectiveCamera PerspectiveCamera] لـ
  52. إدارة رؤية الظل للعالم.
  53. </p>
  54. <h2>الخصائص (Properties)</h2>
  55. <p>
  56. انظر الفئة الأساسية [page:LightShadow LightShadow] للخصائص المشتركة.
  57. </p>
  58. <h3>[property:Camera camera]</h3>
  59. <p>
  60. رؤية الضوء للعالم. يتم استخدام هذا لإنشاء خريطة عمق لـ
  61. المشهد ؛ الأشياء خلف الأشياء الأخرى من منظور الضوء ستكون
  62. في الظل. <br /><br />
  63. الافتراضي هو [page:PerspectiveCamera] مع
  64. [page:PerspectiveCamera.near near] كليبينغ بلان عند `0.5`. ال
  65. [page:PerspectiveCamera.fov fov] ستتبع [page:SpotLight.angle angle]
  66. خاصية [page:SpotLight SpotLight] المملوكة عبر
  67. [page:SpotLightShadow.update update] طريقة. بالمثل ،
  68. [page:PerspectiveCamera.aspect aspect] خاصية ستتبع نسبة
  69. [page:LightShadow.mapSize mapSize]. إذا تم تعيين [page:SpotLight.distance distance]
  70. خاصية الضوء ، فستتبع [page:PerspectiveCamera.far far]
  71. كليبينغ بلان ذلك ، وإلا فإنه يفترض `500`.
  72. </p>
  73. <h3>[property:Number focus]</h3>
  74. <p>
  75. تستخدم لتركيز كاميرا الظل. يتم تعيين حقل رؤية الكاميرا كـ
  76. نسبة مئوية من حقل رؤية المصباح. المدى هو `[0، 1]`. الافتراضي هو
  77. `1.0`. <br />
  78. </p>
  79. <h3>[property:Boolean isSpotLightShadow]</h3>
  80. <p>علامة للقراءة فقط للتحقق مما إذا كان الكائن المعطى هو من نوع [name].</p>
  81. <h2>الطرق (Methods)</h2>
  82. <p>انظر الفئة الأساسية [page:LightShadow LightShadow] للطرق المشتركة.</p>
  83. <h2>المصدر (Source)</h2>
  84. <p>
  85. [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js]
  86. </p>
  87. </body>
  88. </html>