Three. js source code annotation (39) Light/HemisphereLight. js

Source: Internet
Author: User

Three. js source code annotation (39) Light/HemisphereLight. 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/HemisphereLight. JS file in the THREE. js source code file.

 


/*** @ Author alteredq/http://alteredqualia.com/* // HemisphereLight class is used to create hemisphere light in the scene, that is, the sky light effect, often used outdoors, illumination of objects in various locations. The light in the room is mostly in the direction. // whether it is a window or a light trough, It is very convenient to use a plane light, and it is too troublesome to use a plane light outside. the function functions of the HemisphereLight object are implemented using the defined constructed function prototype object. /// TODO: the shadow of the HemisphereLight light has not been implemented in this version .??? /// Example: // var light = new THREE. hemisphereLight (0x003388, 0xcc0088, 1); // create hemisphere light // scene. add (light) // add to scenario ///light. position. set (0,300, 0 );*////HemisphereLight///Hemisphere light color (the color of the sky )///Background Color of hemisphere light ///The light intensity. The default value is 1 ///
 
  
Returns HemisphereLight, hemisphere light.
 THREE. hemisphereLight = function (skyColor, groundColor, intensity) {THREE. light. call (this, skyColor); // call the call method of the Light object, and hand over the method originally belongs to the Light to the current object HemisphereLight for use. this. position. set (0,100, 0); // The lighting position attribute is initialized to, 0,100, 0this. groundColor = new THREE. color (groundColor); // the background Color of the hemisphere light. this. intensity = (intensity! = Undefined )? Intensity: 1; // color attribute of the light. If not specified, the light is initialized to 1 .}; /*************************************** **************************************** * ********** the function definitions provided by the HemisphereLight object are as follows, some of them inherit from the Light method through prototype ********************************* **************************************** * *************/THREE. hemisphereLight. prototype = Object. create (THREE. light. prototype); // HemisphereLight object from THREE. the Light prototype inherits all the property methods/* clone method // clone method to clone the PointLight object *////Clone///
 
  
Returns the cloned HemiSphereLight object.
 THREE. hemisphereLight. prototype. clone = function () {var light = new THREE. hemisphereLight (); THREE. light. prototype. clone. call (this, light); // call THREE. light. clone method: clone the light object. groundColor. copy (this. groundColor); // copy the light's Ground Color Attribute light. intensity = this. intensity; // copy the light intensity attribute. return light; // return the cloned hemisphere light object };
Http://www.bkjia.com/kf/201412/359024.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.