Three. js source code annotation (40) Light/PointLight. js

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.