id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8,800 | greggman/twgl.js | src/programs.js | loadShader | function loadShader(gl, shaderSource, shaderType, opt_errorCallback) {
const errFn = opt_errorCallback || error;
// Create the shader object
const shader = gl.createShader(shaderType);
// Remove the first end of line because WebGL 2.0 requires
// #version 300 es
// as the first line. No whitespace allowed ... | javascript | function loadShader(gl, shaderSource, shaderType, opt_errorCallback) {
const errFn = opt_errorCallback || error;
// Create the shader object
const shader = gl.createShader(shaderType);
// Remove the first end of line because WebGL 2.0 requires
// #version 300 es
// as the first line. No whitespace allowed ... | [
"function",
"loadShader",
"(",
"gl",
",",
"shaderSource",
",",
"shaderType",
",",
"opt_errorCallback",
")",
"{",
"const",
"errFn",
"=",
"opt_errorCallback",
"||",
"error",
";",
"// Create the shader object",
"const",
"shader",
"=",
"gl",
".",
"createShader",
"(",
... | Loads a shader.
@param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
@param {string} shaderSource The shader source.
@param {number} shaderType The type of shader.
@param {module:twgl.ErrorCallback} opt_errorCallback callback for errors.
@return {WebGLShader} The created shader.
@private | [
"Loads",
"a",
"shader",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L477-L516 |
8,801 | greggman/twgl.js | src/programs.js | createUniformSetters | function createUniformSetters(gl, program) {
let textureUnit = 0;
/**
* Creates a setter for a uniform of the given program with it's
* location embedded in the setter.
* @param {WebGLProgram} program
* @param {WebGLUniformInfo} uniformInfo
* @returns {function} the created setter.
*/
function ... | javascript | function createUniformSetters(gl, program) {
let textureUnit = 0;
/**
* Creates a setter for a uniform of the given program with it's
* location embedded in the setter.
* @param {WebGLProgram} program
* @param {WebGLUniformInfo} uniformInfo
* @returns {function} the created setter.
*/
function ... | [
"function",
"createUniformSetters",
"(",
"gl",
",",
"program",
")",
"{",
"let",
"textureUnit",
"=",
"0",
";",
"/**\n * Creates a setter for a uniform of the given program with it's\n * location embedded in the setter.\n * @param {WebGLProgram} program\n * @param {WebGLUniformInfo} ... | Creates setter functions for all uniforms of a shader
program.
@see {@link module:twgl.setUniforms}
@param {WebGLProgram} program the program to create setters for.
@returns {Object.<string, function>} an object with a setter by name for each uniform
@memberOf module:twgl/programs | [
"Creates",
"setter",
"functions",
"for",
"all",
"uniforms",
"of",
"a",
"shader",
"program",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L815-L871 |
8,802 | greggman/twgl.js | src/programs.js | createUniformSetter | function createUniformSetter(program, uniformInfo) {
const location = gl.getUniformLocation(program, uniformInfo.name);
const isArray = (uniformInfo.size > 1 && uniformInfo.name.substr(-3) === "[0]");
const type = uniformInfo.type;
const typeInfo = typeMap[type];
if (!typeInfo) {
throw ("unkno... | javascript | function createUniformSetter(program, uniformInfo) {
const location = gl.getUniformLocation(program, uniformInfo.name);
const isArray = (uniformInfo.size > 1 && uniformInfo.name.substr(-3) === "[0]");
const type = uniformInfo.type;
const typeInfo = typeMap[type];
if (!typeInfo) {
throw ("unkno... | [
"function",
"createUniformSetter",
"(",
"program",
",",
"uniformInfo",
")",
"{",
"const",
"location",
"=",
"gl",
".",
"getUniformLocation",
"(",
"program",
",",
"uniformInfo",
".",
"name",
")",
";",
"const",
"isArray",
"=",
"(",
"uniformInfo",
".",
"size",
"... | Creates a setter for a uniform of the given program with it's
location embedded in the setter.
@param {WebGLProgram} program
@param {WebGLUniformInfo} uniformInfo
@returns {function} the created setter. | [
"Creates",
"a",
"setter",
"for",
"a",
"uniform",
"of",
"the",
"given",
"program",
"with",
"it",
"s",
"location",
"embedded",
"in",
"the",
"setter",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L825-L852 |
8,803 | greggman/twgl.js | src/programs.js | bindTransformFeedbackInfo | function bindTransformFeedbackInfo(gl, transformFeedbackInfo, bufferInfo) {
if (transformFeedbackInfo.transformFeedbackInfo) {
transformFeedbackInfo = transformFeedbackInfo.transformFeedbackInfo;
}
if (bufferInfo.attribs) {
bufferInfo = bufferInfo.attribs;
}
for (const name in bufferInfo) {
const ... | javascript | function bindTransformFeedbackInfo(gl, transformFeedbackInfo, bufferInfo) {
if (transformFeedbackInfo.transformFeedbackInfo) {
transformFeedbackInfo = transformFeedbackInfo.transformFeedbackInfo;
}
if (bufferInfo.attribs) {
bufferInfo = bufferInfo.attribs;
}
for (const name in bufferInfo) {
const ... | [
"function",
"bindTransformFeedbackInfo",
"(",
"gl",
",",
"transformFeedbackInfo",
",",
"bufferInfo",
")",
"{",
"if",
"(",
"transformFeedbackInfo",
".",
"transformFeedbackInfo",
")",
"{",
"transformFeedbackInfo",
"=",
"transformFeedbackInfo",
".",
"transformFeedbackInfo",
... | Binds buffers for transform feedback.
@param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
@param {(module:twgl.ProgramInfo|Object<string, module:twgl.TransformFeedbackInfo>)} transformFeedbackInfo A ProgramInfo or TransformFeedbackInfo.
@param {(module:twgl.BufferInfo|Object<string, module:twgl.AttribI... | [
"Binds",
"buffers",
"for",
"transform",
"feedback",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L910-L928 |
8,804 | greggman/twgl.js | src/programs.js | createTransformFeedback | function createTransformFeedback(gl, programInfo, bufferInfo) {
const tf = gl.createTransformFeedback();
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tf);
gl.useProgram(programInfo.program);
bindTransformFeedbackInfo(gl, programInfo, bufferInfo);
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
ret... | javascript | function createTransformFeedback(gl, programInfo, bufferInfo) {
const tf = gl.createTransformFeedback();
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tf);
gl.useProgram(programInfo.program);
bindTransformFeedbackInfo(gl, programInfo, bufferInfo);
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
ret... | [
"function",
"createTransformFeedback",
"(",
"gl",
",",
"programInfo",
",",
"bufferInfo",
")",
"{",
"const",
"tf",
"=",
"gl",
".",
"createTransformFeedback",
"(",
")",
";",
"gl",
".",
"bindTransformFeedback",
"(",
"gl",
".",
"TRANSFORM_FEEDBACK",
",",
"tf",
")"... | Creates a transform feedback and sets the buffers
@param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
@param {module:twgl.ProgramInfo} programInfo A ProgramInfo as returned from {@link module:twgl.createProgramInfo}
@param {(module:twgl.BufferInfo|Object<string, module:twgl.AttribInfo>)} [bufferInfo] A ... | [
"Creates",
"a",
"transform",
"feedback",
"and",
"sets",
"the",
"buffers"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L938-L945 |
8,805 | greggman/twgl.js | src/programs.js | createUniformBlockSpecFromProgram | function createUniformBlockSpecFromProgram(gl, program) {
const numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
const uniformData = [];
const uniformIndices = [];
for (let ii = 0; ii < numUniforms; ++ii) {
uniformIndices.push(ii);
uniformData.push({});
const uniformInfo = gl.getA... | javascript | function createUniformBlockSpecFromProgram(gl, program) {
const numUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
const uniformData = [];
const uniformIndices = [];
for (let ii = 0; ii < numUniforms; ++ii) {
uniformIndices.push(ii);
uniformData.push({});
const uniformInfo = gl.getA... | [
"function",
"createUniformBlockSpecFromProgram",
"(",
"gl",
",",
"program",
")",
"{",
"const",
"numUniforms",
"=",
"gl",
".",
"getProgramParameter",
"(",
"program",
",",
"gl",
".",
"ACTIVE_UNIFORMS",
")",
";",
"const",
"uniformData",
"=",
"[",
"]",
";",
"const... | A `UniformBlockSpec` represents the data needed to create and bind
UniformBlockObjects for a given program
@typedef {Object} UniformBlockSpec
@property {Object.<string, module:twgl.BlockSpec> blockSpecs The BlockSpec for each block by block name
@property {UniformData[]} uniformData An array of data for each uniform b... | [
"A",
"UniformBlockSpec",
"represents",
"the",
"data",
"needed",
"to",
"create",
"and",
"bind",
"UniformBlockObjects",
"for",
"a",
"given",
"program"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L991-L1040 |
8,806 | greggman/twgl.js | src/programs.js | createUniformBlockInfoFromProgram | function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockName) {
const blockSpecs = uniformBlockSpec.blockSpecs;
const uniformData = uniformBlockSpec.uniformData;
const blockSpec = blockSpecs[blockName];
if (!blockSpec) {
warn("no uniform block object named:", blockName);
return {
... | javascript | function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockName) {
const blockSpecs = uniformBlockSpec.blockSpecs;
const uniformData = uniformBlockSpec.uniformData;
const blockSpec = blockSpecs[blockName];
if (!blockSpec) {
warn("no uniform block object named:", blockName);
return {
... | [
"function",
"createUniformBlockInfoFromProgram",
"(",
"gl",
",",
"program",
",",
"uniformBlockSpec",
",",
"blockName",
")",
"{",
"const",
"blockSpecs",
"=",
"uniformBlockSpec",
".",
"blockSpecs",
";",
"const",
"uniformData",
"=",
"uniformBlockSpec",
".",
"uniformData"... | Represents a UniformBlockObject including an ArrayBuffer with all the uniform values
and a corresponding WebGLBuffer to hold those values on the GPU
@typedef {Object} UniformBlockInfo
@property {string} name The name of the block
@property {ArrayBuffer} array The array buffer that contains the uniform values
@property... | [
"Represents",
"a",
"UniformBlockObject",
"including",
"an",
"ArrayBuffer",
"with",
"all",
"the",
"uniform",
"values",
"and",
"a",
"corresponding",
"WebGLBuffer",
"to",
"hold",
"those",
"values",
"on",
"the",
"GPU"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L1080-L1120 |
8,807 | greggman/twgl.js | src/programs.js | createUniformBlockInfo | function createUniformBlockInfo(gl, programInfo, blockName) {
return createUniformBlockInfoFromProgram(gl, programInfo.program, programInfo.uniformBlockSpec, blockName);
} | javascript | function createUniformBlockInfo(gl, programInfo, blockName) {
return createUniformBlockInfoFromProgram(gl, programInfo.program, programInfo.uniformBlockSpec, blockName);
} | [
"function",
"createUniformBlockInfo",
"(",
"gl",
",",
"programInfo",
",",
"blockName",
")",
"{",
"return",
"createUniformBlockInfoFromProgram",
"(",
"gl",
",",
"programInfo",
".",
"program",
",",
"programInfo",
".",
"uniformBlockSpec",
",",
"blockName",
")",
";",
... | Creates a `UniformBlockInfo` for the specified block
Note: **If the blockName matches no existing blocks a warning is printed to the console and a dummy
`UniformBlockInfo` is returned**. This is because when debugging GLSL
it is common to comment out large portions of a shader or for example set
the final output to a ... | [
"Creates",
"a",
"UniformBlockInfo",
"for",
"the",
"specified",
"block"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L1138-L1140 |
8,808 | greggman/twgl.js | src/programs.js | bindUniformBlock | function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
const uniformBlockSpec = programInfo.uniformBlockSpec || programInfo;
const blockSpec = uniformBlockSpec.blockSpecs[uniformBlockInfo.name];
if (blockSpec) {
const bufferBindIndex = blockSpec.index;
gl.bindBufferRange(gl.UNIFORM_BUFFER, bufferB... | javascript | function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
const uniformBlockSpec = programInfo.uniformBlockSpec || programInfo;
const blockSpec = uniformBlockSpec.blockSpecs[uniformBlockInfo.name];
if (blockSpec) {
const bufferBindIndex = blockSpec.index;
gl.bindBufferRange(gl.UNIFORM_BUFFER, bufferB... | [
"function",
"bindUniformBlock",
"(",
"gl",
",",
"programInfo",
",",
"uniformBlockInfo",
")",
"{",
"const",
"uniformBlockSpec",
"=",
"programInfo",
".",
"uniformBlockSpec",
"||",
"programInfo",
";",
"const",
"blockSpec",
"=",
"uniformBlockSpec",
".",
"blockSpecs",
"[... | Binds a unform block to the matching uniform block point.
Matches by blocks by name so blocks must have the same name not just the same
structure.
If you have changed any values and you upload the valus into the corresponding WebGLBuffer
call {@link module:twgl.setUniformBlock} instead.
@param {WebGL2RenderingContext... | [
"Binds",
"a",
"unform",
"block",
"to",
"the",
"matching",
"uniform",
"block",
"point",
".",
"Matches",
"by",
"blocks",
"by",
"name",
"so",
"blocks",
"must",
"have",
"the",
"same",
"name",
"not",
"just",
"the",
"same",
"structure",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L1160-L1169 |
8,809 | greggman/twgl.js | src/programs.js | setUniformBlock | function setUniformBlock(gl, programInfo, uniformBlockInfo) {
if (bindUniformBlock(gl, programInfo, uniformBlockInfo)) {
gl.bufferData(gl.UNIFORM_BUFFER, uniformBlockInfo.array, gl.DYNAMIC_DRAW);
}
} | javascript | function setUniformBlock(gl, programInfo, uniformBlockInfo) {
if (bindUniformBlock(gl, programInfo, uniformBlockInfo)) {
gl.bufferData(gl.UNIFORM_BUFFER, uniformBlockInfo.array, gl.DYNAMIC_DRAW);
}
} | [
"function",
"setUniformBlock",
"(",
"gl",
",",
"programInfo",
",",
"uniformBlockInfo",
")",
"{",
"if",
"(",
"bindUniformBlock",
"(",
"gl",
",",
"programInfo",
",",
"uniformBlockInfo",
")",
")",
"{",
"gl",
".",
"bufferData",
"(",
"gl",
".",
"UNIFORM_BUFFER",
... | Uploads the current uniform values to the corresponding WebGLBuffer
and binds that buffer to the program's corresponding bind point for the uniform block object.
If you haven't changed any values and you only need to bind the uniform block object
call {@link module:twgl.bindUniformBlock} instead.
@param {WebGL2Render... | [
"Uploads",
"the",
"current",
"uniform",
"values",
"to",
"the",
"corresponding",
"WebGLBuffer",
"and",
"binds",
"that",
"buffer",
"to",
"the",
"program",
"s",
"corresponding",
"bind",
"point",
"for",
"the",
"uniform",
"block",
"object",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L1186-L1190 |
8,810 | greggman/twgl.js | src/programs.js | setBlockUniforms | function setBlockUniforms(uniformBlockInfo, values) {
const uniforms = uniformBlockInfo.uniforms;
for (const name in values) {
const array = uniforms[name];
if (array) {
const value = values[name];
if (value.length) {
array.set(value);
} else {
array[0] = value;
}
... | javascript | function setBlockUniforms(uniformBlockInfo, values) {
const uniforms = uniformBlockInfo.uniforms;
for (const name in values) {
const array = uniforms[name];
if (array) {
const value = values[name];
if (value.length) {
array.set(value);
} else {
array[0] = value;
}
... | [
"function",
"setBlockUniforms",
"(",
"uniformBlockInfo",
",",
"values",
")",
"{",
"const",
"uniforms",
"=",
"uniformBlockInfo",
".",
"uniforms",
";",
"for",
"(",
"const",
"name",
"in",
"values",
")",
"{",
"const",
"array",
"=",
"uniforms",
"[",
"name",
"]",
... | Sets values of a uniform block object
@param {module:twgl.UniformBlockInfo} uniformBlockInfo A UniformBlockInfo as returned by {@link module:twgl.createUniformBlockInfo}.
@param {Object.<string, ?>} values A uniform name to value map where the value is correct for the given
type of uniform. So for example given a bloc... | [
"Sets",
"values",
"of",
"a",
"uniform",
"block",
"object"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L1220-L1233 |
8,811 | greggman/twgl.js | src/programs.js | createProgramInfo | function createProgramInfo(
gl, shaderSources, opt_attribs, opt_locations, opt_errorCallback) {
const progOptions = getProgramOptions(opt_attribs, opt_locations, opt_errorCallback);
let good = true;
shaderSources = shaderSources.map(function(source) {
// Lets assume if there is no \n it's an id
if (so... | javascript | function createProgramInfo(
gl, shaderSources, opt_attribs, opt_locations, opt_errorCallback) {
const progOptions = getProgramOptions(opt_attribs, opt_locations, opt_errorCallback);
let good = true;
shaderSources = shaderSources.map(function(source) {
// Lets assume if there is no \n it's an id
if (so... | [
"function",
"createProgramInfo",
"(",
"gl",
",",
"shaderSources",
",",
"opt_attribs",
",",
"opt_locations",
",",
"opt_errorCallback",
")",
"{",
"const",
"progOptions",
"=",
"getProgramOptions",
"(",
"opt_attribs",
",",
"opt_locations",
",",
"opt_errorCallback",
")",
... | Creates a ProgramInfo from 2 sources.
A ProgramInfo contains
programInfo = {
program: WebGLProgram,
uniformSetters: object of setters as returned from createUniformSetters,
attribSetters: object of setters as returned from createAttribSetters,
}
NOTE: There are 4 signatures for this function
twgl.createProgramInfo(... | [
"Creates",
"a",
"ProgramInfo",
"from",
"2",
"sources",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/programs.js#L1584-L1609 |
8,812 | greggman/twgl.js | src/textures.js | canGenerateMipmap | function canGenerateMipmap(gl, width, height, internalFormat /*, type */) {
if (!utils.isWebGL2(gl)) {
return isPowerOf2(width) && isPowerOf2(height);
}
const info = textureInternalFormatInfo[internalFormat];
if (!info) {
throw "unknown internal format";
}
return info.colorRenderable && info.texture... | javascript | function canGenerateMipmap(gl, width, height, internalFormat /*, type */) {
if (!utils.isWebGL2(gl)) {
return isPowerOf2(width) && isPowerOf2(height);
}
const info = textureInternalFormatInfo[internalFormat];
if (!info) {
throw "unknown internal format";
}
return info.colorRenderable && info.texture... | [
"function",
"canGenerateMipmap",
"(",
"gl",
",",
"width",
",",
"height",
",",
"internalFormat",
"/*, type */",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"isWebGL2",
"(",
"gl",
")",
")",
"{",
"return",
"isPowerOf2",
"(",
"width",
")",
"&&",
"isPowerOf2",
"(... | Gets whether or not we can generate mips for the given
internal format.
@param {number} internalFormat The internalFormat parameter from texImage2D etc..
@param {number} type The type parameter for texImage2D etc..
@return {boolean} true if we can generate mips
@memberOf module:twgl/textures | [
"Gets",
"whether",
"or",
"not",
"we",
"can",
"generate",
"mips",
"for",
"the",
"given",
"internal",
"format",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L348-L357 |
8,813 | greggman/twgl.js | src/textures.js | getTextureTypeForArrayType | function getTextureTypeForArrayType(gl, src, defaultType) {
if (isArrayBuffer(src)) {
return typedArrays.getGLTypeForTypedArray(src);
}
return defaultType || gl.UNSIGNED_BYTE;
} | javascript | function getTextureTypeForArrayType(gl, src, defaultType) {
if (isArrayBuffer(src)) {
return typedArrays.getGLTypeForTypedArray(src);
}
return defaultType || gl.UNSIGNED_BYTE;
} | [
"function",
"getTextureTypeForArrayType",
"(",
"gl",
",",
"src",
",",
"defaultType",
")",
"{",
"if",
"(",
"isArrayBuffer",
"(",
"src",
")",
")",
"{",
"return",
"typedArrays",
".",
"getGLTypeForTypedArray",
"(",
"src",
")",
";",
"}",
"return",
"defaultType",
... | Gets the texture type for a given array type.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@return {number} the gl texture type
@private | [
"Gets",
"the",
"texture",
"type",
"for",
"a",
"given",
"array",
"type",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L394-L399 |
8,814 | greggman/twgl.js | src/textures.js | savePackState | function savePackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
lastPackState.colorspaceConversion = gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
}
if (options.premultiplyAlpha !== undef... | javascript | function savePackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
lastPackState.colorspaceConversion = gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
}
if (options.premultiplyAlpha !== undef... | [
"function",
"savePackState",
"(",
"gl",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"colorspaceConversion",
"!==",
"undefined",
")",
"{",
"lastPackState",
".",
"colorspaceConversion",
"=",
"gl",
".",
"getParameter",
"(",
"gl",
".",
"UNPACK_COLORSPACE_CO... | Saves any packing state that will be set based on the options.
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@private | [
"Saves",
"any",
"packing",
"state",
"that",
"will",
"be",
"set",
"based",
"on",
"the",
"options",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L574-L587 |
8,815 | greggman/twgl.js | src/textures.js | restorePackState | function restorePackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, lastPackState.colorspaceConversion);
}
if (options.premultiplyAlpha !== undefined) {
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, lastPackState.premultiplyA... | javascript | function restorePackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, lastPackState.colorspaceConversion);
}
if (options.premultiplyAlpha !== undefined) {
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, lastPackState.premultiplyA... | [
"function",
"restorePackState",
"(",
"gl",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"colorspaceConversion",
"!==",
"undefined",
")",
"{",
"gl",
".",
"pixelStorei",
"(",
"gl",
".",
"UNPACK_COLORSPACE_CONVERSION_WEBGL",
",",
"lastPackState",
".",
"colo... | Restores any packing state that was set based on the options.
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@private | [
"Restores",
"any",
"packing",
"state",
"that",
"was",
"set",
"based",
"on",
"the",
"options",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L595-L605 |
8,816 | greggman/twgl.js | src/textures.js | saveSkipState | function saveSkipState(gl) {
lastPackState.unpackAlignment = gl.getParameter(gl.UNPACK_ALIGNMENT);
if (utils.isWebGL2(gl)) {
lastPackState.unpackRowLength = gl.getParameter(gl.UNPACK_ROW_LENGTH);
lastPackState.unpackImageHeight = gl.getParameter(gl.UNPACK_IMAGE_HEIGHT);
lastPackState.unpackSkipPixel... | javascript | function saveSkipState(gl) {
lastPackState.unpackAlignment = gl.getParameter(gl.UNPACK_ALIGNMENT);
if (utils.isWebGL2(gl)) {
lastPackState.unpackRowLength = gl.getParameter(gl.UNPACK_ROW_LENGTH);
lastPackState.unpackImageHeight = gl.getParameter(gl.UNPACK_IMAGE_HEIGHT);
lastPackState.unpackSkipPixel... | [
"function",
"saveSkipState",
"(",
"gl",
")",
"{",
"lastPackState",
".",
"unpackAlignment",
"=",
"gl",
".",
"getParameter",
"(",
"gl",
".",
"UNPACK_ALIGNMENT",
")",
";",
"if",
"(",
"utils",
".",
"isWebGL2",
"(",
"gl",
")",
")",
"{",
"lastPackState",
".",
... | Saves state related to data size
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@private | [
"Saves",
"state",
"related",
"to",
"data",
"size"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L612-L621 |
8,817 | greggman/twgl.js | src/textures.js | setTextureSamplerParameters | function setTextureSamplerParameters(gl, target, parameteriFn, options) {
if (options.minMag) {
parameteriFn.call(gl, target, gl.TEXTURE_MIN_FILTER, options.minMag);
parameteriFn.call(gl, target, gl.TEXTURE_MAG_FILTER, options.minMag);
}
if (options.min) {
parameteriFn.call(gl, target, gl.TEXTURE_MIN_... | javascript | function setTextureSamplerParameters(gl, target, parameteriFn, options) {
if (options.minMag) {
parameteriFn.call(gl, target, gl.TEXTURE_MIN_FILTER, options.minMag);
parameteriFn.call(gl, target, gl.TEXTURE_MAG_FILTER, options.minMag);
}
if (options.min) {
parameteriFn.call(gl, target, gl.TEXTURE_MIN_... | [
"function",
"setTextureSamplerParameters",
"(",
"gl",
",",
"target",
",",
"parameteriFn",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"minMag",
")",
"{",
"parameteriFn",
".",
"call",
"(",
"gl",
",",
"target",
",",
"gl",
".",
"TEXTURE_MIN_FILTER",
... | Sets the parameters of a texture or sampler
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {number|WebGLSampler} target texture target or sampler
@param {function()} parameteriFn texParamteri or samplerParameteri fn
@param {WebGLTexture} tex the WebGLTexture to set parameters for
@param {module:twgl... | [
"Sets",
"the",
"parameters",
"of",
"a",
"texture",
"or",
"sampler"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L650-L689 |
8,818 | greggman/twgl.js | src/textures.js | setTextureParameters | function setTextureParameters(gl, tex, options) {
const target = options.target || gl.TEXTURE_2D;
gl.bindTexture(target, tex);
setTextureSamplerParameters(gl, target, gl.texParameteri, options);
} | javascript | function setTextureParameters(gl, tex, options) {
const target = options.target || gl.TEXTURE_2D;
gl.bindTexture(target, tex);
setTextureSamplerParameters(gl, target, gl.texParameteri, options);
} | [
"function",
"setTextureParameters",
"(",
"gl",
",",
"tex",
",",
"options",
")",
"{",
"const",
"target",
"=",
"options",
".",
"target",
"||",
"gl",
".",
"TEXTURE_2D",
";",
"gl",
".",
"bindTexture",
"(",
"target",
",",
"tex",
")",
";",
"setTextureSamplerPara... | Sets the texture parameters of a texture.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {WebGLTexture} tex the WebGLTexture to set parameters for
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
This is often the same options you passed in w... | [
"Sets",
"the",
"texture",
"parameters",
"of",
"a",
"texture",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L699-L703 |
8,819 | greggman/twgl.js | src/textures.js | setSamplerParameters | function setSamplerParameters(gl, sampler, options) {
setTextureSamplerParameters(gl, sampler, gl.samplerParameteri, options);
} | javascript | function setSamplerParameters(gl, sampler, options) {
setTextureSamplerParameters(gl, sampler, gl.samplerParameteri, options);
} | [
"function",
"setSamplerParameters",
"(",
"gl",
",",
"sampler",
",",
"options",
")",
"{",
"setTextureSamplerParameters",
"(",
"gl",
",",
"sampler",
",",
"gl",
".",
"samplerParameteri",
",",
"options",
")",
";",
"}"
] | Sets the sampler parameters of a sampler.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {WebGLSampler} sampler the WebGLSampler to set parameters for
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
@memberOf module:twgl/textures | [
"Sets",
"the",
"sampler",
"parameters",
"of",
"a",
"sampler",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L712-L714 |
8,820 | greggman/twgl.js | src/textures.js | createSampler | function createSampler(gl, options) {
const sampler = gl.createSampler();
setSamplerParameters(gl, sampler, options);
return sampler;
} | javascript | function createSampler(gl, options) {
const sampler = gl.createSampler();
setSamplerParameters(gl, sampler, options);
return sampler;
} | [
"function",
"createSampler",
"(",
"gl",
",",
"options",
")",
"{",
"const",
"sampler",
"=",
"gl",
".",
"createSampler",
"(",
")",
";",
"setSamplerParameters",
"(",
"gl",
",",
"sampler",
",",
"options",
")",
";",
"return",
"sampler",
";",
"}"
] | Creates a new sampler object and sets parameters.
Example:
const sampler = twgl.createSampler(gl, {
minMag: gl.NEAREST, // sets both TEXTURE_MIN_FILTER and TEXTURE_MAG_FILTER
wrap: gl.CLAMP_TO_NEAREST, // sets both TEXTURE_WRAP_S and TEXTURE_WRAP_T and TEXTURE_WRAP_R
});
@param {WebGLRenderingContext} gl th... | [
"Creates",
"a",
"new",
"sampler",
"object",
"and",
"sets",
"parameters",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L731-L735 |
8,821 | greggman/twgl.js | src/textures.js | createSamplers | function createSamplers(gl, samplerOptions) {
const samplers = {};
Object.keys(samplerOptions).forEach(function(name) {
samplers[name] = createSampler(gl, samplerOptions[name]);
});
return samplers;
} | javascript | function createSamplers(gl, samplerOptions) {
const samplers = {};
Object.keys(samplerOptions).forEach(function(name) {
samplers[name] = createSampler(gl, samplerOptions[name]);
});
return samplers;
} | [
"function",
"createSamplers",
"(",
"gl",
",",
"samplerOptions",
")",
"{",
"const",
"samplers",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"samplerOptions",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
")",
"{",
"samplers",
"[",
"name",
"]",
... | Creates a multiple sampler objects and sets parameters on each.
Example:
const samplers = twgl.createSamplers(gl, {
nearest: {
minMag: gl.NEAREST,
},
nearestClampS: {
minMag: gl.NEAREST,
wrapS: gl.CLAMP_TO_NEAREST,
},
linear: {
minMag: gl.LINEAR,
},
nearestClamp: {
minMag: gl.NEAREST,
wrap: gl.CLAMP_TO_EDGE,
},
linea... | [
"Creates",
"a",
"multiple",
"sampler",
"objects",
"and",
"sets",
"parameters",
"on",
"each",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L771-L777 |
8,822 | greggman/twgl.js | src/textures.js | make1Pixel | function make1Pixel(color) {
color = color || defaults.textureColor;
if (isArrayBuffer(color)) {
return color;
}
return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]);
} | javascript | function make1Pixel(color) {
color = color || defaults.textureColor;
if (isArrayBuffer(color)) {
return color;
}
return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]);
} | [
"function",
"make1Pixel",
"(",
"color",
")",
"{",
"color",
"=",
"color",
"||",
"defaults",
".",
"textureColor",
";",
"if",
"(",
"isArrayBuffer",
"(",
"color",
")",
")",
"{",
"return",
"color",
";",
"}",
"return",
"new",
"Uint8Array",
"(",
"[",
"color",
... | Makes a 1x1 pixel
If no color is passed in uses the default color which can be set by calling `setDefaultTextureColor`.
@param {(number[]|ArrayBufferView)} [color] The color using 0-1 values
@return {Uint8Array} Unit8Array with color.
@private | [
"Makes",
"a",
"1x1",
"pixel",
"If",
"no",
"color",
"is",
"passed",
"in",
"uses",
"the",
"default",
"color",
"which",
"can",
"be",
"set",
"by",
"calling",
"setDefaultTextureColor",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L786-L792 |
8,823 | greggman/twgl.js | src/textures.js | getCubeFaceOrder | function getCubeFaceOrder(gl, options) {
options = options || {};
return options.cubeFaceOrder || [
gl.TEXTURE_CUBE_MAP_POSITIVE_X,
gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
gl.TEXTURE_CUBE_MAP_... | javascript | function getCubeFaceOrder(gl, options) {
options = options || {};
return options.cubeFaceOrder || [
gl.TEXTURE_CUBE_MAP_POSITIVE_X,
gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
gl.TEXTURE_CUBE_MAP_... | [
"function",
"getCubeFaceOrder",
"(",
"gl",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"return",
"options",
".",
"cubeFaceOrder",
"||",
"[",
"gl",
".",
"TEXTURE_CUBE_MAP_POSITIVE_X",
",",
"gl",
".",
"TEXTURE_CUBE_MAP_NEGATIVE_X",
... | Gets an array of cubemap face enums
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
This is often the same options you passed in when you created the texture.
@return {number[]} cubemap face enums
@pri... | [
"Gets",
"an",
"array",
"of",
"cubemap",
"face",
"enums"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L839-L849 |
8,824 | greggman/twgl.js | src/textures.js | urlIsSameOrigin | function urlIsSameOrigin(url) {
if (typeof document !== 'undefined') {
// for IE really
const a = document.createElement('a');
a.href = url;
return a.hostname === location.hostname &&
a.port === location.port &&
a.protocol === location.protocol;
} else {
const localOrig... | javascript | function urlIsSameOrigin(url) {
if (typeof document !== 'undefined') {
// for IE really
const a = document.createElement('a');
a.href = url;
return a.hostname === location.hostname &&
a.port === location.port &&
a.protocol === location.protocol;
} else {
const localOrig... | [
"function",
"urlIsSameOrigin",
"(",
"url",
")",
"{",
"if",
"(",
"typeof",
"document",
"!==",
"'undefined'",
")",
"{",
"// for IE really",
"const",
"a",
"=",
"document",
".",
"createElement",
"(",
"'a'",
")",
";",
"a",
".",
"href",
"=",
"url",
";",
"retur... | Checks whether the url's origin is the same so that we can set the `crossOrigin`
@param {string} url url to image
@returns {boolean} true if the window's origin is the same as image's url
@private | [
"Checks",
"whether",
"the",
"url",
"s",
"origin",
"is",
"the",
"same",
"so",
"that",
"we",
"can",
"set",
"the",
"crossOrigin"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1018-L1031 |
8,825 | greggman/twgl.js | src/textures.js | loadImage | function loadImage(url, crossOrigin, callback) {
callback = callback || noop;
let img;
crossOrigin = crossOrigin !== undefined ? crossOrigin : defaults.crossOrigin;
crossOrigin = setToAnonymousIfUndefinedAndURLIsNotSameOrigin(url, crossOrigin);
if (typeof Image !== 'undefined') {
img = new Image();
if... | javascript | function loadImage(url, crossOrigin, callback) {
callback = callback || noop;
let img;
crossOrigin = crossOrigin !== undefined ? crossOrigin : defaults.crossOrigin;
crossOrigin = setToAnonymousIfUndefinedAndURLIsNotSameOrigin(url, crossOrigin);
if (typeof Image !== 'undefined') {
img = new Image();
if... | [
"function",
"loadImage",
"(",
"url",
",",
"crossOrigin",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"noop",
";",
"let",
"img",
";",
"crossOrigin",
"=",
"crossOrigin",
"!==",
"undefined",
"?",
"crossOrigin",
":",
"defaults",
".",
"crossOrig... | Loads an image
@param {string} url url to image
@param {string} crossOrigin
@param {function(err, img)} [callback] a callback that's passed an error and the image. The error will be non-null
if there was an error
@return {HTMLImageElement} the image being loaded.
@private | [
"Loads",
"an",
"image"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1048-L1116 |
8,826 | greggman/twgl.js | src/textures.js | isTexImageSource | function isTexImageSource(obj) {
return (typeof ImageBitmap !== 'undefined' && obj instanceof ImageBitmap) ||
(typeof ImageData !== 'undefined' && obj instanceof ImageData) ||
(typeof HTMLElement !== 'undefined' && obj instanceof HTMLElement);
} | javascript | function isTexImageSource(obj) {
return (typeof ImageBitmap !== 'undefined' && obj instanceof ImageBitmap) ||
(typeof ImageData !== 'undefined' && obj instanceof ImageData) ||
(typeof HTMLElement !== 'undefined' && obj instanceof HTMLElement);
} | [
"function",
"isTexImageSource",
"(",
"obj",
")",
"{",
"return",
"(",
"typeof",
"ImageBitmap",
"!==",
"'undefined'",
"&&",
"obj",
"instanceof",
"ImageBitmap",
")",
"||",
"(",
"typeof",
"ImageData",
"!==",
"'undefined'",
"&&",
"obj",
"instanceof",
"ImageData",
")"... | check if object is a TexImageSource
@param {Object} obj Object to test
@return {boolean} true if object is a TexImageSource
@private | [
"check",
"if",
"object",
"is",
"a",
"TexImageSource"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1125-L1129 |
8,827 | greggman/twgl.js | src/textures.js | loadAndUseImage | function loadAndUseImage(obj, crossOrigin, callback) {
if (isTexImageSource(obj)) {
setTimeout(function() {
callback(null, obj);
});
return obj;
}
return loadImage(obj, crossOrigin, callback);
} | javascript | function loadAndUseImage(obj, crossOrigin, callback) {
if (isTexImageSource(obj)) {
setTimeout(function() {
callback(null, obj);
});
return obj;
}
return loadImage(obj, crossOrigin, callback);
} | [
"function",
"loadAndUseImage",
"(",
"obj",
",",
"crossOrigin",
",",
"callback",
")",
"{",
"if",
"(",
"isTexImageSource",
"(",
"obj",
")",
")",
"{",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"callback",
"(",
"null",
",",
"obj",
")",
";",
"}",
")",
... | if obj is an TexImageSource then just
uses it otherwise if obj is a string
then load it first.
@param {string|TexImageSource} obj
@param {string} crossOrigin
@param {function(err, img)} [callback] a callback that's passed an error and the image. The error will be non-null
if there was an error
@private | [
"if",
"obj",
"is",
"an",
"TexImageSource",
"then",
"just",
"uses",
"it",
"otherwise",
"if",
"obj",
"is",
"a",
"string",
"then",
"load",
"it",
"first",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1142-L1151 |
8,828 | greggman/twgl.js | src/textures.js | loadTextureFromUrl | function loadTextureFromUrl(gl, tex, options, callback) {
callback = callback || noop;
options = options || defaults.textureOptions;
setTextureTo1PixelColor(gl, tex, options);
// Because it's async we need to copy the options.
options = Object.assign({}, options);
const img = loadAndUseImage(options.src, op... | javascript | function loadTextureFromUrl(gl, tex, options, callback) {
callback = callback || noop;
options = options || defaults.textureOptions;
setTextureTo1PixelColor(gl, tex, options);
// Because it's async we need to copy the options.
options = Object.assign({}, options);
const img = loadAndUseImage(options.src, op... | [
"function",
"loadTextureFromUrl",
"(",
"gl",
",",
"tex",
",",
"options",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"noop",
";",
"options",
"=",
"options",
"||",
"defaults",
".",
"textureOptions",
";",
"setTextureTo1PixelColor",
"(",
"gl",
... | A callback for when an image finished downloading and been uploaded into a texture
@callback ThreeDReadyCallback
@param {*} err If truthy there was an error.
@param {WebGLTexture} tex the texture.
@param {HTMLImageElement[]} imgs the images for each slice.
@memberOf module:twgl
Loads a texture from an image from a Ur... | [
"A",
"callback",
"for",
"when",
"an",
"image",
"finished",
"downloading",
"and",
"been",
"uploaded",
"into",
"a",
"texture"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1244-L1259 |
8,829 | greggman/twgl.js | src/textures.js | setEmptyTexture | function setEmptyTexture(gl, tex, options) {
const target = options.target || gl.TEXTURE_2D;
gl.bindTexture(target, tex);
const level = options.level || 0;
const internalFormat = options.internalFormat || options.format || gl.RGBA;
const formatType = getFormatAndTypeForInternalFormat(internalFormat);
const ... | javascript | function setEmptyTexture(gl, tex, options) {
const target = options.target || gl.TEXTURE_2D;
gl.bindTexture(target, tex);
const level = options.level || 0;
const internalFormat = options.internalFormat || options.format || gl.RGBA;
const formatType = getFormatAndTypeForInternalFormat(internalFormat);
const ... | [
"function",
"setEmptyTexture",
"(",
"gl",
",",
"tex",
",",
"options",
")",
"{",
"const",
"target",
"=",
"options",
".",
"target",
"||",
"gl",
".",
"TEXTURE_2D",
";",
"gl",
".",
"bindTexture",
"(",
"target",
",",
"tex",
")",
";",
"const",
"level",
"=",
... | Sets a texture with no contents of a certain size. In other words calls `gl.texImage2D` with `null`.
You must set `options.width` and `options.height`.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {WebGLTexture} tex the WebGLTexture to set parameters for
@param {module:twgl.TextureOptions} options... | [
"Sets",
"a",
"texture",
"with",
"no",
"contents",
"of",
"a",
"certain",
"size",
".",
"In",
"other",
"words",
"calls",
"gl",
".",
"texImage2D",
"with",
"null",
".",
"You",
"must",
"set",
"options",
".",
"width",
"and",
"options",
".",
"height",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1530-L1549 |
8,830 | greggman/twgl.js | src/textures.js | createTexture | function createTexture(gl, options, callback) {
callback = callback || noop;
options = options || defaults.textureOptions;
const tex = gl.createTexture();
const target = options.target || gl.TEXTURE_2D;
let width = options.width || 1;
let height = options.height || 1;
const internalFormat = options.inte... | javascript | function createTexture(gl, options, callback) {
callback = callback || noop;
options = options || defaults.textureOptions;
const tex = gl.createTexture();
const target = options.target || gl.TEXTURE_2D;
let width = options.width || 1;
let height = options.height || 1;
const internalFormat = options.inte... | [
"function",
"createTexture",
"(",
"gl",
",",
"options",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"noop",
";",
"options",
"=",
"options",
"||",
"defaults",
".",
"textureOptions",
";",
"const",
"tex",
"=",
"gl",
".",
"createTexture",
"("... | Creates a texture based on the options passed in.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
@param {module:twgl.TextureReadyCallback} [callback] A callback called when an image has been downloa... | [
"Creates",
"a",
"texture",
"based",
"on",
"the",
"options",
"passed",
"in",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1559-L1614 |
8,831 | greggman/twgl.js | src/textures.js | resizeTexture | function resizeTexture(gl, tex, options, width, height) {
width = width || options.width;
height = height || options.height;
const target = options.target || gl.TEXTURE_2D;
gl.bindTexture(target, tex);
const level = options.level || 0;
const internalFormat = options.internalFormat || options.format || gl.RG... | javascript | function resizeTexture(gl, tex, options, width, height) {
width = width || options.width;
height = height || options.height;
const target = options.target || gl.TEXTURE_2D;
gl.bindTexture(target, tex);
const level = options.level || 0;
const internalFormat = options.internalFormat || options.format || gl.RG... | [
"function",
"resizeTexture",
"(",
"gl",
",",
"tex",
",",
"options",
",",
"width",
",",
"height",
")",
"{",
"width",
"=",
"width",
"||",
"options",
".",
"width",
";",
"height",
"=",
"height",
"||",
"options",
".",
"height",
";",
"const",
"target",
"=",
... | Resizes a texture based on the options passed in.
Note: This is not a generic resize anything function.
It's mostly used by {@link module:twgl.resizeFramebufferInfo}
It will use `options.src` if it exists to try to determine a `type`
otherwise it will assume `gl.UNSIGNED_BYTE`. No data is provided
for the texture. Tex... | [
"Resizes",
"a",
"texture",
"based",
"on",
"the",
"options",
"passed",
"in",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1632-L1657 |
8,832 | greggman/twgl.js | src/textures.js | createTextures | function createTextures(gl, textureOptions, callback) {
callback = callback || noop;
let numDownloading = 0;
const errors = [];
const textures = {};
const images = {};
function callCallbackIfReady() {
if (numDownloading === 0) {
setTimeout(function() {
callback(errors.length ? errors : un... | javascript | function createTextures(gl, textureOptions, callback) {
callback = callback || noop;
let numDownloading = 0;
const errors = [];
const textures = {};
const images = {};
function callCallbackIfReady() {
if (numDownloading === 0) {
setTimeout(function() {
callback(errors.length ? errors : un... | [
"function",
"createTextures",
"(",
"gl",
",",
"textureOptions",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"noop",
";",
"let",
"numDownloading",
"=",
"0",
";",
"const",
"errors",
"=",
"[",
"]",
";",
"const",
"textures",
"=",
"{",
"}",
... | Creates a bunch of textures based on the passed in options.
Example:
const textures = twgl.createTextures(gl, {
// a power of 2 image
hftIcon: { src: "images/hft-icon-16.png", mag: gl.NEAREST },
// a non-power of 2 image
clover: { src: "images/clover.jpg" },
// From a canvas
fromCanvas: { src: ctx.canvas },
// A cube... | [
"Creates",
"a",
"bunch",
"of",
"textures",
"based",
"on",
"the",
"passed",
"in",
"options",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1747-L1786 |
8,833 | greggman/twgl.js | src/framebuffers.js | resizeFramebufferInfo | function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) {
width = width || gl.drawingBufferWidth;
height = height || gl.drawingBufferHeight;
framebufferInfo.width = width;
framebufferInfo.height = height;
attachments = attachments || defaultAttachments;
attachments.forEach(function... | javascript | function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) {
width = width || gl.drawingBufferWidth;
height = height || gl.drawingBufferHeight;
framebufferInfo.width = width;
framebufferInfo.height = height;
attachments = attachments || defaultAttachments;
attachments.forEach(function... | [
"function",
"resizeFramebufferInfo",
"(",
"gl",
",",
"framebufferInfo",
",",
"attachments",
",",
"width",
",",
"height",
")",
"{",
"width",
"=",
"width",
"||",
"gl",
".",
"drawingBufferWidth",
";",
"height",
"=",
"height",
"||",
"gl",
".",
"drawingBufferHeight... | Resizes the attachments of a framebuffer.
You need to pass in the same `attachments` as you passed in {@link module:twgl.createFramebufferInfo}
because TWGL has no idea the format/type of each attachment.
The simplest usage
// create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer
const fbi = twgl.creat... | [
"Resizes",
"the",
"attachments",
"of",
"a",
"framebuffer",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/framebuffers.js#L274-L292 |
8,834 | greggman/twgl.js | src/framebuffers.js | bindFramebufferInfo | function bindFramebufferInfo(gl, framebufferInfo, target) {
target = target || gl.FRAMEBUFFER;
if (framebufferInfo) {
gl.bindFramebuffer(target, framebufferInfo.framebuffer);
gl.viewport(0, 0, framebufferInfo.width, framebufferInfo.height);
} else {
gl.bindFramebuffer(target, null);
gl.viewport(0,... | javascript | function bindFramebufferInfo(gl, framebufferInfo, target) {
target = target || gl.FRAMEBUFFER;
if (framebufferInfo) {
gl.bindFramebuffer(target, framebufferInfo.framebuffer);
gl.viewport(0, 0, framebufferInfo.width, framebufferInfo.height);
} else {
gl.bindFramebuffer(target, null);
gl.viewport(0,... | [
"function",
"bindFramebufferInfo",
"(",
"gl",
",",
"framebufferInfo",
",",
"target",
")",
"{",
"target",
"=",
"target",
"||",
"gl",
".",
"FRAMEBUFFER",
";",
"if",
"(",
"framebufferInfo",
")",
"{",
"gl",
".",
"bindFramebuffer",
"(",
"target",
",",
"framebuffe... | Binds a framebuffer
This function pretty much soley exists because I spent hours
trying to figure out why something I wrote wasn't working only
to realize I forget to set the viewport dimensions.
My hope is this function will fix that.
It is effectively the same as
gl.bindFramebuffer(gl.FRAMEBUFFER, someFramebufferI... | [
"Binds",
"a",
"framebuffer"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/framebuffers.js#L314-L323 |
8,835 | greggman/twgl.js | src/v3.js | create | function create(x, y, z) {
const dst = new VecType(3);
if (x) {
dst[0] = x;
}
if (y) {
dst[1] = y;
}
if (z) {
dst[2] = z;
}
return dst;
} | javascript | function create(x, y, z) {
const dst = new VecType(3);
if (x) {
dst[0] = x;
}
if (y) {
dst[1] = y;
}
if (z) {
dst[2] = z;
}
return dst;
} | [
"function",
"create",
"(",
"x",
",",
"y",
",",
"z",
")",
"{",
"const",
"dst",
"=",
"new",
"VecType",
"(",
"3",
")",
";",
"if",
"(",
"x",
")",
"{",
"dst",
"[",
"0",
"]",
"=",
"x",
";",
"}",
"if",
"(",
"y",
")",
"{",
"dst",
"[",
"1",
"]",... | Creates a vec3; may be called with x, y, z to set initial values.
@return {module:twgl/v3.Vec3} the created vector
@memberOf module:twgl/v3 | [
"Creates",
"a",
"vec3",
";",
"may",
"be",
"called",
"with",
"x",
"y",
"z",
"to",
"set",
"initial",
"values",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L74-L86 |
8,836 | greggman/twgl.js | src/v3.js | add | function add(a, b, dst) {
dst = dst || new VecType(3);
dst[0] = a[0] + b[0];
dst[1] = a[1] + b[1];
dst[2] = a[2] + b[2];
return dst;
} | javascript | function add(a, b, dst) {
dst = dst || new VecType(3);
dst[0] = a[0] + b[0];
dst[1] = a[1] + b[1];
dst[2] = a[2] + b[2];
return dst;
} | [
"function",
"add",
"(",
"a",
",",
"b",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"+",
"b",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"a",
"... | Adds two vectors; assumes a and b have the same dimension.
@param {module:twgl/v3.Vec3} a Operand vector.
@param {module:twgl/v3.Vec3} b Operand vector.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} the created vector
@memberOf module:twgl/v3 | [
"Adds",
"two",
"vectors",
";",
"assumes",
"a",
"and",
"b",
"have",
"the",
"same",
"dimension",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L96-L104 |
8,837 | greggman/twgl.js | src/v3.js | subtract | function subtract(a, b, dst) {
dst = dst || new VecType(3);
dst[0] = a[0] - b[0];
dst[1] = a[1] - b[1];
dst[2] = a[2] - b[2];
return dst;
} | javascript | function subtract(a, b, dst) {
dst = dst || new VecType(3);
dst[0] = a[0] - b[0];
dst[1] = a[1] - b[1];
dst[2] = a[2] - b[2];
return dst;
} | [
"function",
"subtract",
"(",
"a",
",",
"b",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"-",
"b",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"a"... | Subtracts two vectors.
@param {module:twgl/v3.Vec3} a Operand vector.
@param {module:twgl/v3.Vec3} b Operand vector.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} the created vector
@memberOf module:twgl/v3 | [
"Subtracts",
"two",
"vectors",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L114-L122 |
8,838 | greggman/twgl.js | src/v3.js | mulScalar | function mulScalar(v, k, dst) {
dst = dst || new VecType(3);
dst[0] = v[0] * k;
dst[1] = v[1] * k;
dst[2] = v[2] * k;
return dst;
} | javascript | function mulScalar(v, k, dst) {
dst = dst || new VecType(3);
dst[0] = v[0] * k;
dst[1] = v[1] * k;
dst[2] = v[2] * k;
return dst;
} | [
"function",
"mulScalar",
"(",
"v",
",",
"k",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"v",
"[",
"0",
"]",
"*",
"k",
";",
"dst",
"[",
"1",
"]",
"=",
"v",
"[",
"1",
"]... | Mutiplies a vector by a scalar.
@param {module:twgl/v3.Vec3} v The vector.
@param {number} k The scalar.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} dst.
@memberOf module:twgl/v3 | [
"Mutiplies",
"a",
"vector",
"by",
"a",
"scalar",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L214-L222 |
8,839 | greggman/twgl.js | src/v3.js | divScalar | function divScalar(v, k, dst) {
dst = dst || new VecType(3);
dst[0] = v[0] / k;
dst[1] = v[1] / k;
dst[2] = v[2] / k;
return dst;
} | javascript | function divScalar(v, k, dst) {
dst = dst || new VecType(3);
dst[0] = v[0] / k;
dst[1] = v[1] / k;
dst[2] = v[2] / k;
return dst;
} | [
"function",
"divScalar",
"(",
"v",
",",
"k",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"v",
"[",
"0",
"]",
"/",
"k",
";",
"dst",
"[",
"1",
"]",
"=",
"v",
"[",
"1",
"]... | Divides a vector by a scalar.
@param {module:twgl/v3.Vec3} v The vector.
@param {number} k The scalar.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} dst.
@memberOf module:twgl/v3 | [
"Divides",
"a",
"vector",
"by",
"a",
"scalar",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L232-L240 |
8,840 | greggman/twgl.js | src/v3.js | cross | function cross(a, b, dst) {
dst = dst || new VecType(3);
const t1 = a[2] * b[0] - a[0] * b[2];
const t2 = a[0] * b[1] - a[1] * b[0];
dst[0] = a[1] * b[2] - a[2] * b[1];
dst[1] = t1;
dst[2] = t2;
return dst;
} | javascript | function cross(a, b, dst) {
dst = dst || new VecType(3);
const t1 = a[2] * b[0] - a[0] * b[2];
const t2 = a[0] * b[1] - a[1] * b[0];
dst[0] = a[1] * b[2] - a[2] * b[1];
dst[1] = t1;
dst[2] = t2;
return dst;
} | [
"function",
"cross",
"(",
"a",
",",
"b",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"const",
"t1",
"=",
"a",
"[",
"2",
"]",
"*",
"b",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
"*",
"b",
"[",
"2",
... | Computes the cross product of two vectors; assumes both vectors have
three entries.
@param {module:twgl/v3.Vec3} a Operand vector.
@param {module:twgl/v3.Vec3} b Operand vector.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} The vector a cross b.
@mem... | [
"Computes",
"the",
"cross",
"product",
"of",
"two",
"vectors",
";",
"assumes",
"both",
"vectors",
"have",
"three",
"entries",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L251-L261 |
8,841 | greggman/twgl.js | src/v3.js | normalize | function normalize(a, dst) {
dst = dst || new VecType(3);
const lenSq = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
const len = Math.sqrt(lenSq);
if (len > 0.00001) {
dst[0] = a[0] / len;
dst[1] = a[1] / len;
dst[2] = a[2] / len;
} else {
dst[0] = 0;
dst[1] = 0;
dst[2] = 0;
}
return... | javascript | function normalize(a, dst) {
dst = dst || new VecType(3);
const lenSq = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
const len = Math.sqrt(lenSq);
if (len > 0.00001) {
dst[0] = a[0] / len;
dst[1] = a[1] / len;
dst[2] = a[2] / len;
} else {
dst[0] = 0;
dst[1] = 0;
dst[2] = 0;
}
return... | [
"function",
"normalize",
"(",
"a",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"const",
"lenSq",
"=",
"a",
"[",
"0",
"]",
"*",
"a",
"[",
"0",
"]",
"+",
"a",
"[",
"1",
"]",
"*",
"a",
"[",
"1",
"]",
... | Divides a vector by its Euclidean length and returns the quotient.
@param {module:twgl/v3.Vec3} a The vector.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} The normalized vector.
@memberOf module:twgl/v3 | [
"Divides",
"a",
"vector",
"by",
"its",
"Euclidean",
"length",
"and",
"returns",
"the",
"quotient",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L330-L346 |
8,842 | greggman/twgl.js | src/v3.js | negate | function negate(v, dst) {
dst = dst || new VecType(3);
dst[0] = -v[0];
dst[1] = -v[1];
dst[2] = -v[2];
return dst;
} | javascript | function negate(v, dst) {
dst = dst || new VecType(3);
dst[0] = -v[0];
dst[1] = -v[1];
dst[2] = -v[2];
return dst;
} | [
"function",
"negate",
"(",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"-",
"v",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"-",
"v",
"[",
"1",
"]",
";",
"dst"... | Negates a vector.
@param {module:twgl/v3.Vec3} v The vector.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} -v.
@memberOf module:twgl/v3 | [
"Negates",
"a",
"vector",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L355-L363 |
8,843 | greggman/twgl.js | src/v3.js | copy | function copy(v, dst) {
dst = dst || new VecType(3);
dst[0] = v[0];
dst[1] = v[1];
dst[2] = v[2];
return dst;
} | javascript | function copy(v, dst) {
dst = dst || new VecType(3);
dst[0] = v[0];
dst[1] = v[1];
dst[2] = v[2];
return dst;
} | [
"function",
"copy",
"(",
"v",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"new",
"VecType",
"(",
"3",
")",
";",
"dst",
"[",
"0",
"]",
"=",
"v",
"[",
"0",
"]",
";",
"dst",
"[",
"1",
"]",
"=",
"v",
"[",
"1",
"]",
";",
"dst",
"[",
"2",
... | Copies a vector.
@param {module:twgl/v3.Vec3} v The vector.
@param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created..
@return {module:twgl/v3.Vec3} A copy of v.
@memberOf module:twgl/v3 | [
"Copies",
"a",
"vector",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L372-L380 |
8,844 | greggman/twgl.js | src/primitives.js | deindexVertices | function deindexVertices(vertices) {
const indices = vertices.indices;
const newVertices = {};
const numElements = indices.length;
function expandToUnindexed(channel) {
const srcBuffer = vertices[channel];
const numComponents = srcBuffer.numComponents;
const dstBuffer = createAugmentedTypedArray(nu... | javascript | function deindexVertices(vertices) {
const indices = vertices.indices;
const newVertices = {};
const numElements = indices.length;
function expandToUnindexed(channel) {
const srcBuffer = vertices[channel];
const numComponents = srcBuffer.numComponents;
const dstBuffer = createAugmentedTypedArray(nu... | [
"function",
"deindexVertices",
"(",
"vertices",
")",
"{",
"const",
"indices",
"=",
"vertices",
".",
"indices",
";",
"const",
"newVertices",
"=",
"{",
"}",
";",
"const",
"numElements",
"=",
"indices",
".",
"length",
";",
"function",
"expandToUnindexed",
"(",
... | Given indexed vertices creates a new set of vertices unindexed by expanding the indexed vertices.
@param {Object.<string, TypedArray>} vertices The indexed vertices to deindex
@return {Object.<string, TypedArray>} The deindexed vertices
@memberOf module:twgl/primitives | [
"Given",
"indexed",
"vertices",
"creates",
"a",
"new",
"set",
"of",
"vertices",
"unindexed",
"by",
"expanding",
"the",
"indexed",
"vertices",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L139-L161 |
8,845 | greggman/twgl.js | src/primitives.js | flattenNormals | function flattenNormals(vertices) {
if (vertices.indices) {
throw "can't flatten normals of indexed vertices. deindex them first";
}
const normals = vertices.normal;
const numNormals = normals.length;
for (let ii = 0; ii < numNormals; ii += 9) {
// pull out the 3 normals for this triangle
const n... | javascript | function flattenNormals(vertices) {
if (vertices.indices) {
throw "can't flatten normals of indexed vertices. deindex them first";
}
const normals = vertices.normal;
const numNormals = normals.length;
for (let ii = 0; ii < numNormals; ii += 9) {
// pull out the 3 normals for this triangle
const n... | [
"function",
"flattenNormals",
"(",
"vertices",
")",
"{",
"if",
"(",
"vertices",
".",
"indices",
")",
"{",
"throw",
"\"can't flatten normals of indexed vertices. deindex them first\"",
";",
"}",
"const",
"normals",
"=",
"vertices",
".",
"normal",
";",
"const",
"numNo... | flattens the normals of deindexed vertices in place.
@param {Object.<string, TypedArray>} vertices The deindexed vertices who's normals to flatten
@return {Object.<string, TypedArray>} The flattened vertices (same as was passed in)
@memberOf module:twgl/primitives | [
"flattens",
"the",
"normals",
"of",
"deindexed",
"vertices",
"in",
"place",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L169-L217 |
8,846 | greggman/twgl.js | src/primitives.js | reorientNormals | function reorientNormals(array, matrix) {
applyFuncToV3Array(array, m4.inverse(matrix), transformNormal);
return array;
} | javascript | function reorientNormals(array, matrix) {
applyFuncToV3Array(array, m4.inverse(matrix), transformNormal);
return array;
} | [
"function",
"reorientNormals",
"(",
"array",
",",
"matrix",
")",
"{",
"applyFuncToV3Array",
"(",
"array",
",",
"m4",
".",
"inverse",
"(",
"matrix",
")",
",",
"transformNormal",
")",
";",
"return",
"array",
";",
"}"
] | Reorients normals by the inverse-transpose of the given
matrix..
@param {(number[]|TypedArray)} array The array. Assumes value floats per element.
@param {module:twgl/m4.Mat4} matrix A matrix to multiply by.
@return {(number[]|TypedArray)} the same array that was passed in
@memberOf module:twgl/primitives | [
"Reorients",
"normals",
"by",
"the",
"inverse",
"-",
"transpose",
"of",
"the",
"given",
"matrix",
".."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L263-L266 |
8,847 | greggman/twgl.js | src/primitives.js | createXYQuadVertices | function createXYQuadVertices(size, xOffset, yOffset) {
size = size || 2;
xOffset = xOffset || 0;
yOffset = yOffset || 0;
size *= 0.5;
return {
position: {
numComponents: 2,
data: [
xOffset + -1 * size, yOffset + -1 * size,
xOffset + 1 * size, yOffset + -1 * size,
xOff... | javascript | function createXYQuadVertices(size, xOffset, yOffset) {
size = size || 2;
xOffset = xOffset || 0;
yOffset = yOffset || 0;
size *= 0.5;
return {
position: {
numComponents: 2,
data: [
xOffset + -1 * size, yOffset + -1 * size,
xOffset + 1 * size, yOffset + -1 * size,
xOff... | [
"function",
"createXYQuadVertices",
"(",
"size",
",",
"xOffset",
",",
"yOffset",
")",
"{",
"size",
"=",
"size",
"||",
"2",
";",
"xOffset",
"=",
"xOffset",
"||",
"0",
";",
"yOffset",
"=",
"yOffset",
"||",
"0",
";",
"size",
"*=",
"0.5",
";",
"return",
... | Creates XY quad Buffers
The default with no parameters will return a 2x2 quad with values from -1 to +1.
If you want a unit quad with that goes from 0 to 1 you'd call it with
twgl.primitives.createXYQuadBufferInfo(gl, 1, 0.5, 0.5);
If you want a unit quad centered above 0,0 you'd call it with
twgl.primitives.create... | [
"Creates",
"XY",
"quad",
"Buffers"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L369-L398 |
8,848 | greggman/twgl.js | src/primitives.js | createPlaneVertices | function createPlaneVertices(
width,
depth,
subdivisionsWidth,
subdivisionsDepth,
matrix) {
width = width || 1;
depth = depth || 1;
subdivisionsWidth = subdivisionsWidth || 1;
subdivisionsDepth = subdivisionsDepth || 1;
matrix = matrix || m4.identity();
const numVertices = (subdivisions... | javascript | function createPlaneVertices(
width,
depth,
subdivisionsWidth,
subdivisionsDepth,
matrix) {
width = width || 1;
depth = depth || 1;
subdivisionsWidth = subdivisionsWidth || 1;
subdivisionsDepth = subdivisionsDepth || 1;
matrix = matrix || m4.identity();
const numVertices = (subdivisions... | [
"function",
"createPlaneVertices",
"(",
"width",
",",
"depth",
",",
"subdivisionsWidth",
",",
"subdivisionsDepth",
",",
"matrix",
")",
"{",
"width",
"=",
"width",
"||",
"1",
";",
"depth",
"=",
"depth",
"||",
"1",
";",
"subdivisionsWidth",
"=",
"subdivisionsWid... | Creates XZ plane buffers.
The created plane has position, normal, and texcoord data
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} [width] Width of the plane. Default = 1
@param {number} [depth] Depth of the plane. Default = 1
@param {number} [subdivisionsWidth] Number of steps across th... | [
"Creates",
"XZ",
"plane",
"buffers",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L445-L502 |
8,849 | greggman/twgl.js | src/primitives.js | createSphereVertices | function createSphereVertices(
radius,
subdivisionsAxis,
subdivisionsHeight,
opt_startLatitudeInRadians,
opt_endLatitudeInRadians,
opt_startLongitudeInRadians,
opt_endLongitudeInRadians) {
if (subdivisionsAxis <= 0 || subdivisionsHeight <= 0) {
throw Error('subdivisionAxis and subdivis... | javascript | function createSphereVertices(
radius,
subdivisionsAxis,
subdivisionsHeight,
opt_startLatitudeInRadians,
opt_endLatitudeInRadians,
opt_startLongitudeInRadians,
opt_endLongitudeInRadians) {
if (subdivisionsAxis <= 0 || subdivisionsHeight <= 0) {
throw Error('subdivisionAxis and subdivis... | [
"function",
"createSphereVertices",
"(",
"radius",
",",
"subdivisionsAxis",
",",
"subdivisionsHeight",
",",
"opt_startLatitudeInRadians",
",",
"opt_endLatitudeInRadians",
",",
"opt_startLongitudeInRadians",
",",
"opt_endLongitudeInRadians",
")",
"{",
"if",
"(",
"subdivisionsA... | Creates sphere buffers.
The created sphere has position, normal, and texcoord data
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} radius radius of the sphere.
@param {number} subdivisionsAxis number of steps around the sphere.
@param {number} subdivisionsHeight number of vertically on th... | [
"Creates",
"sphere",
"buffers",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L567-L640 |
8,850 | greggman/twgl.js | src/primitives.js | createCubeVertices | function createCubeVertices(size) {
size = size || 1;
const k = size / 2;
const cornerVertices = [
[-k, -k, -k],
[+k, -k, -k],
[-k, +k, -k],
[+k, +k, -k],
[-k, -k, +k],
[+k, -k, +k],
[-k, +k, +k],
[+k, +k, +k],
];
const faceNormals = [
[+1, +0, +0],
[-1, +0, +0],
... | javascript | function createCubeVertices(size) {
size = size || 1;
const k = size / 2;
const cornerVertices = [
[-k, -k, -k],
[+k, -k, -k],
[-k, +k, -k],
[+k, +k, -k],
[-k, -k, +k],
[+k, -k, +k],
[-k, +k, +k],
[+k, +k, +k],
];
const faceNormals = [
[+1, +0, +0],
[-1, +0, +0],
... | [
"function",
"createCubeVertices",
"(",
"size",
")",
"{",
"size",
"=",
"size",
"||",
"1",
";",
"const",
"k",
"=",
"size",
"/",
"2",
";",
"const",
"cornerVertices",
"=",
"[",
"[",
"-",
"k",
",",
"-",
"k",
",",
"-",
"k",
"]",
",",
"[",
"+",
"k",
... | Creates the buffers and indices for a cube.
The cube is created around the origin. (-size / 2, size / 2).
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} [size] width, height and depth of the cube.
@return {Object.<string, WebGLBuffer>} The created buffers.
@memberOf module:twgl/primitive... | [
"Creates",
"the",
"buffers",
"and",
"indices",
"for",
"a",
"cube",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L689-L752 |
8,851 | greggman/twgl.js | src/primitives.js | expandRLEData | function expandRLEData(rleData, padding) {
padding = padding || [];
const data = [];
for (let ii = 0; ii < rleData.length; ii += 4) {
const runLength = rleData[ii];
const element = rleData.slice(ii + 1, ii + 4);
element.push.apply(element, padding);
for (let jj = 0; jj < runLength; ++jj) {
d... | javascript | function expandRLEData(rleData, padding) {
padding = padding || [];
const data = [];
for (let ii = 0; ii < rleData.length; ii += 4) {
const runLength = rleData[ii];
const element = rleData.slice(ii + 1, ii + 4);
element.push.apply(element, padding);
for (let jj = 0; jj < runLength; ++jj) {
d... | [
"function",
"expandRLEData",
"(",
"rleData",
",",
"padding",
")",
"{",
"padding",
"=",
"padding",
"||",
"[",
"]",
";",
"const",
"data",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"ii",
"=",
"0",
";",
"ii",
"<",
"rleData",
".",
"length",
";",
"ii",
"+... | Expands RLE data
@param {number[]} rleData data in format of run-length, x, y, z, run-length, x, y, z
@param {number[]} [padding] value to add each entry with.
@return {number[]} the expanded rleData
@private | [
"Expands",
"RLE",
"data"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L913-L925 |
8,852 | greggman/twgl.js | src/primitives.js | createCylinderVertices | function createCylinderVertices(
radius,
height,
radialSubdivisions,
verticalSubdivisions,
topCap,
bottomCap) {
return createTruncatedConeVertices(
radius,
radius,
height,
radialSubdivisions,
verticalSubdivisions,
topCap,
bottomCap);
} | javascript | function createCylinderVertices(
radius,
height,
radialSubdivisions,
verticalSubdivisions,
topCap,
bottomCap) {
return createTruncatedConeVertices(
radius,
radius,
height,
radialSubdivisions,
verticalSubdivisions,
topCap,
bottomCap);
} | [
"function",
"createCylinderVertices",
"(",
"radius",
",",
"height",
",",
"radialSubdivisions",
",",
"verticalSubdivisions",
",",
"topCap",
",",
"bottomCap",
")",
"{",
"return",
"createTruncatedConeVertices",
"(",
"radius",
",",
"radius",
",",
"height",
",",
"radialS... | Creates cylinder buffers. The cylinder will be created around the origin
along the y-axis.
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} radius Radius of cylinder.
@param {number} height Height of cylinder.
@param {number} radialSubdivisions The number of subdivisions around the cylinder... | [
"Creates",
"cylinder",
"buffers",
".",
"The",
"cylinder",
"will",
"be",
"created",
"around",
"the",
"origin",
"along",
"the",
"y",
"-",
"axis",
"."
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1507-L1522 |
8,853 | greggman/twgl.js | src/primitives.js | createTorusVertices | function createTorusVertices(
radius,
thickness,
radialSubdivisions,
bodySubdivisions,
startAngle,
endAngle) {
if (radialSubdivisions < 3) {
throw Error('radialSubdivisions must be 3 or greater');
}
if (bodySubdivisions < 3) {
throw Error('verticalSubdivisions must be 3 or greater... | javascript | function createTorusVertices(
radius,
thickness,
radialSubdivisions,
bodySubdivisions,
startAngle,
endAngle) {
if (radialSubdivisions < 3) {
throw Error('radialSubdivisions must be 3 or greater');
}
if (bodySubdivisions < 3) {
throw Error('verticalSubdivisions must be 3 or greater... | [
"function",
"createTorusVertices",
"(",
"radius",
",",
"thickness",
",",
"radialSubdivisions",
",",
"bodySubdivisions",
",",
"startAngle",
",",
"endAngle",
")",
"{",
"if",
"(",
"radialSubdivisions",
"<",
"3",
")",
"{",
"throw",
"Error",
"(",
"'radialSubdivisions m... | Creates buffers for a torus
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} radius radius of center of torus circle.
@param {number} thickness radius of torus ring.
@param {number} radialSubdivisions The number of subdivisions around the torus.
@param {number} bodySubdivisions The number o... | [
"Creates",
"buffers",
"for",
"a",
"torus"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1566-L1634 |
8,854 | greggman/twgl.js | src/primitives.js | createDiscVertices | function createDiscVertices(
radius,
divisions,
stacks,
innerRadius,
stackPower) {
if (divisions < 3) {
throw Error('divisions must be at least 3');
}
stacks = stacks ? stacks : 1;
stackPower = stackPower ? stackPower : 1;
innerRadius = innerRadius ? innerRadius : 0;
// Note: We do... | javascript | function createDiscVertices(
radius,
divisions,
stacks,
innerRadius,
stackPower) {
if (divisions < 3) {
throw Error('divisions must be at least 3');
}
stacks = stacks ? stacks : 1;
stackPower = stackPower ? stackPower : 1;
innerRadius = innerRadius ? innerRadius : 0;
// Note: We do... | [
"function",
"createDiscVertices",
"(",
"radius",
",",
"divisions",
",",
"stacks",
",",
"innerRadius",
",",
"stackPower",
")",
"{",
"if",
"(",
"divisions",
"<",
"3",
")",
"{",
"throw",
"Error",
"(",
"'divisions must be at least 3'",
")",
";",
"}",
"stacks",
"... | Creates disc buffers. The disc will be in the xz plane, centered at
the origin. When creating, at least 3 divisions, or pie
pieces, need to be specified, otherwise the triangles making
up the disc will be degenerate. You can also specify the
number of radial pieces `stacks`. A value of 1 for
stacks will give you a simp... | [
"Creates",
"disc",
"buffers",
".",
"The",
"disc",
"will",
"be",
"in",
"the",
"xz",
"plane",
"centered",
"at",
"the",
"origin",
".",
"When",
"creating",
"at",
"least",
"3",
"divisions",
"or",
"pie",
"pieces",
"need",
"to",
"be",
"specified",
"otherwise",
... | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1718-L1781 |
8,855 | greggman/twgl.js | src/primitives.js | createBufferFunc | function createBufferFunc(fn) {
return function(gl) {
const arrays = fn.apply(this, Array.prototype.slice.call(arguments, 1));
return attributes.createBuffersFromArrays(gl, arrays);
};
} | javascript | function createBufferFunc(fn) {
return function(gl) {
const arrays = fn.apply(this, Array.prototype.slice.call(arguments, 1));
return attributes.createBuffersFromArrays(gl, arrays);
};
} | [
"function",
"createBufferFunc",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
"gl",
")",
"{",
"const",
"arrays",
"=",
"fn",
".",
"apply",
"(",
"this",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
")",
... | creates a function that calls fn to create vertices and then
creates a buffers for them
@private | [
"creates",
"a",
"function",
"that",
"calls",
"fn",
"to",
"create",
"vertices",
"and",
"then",
"creates",
"a",
"buffers",
"for",
"them"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1851-L1856 |
8,856 | greggman/twgl.js | src/primitives.js | createBufferInfoFunc | function createBufferInfoFunc(fn) {
return function(gl) {
const arrays = fn.apply(null, Array.prototype.slice.call(arguments, 1));
return attributes.createBufferInfoFromArrays(gl, arrays);
};
} | javascript | function createBufferInfoFunc(fn) {
return function(gl) {
const arrays = fn.apply(null, Array.prototype.slice.call(arguments, 1));
return attributes.createBufferInfoFromArrays(gl, arrays);
};
} | [
"function",
"createBufferInfoFunc",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
"gl",
")",
"{",
"const",
"arrays",
"=",
"fn",
".",
"apply",
"(",
"null",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
"... | creates a function that calls fn to create vertices and then
creates a bufferInfo object for them
@private | [
"creates",
"a",
"function",
"that",
"calls",
"fn",
"to",
"create",
"vertices",
"and",
"then",
"creates",
"a",
"bufferInfo",
"object",
"for",
"them"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1863-L1868 |
8,857 | greggman/twgl.js | src/primitives.js | copyElements | function copyElements(src, dst, dstNdx, offset) {
offset = offset || 0;
const length = src.length;
for (let ii = 0; ii < length; ++ii) {
dst[dstNdx + ii] = src[ii] + offset;
}
} | javascript | function copyElements(src, dst, dstNdx, offset) {
offset = offset || 0;
const length = src.length;
for (let ii = 0; ii < length; ++ii) {
dst[dstNdx + ii] = src[ii] + offset;
}
} | [
"function",
"copyElements",
"(",
"src",
",",
"dst",
",",
"dstNdx",
",",
"offset",
")",
"{",
"offset",
"=",
"offset",
"||",
"0",
";",
"const",
"length",
"=",
"src",
".",
"length",
";",
"for",
"(",
"let",
"ii",
"=",
"0",
";",
"ii",
"<",
"length",
"... | Copy elements from one array to another
@param {Array|TypedArray} src source array
@param {Array|TypedArray} dst dest array
@param {number} dstNdx index in dest to copy src
@param {number} [offset] offset to add to copied values
@private | [
"Copy",
"elements",
"from",
"one",
"array",
"to",
"another"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1891-L1897 |
8,858 | greggman/twgl.js | src/primitives.js | createArrayOfSameType | function createArrayOfSameType(srcArray, length) {
const arraySrc = getArray(srcArray);
const newArray = new arraySrc.constructor(length);
let newArraySpec = newArray;
// If it appears to have been augmented make new one augemented
if (arraySrc.numComponents && arraySrc.numElements) {
augmentTypedArray(ne... | javascript | function createArrayOfSameType(srcArray, length) {
const arraySrc = getArray(srcArray);
const newArray = new arraySrc.constructor(length);
let newArraySpec = newArray;
// If it appears to have been augmented make new one augemented
if (arraySrc.numComponents && arraySrc.numElements) {
augmentTypedArray(ne... | [
"function",
"createArrayOfSameType",
"(",
"srcArray",
",",
"length",
")",
"{",
"const",
"arraySrc",
"=",
"getArray",
"(",
"srcArray",
")",
";",
"const",
"newArray",
"=",
"new",
"arraySrc",
".",
"constructor",
"(",
"length",
")",
";",
"let",
"newArraySpec",
"... | Creates an array of the same time
@param {(number[]|ArrayBufferView|module:twgl.FullArraySpec)} srcArray array who's type to copy
@param {number} length size of new array
@return {(number[]|ArrayBufferView|module:twgl.FullArraySpec)} array with same type as srcArray
@private | [
"Creates",
"an",
"array",
"of",
"the",
"same",
"time"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1907-L1923 |
8,859 | greggman/twgl.js | src/primitives.js | concatVertices | function concatVertices(arrayOfArrays) {
const names = {};
let baseName;
// get names of all arrays.
// and numElements for each set of vertices
for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
const arrays = arrayOfArrays[ii];
Object.keys(arrays).forEach(function(name) { // eslint-disable-line
... | javascript | function concatVertices(arrayOfArrays) {
const names = {};
let baseName;
// get names of all arrays.
// and numElements for each set of vertices
for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
const arrays = arrayOfArrays[ii];
Object.keys(arrays).forEach(function(name) { // eslint-disable-line
... | [
"function",
"concatVertices",
"(",
"arrayOfArrays",
")",
"{",
"const",
"names",
"=",
"{",
"}",
";",
"let",
"baseName",
";",
"// get names of all arrays.",
"// and numElements for each set of vertices",
"for",
"(",
"let",
"ii",
"=",
"0",
";",
"ii",
"<",
"arrayOfArr... | Concatinates sets of vertices
Assumes the vertices match in composition. For example
if one set of vertices has positions, normals, and indices
all sets of vertices must have positions, normals, and indices
and of the same type.
Example:
const cubeVertices = twgl.primtiives.createCubeVertices(2);
const sphereVertice... | [
"Concatinates",
"sets",
"of",
"vertices"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1950-L2019 |
8,860 | greggman/twgl.js | src/primitives.js | getLengthOfCombinedArrays | function getLengthOfCombinedArrays(name) {
let length = 0;
let arraySpec;
for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
const arrays = arrayOfArrays[ii];
const arrayInfo = arrays[name];
const array = getArray(arrayInfo);
length += array.length;
if (!arraySpec || arrayInfo... | javascript | function getLengthOfCombinedArrays(name) {
let length = 0;
let arraySpec;
for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
const arrays = arrayOfArrays[ii];
const arrayInfo = arrays[name];
const array = getArray(arrayInfo);
length += array.length;
if (!arraySpec || arrayInfo... | [
"function",
"getLengthOfCombinedArrays",
"(",
"name",
")",
"{",
"let",
"length",
"=",
"0",
";",
"let",
"arraySpec",
";",
"for",
"(",
"let",
"ii",
"=",
"0",
";",
"ii",
"<",
"arrayOfArrays",
".",
"length",
";",
"++",
"ii",
")",
"{",
"const",
"arrays",
... | compute length of combined array and return one for reference | [
"compute",
"length",
"of",
"combined",
"array",
"and",
"return",
"one",
"for",
"reference"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1974-L1990 |
8,861 | greggman/twgl.js | src/primitives.js | duplicateVertices | function duplicateVertices(arrays) {
const newArrays = {};
Object.keys(arrays).forEach(function(name) {
const arraySpec = arrays[name];
const srcArray = getArray(arraySpec);
const newArraySpec = createArrayOfSameType(arraySpec, srcArray.length);
copyElements(srcArray, getArray(newArraySpec), 0);
... | javascript | function duplicateVertices(arrays) {
const newArrays = {};
Object.keys(arrays).forEach(function(name) {
const arraySpec = arrays[name];
const srcArray = getArray(arraySpec);
const newArraySpec = createArrayOfSameType(arraySpec, srcArray.length);
copyElements(srcArray, getArray(newArraySpec), 0);
... | [
"function",
"duplicateVertices",
"(",
"arrays",
")",
"{",
"const",
"newArrays",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"arrays",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
")",
"{",
"const",
"arraySpec",
"=",
"arrays",
"[",
"name",
"]"... | Creates a duplicate set of vertices
This is useful for calling reorientVertices when you
also want to keep the original available
@param {module:twgl.Arrays} arrays of vertices
@return {module:twgl.Arrays} The dupilicated vertices.
@memberOf module:twgl/primitives | [
"Creates",
"a",
"duplicate",
"set",
"of",
"vertices"
] | ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L2031-L2041 |
8,862 | isomorphic-git/isomorphic-git | src/models/PGP.js | printKey | function printKey () {
let keyid = printKeyid(this.primaryKey.getKeyId())
let userid = printUser(this.getPrimaryUser().user)
return keyid + ' ' + userid
} | javascript | function printKey () {
let keyid = printKeyid(this.primaryKey.getKeyId())
let userid = printUser(this.getPrimaryUser().user)
return keyid + ' ' + userid
} | [
"function",
"printKey",
"(",
")",
"{",
"let",
"keyid",
"=",
"printKeyid",
"(",
"this",
".",
"primaryKey",
".",
"getKeyId",
"(",
")",
")",
"let",
"userid",
"=",
"printUser",
"(",
"this",
".",
"getPrimaryUser",
"(",
")",
".",
"user",
")",
"return",
"keyi... | Print a key | [
"Print",
"a",
"key"
] | fc29aba74ea55c798abb0274e0a032c6af90cb58 | https://github.com/isomorphic-git/isomorphic-git/blob/fc29aba74ea55c798abb0274e0a032c6af90cb58/src/models/PGP.js#L10-L14 |
8,863 | isomorphic-git/isomorphic-git | src/models/GitPackIndex.js | otherVarIntDecode | function otherVarIntDecode (reader, startWith) {
let result = startWith
let shift = 4
let byte = null
do {
byte = reader.readUInt8()
result |= (byte & 0b01111111) << shift
shift += 7
} while (byte & 0b10000000)
return result
} | javascript | function otherVarIntDecode (reader, startWith) {
let result = startWith
let shift = 4
let byte = null
do {
byte = reader.readUInt8()
result |= (byte & 0b01111111) << shift
shift += 7
} while (byte & 0b10000000)
return result
} | [
"function",
"otherVarIntDecode",
"(",
"reader",
",",
"startWith",
")",
"{",
"let",
"result",
"=",
"startWith",
"let",
"shift",
"=",
"4",
"let",
"byte",
"=",
"null",
"do",
"{",
"byte",
"=",
"reader",
".",
"readUInt8",
"(",
")",
"result",
"|=",
"(",
"byt... | I'm pretty much copying this one from the git C source code, because it makes no sense. | [
"I",
"m",
"pretty",
"much",
"copying",
"this",
"one",
"from",
"the",
"git",
"C",
"source",
"code",
"because",
"it",
"makes",
"no",
"sense",
"."
] | fc29aba74ea55c798abb0274e0a032c6af90cb58 | https://github.com/isomorphic-git/isomorphic-git/blob/fc29aba74ea55c798abb0274e0a032c6af90cb58/src/models/GitPackIndex.js#L35-L45 |
8,864 | isomorphic-git/isomorphic-git | src/models/GitIndex.js | parseCacheEntryFlags | function parseCacheEntryFlags (bits) {
return {
assumeValid: Boolean(bits & 0b1000000000000000),
extended: Boolean(bits & 0b0100000000000000),
stage: (bits & 0b0011000000000000) >> 12,
nameLength: bits & 0b0000111111111111
}
} | javascript | function parseCacheEntryFlags (bits) {
return {
assumeValid: Boolean(bits & 0b1000000000000000),
extended: Boolean(bits & 0b0100000000000000),
stage: (bits & 0b0011000000000000) >> 12,
nameLength: bits & 0b0000111111111111
}
} | [
"function",
"parseCacheEntryFlags",
"(",
"bits",
")",
"{",
"return",
"{",
"assumeValid",
":",
"Boolean",
"(",
"bits",
"&",
"0b1000000000000000",
")",
",",
"extended",
":",
"Boolean",
"(",
"bits",
"&",
"0b0100000000000000",
")",
",",
"stage",
":",
"(",
"bits"... | Extract 1-bit assume-valid, 1-bit extended flag, 2-bit merge state flag, 12-bit path length flag | [
"Extract",
"1",
"-",
"bit",
"assume",
"-",
"valid",
"1",
"-",
"bit",
"extended",
"flag",
"2",
"-",
"bit",
"merge",
"state",
"flag",
"12",
"-",
"bit",
"path",
"length",
"flag"
] | fc29aba74ea55c798abb0274e0a032c6af90cb58 | https://github.com/isomorphic-git/isomorphic-git/blob/fc29aba74ea55c798abb0274e0a032c6af90cb58/src/models/GitIndex.js#L9-L16 |
8,865 | jsonresume/resume-cli | lib/init.js | fillInit | function fillInit() {
console.log('\nThis utility will generate a resume.json file in your current working directory.');
console.log('Fill out your name and email to get started, or leave the fields blank.');
console.log('All fields are optional.\n');
console.log('Press ^C at any time to quit.');
r... | javascript | function fillInit() {
console.log('\nThis utility will generate a resume.json file in your current working directory.');
console.log('Fill out your name and email to get started, or leave the fields blank.');
console.log('All fields are optional.\n');
console.log('Press ^C at any time to quit.');
r... | [
"function",
"fillInit",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'\\nThis utility will generate a resume.json file in your current working directory.'",
")",
";",
"console",
".",
"log",
"(",
"'Fill out your name and email to get started, or leave the fields blank.'",
")",
";",... | slowly replace colors with chalk | [
"slowly",
"replace",
"colors",
"with",
"chalk"
] | 229aa718f054ed4166275d8c1352d11319ffcab2 | https://github.com/jsonresume/resume-cli/blob/229aa718f054ed4166275d8c1352d11319ffcab2/lib/init.js#L6-L46 |
8,866 | zadvorsky/three.bas | dist/bas.module.js | ToonAnimationMaterial | function ToonAnimationMaterial(parameters) {
if (!parameters.defines) {
parameters.defines = {};
}
parameters.defines['TOON'] = '';
PhongAnimationMaterial.call(this, parameters);
} | javascript | function ToonAnimationMaterial(parameters) {
if (!parameters.defines) {
parameters.defines = {};
}
parameters.defines['TOON'] = '';
PhongAnimationMaterial.call(this, parameters);
} | [
"function",
"ToonAnimationMaterial",
"(",
"parameters",
")",
"{",
"if",
"(",
"!",
"parameters",
".",
"defines",
")",
"{",
"parameters",
".",
"defines",
"=",
"{",
"}",
";",
"}",
"parameters",
".",
"defines",
"[",
"'TOON'",
"]",
"=",
"''",
";",
"PhongAnima... | Extends THREE.MeshToonMaterial with custom shader chunks. MeshToonMaterial is mostly the same as MeshPhongMaterial. The only difference is a TOON define, and support for a gradientMap uniform.
@param {Object} parameters Object containing material properties and custom shader chunks.
@constructor | [
"Extends",
"THREE",
".",
"MeshToonMaterial",
"with",
"custom",
"shader",
"chunks",
".",
"MeshToonMaterial",
"is",
"mostly",
"the",
"same",
"as",
"MeshPhongMaterial",
".",
"The",
"only",
"difference",
"is",
"a",
"TOON",
"define",
"and",
"support",
"for",
"a",
"... | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L363-L370 |
8,867 | zadvorsky/three.bas | dist/bas.module.js | MultiPrefabBufferGeometry | function MultiPrefabBufferGeometry(prefabs, repeatCount) {
BufferGeometry.call(this);
if (Array.isArray(prefabs)) {
this.prefabGeometries = prefabs;
} else {
this.prefabGeometries = [prefabs];
}
this.prefabGeometriesCount = this.prefabGeometries.length;
/**
* Number of prefabs.
* @type {Num... | javascript | function MultiPrefabBufferGeometry(prefabs, repeatCount) {
BufferGeometry.call(this);
if (Array.isArray(prefabs)) {
this.prefabGeometries = prefabs;
} else {
this.prefabGeometries = [prefabs];
}
this.prefabGeometriesCount = this.prefabGeometries.length;
/**
* Number of prefabs.
* @type {Num... | [
"function",
"MultiPrefabBufferGeometry",
"(",
"prefabs",
",",
"repeatCount",
")",
"{",
"BufferGeometry",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"prefabs",
")",
")",
"{",
"this",
".",
"prefabGeometries",
"=",
"prefabs",
... | A BufferGeometry where a 'prefab' geometry array is repeated a number of times.
@param {Array} prefabs An array with Geometry instances to repeat.
@param {Number} repeatCount The number of times to repeat the array of Geometries.
@constructor | [
"A",
"BufferGeometry",
"where",
"a",
"prefab",
"geometry",
"array",
"is",
"repeated",
"a",
"number",
"of",
"times",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L657-L696 |
8,868 | zadvorsky/three.bas | dist/bas.module.js | InstancedPrefabBufferGeometry | function InstancedPrefabBufferGeometry(prefab, count) {
if (prefab.isGeometry === true) {
console.error('InstancedPrefabBufferGeometry prefab must be a BufferGeometry.');
}
InstancedBufferGeometry.call(this);
this.prefabGeometry = prefab;
this.copy(prefab);
this.maxInstancedCount = count;
this.pref... | javascript | function InstancedPrefabBufferGeometry(prefab, count) {
if (prefab.isGeometry === true) {
console.error('InstancedPrefabBufferGeometry prefab must be a BufferGeometry.');
}
InstancedBufferGeometry.call(this);
this.prefabGeometry = prefab;
this.copy(prefab);
this.maxInstancedCount = count;
this.pref... | [
"function",
"InstancedPrefabBufferGeometry",
"(",
"prefab",
",",
"count",
")",
"{",
"if",
"(",
"prefab",
".",
"isGeometry",
"===",
"true",
")",
"{",
"console",
".",
"error",
"(",
"'InstancedPrefabBufferGeometry prefab must be a BufferGeometry.'",
")",
";",
"}",
"Ins... | A wrapper around THREE.InstancedBufferGeometry, which is more memory efficient than PrefabBufferGeometry, but requires the ANGLE_instanced_arrays extension.
@param {BufferGeometry} prefab The Geometry instance to repeat.
@param {Number} count The number of times to repeat the geometry.
@constructor | [
"A",
"wrapper",
"around",
"THREE",
".",
"InstancedBufferGeometry",
"which",
"is",
"more",
"memory",
"efficient",
"than",
"PrefabBufferGeometry",
"but",
"requires",
"the",
"ANGLE_instanced_arrays",
"extension",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L907-L919 |
8,869 | zadvorsky/three.bas | dist/bas.module.js | separateFaces | function separateFaces(geometry) {
var vertices = [];
for (var i = 0, il = geometry.faces.length; i < il; i++) {
var n = vertices.length;
var face = geometry.faces[i];
var a = face.a;
var b = face.b;
var c = face.c;
var va = geometry.vertices[a];
var vb = geometry.ve... | javascript | function separateFaces(geometry) {
var vertices = [];
for (var i = 0, il = geometry.faces.length; i < il; i++) {
var n = vertices.length;
var face = geometry.faces[i];
var a = face.a;
var b = face.b;
var c = face.c;
var va = geometry.vertices[a];
var vb = geometry.ve... | [
"function",
"separateFaces",
"(",
"geometry",
")",
"{",
"var",
"vertices",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"geometry",
".",
"faces",
".",
"length",
";",
"i",
"<",
"il",
";",
"i",
"++",
")",
"{",
"var",
"n",... | Duplicates vertices so each face becomes separate.
Same as THREE.ExplodeModifier.
@param {THREE.Geometry} geometry Geometry instance to modify. | [
"Duplicates",
"vertices",
"so",
"each",
"face",
"becomes",
"separate",
".",
"Same",
"as",
"THREE",
".",
"ExplodeModifier",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L979-L1004 |
8,870 | zadvorsky/three.bas | dist/bas.module.js | createDepthAnimationMaterial | function createDepthAnimationMaterial(sourceMaterial) {
return new DepthAnimationMaterial({
uniforms: sourceMaterial.uniforms,
defines: sourceMaterial.defines,
vertexFunctions: sourceMaterial.vertexFunctions,
vertexParameters: sourceMaterial.vertexParameters,
vertexInit: sourceMaterial... | javascript | function createDepthAnimationMaterial(sourceMaterial) {
return new DepthAnimationMaterial({
uniforms: sourceMaterial.uniforms,
defines: sourceMaterial.defines,
vertexFunctions: sourceMaterial.vertexFunctions,
vertexParameters: sourceMaterial.vertexParameters,
vertexInit: sourceMaterial... | [
"function",
"createDepthAnimationMaterial",
"(",
"sourceMaterial",
")",
"{",
"return",
"new",
"DepthAnimationMaterial",
"(",
"{",
"uniforms",
":",
"sourceMaterial",
".",
"uniforms",
",",
"defines",
":",
"sourceMaterial",
".",
"defines",
",",
"vertexFunctions",
":",
... | Create a THREE.BAS.DepthAnimationMaterial for shadows from a THREE.SpotLight or THREE.DirectionalLight by copying relevant shader chunks.
Uniform values must be manually synced between the source material and the depth material.
@see {@link http://three-bas-examples.surge.sh/examples/shadows/}
@param {THREE.BAS.BaseA... | [
"Create",
"a",
"THREE",
".",
"BAS",
".",
"DepthAnimationMaterial",
"for",
"shadows",
"from",
"a",
"THREE",
".",
"SpotLight",
"or",
"THREE",
".",
"DirectionalLight",
"by",
"copying",
"relevant",
"shader",
"chunks",
".",
"Uniform",
"values",
"must",
"be",
"manua... | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L1071-L1080 |
8,871 | zadvorsky/three.bas | dist/bas.module.js | createDistanceAnimationMaterial | function createDistanceAnimationMaterial(sourceMaterial) {
return new DistanceAnimationMaterial({
uniforms: sourceMaterial.uniforms,
defines: sourceMaterial.defines,
vertexFunctions: sourceMaterial.vertexFunctions,
vertexParameters: sourceMaterial.vertexParameters,
vertexInit: sourceMa... | javascript | function createDistanceAnimationMaterial(sourceMaterial) {
return new DistanceAnimationMaterial({
uniforms: sourceMaterial.uniforms,
defines: sourceMaterial.defines,
vertexFunctions: sourceMaterial.vertexFunctions,
vertexParameters: sourceMaterial.vertexParameters,
vertexInit: sourceMa... | [
"function",
"createDistanceAnimationMaterial",
"(",
"sourceMaterial",
")",
"{",
"return",
"new",
"DistanceAnimationMaterial",
"(",
"{",
"uniforms",
":",
"sourceMaterial",
".",
"uniforms",
",",
"defines",
":",
"sourceMaterial",
".",
"defines",
",",
"vertexFunctions",
"... | Create a THREE.BAS.DistanceAnimationMaterial for shadows from a THREE.PointLight by copying relevant shader chunks.
Uniform values must be manually synced between the source material and the distance material.
@see {@link http://three-bas-examples.surge.sh/examples/shadows/}
@param {THREE.BAS.BaseAnimationMaterial} s... | [
"Create",
"a",
"THREE",
".",
"BAS",
".",
"DistanceAnimationMaterial",
"for",
"shadows",
"from",
"a",
"THREE",
".",
"PointLight",
"by",
"copying",
"relevant",
"shader",
"chunks",
".",
"Uniform",
"values",
"must",
"be",
"manually",
"synced",
"between",
"the",
"s... | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L1091-L1100 |
8,872 | zadvorsky/three.bas | dist/bas.module.js | ModelBufferGeometry | function ModelBufferGeometry(model, options) {
BufferGeometry.call(this);
/**
* A reference to the geometry used to create this instance.
* @type {THREE.Geometry}
*/
this.modelGeometry = model;
/**
* Number of faces of the model.
* @type {Number}
*/
this.faceCount = this.modelGeometry.face... | javascript | function ModelBufferGeometry(model, options) {
BufferGeometry.call(this);
/**
* A reference to the geometry used to create this instance.
* @type {THREE.Geometry}
*/
this.modelGeometry = model;
/**
* Number of faces of the model.
* @type {Number}
*/
this.faceCount = this.modelGeometry.face... | [
"function",
"ModelBufferGeometry",
"(",
"model",
",",
"options",
")",
"{",
"BufferGeometry",
".",
"call",
"(",
"this",
")",
";",
"/**\n * A reference to the geometry used to create this instance.\n * @type {THREE.Geometry}\n */",
"this",
".",
"modelGeometry",
"=",
"mode... | A THREE.BufferGeometry for animating individual faces of a THREE.Geometry.
@param {THREE.Geometry} model The THREE.Geometry to base this geometry on.
@param {Object=} options
@param {Boolean=} options.computeCentroids If true, a centroids will be computed for each face and stored in THREE.BAS.ModelBufferGeometry.centr... | [
"A",
"THREE",
".",
"BufferGeometry",
"for",
"animating",
"individual",
"faces",
"of",
"a",
"THREE",
".",
"Geometry",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L1112-L1138 |
8,873 | zadvorsky/three.bas | examples/audio_visual/main.js | function (start, end) {
var total = 0;
start = start || 0;
end = end || this.binCount;
for (var i = start; i < end; i++) {
total += this.frequencyByteData[i];
}
return total / (end - start);
} | javascript | function (start, end) {
var total = 0;
start = start || 0;
end = end || this.binCount;
for (var i = start; i < end; i++) {
total += this.frequencyByteData[i];
}
return total / (end - start);
} | [
"function",
"(",
"start",
",",
"end",
")",
"{",
"var",
"total",
"=",
"0",
";",
"start",
"=",
"start",
"||",
"0",
";",
"end",
"=",
"end",
"||",
"this",
".",
"binCount",
";",
"for",
"(",
"var",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",... | not save if out of bounds | [
"not",
"save",
"if",
"out",
"of",
"bounds"
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/examples/audio_visual/main.js#L331-L342 | |
8,874 | zadvorsky/three.bas | examples/points_animation/main.js | getRandomPointOnSphere | function getRandomPointOnSphere(r) {
var u = THREE.Math.randFloat(0, 1);
var v = THREE.Math.randFloat(0, 1);
var theta = 2 * Math.PI * u;
var phi = Math.acos(2 * v - 1);
var x = r * Math.sin(theta) * Math.sin(phi);
var y = r * Math.cos(theta) * Math.sin(phi);
var z = r * Math.cos(phi);
return {
x,
... | javascript | function getRandomPointOnSphere(r) {
var u = THREE.Math.randFloat(0, 1);
var v = THREE.Math.randFloat(0, 1);
var theta = 2 * Math.PI * u;
var phi = Math.acos(2 * v - 1);
var x = r * Math.sin(theta) * Math.sin(phi);
var y = r * Math.cos(theta) * Math.sin(phi);
var z = r * Math.cos(phi);
return {
x,
... | [
"function",
"getRandomPointOnSphere",
"(",
"r",
")",
"{",
"var",
"u",
"=",
"THREE",
".",
"Math",
".",
"randFloat",
"(",
"0",
",",
"1",
")",
";",
"var",
"v",
"=",
"THREE",
".",
"Math",
".",
"randFloat",
"(",
"0",
",",
"1",
")",
";",
"var",
"theta"... | Get a random point on a sphere
@param {Float} r Shpere radius
@returns {Object} return the point's position | [
"Get",
"a",
"random",
"point",
"on",
"a",
"sphere"
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/examples/points_animation/main.js#L58-L71 |
8,875 | zadvorsky/three.bas | examples/points_animation/main.js | getPointsOnPicture | function getPointsOnPicture(selector) {
var img = document.querySelector(selector);
var width = img.width;
var height = img.height;
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
ctx.dr... | javascript | function getPointsOnPicture(selector) {
var img = document.querySelector(selector);
var width = img.width;
var height = img.height;
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
ctx.dr... | [
"function",
"getPointsOnPicture",
"(",
"selector",
")",
"{",
"var",
"img",
"=",
"document",
".",
"querySelector",
"(",
"selector",
")",
";",
"var",
"width",
"=",
"img",
".",
"width",
";",
"var",
"height",
"=",
"img",
".",
"height",
";",
"var",
"canvas",
... | Translate a picture to a set of points
@param {String} selector The DOM selector of image
@returns {Array} return the set of points | [
"Translate",
"a",
"picture",
"to",
"a",
"set",
"of",
"points"
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/examples/points_animation/main.js#L79-L117 |
8,876 | zadvorsky/three.bas | dist/bas.js | BasicAnimationMaterial | function BasicAnimationMaterial(parameters) {
this.varyingParameters = [];
this.vertexParameters = [];
this.vertexFunctions = [];
this.vertexInit = [];
this.vertexNormal = [];
this.vertexPosition = [];
this.vertexColor = [];
this.vertexPostMorph = [];
this.vertexPostSkinning = [];
this.fragmentFun... | javascript | function BasicAnimationMaterial(parameters) {
this.varyingParameters = [];
this.vertexParameters = [];
this.vertexFunctions = [];
this.vertexInit = [];
this.vertexNormal = [];
this.vertexPosition = [];
this.vertexColor = [];
this.vertexPostMorph = [];
this.vertexPostSkinning = [];
this.fragmentFun... | [
"function",
"BasicAnimationMaterial",
"(",
"parameters",
")",
"{",
"this",
".",
"varyingParameters",
"=",
"[",
"]",
";",
"this",
".",
"vertexParameters",
"=",
"[",
"]",
";",
"this",
".",
"vertexFunctions",
"=",
"[",
"]",
";",
"this",
".",
"vertexInit",
"="... | Extends THREE.MeshBasicMaterial with custom shader chunks.
@see http://three-bas-examples.surge.sh/examples/materials_basic/
@param {Object} parameters Object containing material properties and custom shader chunks.
@constructor | [
"Extends",
"THREE",
".",
"MeshBasicMaterial",
"with",
"custom",
"shader",
"chunks",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.js#L192-L215 |
8,877 | zadvorsky/three.bas | dist/bas.js | PointsAnimationMaterial | function PointsAnimationMaterial(parameters) {
this.varyingParameters = [];
this.vertexFunctions = [];
this.vertexParameters = [];
this.vertexInit = [];
this.vertexPosition = [];
this.vertexColor = [];
this.fragmentFunctions = [];
this.fragmentParameters = [];
this.fragmentInit = [];
this.fragment... | javascript | function PointsAnimationMaterial(parameters) {
this.varyingParameters = [];
this.vertexFunctions = [];
this.vertexParameters = [];
this.vertexInit = [];
this.vertexPosition = [];
this.vertexColor = [];
this.fragmentFunctions = [];
this.fragmentParameters = [];
this.fragmentInit = [];
this.fragment... | [
"function",
"PointsAnimationMaterial",
"(",
"parameters",
")",
"{",
"this",
".",
"varyingParameters",
"=",
"[",
"]",
";",
"this",
".",
"vertexFunctions",
"=",
"[",
"]",
";",
"this",
".",
"vertexParameters",
"=",
"[",
"]",
";",
"this",
".",
"vertexInit",
"=... | Extends THREE.PointsMaterial with custom shader chunks.
@param {Object} parameters Object containing material properties and custom shader chunks.
@constructor | [
"Extends",
"THREE",
".",
"PointsMaterial",
"with",
"custom",
"shader",
"chunks",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.js#L384-L405 |
8,878 | zadvorsky/three.bas | dist/bas.js | PrefabBufferGeometry | function PrefabBufferGeometry(prefab, count) {
three.BufferGeometry.call(this);
/**
* A reference to the prefab geometry used to create this instance.
* @type {Geometry|BufferGeometry}
*/
this.prefabGeometry = prefab;
this.isPrefabBufferGeometry = prefab.isBufferGeometry;
/**
* Number of prefabs... | javascript | function PrefabBufferGeometry(prefab, count) {
three.BufferGeometry.call(this);
/**
* A reference to the prefab geometry used to create this instance.
* @type {Geometry|BufferGeometry}
*/
this.prefabGeometry = prefab;
this.isPrefabBufferGeometry = prefab.isBufferGeometry;
/**
* Number of prefabs... | [
"function",
"PrefabBufferGeometry",
"(",
"prefab",
",",
"count",
")",
"{",
"three",
".",
"BufferGeometry",
".",
"call",
"(",
"this",
")",
";",
"/**\n * A reference to the prefab geometry used to create this instance.\n * @type {Geometry|BufferGeometry}\n */",
"this",
".",... | A BufferGeometry where a 'prefab' geometry is repeated a number of times.
@param {Geometry|BufferGeometry} prefab The Geometry instance to repeat.
@param {Number} count The number of times to repeat the geometry.
@constructor | [
"A",
"BufferGeometry",
"where",
"a",
"prefab",
"geometry",
"is",
"repeated",
"a",
"number",
"of",
"times",
"."
] | e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44 | https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.js#L474-L502 |
8,879 | OpenVidu/openvidu | openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js | RpcNotification | function RpcNotification(method, params)
{
if(defineProperty_IE8)
{
this.method = method
this.params = params
}
else
{
Object.defineProperty(this, 'method', {value: method, enumerable: true});
Object.defineProperty(this, 'params', {value: params, enumerable: true});
}
} | javascript | function RpcNotification(method, params)
{
if(defineProperty_IE8)
{
this.method = method
this.params = params
}
else
{
Object.defineProperty(this, 'method', {value: method, enumerable: true});
Object.defineProperty(this, 'params', {value: params, enumerable: true});
}
} | [
"function",
"RpcNotification",
"(",
"method",
",",
"params",
")",
"{",
"if",
"(",
"defineProperty_IE8",
")",
"{",
"this",
".",
"method",
"=",
"method",
"this",
".",
"params",
"=",
"params",
"}",
"else",
"{",
"Object",
".",
"defineProperty",
"(",
"this",
... | Representation of a RPC notification
@class
@constructor
@param {String} method -method of the notification
@param params - parameters of the notification | [
"Representation",
"of",
"a",
"RPC",
"notification"
] | 89db47dd37949ceab29e5228371a8fcab04d8d55 | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js#L132-L144 |
8,880 | OpenVidu/openvidu | openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js | storeResponse | function storeResponse(message, id, dest)
{
var response =
{
message: message,
/** Timeout to auto-clean old responses */
timeout: setTimeout(function()
{
responses.remove(id, dest);
},
response_timeout)
};
responses.set(response, id, dest);
} | javascript | function storeResponse(message, id, dest)
{
var response =
{
message: message,
/** Timeout to auto-clean old responses */
timeout: setTimeout(function()
{
responses.remove(id, dest);
},
response_timeout)
};
responses.set(response, id, dest);
} | [
"function",
"storeResponse",
"(",
"message",
",",
"id",
",",
"dest",
")",
"{",
"var",
"response",
"=",
"{",
"message",
":",
"message",
",",
"/** Timeout to auto-clean old responses */",
"timeout",
":",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"responses",
... | Store the response to prevent to process duplicate request later | [
"Store",
"the",
"response",
"to",
"prevent",
"to",
"process",
"duplicate",
"request",
"later"
] | 89db47dd37949ceab29e5228371a8fcab04d8d55 | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js#L289-L303 |
8,881 | OpenVidu/openvidu | openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js | storeProcessedResponse | function storeProcessedResponse(ack, from)
{
var timeout = setTimeout(function()
{
processedResponses.remove(ack, from);
},
duplicates_timeout);
processedResponses.set(timeout, ack, from);
} | javascript | function storeProcessedResponse(ack, from)
{
var timeout = setTimeout(function()
{
processedResponses.remove(ack, from);
},
duplicates_timeout);
processedResponses.set(timeout, ack, from);
} | [
"function",
"storeProcessedResponse",
"(",
"ack",
",",
"from",
")",
"{",
"var",
"timeout",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"processedResponses",
".",
"remove",
"(",
"ack",
",",
"from",
")",
";",
"}",
",",
"duplicates_timeout",
")",
";",
... | Store the response to ignore duplicated messages later | [
"Store",
"the",
"response",
"to",
"ignore",
"duplicated",
"messages",
"later"
] | 89db47dd37949ceab29e5228371a8fcab04d8d55 | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js#L308-L317 |
8,882 | midwayjs/midway | packages/midway-init/boilerplate/midway-ts-ant-design-pro-boilerplate/boilerplate/client/src/models/menu.js | formatter | function formatter(data, parentAuthority, parentName) {
if (!data) {
return undefined;
}
return data
.map(item => {
if (!item.name || !item.path) {
return null;
}
let locale = 'menu';
if (parentName && parentName !== '/') {
locale = `${parentName}.${item.name}`;
... | javascript | function formatter(data, parentAuthority, parentName) {
if (!data) {
return undefined;
}
return data
.map(item => {
if (!item.name || !item.path) {
return null;
}
let locale = 'menu';
if (parentName && parentName !== '/') {
locale = `${parentName}.${item.name}`;
... | [
"function",
"formatter",
"(",
"data",
",",
"parentAuthority",
",",
"parentName",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
"undefined",
";",
"}",
"return",
"data",
".",
"map",
"(",
"item",
"=>",
"{",
"if",
"(",
"!",
"item",
".",
"name",
... | Conversion router to menu. | [
"Conversion",
"router",
"to",
"menu",
"."
] | e7aeb80dedc31d25d8ac0fbe5a789062a7da5eb8 | https://github.com/midwayjs/midway/blob/e7aeb80dedc31d25d8ac0fbe5a789062a7da5eb8/packages/midway-init/boilerplate/midway-ts-ant-design-pro-boilerplate/boilerplate/client/src/models/menu.js#L5-L34 |
8,883 | geotiffjs/geotiff.js | src/compression/lzw.js | getByte | function getByte(array, position, length) {
const d = position % 8;
const a = Math.floor(position / 8);
const de = 8 - d;
const ef = (position + length) - ((a + 1) * 8);
let fg = (8 * (a + 2)) - (position + length);
const dg = ((a + 2) * 8) - position;
fg = Math.max(0, fg);
if (a >= array.length) {
... | javascript | function getByte(array, position, length) {
const d = position % 8;
const a = Math.floor(position / 8);
const de = 8 - d;
const ef = (position + length) - ((a + 1) * 8);
let fg = (8 * (a + 2)) - (position + length);
const dg = ((a + 2) * 8) - position;
fg = Math.max(0, fg);
if (a >= array.length) {
... | [
"function",
"getByte",
"(",
"array",
",",
"position",
",",
"length",
")",
"{",
"const",
"d",
"=",
"position",
"%",
"8",
";",
"const",
"a",
"=",
"Math",
".",
"floor",
"(",
"position",
"/",
"8",
")",
";",
"const",
"de",
"=",
"8",
"-",
"d",
";",
"... | end of information | [
"end",
"of",
"information"
] | b2ac9467b943836664f10730676adcd3cef5a544 | https://github.com/geotiffjs/geotiff.js/blob/b2ac9467b943836664f10730676adcd3cef5a544/src/compression/lzw.js#L8-L34 |
8,884 | easysoft/zui | dist/js/zui.js | function(element, options) {
var that = this;
that.name = NAME;
that.$ = $(element);
options = that.options = $.extend({}, Pager.DEFAULTS, this.$.data(), options);
var lang = options.lang || $.zui.clientLang();
that.lang = $.isPlainObject(lang) ? ($.extend(true, {}, ... | javascript | function(element, options) {
var that = this;
that.name = NAME;
that.$ = $(element);
options = that.options = $.extend({}, Pager.DEFAULTS, this.$.data(), options);
var lang = options.lang || $.zui.clientLang();
that.lang = $.isPlainObject(lang) ? ($.extend(true, {}, ... | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"var",
"that",
"=",
"this",
";",
"that",
".",
"name",
"=",
"NAME",
";",
"that",
".",
"$",
"=",
"$",
"(",
"element",
")",
";",
"options",
"=",
"that",
".",
"options",
"=",
"$",
".",
"extend",
... | The pager model class | [
"The",
"pager",
"model",
"class"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L434-L465 | |
8,885 | easysoft/zui | dist/js/zui.js | function () {
var ie = this.isIE() || this.isIE10() || false;
if (ie) {
for (var i = 10; i > 5; i--) {
if (this.isIE(i)) {
ie = i;
break;
}
}
}
this.ie = ie;
this.cssHelper();
} | javascript | function () {
var ie = this.isIE() || this.isIE10() || false;
if (ie) {
for (var i = 10; i > 5; i--) {
if (this.isIE(i)) {
ie = i;
break;
}
}
}
this.ie = ie;
this.cssHelper();
} | [
"function",
"(",
")",
"{",
"var",
"ie",
"=",
"this",
".",
"isIE",
"(",
")",
"||",
"this",
".",
"isIE10",
"(",
")",
"||",
"false",
";",
"if",
"(",
"ie",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"10",
";",
"i",
">",
"5",
";",
"i",
"--",
")",
... | The browser modal class | [
"The",
"browser",
"modal",
"class"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1207-L1221 | |
8,886 | easysoft/zui | dist/js/zui.js | function() {
// Since window has its own native 'resize' event, return false so that
// jQuery will bind the event using DOM methods. Since only 'window'
// objects have a .setTimeout method, this should be a sufficient test.
// Unless, of course, we're throttling the 're... | javascript | function() {
// Since window has its own native 'resize' event, return false so that
// jQuery will bind the event using DOM methods. Since only 'window'
// objects have a .setTimeout method, this should be a sufficient test.
// Unless, of course, we're throttling the 're... | [
"function",
"(",
")",
"{",
"// Since window has its own native 'resize' event, return false so that",
"// jQuery will bind the event using DOM methods. Since only 'window'",
"// objects have a .setTimeout method, this should be a sufficient test.",
"// Unless, of course, we're throttling the 'resize' ... | Called only when the first 'resize' event callback is bound per element. | [
"Called",
"only",
"when",
"the",
"first",
"resize",
"event",
"callback",
"is",
"bound",
"per",
"element",
"."
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1757-L1781 | |
8,887 | easysoft/zui | dist/js/zui.js | function() {
// Since window has its own native 'resize' event, return false so that
// jQuery will unbind the event using DOM methods. Since only 'window'
// objects have a .setTimeout method, this should be a sufficient test.
// Unless, of course, we're throttling the '... | javascript | function() {
// Since window has its own native 'resize' event, return false so that
// jQuery will unbind the event using DOM methods. Since only 'window'
// objects have a .setTimeout method, this should be a sufficient test.
// Unless, of course, we're throttling the '... | [
"function",
"(",
")",
"{",
"// Since window has its own native 'resize' event, return false so that",
"// jQuery will unbind the event using DOM methods. Since only 'window'",
"// objects have a .setTimeout method, this should be a sufficient test.",
"// Unless, of course, we're throttling the 'resize... | Called only when the last 'resize' event callback is unbound per element. | [
"Called",
"only",
"when",
"the",
"last",
"resize",
"event",
"callback",
"is",
"unbound",
"per",
"element",
"."
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1784-L1805 | |
8,888 | easysoft/zui | dist/js/zui.js | new_handler | function new_handler(e, w, h) {
var elem = $(this),
data = $.data(this, str_data) || {};
// If called from the polling loop, w and h will be passed in as
// arguments. If called manually, via .trigger( 'resize' ) or .resize(),
// those... | javascript | function new_handler(e, w, h) {
var elem = $(this),
data = $.data(this, str_data) || {};
// If called from the polling loop, w and h will be passed in as
// arguments. If called manually, via .trigger( 'resize' ) or .resize(),
// those... | [
"function",
"new_handler",
"(",
"e",
",",
"w",
",",
"h",
")",
"{",
"var",
"elem",
"=",
"$",
"(",
"this",
")",
",",
"data",
"=",
"$",
".",
"data",
"(",
"this",
",",
"str_data",
")",
"||",
"{",
"}",
";",
"// If called from the polling loop, w and h will ... | The new_handler function is executed every time the event is triggered. This is used to update the internal element data store with the width and height when the event is triggered manually, to avoid double-firing of the event callback. See the "Double firing issue in jQuery 1.3.2" comments above for more information. | [
"The",
"new_handler",
"function",
"is",
"executed",
"every",
"time",
"the",
"event",
"is",
"triggered",
".",
"This",
"is",
"used",
"to",
"update",
"the",
"internal",
"element",
"data",
"store",
"with",
"the",
"width",
"and",
"height",
"when",
"the",
"event",... | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1825-L1836 |
8,889 | easysoft/zui | dist/js/zui.js | function(modal, callback, redirect) {
var originModal = modal;
if($.isFunction(modal)) {
var oldModal = redirect;
redirect = callback;
callback = modal;
modal = oldModal;
}
modal = getModal(modal);
if(modal && modal.length) {
... | javascript | function(modal, callback, redirect) {
var originModal = modal;
if($.isFunction(modal)) {
var oldModal = redirect;
redirect = callback;
callback = modal;
modal = oldModal;
}
modal = getModal(modal);
if(modal && modal.length) {
... | [
"function",
"(",
"modal",
",",
"callback",
",",
"redirect",
")",
"{",
"var",
"originModal",
"=",
"modal",
";",
"if",
"(",
"$",
".",
"isFunction",
"(",
"modal",
")",
")",
"{",
"var",
"oldModal",
"=",
"redirect",
";",
"redirect",
"=",
"callback",
";",
... | callback, redirect, modal | [
"callback",
"redirect",
"modal"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L3779-L3798 | |
8,890 | easysoft/zui | dist/js/zui.js | function(element, options) {
var that = this;
that.name = NAME;
that.$ = $(element);
options = that.options = $.extend({trigger: 'contextmenu'}, ContextMenu.DEFAULTS, this.$.data(), options);
var trigger = options.trigger;
that.id = $.zui.uuid();
var eventHandl... | javascript | function(element, options) {
var that = this;
that.name = NAME;
that.$ = $(element);
options = that.options = $.extend({trigger: 'contextmenu'}, ContextMenu.DEFAULTS, this.$.data(), options);
var trigger = options.trigger;
that.id = $.zui.uuid();
var eventHandl... | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"var",
"that",
"=",
"this",
";",
"that",
".",
"name",
"=",
"NAME",
";",
"that",
".",
"$",
"=",
"$",
"(",
"element",
")",
";",
"options",
"=",
"that",
".",
"options",
"=",
"$",
".",
"extend",
... | The contextmenu model class | [
"The",
"contextmenu",
"model",
"class"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L4781-L4814 | |
8,891 | easysoft/zui | assets/live.js | function () {
if (document.body) {
// make sure all resources are loaded on first activation
if (!loaded) Live.loadresources();
Live.checkForChanges();
}
setTimeout(Live.heartbeat, interval);
} | javascript | function () {
if (document.body) {
// make sure all resources are loaded on first activation
if (!loaded) Live.loadresources();
Live.checkForChanges();
}
setTimeout(Live.heartbeat, interval);
} | [
"function",
"(",
")",
"{",
"if",
"(",
"document",
".",
"body",
")",
"{",
"// make sure all resources are loaded on first activation\r",
"if",
"(",
"!",
"loaded",
")",
"Live",
".",
"loadresources",
"(",
")",
";",
"Live",
".",
"checkForChanges",
"(",
")",
";",
... | performs a cycle per interval | [
"performs",
"a",
"cycle",
"per",
"interval"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L37-L44 | |
8,892 | easysoft/zui | assets/live.js | function () {
// helper method to assert if a given url is local
function isLocal(url) {
var loc = document.location,
reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
return url.match(reg);
}
// gather all resources
... | javascript | function () {
// helper method to assert if a given url is local
function isLocal(url) {
var loc = document.location,
reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
return url.match(reg);
}
// gather all resources
... | [
"function",
"(",
")",
"{",
"// helper method to assert if a given url is local\r",
"function",
"isLocal",
"(",
"url",
")",
"{",
"var",
"loc",
"=",
"document",
".",
"location",
",",
"reg",
"=",
"new",
"RegExp",
"(",
"\"^\\\\.|^\\/(?!\\/)|^[\\\\w]((?!://).)*$|\"",
"+",
... | loads all local css and js resources upon first activation | [
"loads",
"all",
"local",
"css",
"and",
"js",
"resources",
"upon",
"first",
"activation"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L47-L104 | |
8,893 | easysoft/zui | assets/live.js | isLocal | function isLocal(url) {
var loc = document.location,
reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
return url.match(reg);
} | javascript | function isLocal(url) {
var loc = document.location,
reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
return url.match(reg);
} | [
"function",
"isLocal",
"(",
"url",
")",
"{",
"var",
"loc",
"=",
"document",
".",
"location",
",",
"reg",
"=",
"new",
"RegExp",
"(",
"\"^\\\\.|^\\/(?!\\/)|^[\\\\w]((?!://).)*$|\"",
"+",
"loc",
".",
"protocol",
"+",
"\"//\"",
"+",
"loc",
".",
"host",
")",
";... | helper method to assert if a given url is local | [
"helper",
"method",
"to",
"assert",
"if",
"a",
"given",
"url",
"is",
"local"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L50-L54 |
8,894 | easysoft/zui | assets/live.js | function () {
for (var url in resources) {
if (pendingRequests[url])
continue;
Live.getHead(url, function (url, newInfo) {
var oldInfo = resources[url],
hasChanged = false;
resources[url] = newInfo;
for (var header in oldInfo) {
... | javascript | function () {
for (var url in resources) {
if (pendingRequests[url])
continue;
Live.getHead(url, function (url, newInfo) {
var oldInfo = resources[url],
hasChanged = false;
resources[url] = newInfo;
for (var header in oldInfo) {
... | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"url",
"in",
"resources",
")",
"{",
"if",
"(",
"pendingRequests",
"[",
"url",
"]",
")",
"continue",
";",
"Live",
".",
"getHead",
"(",
"url",
",",
"function",
"(",
"url",
",",
"newInfo",
")",
"{",
"var",... | check all tracking resources for changes | [
"check",
"all",
"tracking",
"resources",
"for",
"changes"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L107-L137 | |
8,895 | easysoft/zui | assets/live.js | function (url, type) {
switch (type.toLowerCase()) {
// css files can be reloaded dynamically by replacing the link element
case "text/css":
var link = currentLinkElements[url],
html = document.body.parentNode,
head = link.... | javascript | function (url, type) {
switch (type.toLowerCase()) {
// css files can be reloaded dynamically by replacing the link element
case "text/css":
var link = currentLinkElements[url],
html = document.body.parentNode,
head = link.... | [
"function",
"(",
"url",
",",
"type",
")",
"{",
"switch",
"(",
"type",
".",
"toLowerCase",
"(",
")",
")",
"{",
"// css files can be reloaded dynamically by replacing the link element \r",
"case",
"\"text/css\"",
":",
"var",
"link",
"=",
"cur... | act upon a changed url of certain content type | [
"act",
"upon",
"a",
"changed",
"url",
"of",
"certain",
"content",
"type"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L140-L173 | |
8,896 | easysoft/zui | assets/live.js | function () {
var pending = 0;
for (var url in oldLinkElements) {
// if this sheet has any cssRules, delete the old link
try {
var link = currentLinkElements[url],
oldLink = oldLinkElements[url],
html = document.body.parentNode,
she... | javascript | function () {
var pending = 0;
for (var url in oldLinkElements) {
// if this sheet has any cssRules, delete the old link
try {
var link = currentLinkElements[url],
oldLink = oldLinkElements[url],
html = document.body.parentNode,
she... | [
"function",
"(",
")",
"{",
"var",
"pending",
"=",
"0",
";",
"for",
"(",
"var",
"url",
"in",
"oldLinkElements",
")",
"{",
"// if this sheet has any cssRules, delete the old link\r",
"try",
"{",
"var",
"link",
"=",
"currentLinkElements",
"[",
"url",
"]",
",",
"o... | removes the old stylesheet rules only once the new one has finished loading | [
"removes",
"the",
"old",
"stylesheet",
"rules",
"only",
"once",
"the",
"new",
"one",
"has",
"finished",
"loading"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L176-L198 | |
8,897 | easysoft/zui | assets/live.js | function (url, callback) {
pendingRequests[url] = true;
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp");
xhr.open("HEAD", url, true);
xhr.onreadystatechange = function () {
delete pendingRequests[url];
if (xhr.readyState == 4 ... | javascript | function (url, callback) {
pendingRequests[url] = true;
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp");
xhr.open("HEAD", url, true);
xhr.onreadystatechange = function () {
delete pendingRequests[url];
if (xhr.readyState == 4 ... | [
"function",
"(",
"url",
",",
"callback",
")",
"{",
"pendingRequests",
"[",
"url",
"]",
"=",
"true",
";",
"var",
"xhr",
"=",
"window",
".",
"XMLHttpRequest",
"?",
"new",
"XMLHttpRequest",
"(",
")",
":",
"new",
"ActiveXObject",
"(",
"\"Microsoft.XmlHttp\"",
... | performs a HEAD request and passes the header info to the given callback | [
"performs",
"a",
"HEAD",
"request",
"and",
"passes",
"the",
"header",
"info",
"to",
"the",
"given",
"callback"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L201-L221 | |
8,898 | easysoft/zui | dist/lib/markdoc/zui.markdoc.js | function(element, options) {
var that = this;
that.name = NAME;
that.$ = $(element);
that.options = $.extend({}, MarkDoc.DEFAULTS, this.$.data(), options);
that.$.data('originContent', that.$.text());
that.render();
} | javascript | function(element, options) {
var that = this;
that.name = NAME;
that.$ = $(element);
that.options = $.extend({}, MarkDoc.DEFAULTS, this.$.data(), options);
that.$.data('originContent', that.$.text());
that.render();
} | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"var",
"that",
"=",
"this",
";",
"that",
".",
"name",
"=",
"NAME",
";",
"that",
".",
"$",
"=",
"$",
"(",
"element",
")",
";",
"that",
".",
"options",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
... | model name The markdoc model class | [
"model",
"name",
"The",
"markdoc",
"model",
"class"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/lib/markdoc/zui.markdoc.js#L1311-L1319 | |
8,899 | easysoft/zui | dist/lib/chart/zui.chart.js | function(easeDecimal) {
var animDecimal = (easeDecimal) ? easeDecimal : 1;
this.clear();
// ZUI change begin
var labelPositionMap;
// ZUI change end
helpers.each(this.segments, function(segment, index) {
segment.transition({
... | javascript | function(easeDecimal) {
var animDecimal = (easeDecimal) ? easeDecimal : 1;
this.clear();
// ZUI change begin
var labelPositionMap;
// ZUI change end
helpers.each(this.segments, function(segment, index) {
segment.transition({
... | [
"function",
"(",
"easeDecimal",
")",
"{",
"var",
"animDecimal",
"=",
"(",
"easeDecimal",
")",
"?",
"easeDecimal",
":",
"1",
";",
"this",
".",
"clear",
"(",
")",
";",
"// ZUI change begin",
"var",
"labelPositionMap",
";",
"// ZUI change end",
"helpers",
".",
... | ZUI change end | [
"ZUI",
"change",
"end"
] | a5af01d76e9481d618d6abd3e873a8ee7e49c59f | https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/lib/chart/zui.chart.js#L2822-L2872 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.