Three. js source code annotation () Material/SpriteMaterial. js

Source: Internet
Author: User

Three. js source code annotation () Material/SpriteMaterial. js

 

/*** @ Author alteredq/http://alteredqualia.com/*** parameters = {* color:
 
  
, * Opacity:
  
   
, * Map: new THREE. Texture (), ** blending: THREE. NormalBlending, * depthTest:
   
    
, * DepthWrite:
    
     
, ** UvOffset: new THREE. Vector2 (), * uvScale: new THREE. Vector2 (), ** fog:
     
      
*} * // The SpriteMaterial method creates the Sprite material type based on the parameters parameter. The format of the parameters parameter is shown above. the SpriteMaterial object function is implemented by defining the constructed function prototype object. most attribute Methods inherit from the Material's base class Material. *////
      SpriteMaterial///
      Material attribute parameters in JSON format of string type ///
      
        Return SpriteMaterial and click the sprite material.
      THREE. spriteMaterial = 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 // defaults default this. color = new THREE. color (0 xffffff); // Color, default Initialization is 0 xffffff, white this. map = null; // normal texture. The default value is nullthis. rotation = 0; // The rotation Angle of the texture of the particle system. think about it. this. fog = false; // fog effect. The default value is true. // TODO: Why does SpriteMaterial have the fog effect attribute, and the default Initialization is true ????????? // Set parameters to set the parameter this. setValues (parameters); // call the setValues method of the Material class and assign the parameter parameters to the attributes of the current SpriteMaterial Material .}; /*************************************** * ************************ the method attribute definition of the SpriteMaterial object is as follows, inherited from Material ************************************* * ***********************/THREE. spriteMaterial. prototype = Object. create (THREE. material. prototype);/* clone method // clone method to clone the SpriteMaterial object ,*////
      Clone///
      SpriteMaterial object; optional .///
      
        Returns the cloned SpriteMaterial object.
      THREE. spriteMaterial. prototype. clone = function () {// copy the attributes of the material one by one. var material = new THREE. spriteMaterial (); THREE. material. prototype. clone. call (this, material); material. color. copy (this. color); material. map = this. map; material. rotation = this. rotation; material. fog = this. fog; return material; // returns the cloned SpriteMaterial object };
     
    
   
  
 

Http://www.bkjia.com/kf/201412/365617.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.