_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q21800 | train | function (idx, out) {
if (idx < this.triangleCount && idx >= 0) {
if (!out) {
out = [];
}
var indices = this.indices;
out[0] = indices[idx * 3];
out[1] = indices[idx * 3 + 1];
out[2] = indices[idx * 3 + 2];
retur... | javascript | {
"resource": ""
} | |
q21801 | train | function (idx, arr) {
var indices = this.indices;
indices[idx * 3] = arr[0];
indices[idx * 3 + 1] = arr[1];
indices[idx * 3 + 2] = arr[2];
} | javascript | {
"resource": ""
} | |
q21802 | train | function (array) {
var value;
var ArrayConstructor = this.vertexCount > 0xffff
? vendor.Uint32Array : vendor.Uint16Array;
// Convert 2d array to flat
if (array[0] && (array[0].length)) {
var n = 0;
var size = 3;
value = new ArrayConstructo... | javascript | {
"resource": ""
} | |
q21803 | train | function () {
var enabledAttributes = this._enabledAttributes;
var attributeList = this._attributeList;
// Cache
if (enabledAttributes) {
return enabledAttributes;
}
var result = [];
var nVertex = this.vertexCount;
for (var i = 0; i < attribu... | javascript | {
"resource": ""
} | |
q21804 | train | function (renderer) {
var cache = this._cache;
cache.use(renderer.__uid__);
var chunks = cache.get('chunks');
if (chunks) {
for (var c = 0; c < chunks.length; c++) {
var chunk = chunks[c];
for (var k = 0; k < chunk.attributeBuffers.length; k... | javascript | {
"resource": ""
} | |
q21805 | train | function (globalEasing) {
var self = this;
var clipCount = 0;
var oneTrackDone = function() {
clipCount--;
if (clipCount === 0) {
self._doneCallback();
}
};
var lastClip;
for (var propName in this._tracks) {
... | javascript | {
"resource": ""
} | |
q21806 | train | function () {
for (var i = 0; i < this._clipList.length; i++) {
var clip = this._clipList[i];
this.animation.removeClip(clip);
}
this._clipList = [];
} | javascript | {
"resource": ""
} | |
q21807 | vec3lerp | train | function vec3lerp(out, a, b, t, oa, ob) {
var ax = a[oa];
var ay = a[oa + 1];
var az = a[oa + 2];
out[0] = ax + t * (b[ob] - ax);
out[1] = ay + t * (b[ob + 1] - ay);
out[2] = az + t * (b[ob + 2] - az);
return out;
} | javascript | {
"resource": ""
} |
q21808 | train | function (opts) {
opts = opts || {};
this.name = opts.name || '';
/**
* @param {clay.Node}
*/
this.target = opts.target || null;
/**
* @type {Array}
*/
this.position = vec3.create();
/**
* Rotation is represented by a quaternion
* @type {Array}
*/
this... | javascript | {
"resource": ""
} | |
q21809 | derive | train | function derive(makeDefaultOpt, initialize/*optional*/, proto/*optional*/) {
if (typeof initialize == 'object') {
proto = initialize;
initialize = null;
}
var _super = this;
var propList;
if (!(makeDefaultOpt instanceof Function)) {
// Optimize the property iterate if it h... | javascript | {
"resource": ""
} |
q21810 | train | function(name, action, context) {
if (!name || !action) {
return;
}
var handlers = this.__handlers__ || (this.__handlers__={});
if (!handlers[name]) {
handlers[name] = [];
}
else {
if (this.has(name, action)) {
return;
... | javascript | {
"resource": ""
} | |
q21811 | train | function(name, action, context) {
if (!name || !action) {
return;
}
var self = this;
function wrapper() {
self.off(name, wrapper);
action.apply(this, arguments);
}
return this.on(name, wrapper, context);
} | javascript | {
"resource": ""
} | |
q21812 | train | function(name, action) {
var handlers = this.__handlers__;
if (! handlers ||
! handlers[name]) {
return false;
}
var hdls = handlers[name];
for (var i = 0; i < hdls.length; i++) {
if (hdls[i].action === action) {
return true;
... | javascript | {
"resource": ""
} | |
q21813 | train | function (path, basePath) {
if (!basePath || path.match(/^\//)) {
return path;
}
var pathParts = path.split('/');
var basePathParts = basePath.split('/');
var item = pathParts[0];
while(item === '.' || item === '..') {
if (item === '..') {
... | javascript | {
"resource": ""
} | |
q21814 | train | function (target, source) {
if (source) {
for (var propName in source) {
if (target[propName] === undefined) {
target[propName] = source[propName];
}
}
}
return target;
} | javascript | {
"resource": ""
} | |
q21815 | train | function () {
var self = this;
this._running = true;
this._time = Date.now();
this._pausedTime = 0;
var requestAnimationFrame = vendor.requestAnimationFrame;
function step() {
if (self._running) {
requestAnimationFrame(step);
... | javascript | {
"resource": ""
} | |
q21816 | train | function (target, options) {
options = options || {};
var animator = new Animator(
target,
options.loop,
options.getter,
options.setter,
options.interpolater
);
animator.animation = this;
return animator;
} | javascript | {
"resource": ""
} | |
q21817 | train | function (symbol, value) {
if (value === undefined) {
console.warn('Uniform value "' + symbol + '" is undefined');
}
var uniform = this.uniforms[symbol];
if (uniform) {
if (typeof value === 'string') {
// Try to parse as a color. Invalid color str... | javascript | {
"resource": ""
} | |
q21818 | train | function (symbol, value) {
if (typeof(symbol) === 'object') {
for (var key in symbol) {
var val = symbol[key];
this.setUniform(key, val);
}
}
else {
this.setUniform(symbol, value);
}
} | javascript | {
"resource": ""
} | |
q21819 | train | function(shader, keepStatus) {
var originalUniforms = this.uniforms;
// Ignore if uniform can use in shader.
this.uniforms = shader.createUniforms();
this.shader = shader;
var uniforms = this.uniforms;
this._enabledUniforms = Object.keys(uniforms);
// Make sure ... | javascript | {
"resource": ""
} | |
q21820 | train | function () {
var material = new this.constructor({
name: this.name,
shader: this.shader
});
for (var symbol in this.uniforms) {
material.uniforms[symbol].value = this.uniforms[symbol].value;
}
material.depthTest = this.depthTest;
mater... | javascript | {
"resource": ""
} | |
q21821 | train | function () {
var enabledTextures = [];
var textureStatus = this._textureStatus;
for (var symbol in textureStatus) {
if (textureStatus[symbol].enabled) {
enabledTextures.push(symbol);
}
}
return enabledTextures;
} | javascript | {
"resource": ""
} | |
q21822 | checkShaderErrorMsg | train | function checkShaderErrorMsg(_gl, shader, shaderString) {
if (!_gl.getShaderParameter(shader, _gl.COMPILE_STATUS)) {
return [_gl.getShaderInfoLog(shader), addLineNumbers(shaderString)].join('\n');
}
} | javascript | {
"resource": ""
} |
q21823 | train | function () {
var uniforms = {};
for (var symbol in this.uniformTemplates){
var uniformTpl = this.uniformTemplates[symbol];
uniforms[symbol] = {
type: uniformTpl.type,
value: uniformTpl.value()
};
}
return uniforms;
... | javascript | {
"resource": ""
} | |
q21824 | train | function () {
var code = shaderCodeCache[this._shaderID];
var shader = new Shader(code.vertex, code.fragment);
return shader;
} | javascript | {
"resource": ""
} | |
q21825 | train | function () {
if (this._clearStack.length > 0) {
var opt = this._clearStack.pop();
this.clearColor = opt.clearColor;
this.clearBit = opt.clearBit;
}
} | javascript | {
"resource": ""
} | |
q21826 | train | function(root, disposeGeometry, disposeTexture) {
// Dettached from parent
if (root.getParent()) {
root.getParent().remove(root);
}
var disposedMap = {};
root.traverse(function(node) {
var material = node.material;
if (node.geometry && disposeG... | javascript | {
"resource": ""
} | |
q21827 | train | function (m) {
var v = this.array;
m = m.array;
// Perspective projection
if (m[15] === 0) {
var w = -1 / v[2];
v[0] = m[0] * v[0] * w;
v[1] = m[5] * v[1] * w;
v[2] = (m[10] * v[2] + m[14]) * w;
}
else {
v[0] = ... | javascript | {
"resource": ""
} | |
q21828 | train | function (x, y, z, w) {
this.array[0] = x;
this.array[1] = y;
this.array[2] = z;
this.array[3] = w;
this._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21829 | train | function (arr) {
this.array[0] = arr[0];
this.array[1] = arr[1];
this.array[2] = arr[2];
this.array[3] = arr[3];
this._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21830 | train | function (view, right, up) {
quat.setAxes(this.array, view.array, right.array, up.array);
this._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21831 | train | function (arr) {
for (var i = 0; i < this.array.length; i++) {
this.array[i] = arr[i];
}
this._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21832 | train | function(q, v) {
mat4.fromRotationTranslation(this.array, q.array, v.array);
this._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21833 | train | function(rad, axis) {
mat4.rotate(this.array, this.array, rad, axis.array);
this._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21834 | train | function (min, max) {
/**
* Minimum coords of bounding box
* @type {clay.Vector3}
*/
this.min = min || new Vector3(Infinity, Infinity, Infinity);
/**
* Maximum coords of bounding box
* @type {clay.Vector3}
*/
this.max = max || new Vector3(-Infinity, -Infinity, -Infinity);... | javascript | {
"resource": ""
} | |
q21835 | train | function (vertices) {
if (vertices.length > 0) {
var min = this.min;
var max = this.max;
var minArr = min.array;
var maxArr = max.array;
vec3Copy(minArr, vertices[0]);
vec3Copy(maxArr, vertices[0]);
for (var i = 1; i < vertices.... | javascript | {
"resource": ""
} | |
q21836 | train | function (bbox) {
var min = this.min;
var max = this.max;
vec3.min(min.array, min.array, bbox.min.array);
vec3.max(max.array, max.array, bbox.max.array);
min._dirty = true;
max._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21837 | train | function (bbox) {
var _min = this.min.array;
var _max = this.max.array;
var _min2 = bbox.min.array;
var _max2 = bbox.max.array;
return ! (_min[0] > _max2[0] || _min[1] > _max2[1] || _min[2] > _max2[2]
|| _max[0] < _min2[0] || _max[1] < _min2[1] || _max[2] < _min2[2]... | javascript | {
"resource": ""
} | |
q21838 | train | function (p) {
var _min = this.min.array;
var _max = this.max.array;
var _p = p.array;
return _min[0] <= _p[0] && _min[1] <= _p[1] && _min[2] <= _p[2]
&& _max[0] >= _p[0] && _max[1] >= _p[1] && _max[2] >= _p[2];
} | javascript | {
"resource": ""
} | |
q21839 | train | function () {
var _min = this.min.array;
var _max = this.max.array;
return isFinite(_min[0]) && isFinite(_min[1]) && isFinite(_min[2])
&& isFinite(_max[0]) && isFinite(_max[1]) && isFinite(_max[2]);
} | javascript | {
"resource": ""
} | |
q21840 | train | function (matrix) {
var min = this.min.array;
var max = this.max.array;
var m = matrix.array;
// min in min z
var v10 = min[0];
var v11 = min[1];
var v12 = min[2];
// max in min z
var v20 = max[0];
var v21 = max[1];
var v22 = min[2... | javascript | {
"resource": ""
} | |
q21841 | train | function (bbox) {
var min = this.min;
var max = this.max;
vec3Copy(min.array, bbox.min.array);
vec3Copy(max.array, bbox.max.array);
min._dirty = true;
max._dirty = true;
return this;
} | javascript | {
"resource": ""
} | |
q21842 | train | function (name) {
var scene = this._scene;
if (scene) {
var nodeRepository = scene._nodeRepository;
delete nodeRepository[this.name];
nodeRepository[name] = this;
}
this.name = name;
} | javascript | {
"resource": ""
} | |
q21843 | train | function (node) {
var originalParent = node._parent;
if (originalParent === this) {
return;
}
if (originalParent) {
originalParent.remove(node);
}
node._parent = this;
this._children.push(node);
var scene = this._scene;
if ... | javascript | {
"resource": ""
} | |
q21844 | train | function (node) {
var children = this._children;
var idx = children.indexOf(node);
if (idx < 0) {
return;
}
children.splice(idx, 1);
node._parent = null;
if (this._scene) {
node.traverse(this._removeSelfFromScene, this);
}
} | javascript | {
"resource": ""
} | |
q21845 | train | function () {
var children = this._children;
for (var idx = 0; idx < children.length; idx++) {
children[idx]._parent = null;
if (this._scene) {
children[idx].traverse(this._removeSelfFromScene, this);
}
}
this._children = [];
} | javascript | {
"resource": ""
} | |
q21846 | train | function (node) {
var parent = node._parent;
while(parent) {
if (parent === this) {
return true;
}
parent = parent._parent;
}
return false;
} | javascript | {
"resource": ""
} | |
q21847 | train | function (name) {
var children = this._children;
for (var i = 0; i < children.length; i++) {
if (children[i].name === name) {
return children[i];
}
}
} | javascript | {
"resource": ""
} | |
q21848 | train | function (name) {
var children = this._children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child.name === name) {
return child;
} else {
var res = child.getDescendantByName(name);
if (res) ... | javascript | {
"resource": ""
} | |
q21849 | train | function (path) {
if (!path) {
return;
}
// TODO Name have slash ?
var pathArr = path.split('/');
var current = this;
for (var i = 0; i < pathArr.length; i++) {
var name = pathArr[i];
// Skip empty
if (!name) {
... | javascript | {
"resource": ""
} | |
q21850 | train | function (callback, context) {
callback.call(context, this);
var _children = this._children;
for(var i = 0, len = _children.length; i < len; i++) {
_children[i].traverse(callback, context);
}
} | javascript | {
"resource": ""
} | |
q21851 | train | function (callback, context) {
var _children = this._children;
for(var i = 0, len = _children.length; i < len; i++) {
var child = _children[i];
callback.call(context, child, i);
}
} | javascript | {
"resource": ""
} | |
q21852 | train | function (keepScale) {
var scale = !keepScale ? this.scale: null;
this.localTransform.decomposeMatrix(scale, this.rotation, this.position);
} | javascript | {
"resource": ""
} | |
q21853 | train | function () {
var position = this.position;
var rotation = this.rotation;
var scale = this.scale;
if (this.transformNeedsUpdate()) {
var m = this.localTransform.array;
// Transform order, scale->rotation->position
mat4.fromRotationTranslation(m, rota... | javascript | {
"resource": ""
} | |
q21854 | train | function () {
var localTransform = this.localTransform.array;
var worldTransform = this.worldTransform.array;
if (this._parent) {
mat4.multiplyAffine(
worldTransform,
this._parent.worldTransform.array,
localTransform
);
... | javascript | {
"resource": ""
} | |
q21855 | train | function () {
// Find the root node which transform needs update;
var rootNodeIsDirty = this;
while (rootNodeIsDirty && rootNodeIsDirty.getParent()
&& rootNodeIsDirty.getParent().transformNeedsUpdate()
) {
rootNodeIsDirty = rootNodeIsDirty.getParent();
}
... | javascript | {
"resource": ""
} | |
q21856 | train | function (forceUpdateWorld) {
if (this.autoUpdateLocalTransform) {
this.updateLocalTransform();
}
else {
// Transform is manually setted
forceUpdateWorld = true;
}
if (forceUpdateWorld || this._needsUpdateWorldTransform) {
this._up... | javascript | {
"resource": ""
} | |
q21857 | train | function (out) {
// PENDING
if (this.transformNeedsUpdate()) {
this.updateWorldTransform();
}
var m = this.worldTransform.array;
if (out) {
var arr = out.array;
arr[0] = m[12];
arr[1] = m[13];
arr[2] = m[14];
... | javascript | {
"resource": ""
} | |
q21858 | train | function () {
var node = new this.constructor();
var children = this._children;
node.setName(this.name);
node.position.copy(this.position);
node.rotation.copy(this.rotation);
node.scale.copy(this.scale);
for (var i = 0; i < children.length; i++) {
n... | javascript | {
"resource": ""
} | |
q21859 | train | function(point, out) {
if (!out) {
out = new Vector3();
}
var d = this.distanceToPoint(point);
vec3.scaleAndAdd(out.array, point.array, this.normal.array, -d);
out._dirty = true;
return out;
} | javascript | {
"resource": ""
} | |
q21860 | train | function() {
var invLen = 1 / vec3.len(this.normal.array);
vec3.scale(this.normal.array, invLen);
this.distance *= invLen;
} | javascript | {
"resource": ""
} | |
q21861 | train | function(frustum) {
// Check if all coords of frustum is on plane all under plane
var coords = frustum.vertices;
var normal = this.normal.array;
var onPlane = vec3.dot(coords[0].array, normal) > this.distance;
for (var i = 1; i < 8; i++) {
if ((vec3.dot(coords[i].arra... | javascript | {
"resource": ""
} | |
q21862 | train | function(plane) {
vec3.copy(this.normal.array, plane.normal.array);
this.normal._dirty = true;
this.distance = plane.distance;
} | javascript | {
"resource": ""
} | |
q21863 | train | function (plane) {
// Distance to plane
var d = vec3.dot(plane.normal.array, this.direction.array);
vec3.scaleAndAdd(this.direction.array, this.direction.array, plane.normal.array, -d * 2);
this.direction._dirty = true;
} | javascript | {
"resource": ""
} | |
q21864 | train | function (matrix) {
Vector3.add(this.direction, this.direction, this.origin);
Vector3.transformMat4(this.origin, this.origin, matrix);
Vector3.transformMat4(this.direction, this.direction, matrix);
Vector3.sub(this.direction, this.direction, this.origin);
Vector3.normalize(this.... | javascript | {
"resource": ""
} | |
q21865 | train | function (ray) {
Vector3.copy(this.origin, ray.origin);
Vector3.copy(this.direction, ray.direction);
} | javascript | {
"resource": ""
} | |
q21866 | train | function (viewMatrix) {
Matrix4.copy(this.viewMatrix, viewMatrix);
Matrix4.invert(this.worldTransform, viewMatrix);
this.decomposeWorldTransform();
} | javascript | {
"resource": ""
} | |
q21867 | train | function (projectionMatrix) {
Matrix4.copy(this.projectionMatrix, projectionMatrix);
Matrix4.invert(this.invProjectionMatrix, projectionMatrix);
this.decomposeProjectionMatrix();
} | javascript | {
"resource": ""
} | |
q21868 | train | function (node) {
if (node instanceof Camera) {
if (this._cameraList.length > 0) {
console.warn('Found multiple camera in one scene. Use the fist one.');
}
this._cameraList.push(node);
}
else if (node instanceof Light) {
this.lights... | javascript | {
"resource": ""
} | |
q21869 | train | function (node) {
var idx;
if (node instanceof Camera) {
idx = this._cameraList.indexOf(node);
if (idx >= 0) {
this._cameraList.splice(idx, 1);
}
}
else if (node instanceof Light) {
idx = this.lights.indexOf(node);
... | javascript | {
"resource": ""
} | |
q21870 | train | function (camera) {
var idx = this._cameraList.indexOf(camera);
if (idx >= 0) {
this._cameraList.splice(idx, 1);
}
this._cameraList.unshift(camera);
} | javascript | {
"resource": ""
} | |
q21871 | train | function (camera, updateSceneBoundingBox) {
var id = camera.__uid__;
var renderList = this._renderLists.get(id);
if (!renderList) {
renderList = new RenderList();
this._renderLists.put(id, renderList);
}
renderList.startCount();
if (updateSceneBou... | javascript | {
"resource": ""
} | |
q21872 | train | function (lightGroup) {
var prevLightNumber = this._previousLightNumber;
var currentLightNumber = this._lightNumber;
// PENDING Performance
for (var type in currentLightNumber[lightGroup]) {
if (!prevLightNumber[lightGroup]) {
return true;
}
... | javascript | {
"resource": ""
} | |
q21873 | train | function (name, type, size, semantic) {
var attrib = new Attribute$1(name, type, size, semantic);
if (this.attributes[name]) {
this.removeAttribute(name);
}
this.attributes[name] = attrib;
this._attributeList.push(name);
return attrib;
} | javascript | {
"resource": ""
} | |
q21874 | train | function () {
var bbox = this.boundingBox;
if (!bbox) {
bbox = this.boundingBox = new BoundingBox();
}
var posArr = this.attributes.position.value;
if (posArr && posArr.length) {
var min = bbox.min;
var max = bbox.max;
var minArr = ... | javascript | {
"resource": ""
} | |
q21875 | train | function () {
if (!this.vertexCount || !this.indices) {
return;
}
if (this.indices.length > 0xffff) {
this.indices = new vendor.Uint32Array(this.indices);
}
var attributes = this.attributes;
var indices = this.indices;
var attributeNameL... | javascript | {
"resource": ""
} | |
q21876 | train | function () {
if (!this.vertexCount) {
return;
}
if (!this.isUniqueVertex()) {
this.generateUniqueVertex();
}
var attributes = this.attributes;
var array = attributes.barycentric.value;
var indices = this.indices;
// Already exist... | javascript | {
"resource": ""
} | |
q21877 | train | function (matrix) {
var attributes = this.attributes;
var positions = attributes.position.value;
var normals = attributes.normal.value;
var tangents = attributes.tangent.value;
matrix = matrix.array;
// Normal Matrix
var inverseTransposeMatrix = mat4.create();
... | javascript | {
"resource": ""
} | |
q21878 | train | function() {
var heightSegments = this.heightSegments;
var widthSegments = this.widthSegments;
var attributes = this.attributes;
var positions = [];
var texcoords = [];
var normals = [];
var faces = [];
for (var y = 0; y <= heightSegments; y++) {
... | javascript | {
"resource": ""
} | |
q21879 | train | function() {
var planes = {
'px': createPlane('px', this.depthSegments, this.heightSegments),
'nx': createPlane('nx', this.depthSegments, this.heightSegments),
'py': createPlane('py', this.widthSegments, this.depthSegments),
'ny': createPlane('ny', this.widthSegm... | javascript | {
"resource": ""
} | |
q21880 | train | function (renderer) {
var _gl = renderer.gl;
_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, this.flipY);
_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);
_gl.pixelStorei(_gl.UNPACK_ALIGNMENT, this.unpackAlignment);
// Use of none-power of two texture
... | javascript | {
"resource": ""
} | |
q21881 | train | function () {
if (this.image.px) {
return isPowerOfTwo$1(this.image.px.width)
&& isPowerOfTwo$1(this.image.px.height);
}
else {
return isPowerOfTwo$1(this.width)
&& isPowerOfTwo$1(this.height);
}
} | javascript | {
"resource": ""
} | |
q21882 | train | function (clip, mapRule) {
// Clip have been exists in
for (var i = 0; i < this._clips.length; i++) {
if (this._clips[i].clip === clip) {
return;
}
}
// Map the joint index in skeleton to joint pose index in clip
var maps = [];
for ... | javascript | {
"resource": ""
} | |
q21883 | train | function (geometry) {
var attributes = geometry.attributes;
var positionAttr = attributes.position;
var jointAttr = attributes.joint;
var weightAttr = attributes.weight;
var jointsBoundingBoxes = [];
for (var i = 0; i < this.joints.length; i++) {
jointsBoundi... | javascript | {
"resource": ""
} | |
q21884 | train | function () {
this._setPose();
var jointsBoundingBoxes = this._jointsBoundingBoxes;
for (var i = 0; i < this.joints.length; i++) {
var joint = this.joints[i];
mat4.multiply(
this._skinMatricesSubArrays[i],
joint.node.worldTransform.array... | javascript | {
"resource": ""
} | |
q21885 | train | function (buffer) {
var header = new Uint32Array(buffer, 0, 4);
if (header[0] !== 0x46546C67) {
this.trigger('error', 'Invalid glTF binary format: Invalid header');
return;
}
if (header[0] < 2) {
this.trigger('error', 'Only glTF2.0 is supported.');
... | javascript | {
"resource": ""
} | |
q21886 | train | function (path) {
if (path && path.match(/^data:(.*?)base64,/)) {
return path;
}
var rootPath = this.bufferRootPath;
if (rootPath == null) {
rootPath = this.rootPath;
}
return util$1.relative2absolute(path, rootPath);
} | javascript | {
"resource": ""
} | |
q21887 | train | function (path) {
if (path && path.match(/^data:(.*?)base64,/)) {
return path;
}
var rootPath = this.textureRootPath;
if (rootPath == null) {
rootPath = this.rootPath;
}
return util$1.relative2absolute(path, rootPath);
} | javascript | {
"resource": ""
} | |
q21888 | train | function (renderer) {
if (renderer.__currentFrameBuffer) {
// Already bound
if (renderer.__currentFrameBuffer === this) {
return;
}
console.warn('Renderer already bound with another framebuffer. Unbind it first');
}
renderer.__cur... | javascript | {
"resource": ""
} | |
q21889 | train | function (renderer) {
// Remove status record on renderer
renderer.__currentFrameBuffer = null;
var _gl = renderer.gl;
_gl.bindFramebuffer(GL_FRAMEBUFFER, null);
this._boundRenderer = null;
this._cache.use(renderer.__uid__);
var viewport = this._cache.get('view... | javascript | {
"resource": ""
} | |
q21890 | train | function (renderer) {
var _gl = renderer.gl;
for (var attachment in this._textures) {
var obj = this._textures[attachment];
if (obj) {
var texture = obj.texture;
// FIXME some texture format can't generate mipmap
if (!texture.NPOT &... | javascript | {
"resource": ""
} | |
q21891 | train | function (attachment, target) {
// TODO depth extension check ?
this._textures[attachment] = null;
if (this._boundRenderer) {
var cache = this._cache;
cache.use(this._boundRenderer.__uid__);
this._doDetach(this._boundRenderer.gl, attachment, target);
}... | javascript | {
"resource": ""
} | |
q21892 | train | function (scene) {
if (this.scene) {
this.detachScene();
}
scene.skybox = this;
this.scene = scene;
scene.on('beforerender', this._beforeRenderScene, this);
} | javascript | {
"resource": ""
} | |
q21893 | train | function (envMap) {
if (envMap.textureType === 'texture2D') {
this.material.define('EQUIRECTANGULAR');
// LINEAR filter can remove the artifacts in pole
envMap.minFilter = Texture.LINEAR;
}
else {
this.material.undefine('EQUIRECTANGULAR');
... | javascript | {
"resource": ""
} | |
q21894 | train | function (renderer, path, cubeMap, option, onsuccess, onerror) {
var self = this;
if (typeof(option) === 'function') {
onsuccess = option;
onerror = onsuccess;
option = {};
}
else {
option = option || {};
}
textureUtil.loa... | javascript | {
"resource": ""
} | |
q21895 | train | function (renderer, panoramaMap, cubeMap, option) {
var environmentMapPass = new EnvironmentMapPass();
var skydome = new Skybox$1({
scene: new Scene()
});
skydome.setEnvironmentMap(panoramaMap);
option = option || {};
if (option.encodeRGBM) {
skyd... | javascript | {
"resource": ""
} | |
q21896 | train | function (size, unitSize, color1, color2) {
size = size || 512;
unitSize = unitSize || 64;
color1 = color1 || 'black';
color2 = color2 || 'white';
var repeat = Math.ceil(size / unitSize);
var canvas = document.createElement('canvas');
canvas.width = size;
... | javascript | {
"resource": ""
} | |
q21897 | train | function (color) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.fillStyle = color;
ctx.fillRect(0, 0, 1, 1);
var texture = new Texture2D({
image: canvas
});
... | javascript | {
"resource": ""
} | |
q21898 | train | function (renderer, size) {
if (!renderer.getGLExtension('EXT_shader_texture_lod')) {
console.warn('Device not support textureCubeLodEXT');
return;
}
if (!this._brdfLookup) {
this._normalDistribution = cubemapUtil.generateNormalDistribution();
this... | javascript | {
"resource": ""
} | |
q21899 | train | function (renderer, scene, sceneCamera, notUpdateScene) {
if (!sceneCamera) {
sceneCamera = scene.getMainCamera();
}
this.trigger('beforerender', this, renderer, scene, sceneCamera);
this._renderShadowPass(renderer, scene, sceneCamera, notUpdateScene);
this.trigger('a... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.