Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3ab982bc
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
3ab982bc
编写于
2月 19, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
41a173c6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
558 addition
and
529 deletion
+558
-529
build/three.js
build/three.js
+289
-260
build/three.min.js
build/three.min.js
+269
-269
未找到文件。
build/three.js
浏览文件 @
3ab982bc
...
...
@@ -17829,29 +17829,6 @@ THREE.WebGLRenderer = function ( parameters ) {
_usedTextureUnits = 0,
// GL state cache
_oldDoubleSided = - 1,
_oldFlipSided = - 1,
_oldBlending = - 1,
_oldBlendEquation = - 1,
_oldBlendSrc = - 1,
_oldBlendDst = - 1,
_oldBlendEquationAlpha = - 1,
_oldBlendSrcAlpha = - 1,
_oldBlendDstAlpha = - 1,
_oldDepthTest = - 1,
_oldDepthWrite = - 1,
_oldPolygonOffset = null,
_oldPolygonOffsetFactor = null,
_oldPolygonOffsetUnits = null,
_oldLineWidth = null,
_viewportX = 0,
_viewportY = 0,
_viewportWidth = _canvas.width,
...
...
@@ -17937,6 +17914,8 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var state = new THREE.WebGLState( _gl, paramThreeToGL );
if ( _gl.getShaderPrecisionFormat === undefined ) {
_gl.getShaderPrecisionFormat = function () {
...
...
@@ -18007,11 +17986,6 @@ THREE.WebGLRenderer = function ( parameters ) {
_currentProgram = null;
_currentCamera = null;
_oldBlending = - 1;
_oldDepthTest = - 1;
_oldDepthWrite = - 1;
_oldDoubleSided = - 1;
_oldFlipSided = - 1;
_currentGeometryProgram = '';
_currentMaterialId = - 1;
...
...
@@ -18023,11 +17997,14 @@ THREE.WebGLRenderer = function ( parameters ) {
}
state.reset();
};
setDefaultGLState();
this.context = _gl;
this.state = state;
// GPU capabilities
...
...
@@ -20439,7 +20416,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
setLineWidth( material.linewidth );
s
tate.s
etLineWidth( material.linewidth );
var index = geometry.attributes.index;
...
...
@@ -20733,7 +20710,8 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.wireframe ) {
setLineWidth( material.wireframeLinewidth );
state.setLineWidth( material.wireframeLinewidth );
if ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer );
_gl.drawElements( _gl.LINES, geometryGroup.__webglLineCount, type, 0 );
...
...
@@ -20756,7 +20734,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
setLineWidth( material.linewidth );
s
tate.s
etLineWidth( material.linewidth );
_gl.drawArrays( mode, 0, geometryGroup.__webglLineCount );
...
...
@@ -21117,32 +21095,27 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( scene.overrideMaterial ) {
var
m
aterial = scene.overrideMaterial;
var
overrideM
aterial = scene.overrideMaterial;
this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );
this.setDepthTest( material.depthTest );
this.setDepthWrite( material.depthWrite );
setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
setMaterial( overrideMaterial );
renderObjects( opaqueObjects, camera, lights, fog,
true, m
aterial );
renderObjects( transparentObjects, camera, lights, fog,
true, m
aterial );
renderObjectsImmediate( _webglObjectsImmediate, '', camera, lights, fog,
false, m
aterial );
renderObjects( opaqueObjects, camera, lights, fog,
overrideM
aterial );
renderObjects( transparentObjects, camera, lights, fog,
overrideM
aterial );
renderObjectsImmediate( _webglObjectsImmediate, '', camera, lights, fog,
overrideM
aterial );
} else {
var material = null;
// opaque pass (front-to-back order)
this
.setBlending( THREE.NoBlending );
state
.setBlending( THREE.NoBlending );
renderObjects( opaqueObjects, camera, lights, fog,
false, materia
l );
renderObjectsImmediate( _webglObjectsImmediate, 'opaque', camera, lights, fog,
false, materia
l );
renderObjects( opaqueObjects, camera, lights, fog,
nul
l );
renderObjectsImmediate( _webglObjectsImmediate, 'opaque', camera, lights, fog,
nul
l );
// transparent pass (back-to-front order)
renderObjects( transparentObjects, camera, lights, fog,
true, materia
l );
renderObjectsImmediate( _webglObjectsImmediate, 'transparent', camera, lights, fog,
true, materia
l );
renderObjects( transparentObjects, camera, lights, fog,
nul
l );
renderObjectsImmediate( _webglObjectsImmediate, 'transparent', camera, lights, fog,
nul
l );
}
...
...
@@ -21161,8 +21134,8 @@ THREE.WebGLRenderer = function ( parameters ) {
// Ensure depth buffer writing is enabled so it can be cleared on next render
this
.setDepthTest( true );
this
.setDepthWrite( true );
state
.setDepthTest( true );
state
.setDepthWrite( true );
// _gl.finish();
...
...
@@ -21231,7 +21204,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
function renderObjects( renderList, camera, lights, fog,
useBlending,
overrideMaterial ) {
function renderObjects( renderList, camera, lights, fog, overrideMaterial ) {
var material;
...
...
@@ -21254,11 +21227,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( ! material ) continue;
if ( useBlending ) _this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );
_this.setDepthTest( material.depthTest );
_this.setDepthWrite( material.depthWrite );
setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
setMaterial( material );
}
...
...
@@ -21278,7 +21247,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
function renderObjectsImmediate ( renderList, materialType, camera, lights, fog,
useBlending,
overrideMaterial ) {
function renderObjectsImmediate ( renderList, materialType, camera, lights, fog, overrideMaterial ) {
var material;
...
...
@@ -21299,11 +21268,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( ! material ) continue;
if ( useBlending ) _this.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );
_this.setDepthTest( material.depthTest );
_this.setDepthWrite( material.depthWrite );
setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
setMaterial( material );
}
...
...
@@ -22070,6 +22035,24 @@ THREE.WebGLRenderer = function ( parameters ) {
}
function setMaterial( material ) {
if ( material.transparent === true ) {
state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );
} else {
state.setBlending( THREE.NoBlending );
}
state.setDepthTest( material.depthTest );
state.setDepthWrite( material.depthWrite );
state.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
}
function setProgram( camera, lights, fog, material, object ) {
_usedTextureUnits = 0;
...
...
@@ -23165,197 +23148,8 @@ THREE.WebGLRenderer = function ( parameters ) {
this.setMaterialFaces = function ( material ) {
var doubleSided = material.side === THREE.DoubleSide;
var flipSided = material.side === THREE.BackSide;
if ( _oldDoubleSided !== doubleSided ) {
if ( doubleSided ) {
_gl.disable( _gl.CULL_FACE );
} else {
_gl.enable( _gl.CULL_FACE );
}
_oldDoubleSided = doubleSided;
}
if ( _oldFlipSided !== flipSided ) {
if ( flipSided ) {
_gl.frontFace( _gl.CW );
} else {
_gl.frontFace( _gl.CCW );
}
_oldFlipSided = flipSided;
}
};
this.setDepthTest = function ( depthTest ) {
if ( _oldDepthTest !== depthTest ) {
if ( depthTest ) {
_gl.enable( _gl.DEPTH_TEST );
} else {
_gl.disable( _gl.DEPTH_TEST );
}
_oldDepthTest = depthTest;
}
};
this.setDepthWrite = function ( depthWrite ) {
if ( _oldDepthWrite !== depthWrite ) {
_gl.depthMask( depthWrite );
_oldDepthWrite = depthWrite;
}
};
function setLineWidth ( width ) {
width *= pixelRatio;
if ( width !== _oldLineWidth ) {
_gl.lineWidth( width );
_oldLineWidth = width;
}
}
function setPolygonOffset ( polygonoffset, factor, units ) {
if ( _oldPolygonOffset !== polygonoffset ) {
if ( polygonoffset ) {
_gl.enable( _gl.POLYGON_OFFSET_FILL );
} else {
_gl.disable( _gl.POLYGON_OFFSET_FILL );
}
_oldPolygonOffset = polygonoffset;
}
if ( polygonoffset && ( _oldPolygonOffsetFactor !== factor || _oldPolygonOffsetUnits !== units ) ) {
_gl.polygonOffset( factor, units );
_oldPolygonOffsetFactor = factor;
_oldPolygonOffsetUnits = units;
}
}
this.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {
if ( blending !== _oldBlending ) {
if ( blending === THREE.NoBlending ) {
_gl.disable( _gl.BLEND );
} else if ( blending === THREE.AdditiveBlending ) {
_gl.enable( _gl.BLEND );
_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 );
_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 );
_gl.blendEquation( _gl.FUNC_ADD );
_gl.blendFunc( _gl.ZERO, _gl.SRC_COLOR );
} else if ( blending === THREE.CustomBlending ) {
_gl.enable( _gl.BLEND );
} else {
_gl.enable( _gl.BLEND );
_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 );
}
_oldBlending = blending;
}
if ( blending === THREE.CustomBlending ) {
blendEquationAlpha = blendEquationAlpha || blendEquation;
blendSrcAlpha = blendSrcAlpha || blendSrc;
blendDstAlpha = blendDstAlpha || blendDst;
if ( blendEquation !== _oldBlendEquation || blendEquationAlpha !== _oldBlendEquationAlpha ) {
_gl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) );
_oldBlendEquation = blendEquation;
_oldBlendEquationAlpha = blendEquationAlpha;
}
if ( blendSrc !== _oldBlendSrc || blendDst !== _oldBlendDst || blendSrcAlpha !== _oldBlendSrcAlpha || blendDstAlpha !== _oldBlendDstAlpha ) {
_gl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) );
_oldBlendSrc = blendSrc;
_oldBlendDst = blendDst;
_oldBlendSrcAlpha = blendSrcAlpha;
_oldBlendDstAlpha = blendDstAlpha;
}
} else {
_oldBlendEquation = null;
_oldBlendSrc = null;
_oldBlendDst = null;
_oldBlendEquationAlpha = null;
_oldBlendSrcAlpha = null;
_oldBlendDstAlpha = null;
}
state.setDoubleSided( material.side === THREE.DoubleSide );
state.setFlipSided( material.side === THREE.BackSide );
};
...
...
@@ -23399,10 +23193,10 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( extension && texture.type !== THREE.FloatType && texture.type !== THREE.HalfFloatType ) {
if ( texture.anisotropy > 1 || texture.__
old
Anisotropy ) {
if ( texture.anisotropy > 1 || texture.__
current
Anisotropy ) {
_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, _this.getMaxAnisotropy() ) );
texture.__
old
Anisotropy = texture.anisotropy;
texture.__
current
Anisotropy = texture.anisotropy;
}
...
...
@@ -24821,6 +24615,241 @@ THREE.WebGLShader = ( function () {
} )();
// File:src/renderers/webgl/WebGLState.js
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.WebGLState = function ( gl, paramThreeToGL ) {
var currentBlending = - 1;
var currentBlendEquation = - 1;
var currentBlendSrc = - 1;
var currentBlendDst = - 1;
var currentBlendEquationAlpha = - 1;
var currentBlendSrcAlpha = - 1;
var currentBlendDstAlpha = - 1;
var currentDepthTest = - 1;
var currentDepthWrite = - 1;
var currentDoubleSided = - 1;
var currentFlipSided = - 1;
var currentLineWidth = null;
var currentPolygonOffset = null;
var currentPolygonOffsetFactor = null;
var currentPolygonOffsetUnits = null;
this.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {
if ( blending !== currentBlending ) {
if ( blending === THREE.NoBlending ) {
gl.disable( gl.BLEND );
} else if ( blending === THREE.AdditiveBlending ) {
gl.enable( gl.BLEND );
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 );
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 );
gl.blendEquation( gl.FUNC_ADD );
gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
} else if ( blending === THREE.CustomBlending ) {
gl.enable( gl.BLEND );
} else {
gl.enable( gl.BLEND );
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 );
}
currentBlending = blending;
}
if ( blending === THREE.CustomBlending ) {
blendEquationAlpha = blendEquationAlpha || blendEquation;
blendSrcAlpha = blendSrcAlpha || blendSrc;
blendDstAlpha = blendDstAlpha || blendDst;
if ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {
gl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) );
currentBlendEquation = blendEquation;
currentBlendEquationAlpha = blendEquationAlpha;
}
if ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {
gl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) );
currentBlendSrc = blendSrc;
currentBlendDst = blendDst;
currentBlendSrcAlpha = blendSrcAlpha;
currentBlendDstAlpha = blendDstAlpha;
}
} else {
currentBlendEquation = null;
currentBlendSrc = null;
currentBlendDst = null;
currentBlendEquationAlpha = null;
currentBlendSrcAlpha = null;
currentBlendDstAlpha = null;
}
};
this.setDepthTest = function ( depthTest ) {
if ( currentDepthTest !== depthTest ) {
if ( depthTest ) {
gl.enable( gl.DEPTH_TEST );
} else {
gl.disable( gl.DEPTH_TEST );
}
currentDepthTest = depthTest;
}
};
this.setDepthWrite = function ( depthWrite ) {
if ( currentDepthWrite !== depthWrite ) {
gl.depthMask( depthWrite );
currentDepthWrite = depthWrite;
}
};
this.setDoubleSided = function ( doubleSided ) {
if ( currentDoubleSided !== doubleSided ) {
if ( doubleSided ) {
gl.disable( gl.CULL_FACE );
} else {
gl.enable( gl.CULL_FACE );
}
currentDoubleSided = doubleSided;
}
};
this.setFlipSided = function ( flipSided ) {
if ( currentFlipSided !== flipSided ) {
if ( flipSided ) {
gl.frontFace( gl.CW );
} else {
gl.frontFace( gl.CCW );
}
currentFlipSided = flipSided;
}
};
this.setLineWidth = function ( width ) {
if ( width !== currentLineWidth ) {
gl.lineWidth( width );
currentLineWidth = width;
}
};
this.setPolygonOffset = function ( polygonoffset, factor, units ) {
if ( currentPolygonOffset !== polygonoffset ) {
if ( polygonoffset ) {
gl.enable( gl.POLYGON_OFFSET_FILL );
} else {
gl.disable( gl.POLYGON_OFFSET_FILL );
}
currentPolygonOffset = polygonoffset;
}
if ( polygonoffset && ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) ) {
gl.polygonOffset( factor, units );
currentPolygonOffsetFactor = factor;
currentPolygonOffsetUnits = units;
}
};
this.reset = function () {
currentBlending = - 1;
currentDepthTest = - 1;
currentDepthWrite = - 1;
currentDoubleSided = - 1;
currentFlipSided = - 1;
};
};
// File:src/renderers/webgl/plugins/LensFlarePlugin.js
/**
...
...
@@ -25146,7 +25175,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
// calc object screen position
var flare = flares[ i ];
tempPosition.set( flare.matrixWorld.elements[12], flare.matrixWorld.elements[13], flare.matrixWorld.elements[14] );
tempPosition.applyMatrix4( camera.matrixWorldInverse );
...
...
@@ -25244,7 +25273,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.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );
renderer.s
tate.s
etBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );
renderer.setTexture( sprite.texture, 1 );
gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );
...
...
@@ -25312,7 +25341,7 @@ THREE.ShadowMapPlugin = function ( _renderer, _lights, _webglObjects, _webglObje
_max = new THREE.Vector3(),
_matrixPosition = new THREE.Vector3(),
_renderList = [];
// init
...
...
@@ -25386,7 +25415,7 @@ THREE.ShadowMapPlugin = function ( _renderer, _lights, _webglObjects, _webglObje
}
_renderer.setDepthTest( true );
_renderer.s
tate.s
etDepthTest( true );
// preprocess lights
// - skip lights that are not casting shadows
...
...
@@ -26036,9 +26065,9 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
gl.uniform1f( uniforms.rotation, material.rotation );
gl.uniform2fv( uniforms.scale, scale );
renderer.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
renderer.setDepthTest( material.depthTest );
renderer.setDepthWrite( material.depthWrite );
renderer.s
tate.s
etBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );
renderer.s
tate.s
etDepthTest( material.depthTest );
renderer.s
tate.s
etDepthWrite( material.depthWrite );
if ( material.map && material.map.image && material.map.image.width ) {
...
...
build/three.min.js
浏览文件 @
3ab982bc
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录