language stringclasses 1 value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2 classes |
|---|---|---|---|---|---|---|---|
Other | mrdoob | three.js | ba79e7ce7745f5d6e7cbda305d1d7e6302cd8f54.json | add documentation for webglrenderer.compile | docs/api/renderers/WebGLRenderer.html | @@ -305,6 +305,9 @@ <h3>[method:null clearTarget]([page:WebGLRenderTarget renderTarget], [page:boole
This method clears a rendertarget. To do this, it activates the rendertarget.
</div>
+ <h3>[method:null compile]( [page:Scene scene], [page:Camera camera] )</h3>
+ <div>Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering.</div>
+
<h3>[method:null dispose]( )</h3>
<div>Dispose of the current rendering context.</div>
| false |
Other | mrdoob | three.js | 24f2f9e249174b39d77accf0bfa237ab7285e334.json | Update binary implementation for glTF 2.0. | examples/js/loaders/GLTF2Loader.js | @@ -55,7 +55,7 @@ THREE.GLTF2Loader = ( function () {
var magic = convertUint8ArrayToString( new Uint8Array( data, 0, 4 ) );
- if ( magic === BINARY_EXTENSION_HEADER_DEFAULTS.magic ) {
+ if ( magic === BINARY_EXTENSION_HEADER_MAGIC ) {
extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );
content = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content;
@@ -320,63 +320,70 @@ THREE.GLTF2Loader = ( function () {
/* BINARY EXTENSION */
var BINARY_EXTENSION_BUFFER_NAME = 'binary_glTF';
-
- var BINARY_EXTENSION_HEADER_DEFAULTS = { magic: 'glTF', version: 1, contentFormat: 0 };
-
- var BINARY_EXTENSION_HEADER_LENGTH = 20;
+ var BINARY_EXTENSION_HEADER_MAGIC = 'glTF';
+ var BINARY_EXTENSION_HEADER_LENGTH = 12;
+ var BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4E4F534A, BIN: 0x004E4942 };
function GLTFBinaryExtension( data ) {
this.name = EXTENSIONS.KHR_BINARY_GLTF;
+ this.content = null;
+ this.body = null;
var headerView = new DataView( data, 0, BINARY_EXTENSION_HEADER_LENGTH );
- var header = {
+ this.header = {
magic: convertUint8ArrayToString( new Uint8Array( data.slice( 0, 4 ) ) ),
version: headerView.getUint32( 4, true ),
- length: headerView.getUint32( 8, true ),
- contentLength: headerView.getUint32( 12, true ),
- contentFormat: headerView.getUint32( 16, true )
+ length: headerView.getUint32( 8, true )
};
- for ( var key in BINARY_EXTENSION_HEADER_DEFAULTS ) {
-
- var value = BINARY_EXTENSION_HEADER_DEFAULTS[ key ];
+ if ( this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC ) {
- if ( header[ key ] !== value ) {
+ throw new Error( 'GLTF2Loader: Unsupported glTF-Binary header.' );
- throw new Error( 'Unsupported glTF-Binary header: Expected "%s" to be "%s".', key, value );
+ } else if ( this.header.version < 2.0 ) {
- }
+ throw new Error( 'GLTF2Loader: Legacy binary file detected. Use GLTFLoader instead.' );
}
- var contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH, header.contentLength );
+ var chunkView = new DataView( data, BINARY_EXTENSION_HEADER_LENGTH );
+ var chunkIndex = 0;
- this.header = header;
- this.content = convertUint8ArrayToString( contentArray );
- this.body = data.slice( BINARY_EXTENSION_HEADER_LENGTH + header.contentLength, header.length );
+ while ( chunkIndex < chunkView.byteLength ) {
- }
+ var chunkLength = chunkView.getUint32( chunkIndex, true );
+ chunkIndex += 4;
- GLTFBinaryExtension.prototype.loadShader = function ( shader, bufferViews ) {
+ var chunkType = chunkView.getUint32( chunkIndex, true );
+ chunkIndex += 4;
- var bufferView = bufferViews[ shader.extensions[ EXTENSIONS.KHR_BINARY_GLTF ].bufferView ];
- var array = new Uint8Array( bufferView );
+ if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON ) {
- return convertUint8ArrayToString( array );
+ var contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength );
+ this.content = convertUint8ArrayToString( contentArray );
- };
+ } else if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN ) {
- GLTFBinaryExtension.prototype.loadTextureSourceUri = function ( source, bufferViews ) {
+ var byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
+ this.body = data.slice( byteOffset, byteOffset + chunkLength );
- var metadata = source.extensions[ EXTENSIONS.KHR_BINARY_GLTF ];
- var bufferView = bufferViews[ metadata.bufferView ];
- var stringData = convertUint8ArrayToString( new Uint8Array( bufferView ) );
+ }
- return 'data:' + metadata.mimeType + ';base64,' + btoa( stringData );
+ // Clients must ignore chunks with unknown types.
- };
+ chunkIndex += chunkLength;
+
+ }
+
+ if ( this.content === null ) {
+
+ throw new Error( 'GLTF2Loader: JSON content not found.' );
+
+ }
+
+ }
/*********************************/
/********** INTERNALS ************/
@@ -894,7 +901,6 @@ THREE.GLTF2Loader = ( function () {
GLTFParser.prototype.loadShaders = function () {
var json = this.json;
- var extensions = this.extensions;
var options = this.options;
return this._withDependencies( [
@@ -905,9 +911,11 @@ THREE.GLTF2Loader = ( function () {
return _each( json.shaders, function ( shader ) {
- if ( shader.extensions && shader.extensions[ EXTENSIONS.KHR_BINARY_GLTF ] ) {
+ if ( shader.bufferView !== undefined ) {
- return extensions[ EXTENSIONS.KHR_BINARY_GLTF ].loadShader( shader, dependencies.bufferViews );
+ var bufferView = dependencies.bufferViews[ shader.bufferView ];
+ var array = new Uint8Array( bufferView );
+ return convertUint8ArrayToString( array );
}
@@ -937,13 +945,14 @@ THREE.GLTF2Loader = ( function () {
return _each( json.buffers, function ( buffer, name ) {
- if ( name === BINARY_EXTENSION_BUFFER_NAME ) {
+ if ( buffer.type === 'arraybuffer' || buffer.type === undefined ) {
- return extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body;
+ // If present, GLB container is required to be the first buffer.
+ if ( buffer.uri === undefined && name === 0 ) {
- }
+ return extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body;
- if ( buffer.type === 'arraybuffer' || buffer.type === undefined ) {
+ }
return new Promise( function ( resolve ) {
@@ -1011,11 +1020,13 @@ THREE.GLTF2Loader = ( function () {
var elementBytes = TypedArray.BYTES_PER_ELEMENT;
var itemBytes = elementBytes * itemSize;
+ var array;
+
// The buffer is not interleaved if the stride is the item size in bytes.
if ( accessor.byteStride && accessor.byteStride !== itemBytes ) {
// Use the full buffer if it's interleaved.
- var array = new TypedArray( arraybuffer );
+ array = new TypedArray( arraybuffer );
// Integer parameters to IB/IBA are in array elements, not bytes.
var ib = new THREE.InterleavedBuffer( array, accessor.byteStride / elementBytes );
@@ -1039,7 +1050,6 @@ THREE.GLTF2Loader = ( function () {
GLTFParser.prototype.loadTextures = function () {
var json = this.json;
- var extensions = this.extensions;
var options = this.options;
return this._withDependencies( [
@@ -1057,9 +1067,11 @@ THREE.GLTF2Loader = ( function () {
var source = json.images[ texture.source ];
var sourceUri = source.uri;
- if ( source.extensions && source.extensions[ EXTENSIONS.KHR_BINARY_GLTF ] ) {
+ if ( source.bufferView !== undefined ) {
- sourceUri = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].loadTextureSourceUri( source, dependencies.bufferViews );
+ var bufferView = dependencies.bufferViews[ source.bufferView ];
+ var stringData = convertUint8ArrayToString( new Uint8Array( bufferView ) );
+ sourceUri = 'data:' + source.mimeType + ';base64,' + btoa( stringData );
}
| true |
Other | mrdoob | three.js | 24f2f9e249174b39d77accf0bfa237ab7285e334.json | Update binary implementation for glTF 2.0. | examples/webgl_loader_gltf.html | @@ -387,9 +387,8 @@
cameraPos: new THREE.Vector3(2, 1, 3),
objectRotation: new THREE.Euler(0, Math.PI, 0),
addLights:true,
- extensions: ["glTF"]
+ extensions: ["glTF", "glTF-Binary"]
},
-
{
name : "Duck", url : "./models/gltf/duck/%s/duck.gltf",
cameraPos: new THREE.Vector3(0, 3, 5), | true |
Other | mrdoob | three.js | 29866387030346a4c775fb9fb46a4dec10a2b72b.json | add split to long animation function | examples/js/loaders/XfileLoader.js | @@ -2,7 +2,7 @@
/**
* @author Jey-en https://github.com/adrs2002
*
- * this loader repo → https://github.com/adrs2002/threeXfileLoader
+ * this loader repo -> https://github.com/adrs2002/threeXfileLoader
*
* This loader is load model (and animation) from .X file format. (for old DirectX).
* ! this version are load from TEXT format .X only ! not a Binary.
@@ -22,7 +22,7 @@
*/
-// テキスト情報の読み込みモード
+//テキスト情報の読み込みモード
// text file Reading Mode
var XfileLoadMode$1 = XfileLoadMode = {
none: -1,
@@ -107,7 +107,7 @@ var XAnimationObj = function () {
key: 'make',
value: function make(XAnimationInfoArray, mesh) {
var keys = Object.keys(XAnimationInfoArray);
- this.hierarchy_tmp = [];
+ var hierarchy_tmp = [];
for (var i = 0; i < keys.length; i++) {
var bone = null;
var parent = -1;
@@ -121,12 +121,12 @@ var XAnimationObj = function () {
break;
}
}
- this.hierarchy_tmp[baseIndex] = this.makeBonekeys(XAnimationInfoArray[keys[i]], bone, parent);
+ hierarchy_tmp[baseIndex] = this.makeBonekeys(XAnimationInfoArray[keys[i]], bone, parent);
}
//Xfileの仕様で、「ボーンの順番どおりにアニメーションが出てる」との保証がないため、ボーンヒエラルキーは再定義
- var keys2 = Object.keys(this.hierarchy_tmp);
+ var keys2 = Object.keys(hierarchy_tmp);
for (var _i = 0; _i < keys2.length; _i++) {
- this.hierarchy.push(this.hierarchy_tmp[_i]);
+ this.hierarchy.push(hierarchy_tmp[_i]);
//こんどは、自分より先に「親」がいるはず。
var parentId = -1;
for (var _m = 0; _m < this.hierarchy.length; _m++) {
@@ -152,7 +152,7 @@ var XAnimationObj = function () {
var keyframe = new Object();
keyframe.time = XAnimationInfo.KeyFrames[i].time * this.fps;
keyframe.matrix = XAnimationInfo.KeyFrames[i].matrix;
- // matrixを再分解。めんどくさっ
+ // matrixを再分解。
keyframe.pos = new THREE.Vector3().setFromMatrixPosition(keyframe.matrix);
keyframe.rot = new THREE.Quaternion().setFromRotationMatrix(keyframe.matrix);
keyframe.scl = new THREE.Vector3().setFromMatrixScale(keyframe.matrix);
@@ -419,7 +419,7 @@ THREE.XFileLoader = function () {
var EndFlg = false;
- //フリーズ現象を防ぐため、1000行ずつの制御にしている(1行ずつだと遅かった)
+ //フリーズ現象を防ぐため、100行ずつの制御にしている(1行ずつだと遅かった)
for (var i = 0; i < 100; i++) {
this.LineRead(this.lines[this.endLineCount].trim());
this.endLineCount++;
@@ -429,7 +429,7 @@ THREE.XFileLoader = function () {
this.readFinalize();
setTimeout(function () {
_this2.animationFinalize();
- }, 0);
+ }, 1);
//this.onLoad(this.LoadingXdata);
break;
}
@@ -438,7 +438,7 @@ THREE.XFileLoader = function () {
if (!EndFlg) {
setTimeout(function () {
_this2.mainloop();
- }, 0);
+ }, 1);
}
}
@@ -877,7 +877,7 @@ THREE.XFileLoader = function () {
value: function readUv(line) {
var data = line.split(";");
//これは宣言された頂点の順に入っていく
- if (XfileLoader_IsUvYReverse) {
+ if (THREE.XFileLoader.IsUvYReverse) {
this.tmpUvArray.push(new THREE.Vector2(parseFloat(data[0]), 1 - parseFloat(data[1])));
} else {
this.tmpUvArray.push(new THREE.Vector2(parseFloat(data[0]), parseFloat(data[1])));
@@ -1354,7 +1354,7 @@ THREE.XFileLoader = function () {
this.LoadingXdata.XAnimationObj[i].name = this.animeKeyNames[i];
this.LoadingXdata.XAnimationObj[i].make(this.LoadingXdata.AnimationSetInfo[this.animeKeyNames[i]], tgtModel);
- tgtModel.geometry.animations = THREE.AnimationClip.parseAnimation(this.LoadingXdata.XAnimationObj[i], tgtModel.skeleton.bones);
+ // tgtModel.geometry.animations = THREE.AnimationClip.parseAnimation(this.LoadingXdata.XAnimationObj[i],tgtModel.skeleton.bones);
}
this.nowReaded++;
if (this.nowReaded >= this.animeKeyNames.length) {
@@ -1371,8 +1371,12 @@ THREE.XFileLoader = function () {
setTimeout(function () {
_this3.onLoad(_this3.LoadingXdata);
- }, 0);
+ }, 1);
}
}]);
return XFileLoader;
}();
+
+
+
+THREE.XFileLoader.IsUvYReverse = true; | true |
Other | mrdoob | three.js | 29866387030346a4c775fb9fb46a4dec10a2b72b.json | add split to long animation function | examples/webgl_loader_xfile.html | @@ -14,7 +14,7 @@
margin: 0px;
overflow: hidden;
}
-
+
#info {
color: #fff;
position: absolute;
@@ -38,10 +38,10 @@
<body>
<div id="canvase3d"></div>
- <!-- 描画領域のためのdiv要素を配置 -->
- <div id="info">
- <a href="http://threejs.org" target="_blank">three.js</a> - X-File Loader test<br />
- </div>
+
+ <div id="info">
+ <a href="http://threejs.org" target="_blank">three.js</a> - X-File Loader test<br />
+ </div>
<div id="dialog_tree" style="width:90%; height:90%;display:block;">
<ul id="bonetree" class="treeview"></ul>
</div>
@@ -50,13 +50,12 @@
<script src="../build/three.js"></script>
<script src="js/controls/OrbitControls.js"></script>
- <script src="js/loaders/XfileLoader.js"></script>
-
- <script src="js/Detector.js"></script>
- <script src="js/libs/stats.min.js"></script>
+ <script src="js/loaders/XfileLoader.js"></script>
+ <script src="js/Detector.js"></script>
+ <script src="js/libs/stats.min.js"></script>
+ <script src='js/libs/dat.gui.min.js'></script>
<script>
-
var StringBuffer = function (string) {
this.buffer = [];
this.append = function (string) { this.buffer.push(string); return this; };
@@ -68,6 +67,7 @@
var container, stats, controls;
var camera, scene, renderer;
var clock = new THREE.Clock();
+ var gui = new dat.GUI();
var mixers = [];
var manager = null;
var Texloader = null;
@@ -85,18 +85,14 @@
var d = new Date();
var LastDateTime = null;
- init();
-
var animates = [];
+ var actions = [];
+ init();
function init() {
- XfileLoader_IsUvYReverse = true;
-
LastDateTime = Date.now();
- XfileLoader_IsPosZReverse = true;
-
container = document.createElement('canvase3d');
document.body.appendChild(container);
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000);
@@ -126,34 +122,92 @@
Texloader = new THREE.TextureLoader();
var loader = new THREE.XFileLoader(manager, Texloader);
- //モデルを読み込む
+ // ! If Texture was reversed Y axis, enable the following
+ // THREE.XFileLoader.IsUvYReverse = false;
+
// read (download) model file
loader.load(['models/xfile/SSR06_Born2.x', true, true], function (object) {
for (var i = 0; i < object.FrameInfo.length; i++) {
Models.push(object.FrameInfo[i]);
scene.add(Models[i]);
- //アニメーションコントローラーをセット&作成する
- // create Animation Mixer
if (Models[i] instanceof THREE.SkinnedMesh) {
skeletonHelper = new THREE.SkeletonHelper(Models[i]);
- scene.add( skeletonHelper );
- if (Models[i].geometry.animations !== undefined) {
-
- Models[i].mixer = new THREE.AnimationMixer(Models[i]);
- animates.push(Models[i].mixer);
-
- var action = Models[i].mixer.clipAction(Models[i].geometry.animations);
- action.play();
+ scene.add(skeletonHelper);
+
+ if (object.XAnimationObj !== undefined && object.XAnimationObj.length !== 0) {
+ Models[i].geometry.animations = [];
+
+ /*
+ * ↓ that is BASIC animation data code.
+ * Usually, please use this.
+ * Because of the data I have, I use a different code
+ *
+ for (var a = 0; a < object.XAnimationObj.length; a++) {
+ Models[i].geometry.animations.push(THREE.AnimationClip.parseAnimation(object.XAnimationObj[a], Models[i].skeleton.bones));
+ }
+ Models[i].mixer = new THREE.AnimationMixer(Models[i]);
+ animates.push(Models[i].mixer);
+
+ var action = Models[i].mixer.clipAction(Models[i].geometry.animations[0]);
+ action.play();
+ */
+
+ // ↓ that is a code for [ All animation-keyframes are connected data ]. output from 'LightWave3D'
+ {
+ Models[i].geometry.animations.push(THREE.AnimationClip.parseAnimation(splitAnimation(object.XAnimationObj[0], 'stand', 10 * object.XAnimationObj[0].fps, 11 * object.XAnimationObj[0].fps), Models[i].skeleton.bones));
+ Models[i].geometry.animations.push(THREE.AnimationClip.parseAnimation(splitAnimation(object.XAnimationObj[0], 'walk', 50 * object.XAnimationObj[0].fps, 80 * object.XAnimationObj[0].fps), Models[i].skeleton.bones));
+ Models[i].geometry.animations.push(THREE.AnimationClip.parseAnimation(splitAnimation(object.XAnimationObj[0], 'dash', 140 * object.XAnimationObj[0].fps, 160 * object.XAnimationObj[0].fps), Models[i].skeleton.bones));
+ Models[i].geometry.animations.push(THREE.AnimationClip.parseAnimation(splitAnimation(object.XAnimationObj[0], 'dashing', 160 * object.XAnimationObj[0].fps, 165 * object.XAnimationObj[0].fps), Models[i].skeleton.bones));
+ Models[i].geometry.animations.push(THREE.AnimationClip.parseAnimation(splitAnimation(object.XAnimationObj[0], 'damage', 500 * object.XAnimationObj[0].fps, 530 * object.XAnimationObj[0].fps), Models[i].skeleton.bones));
+
+ Models[i].mixer = new THREE.AnimationMixer(Models[i]);
+ animates.push(Models[i].mixer);
+
+ var stand = Models[i].mixer.clipAction('stand');
+ // stand.play();
+ stand.setLoop(THREE.LoopRepeat);
+ actions['stand'] = stand;
+
+ var walk = Models[i].mixer.clipAction('walk');
+ walk.setLoop(THREE.LoopRepeat);
+ walk.play();
+ actions['walk'] = walk;
+
+ var dash = Models[i].mixer.clipAction('dash');
+ dash.setLoop(THREE.LoopOnce);
+ //dash.play();
+ actions['dash'] = dash;
+
+ var dashing = Models[i].mixer.clipAction('dashing');
+ dashing.setLoop(THREE.LoopPingPong);
+ // dashing.play();
+ actions['dashing'] = dashing;
+
+ var damage = Models[i].mixer.clipAction('damage');
+ damage.setLoop(THREE.LoopRepeat);
+ //damage.play();
+ actions['damage'] = damage;
+
+ var ActionKeys = Object.keys(actions);
+ var dmy = {};
+ dmy.gui = "";
+ dmy.action = "";
+ gui.add(dmy, 'gui');
+ gui.add(dmy, 'action', ActionKeys).onChange(function (v) {
+ animates[0].stopAllAction();
+ actions[v].play();
+ });
+ }
+ ///////////
}
-
}
}
object = null;
}, onProgress, onError);
- // ↓アニメーションとは関係ない、three.jsお約束的コード
+
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
@@ -183,32 +237,69 @@
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
-
- //update frame
+ //
function animate() {
requestAnimationFrame(animate);
var nowTime = Date.now();
var dulTime = nowTime - LastDateTime;
LastDateTime = nowTime;
- if (animates != null && animates.length > 0 ) {
+ if (animates != null && animates.length > 0) {
for (var i = 0; i < animates.length; i++) {
animates[i].update(dulTime);
}
}
- if (Models != null && Models.length > 0) {
+ if (Models != null && Models.length > 0) {
if (skeletonHelper != null) { skeletonHelper.update(); }
-
+
}
stats.update();
render();
}
function render() {
+ //renderer.setFaceCulling(THREE.CullFaceFront, THREE.FrontFaceDirectionCW);
renderer.render(scene, camera);
}
+
+ /////////////////
+ /// this is not must mount codes.
+
+ // split One and Long Animation, for time
+ function splitAnimation(_baseAnime, _name, _beginTime, _endTime) {
+ var Animation = {};
+ Animation.fps = _baseAnime.fps;
+ Animation.name = _name;
+ Animation.length = _endTime - _beginTime;
+ Animation.hierarchy = [];
+ for (var i = 0; i < _baseAnime.hierarchy.length; i++) {
+ var firstKey = -1;
+ var lastKey = -1;
+ var frame = {};
+ frame.name = _baseAnime.hierarchy[i].name;
+ frame.parent = _baseAnime.hierarchy[i].parent;
+ frame.keys = [];
+ for (var m = 1; m < _baseAnime.hierarchy[i].keys.length; m++) {
+ if (_baseAnime.hierarchy[i].keys[m].time > _beginTime) {
+ if (firstKey === -1) {
+ firstKey = m - 1;
+ frame.keys.push(_baseAnime.hierarchy[i].keys[m - 1]);
+ }
+ frame.keys.push(_baseAnime.hierarchy[i].keys[m]);
+ }
+ if (_endTime <= _baseAnime.hierarchy[i].keys[m].time || m >= _baseAnime.hierarchy[i].keys.length - 1) {
+ break;
+ }
+ }
+ for (var m = 0; m < frame.keys.length; m++) {
+ frame.keys[m].time -= _beginTime;
+ }
+ Animation.hierarchy.push(frame);
+ }
+ return Animation;
+ }
</script>
</body> | true |
Other | mrdoob | three.js | 28c5f12f246585b9975c0aec5619cd96672b243d.json | Add sourcemaps to NPM 'dev' script. | package.json | @@ -31,7 +31,7 @@
"build-test": "rollup -c test/rollup.unit.config.js",
"build-uglify": "rollup -c && uglifyjs build/three.js -cm --preamble \"// threejs.org/license\" > build/three.min.js",
"build-closure": "rollup -c && java -jar utils/build/compiler/closure-compiler-v20160713.jar --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs utils/build/externs.js --language_in=ECMASCRIPT5_STRICT --js build/three.js --js_output_file build/three.min.js",
- "dev": "rollup -c -w",
+ "dev": "rollup -c -w -m inline",
"lint": "eslint src",
"test": "rollup -c test/rollup.unit.config.js -w"
}, | false |
Other | mrdoob | three.js | 66d4ecc0ae0e6d99522fb2c13e09a3e031a06480.json | mirror rtt only | examples/js/MirrorRTT.js | @@ -0,0 +1,9 @@
+THREE.MirrorRTT = function ( width, height, options ) {
+
+ THREE.Mirror.call( this, width, height, options );
+
+ this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
+
+};
+
+THREE.MirrorRTT.prototype = Object.create( THREE.Mirror.prototype ); | true |
Other | mrdoob | three.js | 66d4ecc0ae0e6d99522fb2c13e09a3e031a06480.json | mirror rtt only | examples/webgl_mirror_nodes.html | @@ -37,6 +37,7 @@
<script src="../build/three.js"></script>
<script src="js/libs/dat.gui.min.js"></script>
<script src="js/Mirror.js"></script>
+ <script src="js/MirrorRTT.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<!-- NodeLibrary -->
@@ -152,8 +153,7 @@
var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
// MIRROR planes
- var groundMirror = new THREE.Mirror( 100, 100, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT } );
- groundMirror.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
+ var groundMirror = new THREE.MirrorRTT( 100, 100, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT } );
var mask = new THREE.SwitchNode( new THREE.TextureNode( decalDiffuse ), 'w' );
var maskFlip = new THREE.Math1Node( mask, THREE.Math1Node.INVERT ); | true |
Other | mrdoob | three.js | ef59e58d05ed00082b0699882b8788bef33c6937.json | simplify electron startpoint | editor/package.json | @@ -1,5 +0,0 @@
-{
- "name" : "your-app",
- "version" : "0.1.0",
- "main" : "main.js"
-}
\ No newline at end of file | true |
Other | mrdoob | three.js | ef59e58d05ed00082b0699882b8788bef33c6937.json | simplify electron startpoint | package.json | @@ -34,7 +34,7 @@
"dev": "rollup -c -w",
"lint": "eslint src",
"test": "rollup -c test/rollup.unit.config.js -w",
- "editor-start": "electron ./editor/"
+ "editor-start": "electron ./editor/main.js"
},
"keywords": [
"three", | true |
Other | mrdoob | three.js | 08d40df55b87e14b1a5b7104cb715eab1b4d9f77.json | Check map.format for transparency in GLTF2Loader | examples/js/loaders/GLTF2Loader.js | @@ -1219,9 +1219,15 @@ THREE.GLTF2Loader = ( function () {
}
- // set transparent true if map baseColorTexture is specified because
- // A channel values of it can be less than 1.0.
- if ( materialParams.opacity < 1.0 || materialParams.map !== undefined ) materialParams.transparent = true;
+ if ( materialParams.opacity < 1.0 ||
+ ( materialParams.map !== undefined &&
+ ( materialParams.map.format === THREE.AlphaFormat ||
+ materialParams.map.format === THREE.RGBAFormat ||
+ materialParams.map.format === THREE.LuminanceAlphaFormat ) ) ) {
+
+ materialParams.transparent = true;
+
+ }
materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0; | false |
Other | mrdoob | three.js | 0727fc42ff394dfad54c4fbc228deafeb967ece0.json | Remove .getHex() from GLTF2Loader | examples/js/loaders/GLTF2Loader.js | @@ -1212,7 +1212,7 @@ THREE.GLTF2Loader = ( function () {
} else {
- materialParams.color.setRGB( 1.0, 1.0, 1.0 ).getHex();
+ materialParams.color.setRGB( 1.0, 1.0, 1.0 );
materialParams.opacity = 1.0;
} | false |
Other | mrdoob | three.js | 294639a8182a4b92ea410b0d094500b2eb0d9c88.json | fix groups in extrudebuffergeometry | src/geometries/ExtrudeGeometry.js | @@ -641,11 +641,9 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
}
- if (options.extrudeMaterial !== undefined){
-
- scope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);
-
- }
+
+ scope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);
+
}
| false |
Other | mrdoob | three.js | 1a2a9a335b52a395e2a19f7fdc286f3df1452ef6.json | Add BoomBox model into gltf loader example | examples/webgl_loader_gltf.html | @@ -66,7 +66,8 @@
<a href="https://github.com/KhronosGroup/glTF" target="_blank">glTF</a> loader
<br>
monster by <a href="http://www.3drt.com/downloads.htm" target="_blank">3drt</a> - COLLADA duck by Sony -
- Cesium models by <a href="http://cesiumjs.org/" target="_blank">Cesium</a>
+ Cesium models by <a href="http://cesiumjs.org/" target="_blank">Cesium</a> -
+ BoomBox by <a href="https://www.microsoft.com/" target="_blank">Microsoft</a>
</div>
<div id="container"></div>
<div id="controls">
@@ -381,6 +382,14 @@
addGround:true,
extensions: ["glTF", "glTF-MaterialsCommon", "glTF-Binary"]
},
+ {
+ name : "BoomBox (PBR)", url : "./models/gltf/BoomBox/%s/BoomBox.gltf",
+ cameraPos: new THREE.Vector3(2, 1, 3),
+ objectRotation: new THREE.Euler(0, Math.PI, 0),
+ addLights:true,
+ extensions: ["glTF"]
+ },
+
{
name : "Duck", url : "./models/gltf/duck/%s/duck.gltf",
cameraPos: new THREE.Vector3(0, 3, 5), | false |
Other | mrdoob | three.js | d25ba360e20895aaac36d5ce06ed3f0a7c8a2d7f.json | Remove unnecessary comment | examples/js/loaders/GLTFLoader.js | @@ -1705,9 +1705,6 @@ THREE.GLTFLoader = ( function () {
// aspectRatio = xfov / yfov
var xfov = yfov * aspectRatio;
- // According to COLLADA spec...
- // aspect_ratio = xfov / yfov
- // yfov = ( yfov === undefined && xfov ) ? xfov / aspect_ratio : yfov;
var _camera = new THREE.PerspectiveCamera( THREE.Math.radToDeg( xfov ), aspectRatio, camera.perspective.znear || 1, camera.perspective.zfar || 2e6 );
if ( camera.name !== undefined ) _camera.name = camera.name;
| false |
Other | mrdoob | three.js | e0bf8b370e7c6e5644cb6be58ddf5310a1b1fc84.json | Use animation.name for AnimationClip | examples/js/loaders/GLTFLoader.js | @@ -1822,7 +1822,9 @@ THREE.GLTFLoader = ( function () {
}
- return new THREE.AnimationClip( "animation_" + animationId, undefined, tracks );
+ var name = animation.name !== undefined ? animation.name : "animation_" + animationId;
+
+ return new THREE.AnimationClip( name, undefined, tracks );
} );
| false |
Other | mrdoob | three.js | e9d108bec519fd48e703c068b563dabb7eb772d8.json | Accept undefined skin.bindShapeMatrix | examples/js/loaders/GLTFLoader.js | @@ -1744,8 +1744,12 @@ THREE.GLTFLoader = ( function () {
return _each( json.skins, function ( skin ) {
+ var bindShapeMatrix = new THREE.Matrix4();
+
+ if ( skin.bindShapeMatrix !== undefined ) bindShapeMatrix.fromArray( skin.bindShapeMatrix );
+
var _skin = {
- bindShapeMatrix: new THREE.Matrix4().fromArray( skin.bindShapeMatrix ),
+ bindShapeMatrix: bindShapeMatrix,
jointNames: skin.jointNames,
inverseBindMatrices: dependencies.accessors[ skin.inverseBindMatrices ]
}; | false |
Other | mrdoob | three.js | f4401306b089a0a8f5100761e41de5b7ff8dc0af.json | Accept undefined animation.samplers.interpolation | examples/js/loaders/GLTFLoader.js | @@ -1800,6 +1800,7 @@ THREE.GLTFLoader = ( function () {
: THREE.VectorKeyframeTrack;
var targetName = node.name ? node.name : node.uuid;
+ var interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : THREE.InterpolateLinear;
// KeyframeTrack.optimize() will modify given 'times' and 'values'
// buffers before creating a truncated copy to keep. Because buffers may
@@ -1808,7 +1809,7 @@ THREE.GLTFLoader = ( function () {
targetName + '.' + PATH_PROPERTIES[ target.path ],
THREE.AnimationUtils.arraySlice( inputAccessor.array, 0 ),
THREE.AnimationUtils.arraySlice( outputAccessor.array, 0 ),
- INTERPOLATION[ sampler.interpolation ]
+ interpolation
) );
} | false |
Other | mrdoob | three.js | 6c96a31043f2e41884c4471abfa07698013a0861.json | Accept undefined scene.nodes | examples/js/loaders/GLTFLoader.js | @@ -2118,7 +2118,7 @@ THREE.GLTFLoader = ( function () {
if ( scene.extras ) _scene.userData = scene.extras;
- var nodes = scene.nodes;
+ var nodes = scene.nodes || [];
for ( var i = 0, l = nodes.length; i < l; i ++ ) {
| false |
Other | mrdoob | three.js | 69818a2b676d67150e2ee2fdcd6224836c80a148.json | Accept undefined mesh.primitives (for 1.0) | examples/js/loaders/GLTFLoader.js | @@ -1551,7 +1551,7 @@ THREE.GLTFLoader = ( function () {
if ( mesh.extras ) group.userData = mesh.extras;
- var primitives = mesh.primitives;
+ var primitives = mesh.primitives || [];
for ( var name in primitives ) {
| false |
Other | mrdoob | three.js | 5bef7d6947ba89e3f2f56c083521cd2b74e3224e.json | Accept undefined bufferView.byteLength (for 1.0) | examples/js/loaders/GLTFLoader.js | @@ -976,7 +976,9 @@ THREE.GLTFLoader = ( function () {
var arraybuffer = dependencies.buffers[ bufferView.buffer ];
- return arraybuffer.slice( bufferView.byteOffset, bufferView.byteOffset + bufferView.byteLength );
+ var byteLength = bufferView.byteLength !== undefined ? bufferView.byteLength : 0;
+
+ return arraybuffer.slice( bufferView.byteOffset, bufferView.byteOffset + byteLength );
} );
| false |
Other | mrdoob | three.js | c4464b92b87030a501260f9577cb1ba2ec881dc2.json | Rename Extra Helpers to Helpers | docs/list.js | @@ -174,7 +174,7 @@ var list = {
[ "WireframeGeometry", "api/geometries/WireframeGeometry" ]
],
- "Extras / Helpers": [
+ "Helpers": [
[ "ArrowHelper", "api/helpers/ArrowHelper" ],
[ "AxisHelper", "api/helpers/AxisHelper" ],
[ "BoxHelper", "api/helpers/BoxHelper" ], | false |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/ArrowHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/AxisHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/BoxHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/CameraHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/DirectionalLightHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/FaceNormalsHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
| true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/GridHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
| true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/HemisphereLightHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/PointLightHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/PolarGridHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/RectAreaLightHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/SkeletonHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/SpotLightHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
| true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/api/helpers/VertexNormalsHelper.html | @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <base href="../../../" />
+ <base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" /> | true |
Other | mrdoob | three.js | 5c483dc67ac7fc314008bca34f5d7a341f1c3f2c.json | Fix Helpers docs paths | docs/list.js | @@ -126,23 +126,6 @@ var list = {
[ "SplineCurve", "api/extras/curves/SplineCurve" ]
],
- "Extras / Helpers": [
- [ "ArrowHelper", "api/extras/helpers/ArrowHelper" ],
- [ "AxisHelper", "api/extras/helpers/AxisHelper" ],
- [ "BoxHelper", "api/extras/helpers/BoxHelper" ],
- [ "CameraHelper", "api/extras/helpers/CameraHelper" ],
- [ "DirectionalLightHelper", "api/extras/helpers/DirectionalLightHelper" ],
- [ "FaceNormalsHelper", "api/extras/helpers/FaceNormalsHelper" ],
- [ "GridHelper", "api/extras/helpers/GridHelper" ],
- [ "PolarGridHelper", "api/extras/helpers/PolarGridHelper"],
- [ "HemisphereLightHelper", "api/extras/helpers/HemisphereLightHelper" ],
- [ "PointLightHelper", "api/extras/helpers/PointLightHelper" ],
- [ "RectAreaLightHelper", "api/extras/helpers/RectAreaLightHelper" ],
- [ "SkeletonHelper", "api/extras/helpers/SkeletonHelper" ],
- [ "SpotLightHelper", "api/extras/helpers/SpotLightHelper" ],
- [ "VertexNormalsHelper", "api/extras/helpers/VertexNormalsHelper" ]
- ],
-
"Extras / Objects": [
[ "ImmediateRenderObject", "api/extras/objects/ImmediateRenderObject" ],
[ "MorphBlendMesh", "api/extras/objects/MorphBlendMesh" ]
@@ -191,6 +174,23 @@ var list = {
[ "WireframeGeometry", "api/geometries/WireframeGeometry" ]
],
+ "Extras / Helpers": [
+ [ "ArrowHelper", "api/helpers/ArrowHelper" ],
+ [ "AxisHelper", "api/helpers/AxisHelper" ],
+ [ "BoxHelper", "api/helpers/BoxHelper" ],
+ [ "CameraHelper", "api/helpers/CameraHelper" ],
+ [ "DirectionalLightHelper", "api/helpers/DirectionalLightHelper" ],
+ [ "FaceNormalsHelper", "api/helpers/FaceNormalsHelper" ],
+ [ "GridHelper", "api/helpers/GridHelper" ],
+ [ "PolarGridHelper", "api/helpers/PolarGridHelper" ],
+ [ "HemisphereLightHelper", "api/helpers/HemisphereLightHelper" ],
+ [ "PointLightHelper", "api/helpers/PointLightHelper" ],
+ [ "RectAreaLightHelper", "api/helpers/RectAreaLightHelper" ],
+ [ "SkeletonHelper", "api/helpers/SkeletonHelper" ],
+ [ "SpotLightHelper", "api/helpers/SpotLightHelper" ],
+ [ "VertexNormalsHelper", "api/helpers/VertexNormalsHelper" ]
+ ],
+
"Lights": [
[ "AmbientLight", "api/lights/AmbientLight" ],
[ "DirectionalLight", "api/lights/DirectionalLight" ], | true |
Other | mrdoob | three.js | adb250a6bd186d328673b5862e9a706d1917dbb9.json | Fix CameraHelper docs typo | docs/api/extras/helpers/CameraHelper.html | @@ -24,8 +24,7 @@ <h2>Example</h2>
<code>
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
-
-var helper = new THREE.CameraHelper( cameraPerspective );
+var helper = new THREE.CameraHelper( camera );
scene.add( helper );
</code>
| false |
Other | mrdoob | three.js | cfacb47f9ab14e17d926a2cea888df4ab0f69a0e.json | Support Texture format in GLTFLoader | examples/js/loaders/GLTFLoader.js | @@ -1072,6 +1072,15 @@ THREE.GLTFLoader = ( function () {
if ( texture.name !== undefined ) _texture.name = texture.name;
+ _texture.format = texture.format !== undefined ? WEBGL_TEXTURE_FORMATS[ texture.format ] : THREE.RGBAFormat;
+
+ if ( texture.internalFormat !== undefined && _texture.format !== WEBGL_TEXTURE_FORMATS[ texture.internalFormat ] ) {
+
+ console.warn( 'THREE.GLTFLoader: Three.js doesn\'t support texture internalFormat which is different from texture format. ' +
+ 'internalFormat will be forced to be the same value as format.' );
+
+ }
+
_texture.type = texture.type !== undefined ? WEBGL_TEXTURE_TYPES[ texture.type ] : THREE.UnsignedByteType;
if ( texture.sampler ) { | false |
Other | mrdoob | three.js | 9dbb37e2342ce9523d1559c00244905745352f14.json | Support texture name in GLTFLoader | examples/js/loaders/GLTFLoader.js | @@ -1070,6 +1070,8 @@ THREE.GLTFLoader = ( function () {
_texture.flipY = false;
+ if ( texture.name !== undefined ) _texture.name = texture.name;
+
if ( texture.sampler ) {
var sampler = json.samplers[ texture.sampler ]; | false |
Other | mrdoob | three.js | 67d67bfcc3ce96a80d18da4f90ad7e8792402ac8.json | Avoid unneeded geometry allocations. | src/helpers/ArrowHelper.js | @@ -24,11 +24,7 @@ import { Mesh } from '../objects/Mesh';
import { Line } from '../objects/Line';
import { Vector3 } from '../math/Vector3';
-var lineGeometry = new BufferGeometry();
-lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
-
-var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
-coneGeometry.translate( 0, - 0.5, 0 );
+var lineGeometry, coneGeometry;
function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
@@ -41,6 +37,16 @@ function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
if ( headLength === undefined ) headLength = 0.2 * length;
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
+ if ( lineGeometry === undefined ) {
+
+ lineGeometry = new BufferGeometry();
+ lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
+
+ coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
+ coneGeometry.translate( 0, - 0.5, 0 );
+
+ }
+
this.position.copy( origin );
this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) ); | true |
Other | mrdoob | three.js | 67d67bfcc3ce96a80d18da4f90ad7e8792402ac8.json | Avoid unneeded geometry allocations. | src/renderers/WebGLRenderer.js | @@ -297,25 +297,8 @@ function WebGLRenderer( parameters ) {
//
- var backgroundCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
- var backgroundCamera2 = new PerspectiveCamera();
- var backgroundPlaneMesh = new Mesh(
- new PlaneBufferGeometry( 2, 2 ),
- new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
- );
- var backgroundBoxShader = ShaderLib[ 'cube' ];
- var backgroundBoxMesh = new Mesh(
- new BoxBufferGeometry( 5, 5, 5 ),
- new ShaderMaterial( {
- uniforms: backgroundBoxShader.uniforms,
- vertexShader: backgroundBoxShader.vertexShader,
- fragmentShader: backgroundBoxShader.fragmentShader,
- side: BackSide,
- depthTest: false,
- depthWrite: false,
- fog: false
- } )
- );
+ var backgroundPlaneCamera, backgroundPlaneMesh;
+ var backgroundBoxCamera, backgroundBoxMesh;
//
@@ -1186,25 +1169,56 @@ function WebGLRenderer( parameters ) {
if ( background && background.isCubeTexture ) {
- backgroundCamera2.projectionMatrix.copy( camera.projectionMatrix );
+ if ( backgroundBoxCamera === undefined ) {
+
+ backgroundBoxCamera = new PerspectiveCamera();
+
+ backgroundBoxMesh = new Mesh(
+ new BoxBufferGeometry( 5, 5, 5 ),
+ new ShaderMaterial( {
+ uniforms: ShaderLib.cube.uniforms,
+ vertexShader: ShaderLib.cube.vertexShader,
+ fragmentShader: ShaderLib.cube.fragmentShader,
+ side: BackSide,
+ depthTest: false,
+ depthWrite: false,
+ fog: false
+ } )
+ );
+
+ }
+
+ backgroundBoxCamera.projectionMatrix.copy( camera.projectionMatrix );
+
+ backgroundBoxCamera.matrixWorld.extractRotation( camera.matrixWorld );
+ backgroundBoxCamera.matrixWorldInverse.getInverse( backgroundBoxCamera.matrixWorld );
- backgroundCamera2.matrixWorld.extractRotation( camera.matrixWorld );
- backgroundCamera2.matrixWorldInverse.getInverse( backgroundCamera2.matrixWorld );
backgroundBoxMesh.material.uniforms[ "tCube" ].value = background;
- backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundCamera2.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
+ backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundBoxCamera.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
objects.update( backgroundBoxMesh );
- _this.renderBufferDirect( backgroundCamera2, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
+ _this.renderBufferDirect( backgroundBoxCamera, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
} else if ( background && background.isTexture ) {
+ if ( backgroundPlaneCamera === undefined ) {
+
+ backgroundPlaneCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
+
+ backgroundPlaneMesh = new Mesh(
+ new PlaneBufferGeometry( 2, 2 ),
+ new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
+ );
+
+ }
+
backgroundPlaneMesh.material.map = background;
objects.update( backgroundPlaneMesh );
- _this.renderBufferDirect( backgroundCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
+ _this.renderBufferDirect( backgroundPlaneCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
}
| true |
Other | mrdoob | three.js | b385a0dd095025a5dc7daa14568f626225c1d106.json | Document the AnimationUtils methods correctly | docs/api/animation/AnimationUtils.html | @@ -18,12 +18,12 @@ <h2>Methods</h2>
<h3>[method:Array arraySlice]( array, from, to )</h3>
<div>
- Convert an array to a specific type.
+ This is the same as Array.prototype.slice, but also works on typed arrays.
</div>
<h3>[method:Array convertArray]( array, type, forceClone )</h3>
<div>
- This is the same as Array.prototype.slice, but also works on typed arrays.
+ Convert an array to a specific type.
</div>
<h3>[method:Boolean isTypedArray]( object )</h3> | false |
Other | mrdoob | three.js | c21d2e9839697c2ec532256d58acc9ddd5d8745b.json | fix an MTK device bug
In some Chinese MTK device, gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS ) will return null but not 0, which will thow an Error.
this Commit can fix it. | src/renderers/webgl/WebGLUniforms.js | @@ -467,7 +467,7 @@ function WebGLUniforms( gl, program, renderer ) {
var n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );
- for ( var i = 0; i !== n; ++ i ) {
+ for ( var i = 0; i < n; ++ i ) {
var info = gl.getActiveUniform( program, i ),
path = info.name, | false |
Other | mrdoob | three.js | f1db9e5f4d701cacf58dafc12595014f65407c43.json | Add missing semicolon in PaintViveController | examples/js/vr/PaintViveController.js | @@ -52,7 +52,7 @@ THREE.PaintViveController = function ( id ) {
mesh.position.set( 0, 0.005, 0.0495 );
mesh.rotation.x = - 1.45;
mesh.scale.setScalar( 0.02 );
- this.add( mesh )
+ this.add( mesh );
var geometry = new THREE.IcosahedronGeometry( 0.1, 2 );
var material = new THREE.MeshBasicMaterial(); | false |
Other | mrdoob | three.js | a4ac61806c4cfd96665443ba98fc336f0e836165.json | Remove unnecessary comma in ShadowMapViewer | examples/js/utils/ShadowMapViewer.js | @@ -39,7 +39,7 @@ THREE.ShadowMapViewer = function ( light ) {
x: 10,
y: 10,
width: 256,
- height: 256,
+ height: 256
};
var camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, 1, 10 ); | false |
Other | mrdoob | three.js | 31397f8bb8a2a614e88fdc589af30b5fadc9a43e.json | Remove unnecessary comma in UnrealBloomPass | examples/js/postprocessing/UnrealBloomPass.js | @@ -231,7 +231,7 @@ THREE.UnrealBloomPass.prototype = Object.assign( Object.create( THREE.Pass.proto
uniforms: {
"colorTexture": { value: null },
"texSize": { value: new THREE.Vector2( 0.5, 0.5 ) },
- "direction": { value: new THREE.Vector2( 0.5, 0.5 ) },
+ "direction": { value: new THREE.Vector2( 0.5, 0.5 ) }
},
vertexShader: | false |
Other | mrdoob | three.js | 683502300442112213a6d857cc83fc74cfaeea4e.json | Add missing semicolon in Math3Node | examples/js/nodes/math/Math3Node.js | @@ -44,7 +44,7 @@ THREE.Math3Node.prototype.generate = function( builder, output ) {
var a, b, c,
al = builder.getFormatLength( this.a.getType( builder ) ),
bl = builder.getFormatLength( this.b.getType( builder ) ),
- cl = builder.getFormatLength( this.c.getType( builder ) )
+ cl = builder.getFormatLength( this.c.getType( builder ) );
// optimzer
| false |
Other | mrdoob | three.js | d606f272dcc1951e0a4becc55253dc9ce2767b48.json | Remove unnecessary comma in StandardNode | examples/js/nodes/materials/StandardNode.js | @@ -165,7 +165,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
THREE.ShaderChunk[ "lights_pars" ],
THREE.ShaderChunk[ "lights_physical_pars_fragment" ],
THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
- THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ],
+ THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ]
].join( "\n" ) );
var output = [ | false |
Other | mrdoob | three.js | 5918295ba320ba435e37a46f3caa92da73fa8712.json | Add missing semicolons in NodeMaterial | examples/js/nodes/NodeMaterial.js | @@ -41,7 +41,7 @@ THREE.NodeMaterial.addShortcuts = function( proto, prop, list ) {
}
};
- };
+ }
return ( function() {
@@ -335,7 +335,7 @@ THREE.NodeMaterial.prototype.getVar = function( uuid, type, ns ) {
var index = this.vars.length,
name = ns ? ns : 'nVv' + index;
- data = { name : name, type : type }
+ data = { name : name, type : type };
this.vars.push( data );
this.vars[ uuid ] = data; | false |
Other | mrdoob | three.js | 92340ca5ea24565f9a4f4a9ef0ab91c2c1abcfbf.json | Remove unnecessary comma in NodeBuilder | examples/js/nodes/NodeBuilder.js | @@ -67,7 +67,7 @@ THREE.NodeBuilder.prototype = {
addSlot : function( name ) {
this.slots.push( {
- name : name || '',
+ name : name || ''
} );
return this.update(); | false |
Other | mrdoob | three.js | 84fa8969e69cc95f24c8376674eed0b672615434.json | Add missing semicolon in SimplifyModifier | examples/js/modifiers/SimplifyModifier.js | @@ -134,7 +134,7 @@ THREE.SimplifyModifier = function() {
}
// we average the cost of collapsing at this vertex
- v.collapseCost = v.totalCost / v.costCount
+ v.collapseCost = v.totalCost / v.costCount;
// v.collapseCost = v.minCost;
}
@@ -349,7 +349,7 @@ THREE.SimplifyModifier = function() {
Vertex.prototype.addUniqueNeighbor = function( vertex ) {
pushIfUnique(this.neighbors, vertex);
- }
+ };
Vertex.prototype.removeIfNonNeighbor = function( n ) {
@@ -365,7 +365,7 @@ THREE.SimplifyModifier = function() {
}
neighbors.splice( offset, 1 );
- }
+ };
THREE.SimplifyModifier.prototype.modify = function( geometry, count ) {
@@ -458,4 +458,4 @@ THREE.SimplifyModifier = function() {
return newGeo;
};
-})()
\ No newline at end of file
+})(); | false |
Other | mrdoob | three.js | abf57981b7af55d82b1d415d555b5ec68d543609.json | Add missing semicolon in PCDLoader | examples/js/loaders/PCDLoader.js | @@ -100,7 +100,7 @@ Object.assign( THREE.PCDLoader.prototype, THREE.EventDispatcher.prototype, {
}
- PCDheader.offset = {}
+ PCDheader.offset = {};
var sizeSum = 0;
for ( var i = 0; i < PCDheader.fields.length; i ++ ) {
| false |
Other | mrdoob | three.js | 892a92d47eb18ccfc8b0dd69fd09f6966fd55a20.json | Remove unnecessary comma in MTLLoader | examples/js/loaders/MTLLoader.js | @@ -473,7 +473,7 @@ THREE.MTLLoader.MaterialCreator.prototype = {
var texParams = {
scale: new THREE.Vector2( 1, 1 ),
- offset: new THREE.Vector2( 0, 0 ),
+ offset: new THREE.Vector2( 0, 0 )
};
| false |
Other | mrdoob | three.js | bfa24378d6418af7c49e519383788f9194c73875.json | Add missing semicolon in MD2Loader | examples/js/loaders/MD2Loader.js | @@ -308,4 +308,4 @@ THREE.MD2Loader.prototype = {
} )()
-}
+}; | false |
Other | mrdoob | three.js | 6f5d75c3c5899a209c82dbeecde57bd0ece4fd86.json | Add missing semicolon in HDRCubeTextureLoader | examples/js/loaders/HDRCubeTextureLoader.js | @@ -9,7 +9,7 @@ THREE.HDRCubeTextureLoader = function (manager) {
this.hdrLoader = new THREE.RGBELoader();
if( THREE.Encodings === undefined ) throw new Error( "HDRCubeMapLoader requires THREE.Encodings" );
-}
+};
THREE.HDRCubeTextureLoader.prototype.load = function(type, urls, onLoad, onProgress, onError) {
var texture = new THREE.CubeTexture(); | false |
Other | mrdoob | three.js | 66b22edf2c8f75d55689ec9efbb24f6924a9284c.json | Fix implicit variable declaration in FBXLoader | examples/js/loaders/FBXLoader.js | @@ -64,7 +64,7 @@
THREE.FBXLoader.prototype.isFbxFormatASCII = function ( body ) {
- CORRECT = [ 'K', 'a', 'y', 'd', 'a', 'r', 'a', '\\', 'F', 'B', 'X', '\\', 'B', 'i', 'n', 'a', 'r', 'y', '\\', '\\' ];
+ var CORRECT = [ 'K', 'a', 'y', 'd', 'a', 'r', 'a', '\\', 'F', 'B', 'X', '\\', 'B', 'i', 'n', 'a', 'r', 'y', '\\', '\\' ];
var cursor = 0;
var read = function ( offset ) {
@@ -78,7 +78,7 @@
for ( var i = 0; i < CORRECT.length; ++ i ) {
- num = read( 1 );
+ var num = read( 1 );
if ( num == CORRECT[ i ] ) {
return false;
@@ -124,7 +124,7 @@
console.timeEnd( 'FBXLoader: ObjectParser' );
console.time( 'FBXLoader: GeometryParser' );
- geometries = this.parseGeometries( nodes );
+ var geometries = this.parseGeometries( nodes );
console.timeEnd( 'FBXLoader: GeometryParser' );
var container = new THREE.Group();
@@ -203,7 +203,7 @@
THREE.FBXLoader.prototype.parseGeometry = function ( node, nodes ) {
- geo = ( new Geometry() ).parse( node );
+ var geo = ( new Geometry() ).parse( node );
geo.addBones( this.hierarchy.hierarchy );
//*
@@ -448,7 +448,7 @@
};
var bones = mesh.geometry.bones;
- for ( frame = 0; frame < animations.frames; frame ++ ) {
+ for ( var frame = 0; frame < animations.frames; frame ++ ) {
for ( i = 0; i < bones.length; i ++ ) {
@@ -772,7 +772,7 @@
// beginning of node
var beginningOfNodeExp = new RegExp( "^\\t{" + this.currentIndent + "}(\\w+):(.*){", '' );
- match = l.match( beginningOfNodeExp );
+ var match = l.match( beginningOfNodeExp );
if ( match ) {
var nodeName = match[ 1 ].trim().replace( /^"/, '' ).replace( /"$/, "" );
@@ -789,7 +789,7 @@
// node's property
var propExp = new RegExp( "^\\t{" + ( this.currentIndent ) + "}(\\w+):[\\s\\t\\r\\n](.*)" );
- match = l.match( propExp );
+ var match = l.match( propExp );
if ( match ) {
var propName = match[ 1 ].replace( /^"/, '' ).replace( /"$/, "" ).trim(); | false |
Other | mrdoob | three.js | 0e55a079cec600a17eb67c669c683d13daa9d79d.json | Remove unnecessary comma in BVHLoader | examples/js/loaders/BVHLoader.js | @@ -116,7 +116,7 @@ THREE.BVHLoader.prototype = {
var keyframe = {
time: frameTime,
position: { x: 0, y: 0, z: 0 },
- rotation: new THREE.Quaternion(),
+ rotation: new THREE.Quaternion()
};
bone.frames.push( keyframe ); | false |
Other | mrdoob | three.js | 271ada4bb8ec049a678b6c934bffc5604463552e.json | Fix implicit declaration in 3MFLoader | examples/js/loaders/3MFLoader.js | @@ -235,7 +235,7 @@ THREE.ThreeMFLoader.prototype = {
for ( var i = 0; i < triangleNodes.length; i++ ) {
- triangleNode = triangleNodes[ i ];
+ var triangleNode = triangleNodes[ i ];
var v1 = triangleNode.getAttribute( 'v1' );
var v2 = triangleNode.getAttribute( 'v2' );
var v3 = triangleNode.getAttribute( 'v3' ); | false |
Other | mrdoob | three.js | 938f881ceb956684ee7d9288f446b96c012bafc5.json | Add missing semicolons in SEA3DLZMA | examples/js/loaders/sea3d/SEA3DLZMA.js | @@ -577,7 +577,7 @@ SEA3D.File.LZMAUncompress = function( data ) {
return this.data[ this.position ++ ];
}
- }
+ };
var outStream = {
data: [],
@@ -587,12 +587,12 @@ SEA3D.File.LZMAUncompress = function( data ) {
this.data[ this.position ++ ] = value;
}
- }
+ };
LZMA.decompressFile( inStream, outStream );
return new Uint8Array( outStream.data ).buffer;
-}
+};
SEA3D.File.setDecompressionEngine( 2, "lzma", SEA3D.File.LZMAUncompress ); | false |
Other | mrdoob | three.js | 6160d83b220550730a5310a3b96fab43aa60434e.json | Add missing semicolons in SEA3DLoader | examples/js/loaders/sea3d/SEA3DLoader.js | @@ -346,39 +346,39 @@ THREE.SEA3D.ScriptDomain = function( domain, root ) {
return domain.id;
- }
+ };
this.isRoot = function() {
return root;
- }
+ };
this.addEvent = function( type, listener ) {
events.addEventListener( type, listener );
- }
+ };
this.hasEvent = function( type, listener ) {
return events.hasEventListener( type, listener );
- }
+ };
this.removeEvent = function( type, listener ) {
events.removeEventListener( type, listener );
- }
+ };
this.dispatchEvent = function( event ) {
event.script = this;
events.dispatchEvent( event );
- }
+ };
this.dispose = function() {
@@ -388,7 +388,7 @@ THREE.SEA3D.ScriptDomain = function( domain, root ) {
this.dispatchEvent( { type : "dispose" } );
- }
+ };
};
@@ -412,21 +412,21 @@ THREE.SEA3D.ScriptManager = function() {
this.scripts.push( src );
- }
+ };
this.remove = function( src ) {
src.removeEvent( "dispose", onDisposeScript );
this.scripts.splice( this.scripts.indexOf( src ), 1 );
- }
+ };
this.contains = function( src ) {
return this.scripts.indexOf( src ) > - 1;
- }
+ };
this.dispatchEvent = function( event ) {
@@ -439,7 +439,7 @@ THREE.SEA3D.ScriptManager = function() {
}
- }
+ };
};
@@ -1120,7 +1120,7 @@ THREE.SEA3D.QUABUF = new THREE.Quaternion();
THREE.SEA3D.prototype.setShadowMap = function( light ) {
- light.shadow.mapSize.width = 2048
+ light.shadow.mapSize.width = 2048;
light.shadow.mapSize.height = 1024;
light.castShadow = true;
@@ -1917,7 +1917,7 @@ THREE.SEA3D.prototype.readCubeMap = function( sea ) {
}
- }
+ };
cubeImage.src = this.bufferToTexture( faces[ i ].buffer );
@@ -2006,15 +2006,15 @@ THREE.SEA3D.prototype.readJavaScriptMethod = function( sea ) {
'hasEvent = $SRC.hasEvent.bind( $SRC ),\n' +
'dispatchEvent = $SRC.dispatchEvent.bind( $SRC ),\n' +
'removeEvent = $SRC.removeEvent.bind( $SRC ),\n' +
- 'dispose = $SRC.dispose.bind( $SRC );\n'
+ 'dispose = $SRC.dispose.bind( $SRC );\n';
for ( var name in sea.methods ) {
src += '$METHOD["' + name + '"] = ' + declare + sea.methods[ name ].src + '}\n';
}
- src += 'return $METHOD; })'
+ src += 'return $METHOD; })';
this.domain.methods = eval( src )();
@@ -2046,7 +2046,7 @@ THREE.SEA3D.prototype.readGLSL = function( sea ) {
THREE.SEA3D.prototype.materialTechnique =
( function() {
- var techniques = {}
+ var techniques = {};
// FINAL
techniques.onComplete = function( mat, sea ) { | false |
Other | mrdoob | three.js | 476491aba1d81f20cd583d9a7c998a6f8fb1eff3.json | Add missing semicolons in SEA3DLegacy | examples/js/loaders/sea3d/SEA3DLegacy.js | @@ -456,7 +456,7 @@ THREE.SEA3D.prototype.readSkeleton = function( sea ) {
for ( var i = 0; i < sea.joint.length; i ++ ) {
- var bone = sea.joint[ i ]
+ var bone = sea.joint[ i ];
// get world inverse matrix
| false |
Other | mrdoob | three.js | af33f2a77d94534a050525ee705837f8b7a091ec.json | Add missing semicolons in SEA3DDeflate | examples/js/loaders/sea3d/SEA3DDeflate.js | @@ -77,7 +77,7 @@ var zip_border = new Array( // Order of the bit length code lengths
var zip_HuftList = function() {
this.next = null;
this.list = null;
-}
+};
var zip_HuftNode = function() {
this.e = 0; // number of extra bits or operation
@@ -86,7 +86,7 @@ var zip_HuftNode = function() {
// union
this.n = 0; // literal, length base, or distance base
this.t = null; // (zip_HuftNode) pointer to next level of table
-}
+};
var zip_HuftBuild = function(b, // code lengths in bits (all assumed <= BMAX)
n, // number of codes (assumed <= N_MAX)
@@ -309,7 +309,7 @@ var zip_HuftBuild = function(b, // code lengths in bits (all assumed <= BMAX)
/* Return true (1) if we were given an incomplete table */
this.status = ((y != 0 && g != 1) ? 1 : 0);
} /* end of constructor */
-}
+};
/* routines (inflate) */
@@ -318,23 +318,23 @@ var zip_GET_BYTE = function() {
if(zip_inflate_data.length == zip_inflate_pos)
return -1;
return zip_inflate_data[zip_inflate_pos++];
-}
+};
var zip_NEEDBITS = function(n) {
while(zip_bit_len < n) {
zip_bit_buf |= zip_GET_BYTE() << zip_bit_len;
zip_bit_len += 8;
}
-}
+};
var zip_GETBITS = function(n) {
return zip_bit_buf & zip_MASK_BITS[n];
-}
+};
var zip_DUMPBITS = function(n) {
zip_bit_buf >>= n;
zip_bit_len -= n;
-}
+};
var zip_inflate_codes = function(buff, off, size) {
/* inflate (decompress) the codes in a deflated (compressed) block.
@@ -416,7 +416,7 @@ var zip_inflate_codes = function(buff, off, size) {
zip_method = -1; // done
return n;
-}
+};
var zip_inflate_stored = function(buff, off, size) {
/* "decompress" an inflated type 0 (stored) block. */
@@ -451,7 +451,7 @@ var zip_inflate_stored = function(buff, off, size) {
if(zip_copy_leng == 0)
zip_method = -1; // done
return n;
-}
+};
var zip_inflate_fixed = function(buff, off, size) {
/* decompress an inflated type 1 (fixed Huffman codes) block. We should
@@ -504,7 +504,7 @@ var zip_inflate_fixed = function(buff, off, size) {
zip_bl = zip_fixed_bl;
zip_bd = zip_fixed_bd;
return zip_inflate_codes(buff, off, size);
-}
+};
var zip_inflate_dynamic = function(buff, off, size) {
// decompress an inflated type 2 (dynamic Huffman codes) block.
@@ -627,7 +627,7 @@ var zip_inflate_dynamic = function(buff, off, size) {
// decompress until an end-of-block code
return zip_inflate_codes(buff, off, size);
-}
+};
var zip_inflate_start = function() {
var i;
@@ -641,7 +641,7 @@ var zip_inflate_start = function() {
zip_eof = false;
zip_copy_leng = zip_copy_dist = 0;
zip_tl = null;
-}
+};
var zip_inflate_internal = function(buff, off, size) {
// decompress an inflated entry
@@ -727,7 +727,7 @@ var zip_inflate_internal = function(buff, off, size) {
n += i;
}
return n;
-}
+};
var zip_inflate = function(data) {
var i, j, pos = 0;
@@ -745,7 +745,7 @@ var zip_inflate = function(data) {
zip_inflate_data = null; // G.C.
return new Uint8Array(out).buffer;
-}
+};
if (! ctx.RawDeflate) ctx.RawDeflate = {};
ctx.RawDeflate.inflate = zip_inflate;
@@ -761,6 +761,6 @@ SEA3D.File.DeflateUncompress = function( data ) {
return RawDeflate.inflate( data );
-}
+};
-SEA3D.File.setDecompressionEngine( 1, "deflate", SEA3D.File.DeflateUncompress );
\ No newline at end of file
+SEA3D.File.setDecompressionEngine( 1, "deflate", SEA3D.File.DeflateUncompress ); | false |
Other | mrdoob | three.js | a2a0c8879d63abd2697d80a396d842f343875542.json | Remove unnecessary comma in TransformControls | examples/js/controls/TransformControls.js | @@ -444,7 +444,7 @@
var group = {
handles: this[ "handles" ],
- pickers: this[ "pickers" ],
+ pickers: this[ "pickers" ]
};
| false |
Other | mrdoob | three.js | 9fbfbf75edf80df1232c3da5a57751d15dce7abe.json | Add missing semicolon in FlyControls | examples/js/controls/FlyControls.js | @@ -270,7 +270,7 @@ THREE.FlyControls = function ( object, domElement ) {
window.removeEventListener( 'keydown', _keydown, false );
window.removeEventListener( 'keyup', _keyup, false );
- }
+ };
var _mousemove = bind( this, this.mousemove );
var _mousedown = bind( this, this.mousedown ); | false |
Other | mrdoob | three.js | 189969453917a350ff2e6af4eaf256642bb84e41.json | Add missing semicolon in FirstPersonControls | examples/js/controls/FirstPersonControls.js | @@ -269,7 +269,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
window.removeEventListener( 'keydown', _onKeyDown, false );
window.removeEventListener( 'keyup', _onKeyUp, false );
- }
+ };
var _onMouseMove = bind( this, this.onMouseMove );
var _onMouseDown = bind( this, this.onMouseDown ); | false |
Other | mrdoob | three.js | b9d8e2168c47b5b665d85e65b392eb2ac227bd0a.json | Add missing semicolon in EditorControls | examples/js/controls/EditorControls.js | @@ -13,9 +13,9 @@ THREE.EditorControls = function ( object, domElement ) {
this.enabled = true;
this.center = new THREE.Vector3();
- this.panSpeed = 0.001
- this.zoomSpeed = 0.001
- this.rotationSpeed = 0.005
+ this.panSpeed = 0.001;
+ this.zoomSpeed = 0.001;
+ this.rotationSpeed = 0.005;
// internals
| false |
Other | mrdoob | three.js | 3d7e3b644e0517f6804b7fd118985c5c62acdde7.json | Add missing semicolon in DragControls | examples/js/controls/DragControls.js | @@ -232,4 +232,4 @@ THREE.DragControls = function( _camera, _objects, _domElement ) {
}
-}
+}; | false |
Other | mrdoob | three.js | 338211e3e6749bb45d99eb3fd9228945d2001094.json | Fix Object3D tests. | test/unit/src/core/Object3D.js | @@ -12,8 +12,7 @@ QUnit.test( "rotateX" , function( assert ) {
var angleInRad = 1.562;
obj.rotateX(angleInRad);
- // should calculate the correct rotation on x
- checkIfFloatsAreEqual(obj.rotation.x, angleInRad, assert);
+ assert.numEqual( obj.rotation.x, angleInRad, "x is equal" );
});
QUnit.test( "rotateY" , function( assert ) {
@@ -22,8 +21,7 @@ QUnit.test( "rotateY" , function( assert ) {
var angleInRad = -0.346;
obj.rotateY(angleInRad);
- // should calculate the correct rotation on y
- checkIfFloatsAreEqual(obj.rotation.y, angleInRad, assert);
+ assert.numEqual( obj.rotation.y, angleInRad, "y is equal" );
});
QUnit.test( "rotateZ" , function( assert ) {
@@ -32,71 +30,53 @@ QUnit.test( "rotateZ" , function( assert ) {
var angleInRad = 1;
obj.rotateZ(angleInRad);
- // should calculate the correct rotation on y
- checkIfFloatsAreEqual(obj.rotation.z, angleInRad, assert);
+ assert.numEqual( obj.rotation.z, angleInRad, "z is equal" );
});
QUnit.test( "translateOnAxis" , function( assert ) {
var obj = new THREE.Object3D();
- // get a reference object for comparing
- var reference = {x: 1, y: 1.23, z: -4.56};
obj.translateOnAxis(new THREE.Vector3(1, 0, 0), 1);
obj.translateOnAxis(new THREE.Vector3(0, 1, 0), 1.23);
obj.translateOnAxis(new THREE.Vector3(0, 0, 1), -4.56);
- checkIfPropsAreEqual(reference, obj.position, assert);
+ assert.propEqual( obj.position, { x: 1, y: 1.23, z: -4.56 } );
});
QUnit.test( "translateX" , function( assert ) {
var obj = new THREE.Object3D();
obj.translateX(1.234);
- assert.ok( obj.position.x === 1.234 , "x is equal" );
+ assert.numEqual( obj.position.x, 1.234, "x is equal" );
});
QUnit.test( "translateY" , function( assert ) {
var obj = new THREE.Object3D();
obj.translateY(1.234);
- assert.ok( obj.position.y === 1.234 , "y is equal" );
+ assert.numEqual( obj.position.y, 1.234, "y is equal" );
});
QUnit.test( "translateZ" , function( assert ) {
var obj = new THREE.Object3D();
obj.translateZ(1.234);
- assert.ok( obj.position.z === 1.234 , "z is equal" );
+ assert.numEqual( obj.position.z, 1.234, "z is equal" );
});
QUnit.test( "lookAt" , function( assert ) {
var obj = new THREE.Object3D();
obj.lookAt(new THREE.Vector3(0, -1, 1));
- assert.ok( obj.rotation.x * RadToDeg === 45 , "x is equal" );
+ assert.numEqual( obj.rotation.x * RadToDeg, 45, "x is equal" );
});
QUnit.test( "getWorldRotation" , function( assert ) {
var obj = new THREE.Object3D();
obj.lookAt(new THREE.Vector3(0, -1, 1));
- assert.ok( obj.getWorldRotation().x * RadToDeg === 45 , "x is equal" );
+ assert.numEqual( obj.getWorldRotation().x * RadToDeg, 45, "x is equal" );
obj.lookAt(new THREE.Vector3(1, 0, 0));
- assert.ok( obj.getWorldRotation().y * RadToDeg === 90 , "y is equal" );
+ assert.numEqual( obj.getWorldRotation().y * RadToDeg, 90, "y is equal" );
});
-
-function checkIfPropsAreEqual(reference, obj, assert) {
- assert.ok( obj.x === reference.x , "x is equal" );
- assert.ok( obj.y === reference.y , "y is equal!" );
- assert.ok( obj.z === reference.z , "z is equal!" );
-}
-
-// since float equal checking is a mess in js, one solution is to cut off
-// decimal places
-function checkIfFloatsAreEqual(f1, f2, assert) {
- var f1Rounded = ((f1 * 1000) | 0) / 1000;
- var f2Rounded = ((f2 * 1000) | 0) / 1000;
-
- assert.ok( f1Rounded === f2Rounded, "passed" );
-} | false |
Other | mrdoob | three.js | d83b92ec2eeb107ef6eeb2f1c212f2376a3568ed.json | Fix light and math tests. | src/lights/RectAreaLight.js | @@ -43,6 +43,17 @@ RectAreaLight.prototype = Object.assign( Object.create( Light.prototype ), {
return this;
+ },
+
+ toJSON: function ( meta ) {
+
+ var data = Light.prototype.toJSON.call( this, meta );
+
+ data.object.width = this.width;
+ data.object.height = this.height;
+
+ return data;
+
}
} ); | true |
Other | mrdoob | three.js | d83b92ec2eeb107ef6eeb2f1c212f2376a3568ed.json | Fix light and math tests. | src/loaders/ObjectLoader.js | @@ -38,6 +38,7 @@ import { SpotLight } from '../lights/SpotLight';
import { PointLight } from '../lights/PointLight';
import { DirectionalLight } from '../lights/DirectionalLight';
import { AmbientLight } from '../lights/AmbientLight';
+import { RectAreaLight } from '../lights/RectAreaLight';
import { OrthographicCamera } from '../cameras/OrthographicCamera';
import { PerspectiveCamera } from '../cameras/PerspectiveCamera';
import { Scene } from '../scenes/Scene';
@@ -626,6 +627,12 @@ Object.assign( ObjectLoader.prototype, {
break;
+ case 'RectAreaLight':
+
+ object = new RectAreaLight( data.color, data.intensity, data.width, data.height );
+
+ break;
+
case 'SpotLight':
object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay ); | true |
Other | mrdoob | three.js | d83b92ec2eeb107ef6eeb2f1c212f2376a3568ed.json | Fix light and math tests. | test/unit/src/math/Triangle.js | @@ -96,11 +96,10 @@ QUnit.test( "normal" , function( assert ) {
QUnit.test( "plane" , function( assert ) {
var a = new THREE.Triangle();
- // artificial normal is created in this case.
- assert.ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" );
- assert.ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" );
- assert.ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" );
- assert.ok( a.plane().normal.equals( a.normal() ), "Passed!" );
+ assert.ok( isNaN( a.plane().distanceToPoint( a.a ) ), "Passed!" );
+ assert.ok( isNaN( a.plane().distanceToPoint( a.b ) ), "Passed!" );
+ assert.ok( isNaN( a.plane().distanceToPoint( a.c ) ), "Passed!" );
+ assert.propEqual( a.plane().normal, {x: NaN, y: NaN, z: NaN}, "Passed!" );
a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
assert.ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" ); | true |
Other | mrdoob | three.js | d83b92ec2eeb107ef6eeb2f1c212f2376a3568ed.json | Fix light and math tests. | test/unit/src/math/Vector2.js | @@ -225,7 +225,7 @@ QUnit.test( "setLength" , function( assert ) {
a = new THREE.Vector2( 0, 0 );
assert.ok( a.length() == 0, "Passed!" );
a.setLength( y );
- assert.ok( a.length() == 0, "Passed!" );
+ assert.ok( isNaN( a.length() ), "Passed!" );
});
QUnit.test( "lerp/clone", function( assert ) { | true |
Other | mrdoob | three.js | d83b92ec2eeb107ef6eeb2f1c212f2376a3568ed.json | Fix light and math tests. | test/unit/src/math/Vector3.js | @@ -235,7 +235,7 @@ QUnit.test( "setLength" , function( assert ) {
a = new THREE.Vector3( 0, 0, 0 );
assert.ok( a.length() == 0, "Passed!" );
a.setLength( y );
- assert.ok( a.length() == 0, "Passed!" );
+ assert.ok( isNaN( a.length() ), "Passed!" );
});
| true |
Other | mrdoob | three.js | d83b92ec2eeb107ef6eeb2f1c212f2376a3568ed.json | Fix light and math tests. | test/unit/src/math/Vector4.js | @@ -132,9 +132,9 @@ QUnit.test( "multiply/divide", function( assert ) {
b.multiplyScalar( -2 );
assert.ok( b.x == 2*x, "Passed!" );
- assert.ok( b.y == 2*y, "Passed!" );
- assert.ok( b.z == 2*z, "Passed!" );
- assert.ok( b.w == 2*w, "Passed!" );
+ assert.ok( b.y == 2*y, "Passed!" );
+ assert.ok( b.z == 2*z, "Passed!" );
+ assert.ok( b.w == 2*w, "Passed!" );
a.divideScalar( -2 );
assert.ok( a.x == x, "Passed!" );
@@ -202,7 +202,7 @@ QUnit.test( "length/lengthSq", function( assert ) {
var c = new THREE.Vector4( 0, 0, z, 0 );
var d = new THREE.Vector4( 0, 0, 0, w );
var e = new THREE.Vector4( 0, 0, 0, 0 );
-
+
assert.ok( a.length() == x, "Passed!" );
assert.ok( a.lengthSq() == x*x, "Passed!" );
assert.ok( b.length() == y, "Passed!" );
@@ -224,7 +224,7 @@ QUnit.test( "normalize" , function( assert ) {
var b = new THREE.Vector4( 0, -y, 0, 0 );
var c = new THREE.Vector4( 0, 0, z, 0 );
var d = new THREE.Vector4( 0, 0, 0, -w );
-
+
a.normalize();
assert.ok( a.length() == 1, "Passed!" );
assert.ok( a.x == 1, "Passed!" );
@@ -249,7 +249,7 @@ QUnit.test( "distanceTo/distanceToSquared", function() {
var c = new THREE.Vector4( 0, 0, z, 0 );
var d = new THREE.Vector4( 0, 0, 0, -w );
var e = new THREE.Vector4();
-
+
ok( a.distanceTo( e ) == x, "Passed!" );
ok( a.distanceToSquared( e ) == x*x, "Passed!" );
@@ -275,7 +275,7 @@ QUnit.test( "setLength" , function( assert ) {
a = new THREE.Vector4( 0, 0, 0, 0 );
assert.ok( a.length() == 0, "Passed!" );
a.setLength( y );
- assert.ok( a.length() == 0, "Passed!" );
+ assert.ok( isNaN( a.length() ), "Passed!" );
});
QUnit.test( "lerp/clone", function( assert ) { | true |
Other | mrdoob | three.js | 551fba84383ece7b214583c92216585974976bdd.json | Add NPM command to watch and rebuild tests. | package.json | @@ -33,7 +33,7 @@
"build-closure": "rollup -c && java -jar utils/build/compiler/closure-compiler-v20160713.jar --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs utils/build/externs.js --language_in=ECMASCRIPT5_STRICT --js build/three.js --js_output_file build/three.min.js",
"dev": "rollup -c -w",
"lint": "eslint src",
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "rollup -c test/rollup.unit.config.js -w"
},
"keywords": [
"three", | false |
Other | mrdoob | three.js | 42d9d311ba7a1d354031b1a5abba4be037b9c6d0.json | call gltfShader.update in object.onBeforeRender | examples/js/loaders/GLTF2Loader.js | @@ -136,15 +136,6 @@ THREE.GLTF2Loader = ( function () {
update: function ( scene, camera ) {
- // update scene graph
-
- scene.updateMatrixWorld();
-
- // update camera matrices and frustum
-
- camera.updateMatrixWorld();
- camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
for ( var name in objects ) {
var object = objects[ name ];
@@ -2177,8 +2168,10 @@ THREE.GLTF2Loader = ( function () {
// Register raw material meshes with GLTF2Loader.Shaders
if ( child.material && child.material.isRawShaderMaterial ) {
- var xshader = new GLTFShader( child, dependencies.nodes );
- GLTF2Loader.Shaders.add( child.uuid, xshader );
+ child.gltfShader = new GLTFShader( child, dependencies.nodes );
+ child.onBeforeRender = function(renderer, scene, camera){
+ this.gltfShader.update(scene, camera);
+ };
}
| true |
Other | mrdoob | three.js | 42d9d311ba7a1d354031b1a5abba4be037b9c6d0.json | call gltfShader.update in object.onBeforeRender | examples/js/loaders/GLTFLoader.js | @@ -135,15 +135,6 @@ THREE.GLTFLoader = ( function () {
update: function ( scene, camera ) {
- // update scene graph
-
- scene.updateMatrixWorld();
-
- // update camera matrices and frustum
-
- camera.updateMatrixWorld();
- camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
for ( var name in objects ) {
var object = objects[ name ];
@@ -2175,8 +2166,10 @@ THREE.GLTFLoader = ( function () {
// Register raw material meshes with GLTFLoader.Shaders
if ( child.material && child.material.isRawShaderMaterial ) {
- var xshader = new GLTFShader( child, dependencies.nodes );
- GLTFLoader.Shaders.add( child.uuid, xshader );
+ child.gltfShader = new GLTFShader( child, dependencies.nodes );
+ child.onBeforeRender = function(renderer, scene, camera){
+ this.gltfShader.update(scene, camera);
+ };
}
| true |
Other | mrdoob | three.js | 42d9d311ba7a1d354031b1a5abba4be037b9c6d0.json | call gltfShader.update in object.onBeforeRender | examples/webgl_loader_gltf.html | @@ -338,7 +338,6 @@
function animate() {
requestAnimationFrame( animate );
if (mixer) mixer.update(clock.getDelta());
- THREE.GLTF2Loader.Shaders.update(scene, camera);
if (cameraIndex == 0)
orbitControls.update();
render(); | true |
Other | mrdoob | three.js | 5cd8b0300cf6f6befdf2657994b622a2c9ed31ff.json | Add points threshold to bounding sphere radius
Resolves issues described in #7710, #9309, and #10763. (hopefully) | src/objects/Points.js | @@ -46,6 +46,7 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
sphere.copy( geometry.boundingSphere );
sphere.applyMatrix4( matrixWorld );
+ sphere.radius += threshold;
if ( raycaster.ray.intersectsSphere( sphere ) === false ) return;
| false |
Other | mrdoob | three.js | ebbe091bc4814762ad7da5c7676070adea0a12ad.json | Accept texture.source/sampler=0 in GLTF2Loader | examples/js/loaders/GLTF2Loader.js | @@ -1063,7 +1063,7 @@ THREE.GLTF2Loader = ( function () {
return _each( json.textures, function ( texture ) {
- if ( texture.source ) {
+ if ( texture.source !== undefined ) {
return new Promise( function ( resolve ) {
@@ -1103,7 +1103,7 @@ THREE.GLTF2Loader = ( function () {
_texture.type = texture.type !== undefined ? WEBGL_TEXTURE_DATATYPES[ texture.type ] : THREE.UnsignedByteType;
- if ( texture.sampler ) {
+ if ( texture.sampler !== undefined ) {
var sampler = json.samplers[ texture.sampler ];
| false |
Other | mrdoob | three.js | 3faad2bfaba6890f56fa6945c0ccc601e65d0c83.json | Revert the change of GLTFLoader | examples/js/loaders/GLTFLoader.js | @@ -1644,7 +1644,7 @@ THREE.GLTFLoader = ( function () {
}
- if ( primitive.indices !== undefined ) {
+ if ( primitive.indices ) {
geometry.setIndex( dependencies.accessors[ primitive.indices ] );
@@ -1694,7 +1694,7 @@ THREE.GLTFLoader = ( function () {
var meshNode;
- if ( primitive.indices !== undefined ) {
+ if ( primitive.indices ) {
geometry.setIndex( dependencies.accessors[ primitive.indices ] );
| false |
Other | mrdoob | three.js | 3f68e221937cd45836a4fdaee3d33e1e1eb55ac6.json | Add a comment with a link to PR | src/core/Clock.js | @@ -18,7 +18,7 @@ Object.assign( Clock.prototype, {
start: function () {
- this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now();
+ this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732
this.oldTime = this.startTime;
this.elapsedTime = 0; | false |
Other | mrdoob | three.js | 68c57aa9c9d90ef76b0f7896b64476a24c6b484a.json | Add Clock support in node | src/core/Clock.js | @@ -18,7 +18,7 @@ Object.assign( Clock.prototype, {
start: function () {
- this.startTime = ( performance || Date ).now();
+ this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now();
this.oldTime = this.startTime;
this.elapsedTime = 0;
@@ -52,7 +52,7 @@ Object.assign( Clock.prototype, {
if ( this.running ) {
- var newTime = ( performance || Date ).now();
+ var newTime = ( typeof performance === 'undefined' ? Date : performance ).now();
diff = ( newTime - this.oldTime ) / 1000;
this.oldTime = newTime; | false |
Other | mrdoob | three.js | cd140d94cd9961cc1557645adb686bf4942f6950.json | Replace magic numbers with descriptive var names | examples/js/loaders/GLTFLoader.js | @@ -1090,10 +1090,10 @@ THREE.GLTFLoader = ( function () {
var sampler = json.samplers[ texture.sampler ];
- _texture.magFilter = WEBGL_FILTERS[ sampler.magFilter || 9729 ];
- _texture.minFilter = WEBGL_FILTERS[ sampler.minFilter || 9986 ];
- _texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS || 10497 ];
- _texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT || 10497 ];
+ _texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || THREE.LinearFilter;
+ _texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || THREE.NearestMipMapLinearFilter;
+ _texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || THREE.RepeatWrapping;
+ _texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || THREE.RepeatWrapping;
}
| false |
Other | mrdoob | three.js | accd0b3b2067ac05cd2557252ba4394fd04c7939.json | Simplify the code. | src/loaders/FileLoader.js | @@ -186,18 +186,9 @@ Object.assign( FileLoader.prototype, {
if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' );
- if ( this.requestHeader !== undefined ) {
+ for ( var header in this.requestHeader ) {
- var keys = Object.keys( this.requestHeader );
-
- for ( var i = 0, il = keys.length; i < il; i ++ ) {
-
- var header = keys[ i ];
- var value = this.requestHeader[ header ];
-
- request.setRequestHeader( header, value );
-
- }
+ request.setRequestHeader( header, this.requestHeader[ header ] );
}
| false |
Other | mrdoob | three.js | 70eec3685613801310ca3799289a96be883ae843.json | fix use of k without definition | examples/js/exporters/OBJExporter.js | @@ -20,7 +20,7 @@ THREE.OBJExporter.prototype = {
var normal = new THREE.Vector3();
var uv = new THREE.Vector2();
- var i, j, l, m, face = [];
+ var i, j, k, l, m, face = [];
var parseMesh = function ( mesh ) {
| false |
Other | mrdoob | three.js | 6f68f3c93fcbdf7a79bc9e99e47a17569580c502.json | Add setRequestHeader method to FileLoader | src/loaders/FileLoader.js | @@ -186,6 +186,21 @@ Object.assign( FileLoader.prototype, {
if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' );
+ if ( this.requestHeader !== undefined ) {
+
+ var keys = Object.keys( this.requestHeader );
+
+ for ( var i = 0, il = keys.length; i < il; i ++ ) {
+
+ var header = keys[ i ];
+ var value = this.requestHeader[ header ];
+
+ request.setRequestHeader( header, value );
+
+ }
+
+ }
+
request.send( null );
}
@@ -222,6 +237,13 @@ Object.assign( FileLoader.prototype, {
this.mimeType = value;
return this;
+ },
+
+ setRequestHeader: function ( value ) {
+
+ this.requestHeader = value;
+ return this;
+
}
} ); | false |
Other | mrdoob | three.js | 1157238af9bed9ddc7d86d4538b4caaa26323b21.json | Fix typo in _removeInactiveAction.
Fixes #10700. | src/animation/AnimationMixer.js | @@ -284,7 +284,7 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
var actionByRoot = actionsForClip.actionByRoot,
- rootUuid = ( actions._localRoot || this._root ).uuid;
+ rootUuid = ( action._localRoot || this._root ).uuid;
delete actionByRoot[ rootUuid ];
| false |
Other | mrdoob | three.js | c7d02f6d564903ee25c057d13842575200da04d6.json | Fix typo in AudioListener documentation | docs/api/audio/AudioListener.html | @@ -93,7 +93,7 @@ <h3>[method:Number getMasterVolume]()</h3>
Return the volume.
</div>
- <h3>[method:null getMasterVolume]( [page:Number value] )</h3>
+ <h3>[method:null setMasterVolume]( [page:Number value] )</h3>
<div>
Set the volume.
</div> | false |
Other | mrdoob | three.js | bc885619e770b64acd4a22f35c55c1436235ff9b.json | Remove USE_SPECULAR2MAP from shader | src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl | @@ -1,4 +1,4 @@
-#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP ) || defined( USE_GLOSSINESSMAP) || defined( USE_SPECULAR2MAP )
+#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP ) || defined( USE_GLOSSINESSMAP )
varying vec2 vUv;
| true |
Other | mrdoob | three.js | bc885619e770b64acd4a22f35c55c1436235ff9b.json | Remove USE_SPECULAR2MAP from shader | src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl | @@ -1,4 +1,4 @@
-#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP ) || defined( USE_GLOSSINESSMAP) || defined( USE_SPECULAR2MAP )
+#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP ) || defined( USE_GLOSSINESSMAP )
varying vec2 vUv;
uniform vec4 offsetRepeat; | true |
Other | mrdoob | three.js | bc885619e770b64acd4a22f35c55c1436235ff9b.json | Remove USE_SPECULAR2MAP from shader | src/renderers/shaders/ShaderChunk/uv_vertex.glsl | @@ -1,4 +1,4 @@
-#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP ) || defined( USE_GLOSSINESSMAP) || defined( USE_SPECULAR2MAP )
+#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP ) || defined( USE_GLOSSINESSMAP )
vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
| true |
Other | mrdoob | three.js | 8360b532643264f817e9d648b72e43c20f111ba5.json | Fix diffuse shader code of Specular-Glossiness | src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl | @@ -1,7 +1,7 @@
PhysicalMaterial material;
#ifdef STANDARD_SG
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - max( max( specular2Factor.r, specular2Factor.g ), specular2Factor.b ) );
+ material.diffuseColor = diffuseColor.rgb;
material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );
material.specularColor = specular2Factor.rgb;
#else | false |
Other | mrdoob | three.js | f99ce24e8212a1ff6fd2883e80140df325a15746.json | Move a comment line in AnimationAction | src/animation/AnimationAction.js | @@ -328,6 +328,8 @@ Object.assign( AnimationAction.prototype, {
_update: function( time, deltaTime, timeDirection, accuIndex ) {
+ // called by the mixer
+
if ( ! this.enabled ) {
// call ._updateWeight() to update ._effectiveWeight
@@ -337,8 +339,6 @@ Object.assign( AnimationAction.prototype, {
}
- // called by the mixer
-
var startTime = this._startTime;
if ( startTime !== null ) { | false |
Other | mrdoob | three.js | 8cda17649d7cfaff1a9728f3f02c7bc5075ab949.json | Fix comments in AnimationAction | src/animation/AnimationAction.js | @@ -66,8 +66,8 @@ function AnimationAction( mixer, clip, localRoot ) {
this.repetitions = Infinity; // no. of repetitions when looping
- this.paused = false; // false -> zero effective time scale
- this.enabled = true; // true -> zero effective weight
+ this.paused = false; // true -> zero effective time scale
+ this.enabled = true; // false -> zero effective weight
this.clampWhenFinished = false; // keep feeding the last frame?
@@ -220,7 +220,7 @@ Object.assign( AnimationAction.prototype, {
// Time Scale Control
- // set the weight stopping any scheduled warping
+ // set the time scale stopping any scheduled warping
// although .paused = true yields an effective time scale of zero, this
// method does *not* change .paused, because it would be confusing
setEffectiveTimeScale: function( timeScale ) { | false |
Other | mrdoob | three.js | 073f3736275625813b838cbb9547c8bfcf4096e9.json | Use 2D noise in webgl_gpgpu_water demo
Using 3D or higher simplex noise (for example, using 3D simplex noise in the demo) may be problematic because of [U.S. 6067776](https://www.google.com/patents/US6867776). (I am not a lawyer.) Fortunately, the demo doesn't appear to rely on 3D noise and can just use 2D noise instead, which I have done here. Alternatively, the demo can use OpenSimplex noise instead, but that seems too considerable an effort for me to propose for now. | examples/webgl_gpgpu_water.html | @@ -421,7 +421,7 @@
var mult = 0.025;
var r = 0;
for ( var i = 0; i < 15; i++ ) {
- r += multR * simplex.noise3d( x * mult, y * mult, z * mult );
+ r += multR * simplex.noise( x * mult, y * mult );
multR *= 0.53 + 0.025 * i;
mult *= 1.25;
} | false |
Other | mrdoob | three.js | 640043905206a080a36c0981a28aca6c42184767.json | use UserAgent to detect IE | examples/js/renderers/CSS3DRenderer.js | @@ -63,10 +63,7 @@ THREE.CSS3DRenderer = function () {
domElement.appendChild( cameraElement );
- // Should we replace to feature detection?
- // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/transformstylepreserve3d.js
- // So far, we use `document.documentMode` to detect IE
- var isFlatTransform = !! document.documentMode;
+ var isIE = /Trident/i.test( navigator.userAgent )
this.setClearColor = function () {};
@@ -147,16 +144,16 @@ THREE.CSS3DRenderer = function () {
epsilon( elements[ 15 ] ) +
')';
- if ( ! isFlatTransform ) {
+ if ( isIE ) {
- return 'translate(-50%,-50%)' + matrix3d;
+ return 'translate(-50%,-50%)' +
+ 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)' +
+ cameraCSSMatrix +
+ matrix3d;
}
- return 'translate(-50%,-50%)' +
- 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)' +
- cameraCSSMatrix +
- matrix3d;
+ return 'translate(-50%,-50%)' + matrix3d;
}
@@ -199,7 +196,7 @@ THREE.CSS3DRenderer = function () {
cache.objects[ object.id ] = { style: style };
- if ( isFlatTransform ) {
+ if ( isIE ) {
cache.objects[ object.id ].distanceToCameraSquared = getDistanceToSquared( camera, object );
@@ -293,7 +290,7 @@ THREE.CSS3DRenderer = function () {
var style = cameraCSSMatrix +
'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)';
- if ( ! isFlatTransform && cache.camera.style !== style ) {
+ if ( cache.camera.style !== style && ! isIE ) {
cameraElement.style.WebkitTransform = style;
cameraElement.style.MozTransform = style;
@@ -305,7 +302,7 @@ THREE.CSS3DRenderer = function () {
renderObject( scene, camera, cameraCSSMatrix );
- if ( isFlatTransform ) {
+ if ( isIE ) {
// IE10 and 11 does not support 'preserve-3d'.
// Thus, z-order in 3D will not work. | false |
Other | mrdoob | three.js | 1a85493265460fb2db69da259ed841d0d2faa829.json | Remove usage of THREE.ImageUtils.loadTexture | examples/js/loaders/AssimpLoader.js | @@ -966,8 +966,7 @@
path = path.substr( path.lastIndexOf( "/" ) + 1 );
}
-
- return THREE.ImageUtils.loadTexture( baseURL + path );
+ return ( new TextureLoader() ).load( baseURL + path );
};
@@ -2350,4 +2349,4 @@
THREE.AssimpLoader = AssimpLoader;
-} )();
\ No newline at end of file
+} )();
| false |
Other | mrdoob | three.js | 796539369ef1a808ccd6b250ec2b2a327cf7bd37.json | Simplify regex a bit, update comments. | src/animation/PropertyBinding.js | @@ -108,13 +108,12 @@ Object.assign( PropertyBinding, {
// be matched to parse the rest of the track name.
var directoryRe = /((?:[\w-]+[\/:])*)/;
- // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'
- // characters, but must begin and end with a word character.
- var nodeRe = /(\w(?:[\w-\.]*\w)?)?/;
+ // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
+ var nodeRe = /([\w-\.]+)?/;
// Object on target node, and accessor. May contain only word characters,
// and must be a member of the supportedObjectNames whitelist. Accessor may
- // contain any non-bracket characters.
+ // contain any character except closing bracket.
var objectRe = /(?:\.([\w-]+)(?:\[(.+)\])?)?/;
// Property and accessor. May contain only word characters. Accessor may
@@ -144,11 +143,11 @@ Object.assign( PropertyBinding, {
var results = {
// directoryName: matches[ 1 ], // (tschw) currently unused
- nodeName: matches[ 2 ], // allowed to be null, specified root node.
+ nodeName: matches[ 2 ],
objectName: matches[ 3 ],
objectIndex: matches[ 4 ],
- propertyName: matches[ 5 ],
- propertyIndex: matches[ 6 ] // allowed to be null, specifies that the whole property is set.
+ propertyName: matches[ 5 ], // required
+ propertyIndex: matches[ 6 ]
};
var lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );
@@ -159,7 +158,7 @@ Object.assign( PropertyBinding, {
if ( supportedObjectNames.indexOf( objectName ) !== -1 ) {
- results.nodeName = results.nodeName.substring( 0, lastDot )
+ results.nodeName = results.nodeName.substring( 0, lastDot );
results.objectName = objectName;
} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.