Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ab4515a6
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,发现更多精彩内容 >>
提交
ab4515a6
编写于
7月 18, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
869ce3ae
变更
3
展开全部
显示空白变更内容
内联
并排
Showing
3 changed file
with
970 addition
and
761 deletion
+970
-761
build/three.js
build/three.js
+139
-35
build/three.min.js
build/three.min.js
+692
-690
build/three.module.js
build/three.module.js
+139
-36
未找到文件。
build/three.js
浏览文件 @
ab4515a6
...
@@ -5772,7 +5772,7 @@
...
@@ -5772,7 +5772,7 @@
var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif";
var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif";
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n";
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined
( DISTANCE ) || defined
( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n";
var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n";
var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n";
...
@@ -5782,9 +5782,9 @@
...
@@ -5782,9 +5782,9 @@
var depth_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n";
var depth_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n";
var distanceRGBA_frag = "
uniform vec3 lightPos;\nuniform float shadowCameraNear;\nuniform float shadowCameraFar;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition.xyz - lightPos.xyz );\n\tdist = ( dist - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear
);\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n";
var distanceRGBA_frag = "
#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance
);\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n";
var distanceRGBA_vert = "
varying vec4 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition
;\n}\n";
var distanceRGBA_vert = "
#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz
;\n}\n";
var equirect_frag = "uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n";
var equirect_frag = "uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n";
...
@@ -6125,9 +6125,9 @@
...
@@ -6125,9 +6125,9 @@
UniformsLib.common,
UniformsLib.common,
UniformsLib.displacementmap,
UniformsLib.displacementmap,
{
{
lightPos
: { value: new Vector3() },
referencePosition
: { value: new Vector3() },
shadowCameraNear
: { value: 1 },
nearDistance
: { value: 1 },
shadowCameraFar
: { value: 1000 }
farDistance
: { value: 1000 }
}
}
] ),
] ),
...
@@ -7688,6 +7688,85 @@
...
@@ -7688,6 +7688,85 @@
};
};
/**
* @author WestLangley / http://github.com/WestLangley
*
* parameters = {
*
* referencePosition: <float>,
* nearDistance: <float>,
* farDistance: <float>,
*
* skinning: <bool>,
* morphTargets: <bool>,
*
* map: new THREE.Texture( <Image> ),
*
* alphaMap: new THREE.Texture( <Image> ),
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementScale: <float>,
* displacementBias: <float>
*
* }
*/
function MeshDistanceMaterial( parameters ) {
Material.call( this );
this.type = 'MeshDistanceMaterial';
this.referencePosition = new THREE.Vector3();
this.nearDistance = 1;
this.farDistance = 1000;
this.skinning = false;
this.morphTargets = false;
this.map = null;
this.alphaMap = null;
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.fog = false;
this.lights = false;
this.setValues( parameters );
}
MeshDistanceMaterial.prototype = Object.create( Material.prototype );
MeshDistanceMaterial.prototype.constructor = MeshDistanceMaterial;
MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
MeshDistanceMaterial.prototype.copy = function ( source ) {
Material.prototype.copy.call( this, source );
this.referencePosition.copy( source.referencePosition );
this.nearDistance = source.nearDistance;
this.farDistance = source.farDistance;
this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.map = source.map;
this.alphaMap = source.alphaMap;
this.displacementMap = source.displacementMap;
this.displacementScale = source.displacementScale;
this.displacementBias = source.displacementBias;
return this;
};
/**
/**
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
* @author WestLangley / http://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
...
@@ -9131,34 +9210,29 @@
...
@@ -9131,34 +9210,29 @@
// init
// init
var depthMaterialTemplate = new MeshDepthMaterial();
depthMaterialTemplate.depthPacking = RGBADepthPacking;
depthMaterialTemplate.clipping = true;
var distanceShader = ShaderLib[ "distanceRGBA" ];
var distanceUniforms = UniformsUtils.clone( distanceShader.uniforms );
for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) {
for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) {
var useMorphing = ( i & _MorphingFlag ) !== 0;
var useMorphing = ( i & _MorphingFlag ) !== 0;
var useSkinning = ( i & _SkinningFlag ) !== 0;
var useSkinning = ( i & _SkinningFlag ) !== 0;
var depthMaterial = depthMaterialTemplate.clone();
var depthMaterial = new MeshDepthMaterial( {
depthMaterial.morphTargets = useMorphing;
depthMaterial.skinning = useSkinning;
depthPacking: RGBADepthPacking,
morphTargets: useMorphing,
skinning: useSkinning
} );
_depthMaterials[ i ] = depthMaterial;
_depthMaterials[ i ] = depthMaterial;
var distanceMaterial = new ShaderMaterial( {
//
defines: {
'USE_SHADOWMAP': ''
var distanceMaterial = new MeshDistanceMaterial( {
},
uniforms: distanceUniforms,
vertexShader: distanceShader.vertexShader,
fragmentShader: distanceShader.fragmentShader,
morphTargets: useMorphing,
morphTargets: useMorphing,
skinning: useSkinning
,
skinning: useSkinning
clipping: true
} );
} );
_distanceMaterials[ i ] = distanceMaterial;
_distanceMaterials[ i ] = distanceMaterial;
...
@@ -9460,11 +9534,11 @@
...
@@ -9460,11 +9534,11 @@
result.wireframeLinewidth = material.wireframeLinewidth;
result.wireframeLinewidth = material.wireframeLinewidth;
result.linewidth = material.linewidth;
result.linewidth = material.linewidth;
if ( isPointLight && result.
uniforms.lightPos !== undefined
) {
if ( isPointLight && result.
isMeshDistanceMaterial
) {
result.
uniforms.lightPos.value
.copy( lightPositionWorld );
result.
referencePosition
.copy( lightPositionWorld );
result.
uniforms.shadowCameraNear.valu
e = shadowCameraNear;
result.
nearDistanc
e = shadowCameraNear;
result.
uniforms.shadowCameraFar.valu
e = shadowCameraFar;
result.
farDistanc
e = shadowCameraFar;
}
}
...
@@ -17935,6 +18009,7 @@
...
@@ -17935,6 +18009,7 @@
var shaderIDs = {
var shaderIDs = {
MeshDepthMaterial: 'depth',
MeshDepthMaterial: 'depth',
MeshDistanceMaterial: 'distanceRGBA',
MeshNormalMaterial: 'normal',
MeshNormalMaterial: 'normal',
MeshBasicMaterial: 'basic',
MeshBasicMaterial: 'basic',
MeshLambertMaterial: 'lambert',
MeshLambertMaterial: 'lambert',
...
@@ -22356,7 +22431,8 @@
...
@@ -22356,7 +22431,8 @@
material.isMeshPhongMaterial ||
material.isMeshPhongMaterial ||
material.isMeshStandardMaterial ||
material.isMeshStandardMaterial ||
material.isMeshNormalMaterial ||
material.isMeshNormalMaterial ||
material.isMeshDepthMaterial ) {
material.isMeshDepthMaterial ||
material.isMeshDistanceMaterial ) {
refreshUniformsCommon( m_uniforms, material );
refreshUniformsCommon( m_uniforms, material );
...
@@ -22399,13 +22475,11 @@
...
@@ -22399,13 +22475,11 @@
} else if ( material.isMeshDepthMaterial ) {
} else if ( material.isMeshDepthMaterial ) {
if ( material.displacementMap ) {
refreshUniformsDepth( m_uniforms, material );
m_uniforms.displacementMap.value = material.displacementMap;
} else if ( material.isMeshDistanceMaterial ) {
m_uniforms.displacementScale.value = material.displacementScale;
m_uniforms.displacementBias.value = material.displacementBias;
}
refreshUniformsDistance( m_uniforms, material );
} else if ( material.isMeshNormalMaterial ) {
} else if ( material.isMeshNormalMaterial ) {
...
@@ -22716,6 +22790,34 @@
...
@@ -22716,6 +22790,34 @@
}
}
function refreshUniformsDepth( uniforms, material ) {
if ( material.displacementMap ) {
uniforms.displacementMap.value = material.displacementMap;
uniforms.displacementScale.value = material.displacementScale;
uniforms.displacementBias.value = material.displacementBias;
}
}
function refreshUniformsDistance( uniforms, material ) {
if ( material.displacementMap ) {
uniforms.displacementMap.value = material.displacementMap;
uniforms.displacementScale.value = material.displacementScale;
uniforms.displacementBias.value = material.displacementBias;
}
uniforms.referencePosition.value.copy( material.referencePosition );
uniforms.nearDistance.value = material.nearDistance;
uniforms.farDistance.value = material.farDistance;
}
function refreshUniformsNormal( uniforms, material ) {
function refreshUniformsNormal( uniforms, material ) {
if ( material.bumpMap ) {
if ( material.bumpMap ) {
...
@@ -29624,6 +29726,7 @@
...
@@ -29624,6 +29726,7 @@
MeshNormalMaterial: MeshNormalMaterial,
MeshNormalMaterial: MeshNormalMaterial,
MeshLambertMaterial: MeshLambertMaterial,
MeshLambertMaterial: MeshLambertMaterial,
MeshDepthMaterial: MeshDepthMaterial,
MeshDepthMaterial: MeshDepthMaterial,
MeshDistanceMaterial: MeshDistanceMaterial,
MeshBasicMaterial: MeshBasicMaterial,
MeshBasicMaterial: MeshBasicMaterial,
LineDashedMaterial: LineDashedMaterial,
LineDashedMaterial: LineDashedMaterial,
LineBasicMaterial: LineBasicMaterial,
LineBasicMaterial: LineBasicMaterial,
...
@@ -44129,6 +44232,7 @@
...
@@ -44129,6 +44232,7 @@
exports.MeshNormalMaterial = MeshNormalMaterial;
exports.MeshNormalMaterial = MeshNormalMaterial;
exports.MeshLambertMaterial = MeshLambertMaterial;
exports.MeshLambertMaterial = MeshLambertMaterial;
exports.MeshDepthMaterial = MeshDepthMaterial;
exports.MeshDepthMaterial = MeshDepthMaterial;
exports.MeshDistanceMaterial = MeshDistanceMaterial;
exports.MeshBasicMaterial = MeshBasicMaterial;
exports.MeshBasicMaterial = MeshBasicMaterial;
exports.LineDashedMaterial = LineDashedMaterial;
exports.LineDashedMaterial = LineDashedMaterial;
exports.LineBasicMaterial = LineBasicMaterial;
exports.LineBasicMaterial = LineBasicMaterial;
...
...
build/three.min.js
浏览文件 @
ab4515a6
此差异已折叠。
点击以展开。
build/three.module.js
浏览文件 @
ab4515a6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录