mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 04:56:01 +10:00
TODO:
- maybe image array loader should go into TextureCube.js so that people could just reuse the code
- it may be worth to be able to specify different combination of environment map and underlying material (in single render pass),
currently color/color map/environment map are multiplied, though addition also produces very interesting looking materials
66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
/**
|
|
* @author mr.doob / http://mrdoob.com/
|
|
* @author alteredq / http://alteredqualia.com/
|
|
*
|
|
* parameters = {
|
|
* color: <hex>,
|
|
* map: new THREE.Texture( <Image> ),
|
|
* env_map: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
|
* reflectivity: <float>,
|
|
* opacity: <float>,
|
|
* shading: THREE.SmoothShading,
|
|
* blending: THREE.NormalBlending,
|
|
* wireframe: <boolean>,
|
|
* wireframe_linewidth: <float>
|
|
* }
|
|
*/
|
|
|
|
THREE.MeshLambertMaterial = function ( parameters ) {
|
|
|
|
this.id = THREE.MeshLambertMaterialCounter.value ++;
|
|
|
|
this.color = new THREE.Color( 0xeeeeee );
|
|
this.map = null;
|
|
this.env_map = null;
|
|
this.reflectivity = 1;
|
|
this.opacity = 1;
|
|
this.shading = THREE.SmoothShading;
|
|
this.blending = THREE.NormalBlending;
|
|
this.wireframe = false;
|
|
this.wireframe_linewidth = 1;
|
|
|
|
if ( parameters ) {
|
|
|
|
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
|
|
if ( parameters.map !== undefined ) this.map = parameters.map;
|
|
if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
|
|
if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
|
|
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
|
|
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
|
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
|
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
|
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
|
|
|
}
|
|
|
|
this.toString = function () {
|
|
|
|
return 'THREE.MeshLambertMaterial (<br/>' +
|
|
'id: ' + this.id + '<br/>' +
|
|
'color: ' + this.color + '<br/>' +
|
|
'map: ' + this.map + '<br/>' +
|
|
'env_map: ' + this.env_map + '<br/>' +
|
|
'reflectivity: ' + this.reflectivity + '<br/>' +
|
|
'opacity: ' + this.opacity + '<br/>' +
|
|
'shading: ' + this.shading + '<br/>' +
|
|
'blending: ' + this.blending + '<br/>' +
|
|
'wireframe: ' + this.wireframe + '<br/>' +
|
|
'wireframe_size: ' + this.wireframe_linewidth + '<br/>' +
|
|
' )';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
THREE.MeshLambertMaterialCounter = { value: 0 };
|