Three. js source code annotation (fifty-six) Material/PointCloudMaterial. js
/*** @ Author mrdoob/http://mrdoob.com/* @ author alteredq/http://alteredqualia.com/** parameters = {* color:
, * Opacity:
, * Map: new THREE. Texture (), ** size:
, ** Blending: THREE. NormalBlending, * depthTest:
, * DepthWrite:
, ** VertexColors:
, ** Fog:
*} * // The PointCloudMaterial method creates a material type for point cloud (Particle System) based on the parameters parameter. The format of the parameters parameter is shown above. the PointCloudMaterial object function is implemented by defining the constructed function prototype object. most attribute Methods inherit from the Material's base class Material. *////
PointCloudMaterial///
Material attribute parameters in JSON format of string type ///
Returns PointCloudMaterial, the material of the point cloud.
THREE. pointCloudMaterial = function (parameters) {THREE. material. call (this); // call the call method of the Material object, and hand over the method originally belonging to the Material to the current object SpriteMaterial to use this. color = new THREE. color (0 xffffff); // Color, default Initialization is 0 xffffff, white this. map = null; // normal texture. The default value is nullthis. size = 1; // the size of the point cloud (particle). The default value is 1. this. sizeAttenuation = true; // particle attenuation. The default value is true. this. vertexColors = THREE. noColors; // vertex color. The default value is THREE. noColors. of course, THREE can also be created. vertex Colors/THREE. faceColors and other options show the flexibility of javascript. this. fog = true; // fog effect. The default value is true. // TODO: Why does PointCloudMaterial have the fog effect attribute, and the default Initialization is true ????????? This. setValues (parameters); // call the setValues method of the Material class and assign the parameter parameters to the attributes of the current PointCloudMaterial Material .}; /*************************************** * ************************ the method attribute definition of PointCloudMaterial object is as follows, inherited from Material ************************************* * ***********************/THREE. pointCloudMaterial. prototype = Object. create (THREE. material. prototype);/* clone method // clone method to clone the PointCloudMaterial object ,*////
Clone///
PointCloudMaterial object; optional .///
Returns the cloned PointCloudMaterial object.
THREE. pointCloudMaterial. prototype. clone = function () {// copy the attributes of the material one by one var material = new THREE. pointCloudMaterial (); THREE. material. prototype. clone. call (this, material); material. color. copy (this. color); material. map = this. map; material. size = this. size; material. sizeAttenuation = this. sizeAttenuation; material. vertexColors = this. vertexColors; material. fog = this. fog; return material; // returns the cloned PointCloudMaterial object}; // backwards compatibility is backward compatible with/* /// the maid method is THREE. pointCloudMaterial method replacement. */THREE. particle basicmaterial = function (parameters) {console. warn ('Three. particle basicmaterial has been renamed to THREE. pointCloudMaterial. '); return new THREE. pointCloudMaterial (parameters) ;};/* // The maid method is THREE. pointCloudMaterial method replacement. */THREE. particle systemmaterial = function (parameters) {console. warn ('Three. particle systemmaterial has been renamed to THREE. pointCloudMaterial. '); return new THREE. pointCloudMaterial (parameters );};
Http://www.bkjia.com/kf/201412/365627.html previous