Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
366eec61
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,发现更多精彩内容 >>
提交
366eec61
编写于
6月 24, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
0f86e3cf
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
408 addition
and
370 deletion
+408
-370
build/three.js
build/three.js
+121
-82
build/three.min.js
build/three.min.js
+287
-288
未找到文件。
build/three.js
浏览文件 @
366eec61
...
...
@@ -19396,20 +19396,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var setDefaultGLState = function () {
_gl.clearColor( 0, 0, 0, 1 );
_gl.clearDepth( 1 );
_gl.clearStencil( 0 );
_gl.enable( _gl.DEPTH_TEST );
_gl.depthFunc( _gl.LEQUAL );
_gl.frontFace( _gl.CCW );
_gl.cullFace( _gl.BACK );
_gl.enable( _gl.CULL_FACE );
_gl.enable( _gl.BLEND );
_gl.blendEquation( _gl.FUNC_ADD );
_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA );
state.init();
_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );
...
...
@@ -21092,6 +21079,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var shader = THREE.ShaderLib[ shaderID ];
material.__webglShader = {
name: material.type,
uniforms: THREE.UniformsUtils.clone( shader.uniforms ),
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader
...
...
@@ -21100,6 +21088,7 @@ THREE.WebGLRenderer = function ( parameters ) {
} else {
material.__webglShader = {
name: material.type,
uniforms: material.uniforms,
vertexShader: material.vertexShader,
fragmentShader: material.fragmentShader
...
...
@@ -23845,6 +23834,8 @@ THREE.WebGLProgram = ( function () {
'precision ' + parameters.precision + ' float;',
'precision ' + parameters.precision + ' int;',
'#define SHADER_NAME ' + material.__webglShader.name,
customDefines,
parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',
...
...
@@ -24173,6 +24164,7 @@ THREE.WebGLShader = ( function () {
THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
var _gl = _renderer.context,
_state = _renderer.state,
_frustum = new THREE.Frustum(),
_projScreenMatrix = new THREE.Matrix4(),
...
...
@@ -24251,7 +24243,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
// set GL state for depth map
_gl.clearColor( 1, 1, 1, 1 );
_
gl.disable( _gl.BLEND
);
_
state.setBlend( false
);
_gl.enable( _gl.CULL_FACE );
_gl.frontFace( _gl.CCW );
...
...
@@ -24266,7 +24258,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
}
_
renderer.
state.setDepthTest( true );
_state.setDepthTest( true );
// preprocess lights
// - skip lights that are not casting shadows
...
...
@@ -24503,7 +24495,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
clearAlpha = _renderer.getClearAlpha();
_gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearAlpha );
_
gl.enable( _gl.BLEND
);
_
state.setBlend( true
);
if ( scope.cullFace === THREE.CullFaceFront ) {
...
...
@@ -24695,6 +24687,7 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
var newAttributes = new Uint8Array( 16 );
var enabledAttributes = new Uint8Array( 16 );
var currentBlend = null;
var currentBlending = null;
var currentBlendEquation = null;
var currentBlendSrc = null;
...
...
@@ -24723,6 +24716,25 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
var currentTextureSlot = undefined;
var currentBoundTextures = {};
this.init = function () {
gl.clearColor( 0, 0, 0, 1 );
gl.clearDepth( 1 );
gl.clearStencil( 0 );
gl.enable( gl.DEPTH_TEST );
gl.depthFunc( gl.LEQUAL );
gl.frontFace( gl.CCW );
gl.cullFace( gl.BACK );
gl.enable( gl.CULL_FACE );
gl.enable( gl.BLEND );
gl.blendEquation( gl.FUNC_ADD );
gl.blendFunc( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA );
};
this.initAttributes = function () {
for ( var i = 0, l = newAttributes.length; i < l; i ++ ) {
...
...
@@ -24761,41 +24773,63 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
};
this.setBlend = function ( blend ) {
if ( blend !== currentBlend ) {
if ( blend ) {
gl.enable( gl.BLEND );
} else {
gl.disable( gl.BLEND );
}
currentBlend = blend;
}
};
this.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {
if ( blending !== currentBlending ) {
if ( blending === THREE.NoBlending ) {
gl.disable( gl.BLEND
);
this.setBlend( false
);
} else if ( blending === THREE.AdditiveBlending ) {
gl.enable( gl.BLEND
);
this.setBlend( true
);
gl.blendEquation( gl.FUNC_ADD );
gl.blendFunc( gl.SRC_ALPHA, gl.ONE );
} else if ( blending === THREE.SubtractiveBlending ) {
// TODO: Find blendFuncSeparate() combination
gl.enable( gl.BLEND );
this.setBlend( true );
gl.blendEquation( gl.FUNC_ADD );
gl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR );
} else if ( blending === THREE.MultiplyBlending ) {
// TODO: Find blendFuncSeparate() combination
gl.enable( gl.BLEND );
this.setBlend( true );
gl.blendEquation( gl.FUNC_ADD );
gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
} else if ( blending === THREE.CustomBlending ) {
gl.enable( gl.BLEND
);
this.setBlend( true
);
} else {
gl.enable( gl.BLEND
);
this.setBlend( true
);
gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD );
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );
...
...
@@ -24895,6 +24929,7 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
default:
gl.depthFunc( gl.LEQUAL );
}
} else {
...
...
@@ -25139,6 +25174,7 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) {
THREE.LensFlarePlugin = function ( renderer, flares ) {
var gl = renderer.context;
var state = renderer.state;
var vertexBuffer, elementBuffer;
var program, attributes, uniforms;
...
...
@@ -25176,14 +25212,14 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
tempTexture = gl.createTexture();
occlusionTexture = gl.createTexture();
renderer.
state.bindTexture( gl.TEXTURE_2D, tempTexture );
state.bindTexture( gl.TEXTURE_2D, tempTexture );
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );
renderer.
state.bindTexture( gl.TEXTURE_2D, occlusionTexture );
state.bindTexture( gl.TEXTURE_2D, occlusionTexture );
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );
...
...
@@ -25428,10 +25464,10 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
gl.useProgram( program );
renderer.
state.initAttributes();
renderer.
state.enableAttribute( attributes.vertex );
renderer.
state.enableAttribute( attributes.uv );
renderer.
state.disableUnusedAttributes();
state.initAttributes();
state.enableAttribute( attributes.vertex );
state.enableAttribute( attributes.uv );
state.disableUnusedAttributes();
// loop through all lens flares to update their occlusion and positions
// setup gl and common used attribs/unforms
...
...
@@ -25479,8 +25515,10 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
// save current RGB to temp texture
renderer.state.activeTexture( gl.TEXTURE1 );
renderer.state.bindTexture( gl.TEXTURE_2D, tempTexture );
state.activeTexture( gl.TEXTURE0 );
state.bindTexture( gl.TEXTURE_2D, null );
state.activeTexture( gl.TEXTURE1 );
state.bindTexture( gl.TEXTURE_2D, tempTexture );
gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );
...
...
@@ -25490,7 +25528,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
gl.uniform2f( uniforms.scale, scale.x, scale.y );
gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z );
gl.disable( gl.BLEND
);
state.setBlend( false
);
gl.enable( gl.DEPTH_TEST );
gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );
...
...
@@ -25498,8 +25536,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
// copy result to occlusionMap
renderer.
state.activeTexture( gl.TEXTURE0 );
renderer.
state.bindTexture( gl.TEXTURE_2D, occlusionTexture );
state.activeTexture( gl.TEXTURE0 );
state.bindTexture( gl.TEXTURE_2D, occlusionTexture );
gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );
...
...
@@ -25508,8 +25546,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
gl.uniform1i( uniforms.renderType, 1 );
gl.disable( gl.DEPTH_TEST );
renderer.
state.activeTexture( gl.TEXTURE1 );
renderer.
state.bindTexture( gl.TEXTURE_2D, tempTexture );
state.activeTexture( gl.TEXTURE1 );
state.bindTexture( gl.TEXTURE_2D, tempTexture );
gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );
...
...
@@ -25530,7 +25568,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
// render flares
gl.uniform1i( uniforms.renderType, 2 );
gl.enable( gl.BLEND
);
state.setBlend( true
);
for ( var j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) {
...
...
@@ -25554,7 +25592,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
gl.uniform1f( uniforms.opacity, sprite.opacity );
gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b );
renderer.
state.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );
state.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );
renderer.setTexture( sprite.texture, 1 );
gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );
...
...
@@ -25613,6 +25651,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
THREE.SpritePlugin = function ( renderer, sprites ) {
var gl = renderer.context;
var state = renderer.state;
var vertexBuffer, elementBuffer;
var program, attributes, uniforms;
...
...
@@ -25705,13 +25744,13 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
gl.useProgram( program );
renderer.
state.initAttributes();
renderer.
state.enableAttribute( attributes.position );
renderer.
state.enableAttribute( attributes.uv );
renderer.
state.disableUnusedAttributes();
state.initAttributes();
state.enableAttribute( attributes.position );
state.enableAttribute( attributes.uv );
state.disableUnusedAttributes();
gl.disable( gl.CULL_FACE );
gl.enable( gl.BLEND
);
state.setBlend( true
);
gl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );
gl.vertexAttribPointer( attributes.position, 2, gl.FLOAT, false, 2 * 8, 0 );
...
...
@@ -25721,7 +25760,7 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
gl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements );
renderer.
state.activeTexture( gl.TEXTURE0 );
state.activeTexture( gl.TEXTURE0 );
gl.uniform1i( uniforms.map, 0 );
var oldFogType = 0;
...
...
@@ -25823,9 +25862,9 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
gl.uniform1f( uniforms.rotation, material.rotation );
gl.uniform2fv( uniforms.scale, scale );
renderer.
state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
renderer.
state.setDepthTest( material.depthTest );
renderer.
state.setDepthWrite( material.depthWrite );
state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
state.setDepthTest( material.depthTest );
state.setDepthWrite( material.depthWrite );
if ( material.map && material.map.image && material.map.image.width ) {
...
...
build/three.min.js
浏览文件 @
366eec61
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录