Three. js source code annotation (fifty-eight) Material/RawShaderMaterial. js

Source: Internet
Author: User

Three. js source code annotation (fifty-eight) Material/RawShaderMaterial. js

 


/*** @ Author mrdoob/http://mrdoob.com/* // RawShaderMaterial method creates a material type for the custom shader according to the parameter parameters, such a material object allows users to expand the material type, with unlimited possibilities. this class works in the same way as ShaderMaterial //. Except for custom uniforms and attribute attributes, they are not automatically appended to the GLSL shader code. /// the format of the parameters parameter is shown above. the ShaderMaterial object function is implemented by defining the constructed function prototype object. most attribute Methods inherit from the base class ShaderMaterial of the material. ///// Example: // var material = new THREE. rawShaderMaterial ({// uniforms: {// time: {type: f, value: new THREE. vector2 ()} //}, // vertexShader: document. getElementById ('vertexshader '). textContent, // fragmentShader: document. getElementById ('fragmentshader '). textContent ///});///*////RawShaderMaterial///Material attribute parameters in JSON format of string type ///
 
  
Returns RawShaderMaterial to create a material type for the custom shader.
 THREE. rawShaderMaterial = function (parameters) {THREE. shaderMaterial. call (this, parameters); // call the call method of the ShaderMaterial object, and hand over the method originally belonging to the ShaderMaterial to the current object for use .}; /*************************************** * ************************ the method attribute definition of RawShaderMaterial object is as follows, inherited from ShaderMaterial ************************************* * ***********************/THREE. rawShaderMaterial. prototype = Object. create (THREE. shaderMaterial. prototype);/* clone method // clone method: clone RawShaderMaterial object ,*////Clone///RawShaderMaterial object; optional .///
 
  
Returns the cloned RawShaderMaterial object.
 THREE. rawShaderMaterial. prototype. clone = function () {// copy the attributes of the material one by one var material = new THREE. rawShaderMaterial (); THREE. shaderMaterial. prototype. clone. call (this, material); return material; // returns the cloned RawShaderMaterial object}; previous http://www.bkjia.com/kf/201412/365624.html

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.