Three. js source code annotation (forty-nine) Material/MeshNormalMaterial. js, three. js

Source: Internet
Author: User

Three. js source code annotation (forty-nine) Material/MeshNormalMaterial. js, three. js

Wuji (http://blog.csdn.net/omni360)

This article follows the "signature-non-commercial use-consistency" creation public agreement

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 Material/MeshNormalMaterial. JS file in the THREE. js source code file.

More updates in: https://github.com/omni360/three.js.sourcecode

/*** @ Author mrdoob/http://mrdoob.com/*** parameters = {* opacity: <float>, ** shading: THREE. flatShading, * blending: THREE. normalBlending, * depthTest: <bool>, * depthWrite: <bool>, ** wireframe: <boolean>, * wireframeLinewidth: <float> *} * // The MeshNormalMaterial method creates the standard material type of the mesh (mesh) based on the parameters parameter. I really don't know how to translate it here, it is better to call it NormalMaterial. // The format of the parameters parameter is shown above. use the MeshNormalMaterial object function to define the constructed Function Prototype object. most attribute Methods inherit from the Material's base class Material. * //// <summary> MeshNormalMaterial </summary> /// <param name = "parameters" type = "String"> string type JSON format material attribute parameter </param> /// <returns type = "MeshNormalMaterial"> returns MeshNormalMaterial, standard mesh material. </returns> THREE. meshNormalMaterial = function (parameters) {THREE. material. call (this, parameters); // call the call method of the Material object, and hand over the method originally belonging to the Material to the current object MeshNormalMaterial for use. this. shading = THREE. FlatShading; // color method, THREE. flatShading // GL_FLAT constant coloring: points, straight lines, or polygon are drawn in a color. The color of the entire element is the color of any of its points. // The following THREE. NoShading = 0; // do not color ???? // THREE. SmoothShading = 1; smooth coloring: Draw with multiple colors, each vertex is processed independently, and each vertex and each element adopt even interpolation. This. wireframe = false; // render the ry in a box. the default value is falsethis. wireframeLinewidth = 1; // The width of the wireframe. this. morphTargets = false; // defines whether the material sets the target deformation animation. The default value is falsethis. setValues (parameters); // call the setValues method of the Material class and assign the parameter parameters to the attributes of the current MeshNormalMaterial Material .}; /*************************************** * ************************ the method attribute definition of the MeshNormalMaterial object is as follows, inherited from Material ************************************* * ***********************/THREE. meshNormalMaterial. prototype = Object. create (THREE. material. prototype);/* clone method // clone method to clone the MeshNormalMaterial object, * //// <summary> clone </summary> /// <param name = "material" type = "MeshNormalMaterial"> MeshNormalMaterial object, optional. </param> // <returns type = "MeshNormalMaterial"> returns the cloned MeshNormalMaterial object </returns> THREE. meshNormalMaterial. prototype. clone = function () {// copy the attributes of the material one by one var material = new THREE. meshNormalMaterial (); THREE. material. prototype. clone. call (this, material); material. shading = this. shading; material. wireframe = this. wireframe; material. wireframeLinewidth = this. wireframeLinewidth; return material; // returns the cloned MeshNormalMaterial object };



Wuji (http://blog.csdn.net/omni360)

This article follows the "signature-non-commercial use-consistency" creation public agreement

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.


The following code is a comment on the Material/MeshNormalMaterial. JS file in the THREE. js source code file.

More updates in: https://github.com/omni360/three.js.sourcecode

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.