Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c3de325d
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c3de325d
编写于
5月 02, 2018
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
bd63a6cc
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
854 addition
and
525 deletion
+854
-525
build/three.js
build/three.js
+179
-16
build/three.min.js
build/three.min.js
+496
-493
build/three.module.js
build/three.module.js
+179
-16
未找到文件。
build/three.js
浏览文件 @
c3de325d
...
...
@@ -21139,6 +21139,14 @@
};
this.isPresenting = isPresenting;
this.requestAnimationFrame = function ( callback ) {
device.requestAnimationFrame( callback );
};
this.submitFrame = function () {
if ( isPresenting() ) device.submitFrame();
...
...
@@ -21157,6 +21165,141 @@
}
/**
* @author mrdoob / http://mrdoob.com/
*/
function WebXRManager( gl ) {
var device = null;
var session = null;
var frameOfRef = null;
var isExclusive = false;
var pose = null;
function isPresenting() {
return session !== null && frameOfRef !== null;
}
//
var cameraL = new PerspectiveCamera();
cameraL.layers.enable( 1 );
cameraL.viewport = new Vector4();
var cameraR = new PerspectiveCamera();
cameraR.layers.enable( 2 );
cameraR.viewport = new Vector4();
var cameraVR = new ArrayCamera( [ cameraL, cameraR ] );
cameraVR.layers.enable( 1 );
cameraVR.layers.enable( 2 );
//
this.enabled = false;
this.getDevice = function () {
return device;
};
this.setDevice = function ( value ) {
if ( value !== undefined ) device = value;
gl.setCompatibleXRDevice( value );
};
this.setSession = function ( value ) {
session = value;
if ( session !== null ) {
session.baseLayer = new XRWebGLLayer( session, gl );
session.requestFrameOfReference( 'stage' ).then( function ( value ) {
frameOfRef = value;
isExclusive = session.exclusive;
console.log( 0 );
} );
}
};
this.getCamera = function ( camera ) {
return isPresenting() ? cameraVR : camera;
};
this.isPresenting = isPresenting;
this.requestAnimationFrame = function ( callback ) {
console.log( 1 );
function onFrame( time, frame ) {
pose = frame.getDevicePose( frameOfRef );
var layer = session.baseLayer;
var views = frame.views;
for ( var i = 0; i < views.length; i ++ ) {
var view = views[ i ];
var viewport = layer.getViewport( view );
var viewMatrix = pose.getViewMatrix( view );
var camera = cameraVR.cameras[ i ];
camera.projectionMatrix.fromArray( view.projectionMatrix );
camera.matrixWorldInverse.fromArray( viewMatrix );
camera.matrixWorld.getInverse( camera.matrixWorldInverse );
camera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );
if ( i === 0 ) {
cameraVR.matrixWorld.copy( camera.matrixWorld );
cameraVR.matrixWorldInverse.copy( camera.matrixWorldInverse );
// HACK (mrdoob)
// https://github.com/w3c/webvr/issues/203
cameraVR.projectionMatrix.copy( camera.projectionMatrix );
}
}
gl.bindFramebuffer( gl.FRAMEBUFFER, session.baseLayer.framebuffer );
callback();
}
session.requestAnimationFrame( onFrame );
};
this.submitFrame = function () {
// if ( device && device.isPresenting ) device.submitFrame();
};
}
/**
* @author supereggbert / http://www.paulbrunt.co.uk/
* @author mrdoob / http://mrdoob.com/
...
...
@@ -21402,7 +21545,7 @@
// vr
var vr = new WebVRManager( _this );
var vr =
( 'xr' in navigator ) ? new WebXRManager( _gl ) :
new WebVRManager( _this );
this.vr = vr;
...
...
@@ -21467,9 +21610,7 @@
this.setSize = function ( width, height, updateStyle ) {
var device = vr.getDevice();
if ( device && device.isPresenting ) {
if ( vr.isPresenting() ) {
console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
return;
...
...
@@ -22151,11 +22292,9 @@
function requestAnimationLoopFrame() {
var device = vr.getDevice();
if ( vr.isPresenting() ) {
if ( device && device.isPresenting ) {
device.requestAnimationFrame( animationLoop );
vr.requestAnimationFrame( animationLoop );
} else {
...
...
@@ -22502,14 +22641,22 @@
if ( object.layers.test( camera2.layers ) ) {
var bounds = camera2.bounds;
if ( 'viewport' in camera2 ) { // XR
state.viewport( _currentViewport.copy( camera2.viewport ) );
} else {
var bounds = camera2.bounds;
var x = bounds.x * _width;
var y = bounds.y * _height;
var width = bounds.z * _width;
var height = bounds.w * _height;
var x = bounds.x * _width;
var y = bounds.y * _height;
var width = bounds.z * _width;
var height = bounds.w * _height;
state.viewport( _currentViewport.set( x, y, width, height ).multiplyScalar( _pixelRatio ) );
state.viewport( _currentViewport.set( x, y, width, height ).multiplyScalar( _pixelRatio ) );
}
renderObject( object, scene, camera2, geometry, material, group );
...
...
@@ -35222,7 +35369,8 @@
'name': clip.name,
'duration': clip.duration,
'tracks': tracks
'tracks': tracks,
'uuid': clip.uuid
};
...
...
@@ -37105,7 +37253,11 @@
for ( var i = 0; i < json.length; i ++ ) {
var clip = AnimationClip.parse( json[ i ] );
var data = json[ i ];
var clip = AnimationClip.parse( data );
if ( data.uuid !== undefined ) clip.uuid = data.uuid;
animations.push( clip );
...
...
@@ -38553,6 +38705,17 @@
},
setMediaElementSource: function ( mediaElement ) {
this.hasPlaybackControl = false;
this.sourceType = 'mediaNode';
this.source = this.context.createMediaElementSource( mediaElement );
this.connect();
return this;
},
setBuffer: function ( audioBuffer ) {
this.buffer = audioBuffer;
build/three.min.js
浏览文件 @
c3de325d
此差异已折叠。
点击以展开。
build/three.module.js
浏览文件 @
c3de325d
...
...
@@ -21133,6 +21133,14 @@ function WebVRManager( renderer ) {
};
this.isPresenting = isPresenting;
this.requestAnimationFrame = function ( callback ) {
device.requestAnimationFrame( callback );
};
this.submitFrame = function () {
if ( isPresenting() ) device.submitFrame();
...
...
@@ -21151,6 +21159,141 @@ function WebVRManager( renderer ) {
}
/**
* @author mrdoob / http://mrdoob.com/
*/
function WebXRManager( gl ) {
var device = null;
var session = null;
var frameOfRef = null;
var isExclusive = false;
var pose = null;
function isPresenting() {
return session !== null && frameOfRef !== null;
}
//
var cameraL = new PerspectiveCamera();
cameraL.layers.enable( 1 );
cameraL.viewport = new Vector4();
var cameraR = new PerspectiveCamera();
cameraR.layers.enable( 2 );
cameraR.viewport = new Vector4();
var cameraVR = new ArrayCamera( [ cameraL, cameraR ] );
cameraVR.layers.enable( 1 );
cameraVR.layers.enable( 2 );
//
this.enabled = false;
this.getDevice = function () {
return device;
};
this.setDevice = function ( value ) {
if ( value !== undefined ) device = value;
gl.setCompatibleXRDevice( value );
};
this.setSession = function ( value ) {
session = value;
if ( session !== null ) {
session.baseLayer = new XRWebGLLayer( session, gl );
session.requestFrameOfReference( 'stage' ).then( function ( value ) {
frameOfRef = value;
isExclusive = session.exclusive;
console.log( 0 );
} );
}
};
this.getCamera = function ( camera ) {
return isPresenting() ? cameraVR : camera;
};
this.isPresenting = isPresenting;
this.requestAnimationFrame = function ( callback ) {
console.log( 1 );
function onFrame( time, frame ) {
pose = frame.getDevicePose( frameOfRef );
var layer = session.baseLayer;
var views = frame.views;
for ( var i = 0; i < views.length; i ++ ) {
var view = views[ i ];
var viewport = layer.getViewport( view );
var viewMatrix = pose.getViewMatrix( view );
var camera = cameraVR.cameras[ i ];
camera.projectionMatrix.fromArray( view.projectionMatrix );
camera.matrixWorldInverse.fromArray( viewMatrix );
camera.matrixWorld.getInverse( camera.matrixWorldInverse );
camera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );
if ( i === 0 ) {
cameraVR.matrixWorld.copy( camera.matrixWorld );
cameraVR.matrixWorldInverse.copy( camera.matrixWorldInverse );
// HACK (mrdoob)
// https://github.com/w3c/webvr/issues/203
cameraVR.projectionMatrix.copy( camera.projectionMatrix );
}
}
gl.bindFramebuffer( gl.FRAMEBUFFER, session.baseLayer.framebuffer );
callback();
}
session.requestAnimationFrame( onFrame );
};
this.submitFrame = function () {
// if ( device && device.isPresenting ) device.submitFrame();
};
}
/**
* @author supereggbert / http://www.paulbrunt.co.uk/
* @author mrdoob / http://mrdoob.com/
...
...
@@ -21396,7 +21539,7 @@ function WebGLRenderer( parameters ) {
// vr
var vr = new WebVRManager( _this );
var vr =
( 'xr' in navigator ) ? new WebXRManager( _gl ) :
new WebVRManager( _this );
this.vr = vr;
...
...
@@ -21461,9 +21604,7 @@ function WebGLRenderer( parameters ) {
this.setSize = function ( width, height, updateStyle ) {
var device = vr.getDevice();
if ( device && device.isPresenting ) {
if ( vr.isPresenting() ) {
console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
return;
...
...
@@ -22145,11 +22286,9 @@ function WebGLRenderer( parameters ) {
function requestAnimationLoopFrame() {
var device = vr.getDevice();
if ( vr.isPresenting() ) {
if ( device && device.isPresenting ) {
device.requestAnimationFrame( animationLoop );
vr.requestAnimationFrame( animationLoop );
} else {
...
...
@@ -22496,14 +22635,22 @@ function WebGLRenderer( parameters ) {
if ( object.layers.test( camera2.layers ) ) {
var bounds = camera2.bounds;
if ( 'viewport' in camera2 ) { // XR
state.viewport( _currentViewport.copy( camera2.viewport ) );
} else {
var bounds = camera2.bounds;
var x = bounds.x * _width;
var y = bounds.y * _height;
var width = bounds.z * _width;
var height = bounds.w * _height;
var x = bounds.x * _width;
var y = bounds.y * _height;
var width = bounds.z * _width;
var height = bounds.w * _height;
state.viewport( _currentViewport.set( x, y, width, height ).multiplyScalar( _pixelRatio ) );
state.viewport( _currentViewport.set( x, y, width, height ).multiplyScalar( _pixelRatio ) );
}
renderObject( object, scene, camera2, geometry, material, group );
...
...
@@ -35216,7 +35363,8 @@ Object.assign( AnimationClip, {
'name': clip.name,
'duration': clip.duration,
'tracks': tracks
'tracks': tracks,
'uuid': clip.uuid
};
...
...
@@ -37099,7 +37247,11 @@ Object.assign( ObjectLoader.prototype, {
for ( var i = 0; i < json.length; i ++ ) {
var clip = AnimationClip.parse( json[ i ] );
var data = json[ i ];
var clip = AnimationClip.parse( data );
if ( data.uuid !== undefined ) clip.uuid = data.uuid;
animations.push( clip );
...
...
@@ -38547,6 +38699,17 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
},
setMediaElementSource: function ( mediaElement ) {
this.hasPlaybackControl = false;
this.sourceType = 'mediaNode';
this.source = this.context.createMediaElementSource( mediaElement );
this.connect();
return this;
},
setBuffer: function ( audioBuffer ) {
this.buffer = audioBuffer;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录