Three. js source code annotation (40) Light/PointLight. js
Reprinted please keep this sentence: Wuji-this blog focuses on Agile development and mobile and IOT device research: data visualization, GOLANG, Html5, WEBGL, THREE. JS. Otherwise, the post from this blog will not be reprinted or reprinted. Thank you for your cooperation.
I also just started learning. Sorry for the errors in many places.
The following code is a comment on the Light/PointLight. JS file in the THREE. js source code file.
/*** @ Author mrdoob/http://mrdoob.com/* // The PointLight method creates a light source based on the color, intensity property intensity, and distance property distance. functions of the PointLight object are implemented by using a function prototype object constructed. /// TODO: the shadow of PointLight has not been implemented in this version .??? /// Example: // var light = new THREE. pointLight (0xff0000, 1,100); // create a light object // light. position. set (50, 50, 30); // set the location // scene. add (lignt); // add the scenario *////PointLight///Light color attributes ///The light intensity. The default value is 1 ///The Length attribute of the Light, starting from the position of the light, which degrades to the length of distance. The default value is 0 ///
The return value is PointLight.
THREE. pointLight = function (color, intensity, distance) {THREE. light. call (this, color); // call the call method of the Light object, and hand over the method originally belongs to the Light to the PointLight object for use. this. intensity = (intensity! = Undefined )? Intensity: 1; // color attribute of the light. If not specified, the light is initialized to 1. this. distance = (distance! = Undefined )? Distance: 0; // the light intensity. If not specified, the light is initialized to 0 .}; /*************************************** **************************************** * ********** the function definition provided by the PointLight object is as follows, some of them inherit from the Light method through prototype ********************************* **************************************** * *************/THREE. pointLight. prototype = Object. create (THREE. light. prototype); // PointLight object from THREE. the Light prototype inherits all the property methods/* clone method // clone method to clone the PointLight object *////Clone///
Returns the cloned PointLight object.
THREE. pointLight. prototype. clone = function () {var light = new THREE. pointLight (); THREE. light. prototype. clone. call (this, light); // call THREE. light. clone method: clone the light object. intensity = this. intensity; // copy the light intensity attribute light. distance = this. distance; // copy the distance property of the light. return light; // return the cloned vertex light source object .};
Http://www.bkjia.com/kf/201412/359023.html previous