提交 4910aaec 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #11160 from Mugen87/material

ShadowMaterial: Added parameters
......@@ -13,11 +13,11 @@
<h1>[name]</h1>
<div class="desc">
This material can recieve shadows, but otherwise is completely transparent.
This material can receive shadows, but otherwise is completely transparent.
</div>
<h3>Example</h3>
[example:webgl_geometry_spline_editor gemoetry / spline / editor]
[example:webgl_geometry_spline_editor geometry / spline / editor]
<code>
var planeGeometry = new THREE.PlaneGeometry( 2000, 2000 );
......@@ -34,7 +34,11 @@ scene.add( plane );
<h2>Constructor</h2>
<h3>[name]( )</h3>
<h3>[name]( [page:Object parameters] )</h3>
<div>
[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
Any property of the material (including any property inherited from [page:Material] and [page:ShaderMaterial]) can be passed in here.<br /><br />
</div>
<h2>Properties</h2>
......
......@@ -98,12 +98,9 @@
scene.add( light );
spotlight = light;
// scene.add( new THREE.CameraHelper( light.shadow.camera ) );
var planeGeometry = new THREE.PlaneGeometry( 2000, 2000 );
planeGeometry.rotateX( - Math.PI / 2 );
var planeMaterial = new THREE.ShadowMaterial();
planeMaterial.opacity = 0.2;
var planeMaterial = new THREE.ShadowMaterial( { opacity: 0.2 } );
var plane = new THREE.Mesh( planeGeometry, planeMaterial );
plane.position.y = -200;
......
......@@ -5,9 +5,13 @@ import { UniformsUtils } from '../renderers/shaders/UniformsUtils';
/**
* @author mrdoob / http://mrdoob.com/
*
* parameters = {
* opacity: <float>
* }
*/
function ShadowMaterial() {
function ShadowMaterial( parameters ) {
ShaderMaterial.call( this, {
uniforms: UniformsUtils.merge( [
......@@ -35,6 +39,8 @@ function ShadowMaterial() {
}
} );
this.setValues( parameters );
}
ShadowMaterial.prototype = Object.create( ShaderMaterial.prototype );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册