Files
three.js/src/materials/MeshBasicMaterial.js
T
alteredq 9ab427b7c6 Refactored core and renderer to use new model format.
Work in progress, not expected to work yet.

(among other things, we don't deal yet with new vertex colors for particles/line/ribbons, for the moment they just use geometry.colors as before, also we need to specify which type of uvs to use somewhere, analogous to which type of vertex colors to use)
2011-03-20 06:54:04 +01:00

91 lines
3.0 KiB
JavaScript

/**
* @author mr.doob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
*
* parameters = {
* color: <hex>,
* opacity: <float>,
* map: new THREE.Texture( <Image> ),
* lightMap: new THREE.Texture( <Image> ),
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
* combine: THREE.Multiply,
* reflectivity: <float>,
* refractionRatio: <float>,
* shading: THREE.SmoothShading,
* blending: THREE.NormalBlending,
* depthTest: <bool>,
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
* vertexColors: false / THREE.VertexColors / THREE.FaceColors,
* skinning: <bool>
* }
*/
THREE.MeshBasicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.map = null;
this.lightMap = null;
this.envMap = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
this.refractionRatio = 0.98;
this.fog = true; // implemented just in WebGLRenderer2
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.wireframe = false;
this.wireframeLinewidth = 1.0;
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
this.vertexColors = false;
this.skinning = false;
this.morphTargets = false;
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.map !== undefined ) this.map = parameters.map;
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
if ( parameters.envMap !== undefined ) this.envMap = parameters.envMap;
if ( parameters.combine !== undefined ) this.combine = parameters.combine;
if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
if ( parameters.refractionRatio !== undefined ) this.refractionRatio = parameters.refractionRatio;
if ( parameters.fog !== undefined ) this.fog = parameters.fog;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
if ( parameters.wireframeLinecap !== undefined ) this.wireframeLinecap = parameters.wireframeLinecap;
if ( parameters.wireframeLinejoin !== undefined ) this.wireframeLinejoin = parameters.wireframeLinejoin;
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
if ( parameters.morphTargets !== undefined ) this.morphTargets = parameters.morphTargets;
}
};