@@ -207,7 +207,7 @@ var GLUtil={
207207* Loads a file from a URL asynchronously, using XMLHttpRequest.
208208* @param {string } url URL of the file to load.
209209* @param {string|null } responseType Expected data type of
210- * the file. Can be "json", "xml", "text", or "arraybuffer".
210+ * the file. Can be "json", "xml", "text", or "arraybuffer".
211211* If null or omitted, the default is "text".
212212* @return {Promise } A promise that resolves when the data
213213* file is loaded successfully (the result will be an object with
@@ -831,7 +831,7 @@ var Texture=function(name){
831831}
832832
833833/**
834- * Sets the wrapping behavior of texture coordinates that
834+ * Sets the wrapping behavior of texture coordinates that
835835* fall out of range when using this texture. This setting
836836* will only have an effect on textures whose width and height
837837* are both powers of two. For other textures, this setting
@@ -852,7 +852,7 @@ Texture.prototype.setClamp=function(clamp){
852852/**
853853* Loads a texture by its URL.
854854* @param {string } name URL of the texture data. Images with a TGA
855- * extension that use the RGBA or grayscale format are supported.
855+ * extension that use the RGBA or grayscale format are supported.
856856* Images supported by the browser will be loaded via
857857* the JavaScript DOM's Image class.
858858* @param {Object } [textureCache] An object whose keys
@@ -881,6 +881,17 @@ Texture.loadTexture=function(name, textureCache){
881881 } ) ;
882882}
883883
884+
885+ /**
886+ * Creates a texture from a byte array specifying the texture data.
887+ * @param {Uint8Array } array A byte array containing the texture data,
888+ * with the pixels arranged in left-to-right rows from top to bottom.
889+ * Each pixel takes 4 bytes, where the bytes are the red, green, blue,
890+ * and alpha components, in that order.
891+ * @param {Uint8Array } width Width, in pixels, of the texture.
892+ * @param {Uint8Array } height Height, in pixels, of the texture.
893+ * @return {glutil.Texture } The new Texture object.
894+ */
884895Texture . fromUint8Array = function ( array , width , height ) {
885896 if ( width < 0 ) throw new Error ( "width less than 0" )
886897 if ( height < 0 ) throw new Error ( "height less than 0" )
@@ -941,7 +952,7 @@ Texture.loadTga=function(name){
941952 arr [ io + 2 ] = col
942953 arr [ io + 3 ] = 0xFF
943954 offset ++ ;
944- }
955+ }
945956 }
946957 return { "width" :width , "height" :height , "image" :arr }
947958 } )
@@ -1701,7 +1712,7 @@ Scene3D.prototype.loadAndMapTexture=function(name){
17011712* rejection).
17021713* @return {Promise } A promise that is resolved when
17031714* all the URLs in the textureFiles array are either resolved or rejected.
1704- * The result will be an object with three properties:
1715+ * The result will be an object with three properties:
17051716* "successes", "failures", and "results".
17061717* See {@link glutil.GLUtil.getPromiseResults}.
17071718*/
0 commit comments