Three. js source code annotation (fifty-five) Material/SpriteCanvasMaterial. js

Source: Internet
Author: User

Three. js source code annotation (fifty-five) Material/SpriteCanvasMaterial. js

 


/*** @ Author mrdoob/http://mrdoob.com/*** parameters = {* color:
 
  
, * Program:
  
   
, * Opacity:
   
    
, * Blending: THREE. normalBlending *} * // The SpriteCanvasMaterial method creates the Sprite (DOT Sprite) material type for the canvas Renderer Based on the parameter parameters. The format of the parameters parameter is shown above. the SpriteCanvasMaterial object function is implemented by defining the constructed function prototype object. most attribute Methods inherit from the Material's base class Material. /// TODO: Apart from several different attributes, SpriteCanvasMaterial and SpriteMaterial have different application scenarios? *////
    SpriteCanvasMaterial///
    Material attribute parameters in JSON format of string type ///
    
     
Return SpriteCanvasMaterial and click the sprite material.
    THREE. spriteCanvasMaterial = 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 SpriteCanvasMaterial to use this. color = new THREE. color (0 xffffff); // Color, default Initialization is 0 xffffff, white this. program = function (context, color) {}; // custom program, // TODO: this. what does the program attribute mean here ??? This. setValues (parameters); // call the setValues method of the Material class and assign the parameter parameters to the attributes of the current SpriteCanvasMaterial Material .}; /*************************************** * ************************ the method attribute definition of the SpriteCanvasMaterial object is as follows, inherited from Material ************************************* * ***********************/THREE. spriteCanvasMaterial. prototype = Object. create (THREE. material. prototype);/* clone method // clone method to clone the SpriteCanvasMaterial object ,*////
    Clone///
    SpriteCanvasMaterial object; optional .///
    
     
Returns the cloned SpriteCanvasMaterial object.
    THREE. spriteCanvasMaterial. prototype. clone = function () {// copy the attributes of the material one by one. var material = new THREE. spriteCanvasMaterial (); THREE. material. prototype. clone. call (this, material); material. color. copy (this. color); material. program = this. program; return material; // return the cloned SpriteMaterial object}; // backwards compatibility is backward compatible with the method. spriteCanvasMaterial method replacement. */THREE. particle canvasmaterial = THREE. spriteCanvasMaterial;
   
  
 

Http://www.bkjia.com/kf/201412/365616.html previous

 

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.