Three.js Source Note (26) Core/bufferattribute.js

Source: Internet
Author: User

Commercial Territory (http://blog.csdn.net/omni360/)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

Reprint Please keep this sentence: Business Domain-this blog focuses on Agile development and mobile and IoT device research: Data visualization, Golang, HTML5, WEBGL, three. JS, Otherwise, from this blog article refused to reprint or reprint, thank you for your cooperation.


I was just beginning to learn, a lot of things are definitely wrong and please forgive me.

The following code is a comment for the core/bufferattribute.js file in the three.js source file.

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


/** * @author mrdoob/http://mrdoob.com/*//*///bufferattribute class is used to store property data associated with Buffergeometry, more details can be found in the official sample HTTP// threejs.org////This class is used to store built-in properties such as vertex position, normals, colors, etc., but can also be used to store custom properties of Buffergeometry objects.// The function of the Bufferattribute object is implemented by a function prototype object that defines the construct.//TODO: Add a base class SetAttr (Index,item,itemsize) to set properties based on the length of the property with many different properties///*////< Summary>bufferattribute</summary>///<param name = "Array" type= "array" > array of Attributes </param>///< param name = "ItemSize" type= "Number" > property phase length </param>///<returns type= "Bufferattribute" > Returns a new property array </ Returns>three. Bufferattribute = function (array, itemsize) {This.array = Array;//bufferattribute array Property This.itemsize = Itemsize;//bu Fferattribute ItemSize Property};/******************************************** The following are the function functions provided by the Bufferattribute object. *********** /three. Bufferattribute.prototype = {Constructor:three. The bufferattribute,//constructor that returns a reference to the Bufferattribute function that created this object./*///get length method used to get the array lengths of the Bufferattribute,///note:get length () BufferAttribute.prototype.length(), this usage is available on browsers other than IE browsers. *////<summary>get length</summary>///<returns type= "number" > Returns the array length of Bufferattribute </returns>get length () {return this.array.length;//returns the length of the Bufferattribute array},/*/// The set method is used to reset the Bufferattribute property array *////<summary>set</summary>///<param name = "value" type= "Array" > Property array </param>///<returns type= "Bufferattribute" > returns the new Bufferattribute Property Object </returns>set:function ( Value) {This.array.set (value); return this;//returns the new Bufferattribute Property object},/*/// The Setx method is used to reset the first component of an array of Bufferattribute properties that contain 3 attribute phases///Note:setx method, the length of the property array is the length of the attribute phase multiplied by the number of attributes. For example, to store 100 points of coordinates, coordinates have 3 attribute phases, Then the length of the property array is 300, if you want to change the x-coordinate of the 30th point, set Index to 30*////<summary>setx</summary>///<param name = "Index" type= " Number > property array index </param>///<param name = "x" type= "number" > the first component of the property array </param>///<returns Type= "Bufferattribute" > Return new Bufferattribute Property Object </returns>setx:function (index, x) {this.array[index * This.itemsize] = X;return this;//returns the new BThe Ufferattribute Property object},/*///sety method is used to reset the second component of an array of Bufferattribute properties that contain 3 properties, or the Note:sety method, The length of the property array is the length of the attribute phase multiplied by the number of attributes. For example, to store 100 points of coordinates, coordinates have 3 attribute phase, then the length of the property array is 300, if you want to change the 30th point of the y-coordinate, set index to 30*////<summary>sety </summary>///<param name = "Index" type= "number" > the index of the property array </param>///<param name = "Y" type= "number The first component of the > property array </param>///<returns type= "Bufferattribute" > returns the new Bufferattribute Property object </returns> Sety:function (index, y) {this.array[index * this.itemsize + 1] = Y;return this;//Returns a new Bufferattribute Property object},/*///setz Party method is used to reset the third component of an array of Bufferattribute attributes with 3 attribute phases///Note:sety method, the length of the attribute array is the length of the attribute phase multiplied by the number of attributes. For example, to store 100 points of coordinates, coordinates have 3 properties, Then the length of the property array is 300, and if you want to change the z-coordinate of the 30th point, set Index to 30*////<summary>setz</summary>///<param name = "Index" type= " Number > property array index </param>///<param name = "Z" type= "number" > the first component of the property array </param>///<returns Type= "Bufferattribute" > returns the new Bufferattribute Property Object </returns>setz:function (index, z) {this.array[index * This.itemsize + 2] = Z;return this;//Returns the new Bufferattribute Property object},/*///setxy method is used to reset the first and second components of an array of Bufferattribute properties with 3 properties,//Note: In the SetXY method, the length of an attribute array is the length of the property's phase multiplied by the number of attributes. For example, to store 100 points of coordinates with 3 attribute phases, then the length of the property array is 300, and if you want to change the x, y coordinates of the 30th point, set Index to 30*////< Summary>setxy</summary>///<param name = "Index" type= "number" > property array index </param>///<param name = "X" type= "number" > the first component of the property array </param>///<param name = "Y" type= "number" > the second component of the property array </param>/// <returns type= "Bufferattribute" > Return new Bufferattribute Property Object </returns>setxy:function (index, x, y) {index *= this.itemsize;this.array[index] = x;this.array[Index + 1] = Y;return this;//return the new Bufferattribute Property Object},/*///setxyz method Used to reset the first, second, and third component of an array of Bufferattribute attributes with 3 properties (or the Note:setxy method), the length of the attribute array is the length of the attribute phase multiplied by the number of attributes. For example, to store 100 points of coordinates, coordinates have 3 properties, Then the length of the property array is 300, if you want to change the x, y, Z coordinates of the 30th point, set Index to 30*////<summary>setxyz</summary>///<param name = "Index" Type= the index of the "number" > property array </param>///<param name = "x" type= "number" > the first component of the property array </paraM>///<param name = "Y" type= "number" > second component of property array </param>///<param name = "Z" type= "number" > The third component of the property array </param>///<returns type= "Bufferattribute" > returns the new Bufferattribute Property object </returns>setxyz: function (index, x, Y, z) {index *= this.itemsize;this.array[index] = x;this.array[Index + 1] = y;this.array[in Dex + 2] = Z;return this;//Returns a new Bufferattribute Property object},/*///setxyzw method is used to reset the first, second, and third of the Bufferattribute property array containing the 3 attributes, Fourth component///NOTE:SETXYZW method, the length of the attribute array is the length of the attribute phase multiplied by the number of attributes. For example, to store 100 points of coordinates, coordinates have 4 attribute phase, then the length of the property array is 400, if you want to change the 30th point x, Y, Z, The W coordinate sets Index to 30*////<summary>setxyzw</summary>///<param name = "Index" type= "number" > the index of the property array </ Param>///<param name = "x" type= "number" > the first component of the property array </param>///<param name = "Y" type= "number" > The second component of the property array </param>///<param name = "Z" type= "number" > the third component of the property array </param>///<param name = "W" type= The fourth component of the "number" > attribute array </param>///<returns type= "Bufferattribute" > Returns a new Bufferattribute Property object andLt;/returns>setxyzw:function (index, x, Y, Z, w) {index *= this.itemsize;this.array[index] = x;this.array[IND Ex + 1] = y;this.array[Index + 2] = z;this.array[Index + 3] = W;return this;//Returns the new Bufferattribute Property object}};/************ The following methods are properties that define different data types and are already removed in the new version. This is reserved for backwards compatibility. ***********************************************************************************/three. Int8attribute = function (data, itemsize) {Console.warn (' three. Int8attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Uint8attribute = function (data, itemsize) {Console.warn (' three. Uint8attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Uint8clampedattribute = function (data, itemsize) {Console.warn (' three. Uint8clampedattribute has been removed. Use THREe. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Int16attribute = function (data, itemsize) {Console.warn (' three. Int16attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Uint16attribute = function (data, itemsize) {Console.warn (' three. Uint16attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Int32attribute = function (data, itemsize) {Console.warn (' three. Int32attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Uint32attribute = function (data, itemsize) {Console.warn (' three. Uint32attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Float32attribute = Function (data, itemsize) {Console.warn (' three. Float32attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);}; Three. Float64attribute = function (data, itemsize) {Console.warn (' three. Float64attribute has been removed. Use three. Bufferattribute (array, itemsize) instead. '); return new three. Bufferattribute (data, itemsize);};


Commercial Territory (http://blog.csdn.net/omni360/)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

Reprint Please keep this sentence: Business Domain-this blog focuses on Agile development and mobile and IoT device research: Data visualization, Golang, HTML5, WEBGL, three. JS, Otherwise, from this blog article refused to reprint or reprint, thank you for your cooperation.


The following code is a comment for the core/bufferattribute.js file in the three.js source file.

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

Three.js Source Note (26) Core/bufferattribute.js

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.