Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3ac9be75
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,体验更适合开发者的 AI 搜索 >>
提交
3ac9be75
编写于
12月 15, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
r83
上级
559cfb2a
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
916 addition
and
728 deletion
+916
-728
build/three.js
build/three.js
+127
-34
build/three.min.js
build/three.min.js
+660
-658
build/three.module.js
build/three.module.js
+127
-34
package.json
package.json
+1
-1
src/constants.js
src/constants.js
+1
-1
未找到文件。
build/three.js
浏览文件 @
3ac9be75
...
...
@@ -181,7 +181,7 @@
} );
var REVISION = '83
dev
';
var REVISION = '83';
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
var CullFaceNone = 0;
var CullFaceBack = 1;
...
...
@@ -3843,29 +3843,27 @@
}(),
applyToBuffer: function () {
applyToBuffer
Attribute
: function () {
var v1;
return function applyToBuffer
( buffer, offset, length
) {
return function applyToBuffer
Attribute( attribute
) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( length === undefined ) length = buffer.length / buffer.itemSize;
for ( var i = 0,
j = offset; i < length; i ++, j
++ ) {
for ( var i = 0,
l = attribute.count; i < l; i
++ ) {
v1.x =
buffer.getX( j
);
v1.y =
buffer.getY( j
);
v1.z =
buffer.getZ( j
);
v1.x =
attribute.getX( i
);
v1.y =
attribute.getY( i
);
v1.z =
attribute.getZ( i
);
v1.applyMatrix4( this );
buffer.setXYZ( j
, v1.x, v1.y, v1.z );
attribute.setXYZ( i
, v1.x, v1.y, v1.z );
}
return
buffer
;
return
attribute
;
};
...
...
@@ -5182,9 +5180,9 @@
var meshphysical_vert = "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n";
var normal_frag = "
uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <normal_flip>\n \n \tgl_FragColor = vec4( packNormalToRGB( vNormal * flipNormal ), opacity );\n\t#include <logdepthbuf
_fragment>\n}\n";
var normal_frag = "
#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#include <premultiplied_alpha_fragment>\n\t#include <encodings
_fragment>\n}\n";
var normal_vert = "
varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>
\n}\n";
var normal_vert = "
#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif
\n}\n";
var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n";
...
...
@@ -6157,9 +6155,15 @@
normal: {
uniforms: {
opacity: { value: 1.0 }
},
uniforms: UniformsUtils.merge( [
UniformsLib.common,
UniformsLib.bumpmap,
UniformsLib.normalmap,
UniformsLib.displacementmap,
{
opacity: { value: 1.0 }
}
] ),
vertexShader: ShaderChunk.normal_vert,
fragmentShader: ShaderChunk.normal_frag
...
...
@@ -8521,29 +8525,27 @@
}(),
applyToBuffer: function () {
applyToBuffer
Attribute
: function () {
var v1;
return function applyToBuffer
( buffer, offset, length
) {
return function applyToBuffer
Attribute( attribute
) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( length === undefined ) length = buffer.length / buffer.itemSize;
for ( var i = 0,
j = offset; i < length; i ++, j
++ ) {
for ( var i = 0,
l = attribute.count; i < l; i
++ ) {
v1.x =
buffer.getX( j
);
v1.y =
buffer.getY( j
);
v1.z =
buffer.getZ( j
);
v1.x =
attribute.getX( i
);
v1.y =
attribute.getY( i
);
v1.z =
attribute.getZ( i
);
v1.applyMatrix3( this );
buffer.setXYZ( j
, v1.x, v1.y, v1.z );
attribute.setXYZ( i
, v1.x, v1.y, v1.z );
}
return
buffer
;
return
attribute
;
};
...
...
@@ -18481,7 +18483,7 @@
var currentStencilFunc = null;
var currentStencilRef = null;
var currentStencilFuncMask = null;
var currentStencilFail
= null;
var currentStencilFail = null;
var currentStencilZFail = null;
var currentStencilZPass = null;
var currentStencilClear = null;
...
...
@@ -18519,10 +18521,10 @@
currentStencilRef !== stencilRef ||
currentStencilFuncMask !== stencilMask ) {
gl.stencilFunc( stencilFunc,
stencilRef, stencilMask );
gl.stencilFunc( stencilFunc, stencilRef, stencilMask );
currentStencilFunc = stencilFunc;
currentStencilRef
= stencilRef;
currentStencilRef = stencilRef;
currentStencilFuncMask = stencilMask;
}
...
...
@@ -18535,9 +18537,9 @@
currentStencilZFail !== stencilZFail ||
currentStencilZPass !== stencilZPass ) {
gl.stencilOp( stencilFail,
stencilZFail, stencilZPass );
gl.stencilOp( stencilFail, stencilZFail, stencilZPass );
currentStencilFail
= stencilFail;
currentStencilFail = stencilFail;
currentStencilZFail = stencilZFail;
currentStencilZPass = stencilZPass;
...
...
@@ -18617,6 +18619,9 @@
var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
var version = parseFloat( /^WebGL\ ([0-9])/.exec( gl.getParameter( gl.VERSION ) )[ 1 ] );
var lineWidthAvailable = parseFloat( version ) >= 1.0;
var currentTextureSlot = null;
var currentBoundTextures = {};
...
...
@@ -19007,7 +19012,7 @@
if ( width !== currentLineWidth ) {
gl.lineWidth( width );
if ( lineWidthAvailable )
gl.lineWidth( width );
currentLineWidth = width;
...
...
@@ -20166,6 +20171,7 @@
if ( ! material.isMeshPhongMaterial &&
! material.isMeshStandardMaterial &&
! material.isMeshNormalMaterial &&
material.shading === FlatShading ) {
for ( var i = 0, l = object.count * 3; i < l; i += 9 ) {
...
...
@@ -21405,6 +21411,7 @@
material.isMeshLambertMaterial ||
material.isMeshPhongMaterial ||
material.isMeshStandardMaterial ||
material.isMeshNormalMaterial ||
material.isMeshDepthMaterial ) {
refreshUniformsCommon( m_uniforms, material );
...
...
@@ -21458,10 +21465,16 @@
} else if ( material.isMeshNormalMaterial ) {
m_uniforms.opacity.value = material.opacity
;
refreshUniformsNormal( m_uniforms, material )
;
}
// RectAreaLight Texture
// TODO (mrdoob): Find a nicer implementation
if ( m_uniforms.ltcMat !== undefined ) m_uniforms.ltcMat.value = THREE.UniformsLib.LTC_MAT_TEXTURE;
if ( m_uniforms.ltcMag !== undefined ) m_uniforms.ltcMag.value = THREE.UniformsLib.LTC_MAG_TEXTURE;
WebGLUniforms.upload(
_gl, materialProperties.uniformsList, m_uniforms, _this );
...
...
@@ -21759,6 +21772,32 @@
}
function refreshUniformsNormal( uniforms, material ) {
if ( material.bumpMap ) {
uniforms.bumpMap.value = material.bumpMap;
uniforms.bumpScale.value = material.bumpScale;
}
if ( material.normalMap ) {
uniforms.normalMap.value = material.normalMap;
uniforms.normalScale.value.copy( material.normalScale );
}
if ( material.displacementMap ) {
uniforms.displacementMap.value = material.displacementMap;
uniforms.displacementScale.value = material.displacementScale;
uniforms.displacementBias.value = material.displacementBias;
}
}
// If uniforms are marked as clean, they don't need to be loaded to the GPU.
function markUniformsLightsNeedsUpdate( uniforms, value ) {
...
...
@@ -28630,12 +28669,27 @@
/**
* @author mrdoob / http://mrdoob.com/
* @author WestLangley / http://github.com/WestLangley
*
* parameters = {
* opacity: <float>,
*
* bumpMap: new THREE.Texture( <Image> ),
* bumpScale: <float>,
*
* normalMap: new THREE.Texture( <Image> ),
* normalScale: <Vector2>,
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementScale: <float>,
* displacementBias: <float>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>
*
* skinning: <bool>,
* morphTargets: <bool>,
* morphNormals: <bool>
* }
*/
...
...
@@ -28645,12 +28699,25 @@
this.type = 'MeshNormalMaterial';
this.bumpMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalScale = new Vector2( 1, 1 );
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.wireframe = false;
this.wireframeLinewidth = 1;
this.fog = false;
this.lights = false;
this.skinning = false;
this.morphTargets = false;
this.morphNormals = false;
this.setValues( parameters );
...
...
@@ -28665,9 +28732,23 @@
Material.prototype.copy.call( this, source );
this.bumpMap = source.bumpMap;
this.bumpScale = source.bumpScale;
this.normalMap = source.normalMap;
this.normalScale.copy( source.normalScale );
this.displacementMap = source.displacementMap;
this.displacementScale = source.displacementScale;
this.displacementBias = source.displacementBias;
this.wireframe = source.wireframe;
this.wireframeLinewidth = source.wireframeLinewidth;
this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.morphNormals = source.morphNormals;
return this;
};
...
...
@@ -29173,7 +29254,7 @@
if ( this.responseType !== undefined ) request.responseType = this.responseType;
if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials;
if (
this.mimeType && request.overrideMimeType ) request.overrideMimeType( this.mimeType
);
if (
request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain'
);
request.send( null );
...
...
@@ -41877,6 +41958,12 @@
console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
return this.applyToVector3Array( a );
},
applyToBuffer: function( buffer, offset, length ) {
console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
}
} );
...
...
@@ -41968,6 +42055,12 @@
console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
},
applyToBuffer: function( buffer, offset, length ) {
console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
}
} );
...
...
build/three.min.js
浏览文件 @
3ac9be75
此差异已折叠。
点击以展开。
build/three.module.js
浏览文件 @
3ac9be75
...
...
@@ -175,7 +175,7 @@ Object.assign( EventDispatcher.prototype, {
} );
var REVISION = '83
dev
';
var REVISION = '83';
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
var CullFaceNone = 0;
var CullFaceBack = 1;
...
...
@@ -3837,29 +3837,27 @@ Matrix4.prototype = {
}(),
applyToBuffer: function () {
applyToBuffer
Attribute
: function () {
var v1;
return function applyToBuffer
( buffer, offset, length
) {
return function applyToBuffer
Attribute( attribute
) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( length === undefined ) length = buffer.length / buffer.itemSize;
for ( var i = 0,
j = offset; i < length; i ++, j
++ ) {
for ( var i = 0,
l = attribute.count; i < l; i
++ ) {
v1.x =
buffer.getX( j
);
v1.y =
buffer.getY( j
);
v1.z =
buffer.getZ( j
);
v1.x =
attribute.getX( i
);
v1.y =
attribute.getY( i
);
v1.z =
attribute.getZ( i
);
v1.applyMatrix4( this );
buffer.setXYZ( j
, v1.x, v1.y, v1.z );
attribute.setXYZ( i
, v1.x, v1.y, v1.z );
}
return
buffer
;
return
attribute
;
};
...
...
@@ -5176,9 +5174,9 @@ var meshphysical_frag = "#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 e
var meshphysical_vert = "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n";
var normal_frag = "
uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <normal_flip>\n \n \tgl_FragColor = vec4( packNormalToRGB( vNormal * flipNormal ), opacity );\n\t#include <logdepthbuf
_fragment>\n}\n";
var normal_frag = "
#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#include <premultiplied_alpha_fragment>\n\t#include <encodings
_fragment>\n}\n";
var normal_vert = "
varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>
\n}\n";
var normal_vert = "
#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif
\n}\n";
var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n";
...
...
@@ -6151,9 +6149,15 @@ var ShaderLib = {
normal: {
uniforms: {
opacity: { value: 1.0 }
},
uniforms: UniformsUtils.merge( [
UniformsLib.common,
UniformsLib.bumpmap,
UniformsLib.normalmap,
UniformsLib.displacementmap,
{
opacity: { value: 1.0 }
}
] ),
vertexShader: ShaderChunk.normal_vert,
fragmentShader: ShaderChunk.normal_frag
...
...
@@ -8515,29 +8519,27 @@ Matrix3.prototype = {
}(),
applyToBuffer: function () {
applyToBuffer
Attribute
: function () {
var v1;
return function applyToBuffer
( buffer, offset, length
) {
return function applyToBuffer
Attribute( attribute
) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( length === undefined ) length = buffer.length / buffer.itemSize;
for ( var i = 0,
j = offset; i < length; i ++, j
++ ) {
for ( var i = 0,
l = attribute.count; i < l; i
++ ) {
v1.x =
buffer.getX( j
);
v1.y =
buffer.getY( j
);
v1.z =
buffer.getZ( j
);
v1.x =
attribute.getX( i
);
v1.y =
attribute.getY( i
);
v1.z =
attribute.getZ( i
);
v1.applyMatrix3( this );
buffer.setXYZ( j
, v1.x, v1.y, v1.z );
attribute.setXYZ( i
, v1.x, v1.y, v1.z );
}
return
buffer
;
return
attribute
;
};
...
...
@@ -18475,7 +18477,7 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
var currentStencilFunc = null;
var currentStencilRef = null;
var currentStencilFuncMask = null;
var currentStencilFail
= null;
var currentStencilFail = null;
var currentStencilZFail = null;
var currentStencilZPass = null;
var currentStencilClear = null;
...
...
@@ -18513,10 +18515,10 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
currentStencilRef !== stencilRef ||
currentStencilFuncMask !== stencilMask ) {
gl.stencilFunc( stencilFunc,
stencilRef, stencilMask );
gl.stencilFunc( stencilFunc, stencilRef, stencilMask );
currentStencilFunc = stencilFunc;
currentStencilRef
= stencilRef;
currentStencilRef = stencilRef;
currentStencilFuncMask = stencilMask;
}
...
...
@@ -18529,9 +18531,9 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
currentStencilZFail !== stencilZFail ||
currentStencilZPass !== stencilZPass ) {
gl.stencilOp( stencilFail,
stencilZFail, stencilZPass );
gl.stencilOp( stencilFail, stencilZFail, stencilZPass );
currentStencilFail
= stencilFail;
currentStencilFail = stencilFail;
currentStencilZFail = stencilZFail;
currentStencilZPass = stencilZPass;
...
...
@@ -18611,6 +18613,9 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
var version = parseFloat( /^WebGL\ ([0-9])/.exec( gl.getParameter( gl.VERSION ) )[ 1 ] );
var lineWidthAvailable = parseFloat( version ) >= 1.0;
var currentTextureSlot = null;
var currentBoundTextures = {};
...
...
@@ -19001,7 +19006,7 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
if ( width !== currentLineWidth ) {
gl.lineWidth( width );
if ( lineWidthAvailable )
gl.lineWidth( width );
currentLineWidth = width;
...
...
@@ -20160,6 +20165,7 @@ function WebGLRenderer( parameters ) {
if ( ! material.isMeshPhongMaterial &&
! material.isMeshStandardMaterial &&
! material.isMeshNormalMaterial &&
material.shading === FlatShading ) {
for ( var i = 0, l = object.count * 3; i < l; i += 9 ) {
...
...
@@ -21399,6 +21405,7 @@ function WebGLRenderer( parameters ) {
material.isMeshLambertMaterial ||
material.isMeshPhongMaterial ||
material.isMeshStandardMaterial ||
material.isMeshNormalMaterial ||
material.isMeshDepthMaterial ) {
refreshUniformsCommon( m_uniforms, material );
...
...
@@ -21452,10 +21459,16 @@ function WebGLRenderer( parameters ) {
} else if ( material.isMeshNormalMaterial ) {
m_uniforms.opacity.value = material.opacity
;
refreshUniformsNormal( m_uniforms, material )
;
}
// RectAreaLight Texture
// TODO (mrdoob): Find a nicer implementation
if ( m_uniforms.ltcMat !== undefined ) m_uniforms.ltcMat.value = THREE.UniformsLib.LTC_MAT_TEXTURE;
if ( m_uniforms.ltcMag !== undefined ) m_uniforms.ltcMag.value = THREE.UniformsLib.LTC_MAG_TEXTURE;
WebGLUniforms.upload(
_gl, materialProperties.uniformsList, m_uniforms, _this );
...
...
@@ -21753,6 +21766,32 @@ function WebGLRenderer( parameters ) {
}
function refreshUniformsNormal( uniforms, material ) {
if ( material.bumpMap ) {
uniforms.bumpMap.value = material.bumpMap;
uniforms.bumpScale.value = material.bumpScale;
}
if ( material.normalMap ) {
uniforms.normalMap.value = material.normalMap;
uniforms.normalScale.value.copy( material.normalScale );
}
if ( material.displacementMap ) {
uniforms.displacementMap.value = material.displacementMap;
uniforms.displacementScale.value = material.displacementScale;
uniforms.displacementBias.value = material.displacementBias;
}
}
// If uniforms are marked as clean, they don't need to be loaded to the GPU.
function markUniformsLightsNeedsUpdate( uniforms, value ) {
...
...
@@ -28624,12 +28663,27 @@ MeshToonMaterial.prototype.copy = function ( source ) {
/**
* @author mrdoob / http://mrdoob.com/
* @author WestLangley / http://github.com/WestLangley
*
* parameters = {
* opacity: <float>,
*
* bumpMap: new THREE.Texture( <Image> ),
* bumpScale: <float>,
*
* normalMap: new THREE.Texture( <Image> ),
* normalScale: <Vector2>,
*
* displacementMap: new THREE.Texture( <Image> ),
* displacementScale: <float>,
* displacementBias: <float>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>
*
* skinning: <bool>,
* morphTargets: <bool>,
* morphNormals: <bool>
* }
*/
...
...
@@ -28639,12 +28693,25 @@ function MeshNormalMaterial( parameters ) {
this.type = 'MeshNormalMaterial';
this.bumpMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalScale = new Vector2( 1, 1 );
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.wireframe = false;
this.wireframeLinewidth = 1;
this.fog = false;
this.lights = false;
this.skinning = false;
this.morphTargets = false;
this.morphNormals = false;
this.setValues( parameters );
...
...
@@ -28659,9 +28726,23 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
Material.prototype.copy.call( this, source );
this.bumpMap = source.bumpMap;
this.bumpScale = source.bumpScale;
this.normalMap = source.normalMap;
this.normalScale.copy( source.normalScale );
this.displacementMap = source.displacementMap;
this.displacementScale = source.displacementScale;
this.displacementBias = source.displacementBias;
this.wireframe = source.wireframe;
this.wireframeLinewidth = source.wireframeLinewidth;
this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.morphNormals = source.morphNormals;
return this;
};
...
...
@@ -29167,7 +29248,7 @@ Object.assign( FileLoader.prototype, {
if ( this.responseType !== undefined ) request.responseType = this.responseType;
if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials;
if (
this.mimeType && request.overrideMimeType ) request.overrideMimeType( this.mimeType
);
if (
request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain'
);
request.send( null );
...
...
@@ -41871,6 +41952,12 @@ Object.assign( Matrix3.prototype, {
console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
return this.applyToVector3Array( a );
},
applyToBuffer: function( buffer, offset, length ) {
console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
}
} );
...
...
@@ -41962,6 +42049,12 @@ Object.assign( Matrix4.prototype, {
console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
},
applyToBuffer: function( buffer, offset, length ) {
console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
}
} );
...
...
package.json
浏览文件 @
3ac9be75
{
"name"
:
"three"
,
"version"
:
"0.8
2.1
"
,
"version"
:
"0.8
3.0
"
,
"description"
:
"JavaScript 3D library"
,
"main"
:
"build/three.js"
,
"repository"
:
"mrdoob/three.js"
,
...
...
src/constants.js
浏览文件 @
3ac9be75
export
var
REVISION
=
'
83
dev
'
;
export
var
REVISION
=
'
83
'
;
export
var
MOUSE
=
{
LEFT
:
0
,
MIDDLE
:
1
,
RIGHT
:
2
};
export
var
CullFaceNone
=
0
;
export
var
CullFaceBack
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录