Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
7b97f379
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,发现更多精彩内容 >>
提交
7b97f379
编写于
4月 20, 2015
作者:
A
Arthur Silber
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'remotes/mrdoob/dev' into feature/typefaceNodeError
上级
88fc7588
da20737e
变更
33
展开全部
隐藏空白更改
内联
并排
Showing
33 changed file
with
636 addition
and
590 deletion
+636
-590
editor/examples/arkanoid.app.json
editor/examples/arkanoid.app.json
+64
-29
editor/js/Sidebar.Geometry.js
editor/js/Sidebar.Geometry.js
+4
-30
examples/webgl_animation_cloth.html
examples/webgl_animation_cloth.html
+1
-1
examples/webgl_animation_skinning_morph.html
examples/webgl_animation_skinning_morph.html
+1
-1
examples/webgl_interactive_draggablecubes.html
examples/webgl_interactive_draggablecubes.html
+2
-2
examples/webgl_lensflares.html
examples/webgl_lensflares.html
+2
-7
examples/webgl_lights_hemisphere.html
examples/webgl_lights_hemisphere.html
+2
-2
examples/webgl_loader_ctm.html
examples/webgl_loader_ctm.html
+1
-1
examples/webgl_loader_gltf.html
examples/webgl_loader_gltf.html
+403
-373
examples/webgl_loader_ply.html
examples/webgl_loader_ply.html
+2
-2
examples/webgl_loader_stl.html
examples/webgl_loader_stl.html
+2
-2
examples/webgl_loader_utf8.html
examples/webgl_loader_utf8.html
+2
-2
examples/webgl_materials_bumpmap.html
examples/webgl_materials_bumpmap.html
+2
-2
examples/webgl_materials_bumpmap_skin.html
examples/webgl_materials_bumpmap_skin.html
+2
-2
examples/webgl_materials_cubemap_dynamic.html
examples/webgl_materials_cubemap_dynamic.html
+4
-4
examples/webgl_materials_normaldisplacementmap.html
examples/webgl_materials_normaldisplacementmap.html
+2
-2
examples/webgl_morphtargets_md2.html
examples/webgl_morphtargets_md2.html
+1
-1
examples/webgl_morphtargets_md2_control.html
examples/webgl_morphtargets_md2_control.html
+4
-4
examples/webgl_shading_physical.html
examples/webgl_shading_physical.html
+2
-2
examples/webgl_shadowmap.html
examples/webgl_shadowmap.html
+2
-2
examples/webgl_shadowmap_performance.html
examples/webgl_shadowmap_performance.html
+2
-2
examples/webgl_shadowmap_viewer.html
examples/webgl_shadowmap_viewer.html
+2
-2
src/cameras/CubeCamera.js
src/cameras/CubeCamera.js
+2
-0
src/core/BufferAttribute.js
src/core/BufferAttribute.js
+20
-20
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+69
-35
src/core/Geometry.js
src/core/Geometry.js
+1
-1
src/core/Object3D.js
src/core/Object3D.js
+9
-10
src/extras/geometries/SphereBufferGeometry.js
src/extras/geometries/SphereBufferGeometry.js
+2
-2
src/materials/Material.js
src/materials/Material.js
+1
-1
src/math/Matrix3.js
src/math/Matrix3.js
+4
-10
src/math/Matrix4.js
src/math/Matrix4.js
+5
-11
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+8
-4
src/renderers/webgl/WebGLShadowMap.js
src/renderers/webgl/WebGLShadowMap.js
+6
-21
未找到文件。
editor/examples/arkanoid.app.json
浏览文件 @
7b97f379
{
"project"
:
{
"vr"
:
false
},
"camera"
:
{
"metadata"
:
{
"version"
:
4.
3
,
"version"
:
4.
4
,
"type"
:
"Object"
,
"generator"
:
"Object
Exporter
"
"generator"
:
"Object
3D.toJSON
"
},
"object"
:
{
"uuid"
:
"
8EFB9C06-6312-4975-B04A-C9E4549BE348
"
,
"uuid"
:
"
E41E9F54-8B31-4D1F-8D09-AF5E802E9A22
"
,
"type"
:
"PerspectiveCamera"
,
"name"
:
"Camera"
,
"matrix"
:
[
0.9392361044883728
,
-2.8092810300250903e-9
,
-0.3432718515396118
,
0
,
-0.14778217673301697
,
0.902585506439209
,
-0.404351145029068
,
0
,
0.3098321855068207
,
0.43051064014434814
,
0.847740888595581
,
0
,
142.32125854492188
,
202.75485229492188
,
389.40936279296875
,
1
],
"fov"
:
50
,
"aspect"
:
1.536388140161725
,
"near"
:
0.1
,
"far"
:
100000
,
"matrix"
:
[
0.9392361044883728
,
-1.2050817232989175e-8
,
-0.34327182173728943
,
0
,
-0.15080472826957703
,
0.8983326554298401
,
-0.41262128949165344
,
0
,
0.30837228894233704
,
0.4393158257007599
,
0.8437464833259583
,
0
,
142.32125854492188
,
202.75485229492188
,
389.40936279296875
,
1
]
"far"
:
100000
}
},
"scene"
:
{
"metadata"
:
{
"version"
:
4.
3
,
"version"
:
4.
4
,
"type"
:
"Object"
,
"generator"
:
"Object
Exporter
"
"generator"
:
"Object
3D.toJSON
"
},
"geometries"
:
[
{
...
...
@@ -31,6 +34,16 @@
"widthSegments"
:
1
,
"heightSegments"
:
1
},
{
"uuid"
:
"EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5"
,
"type"
:
"CylinderGeometry"
,
"radiusTop"
:
5
,
"radiusBottom"
:
5
,
"height"
:
20
,
"radialSegments"
:
32
,
"heightSegments"
:
1
,
"openEnded"
:
false
},
{
"uuid"
:
"7149652B-DBD7-4CB7-A600-27A9AC005C95"
,
"type"
:
"BoxGeometry"
,
...
...
@@ -53,9 +66,9 @@
"thetaLength"
:
3.14
},
{
"uuid"
:
"
A1D8B049-74DD-4B08-B5BC-8DCEC9AF0222
"
,
"uuid"
:
"
EFBF641D-F092-462E-B7FB-0BFAD1591EFC
"
,
"type"
:
"BoxGeometry"
,
"width"
:
4
0
,
"width"
:
2
0
,
"height"
:
10
,
"depth"
:
10
,
"widthSegments"
:
1
,
...
...
@@ -72,13 +85,19 @@
"shininess"
:
30
},
{
"uuid"
:
"
CFBEAD4C-6695-4A99-887B-8161E294722
5"
,
"uuid"
:
"
3B9DE64D-E1C8-4C24-9F73-3A9E10E3E65
5"
,
"type"
:
"MeshPhongMaterial"
,
"color"
:
16777215
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
},
{
"uuid"
:
"D98FC4D1-169E-420A-92EA-20E55009A46D"
,
"type"
:
"MeshBasicMaterial"
,
"wireframe"
:
true
,
"color"
:
63744
},
{
"uuid"
:
"043B208C-1F83-42C6-802C-E0E35621C27C"
,
"type"
:
"MeshPhongMaterial"
,
...
...
@@ -89,11 +108,9 @@
},
{
"uuid"
:
"40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB"
,
"type"
:
"MeshPhongMaterial"
,
"color"
:
13486790
,
"emissive"
:
0
,
"specular"
:
1118481
,
"shininess"
:
30
"type"
:
"MeshBasicMaterial"
,
"wireframe"
:
true
,
"color"
:
63744
}],
"object"
:
{
"uuid"
:
"31517222-A9A7-4EAF-B5F6-60751C0BABA3"
,
...
...
@@ -105,51 +122,69 @@
"uuid"
:
"EBBB1E63-6318-4752-AE2E-440A4E0B3EF3"
,
"type"
:
"Mesh"
,
"name"
:
"Ground"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.0007960614748299122
,
-0.9999997019767761
,
0
,
0
,
0.9999997019767761
,
0.0007960614748299122
,
0
,
0
,
0
,
0
,
1
],
"geometry"
:
"8F05A1F2-3877-478B-8DFC-F572AC61AB3A"
,
"material"
:
"2F69AF3A-DDF5-4BBA-87B5-80159F90DDBF"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
0.000796250649727881
,
-0.9999997019767761
,
0
,
0
,
0.9999997019767761
,
0.000796250649727881
,
0
,
0
,
0
,
0
,
1
]
"material"
:
"2F69AF3A-DDF5-4BBA-87B5-80159F90DDBF"
},
{
"uuid"
:
"6EE2E764-43E0-48E0-85F2-E0C8823C20DC"
,
"type"
:
"DirectionalLight"
,
"name"
:
"DirectionalLight 1"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
100
,
200
,
150
,
1
],
"color"
:
16777215
,
"intensity"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
100
,
200
,
150
,
1
]
"intensity"
:
1
},
{
"uuid"
:
"38219749-1E67-45F2-AB15-E64BA0940CAD"
,
"type"
:
"Mesh"
,
"name"
:
"Brick"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
5
,
0
,
1
],
"children"
:
[
{
"uuid"
:
"711A5955-8F17-4A8B-991A-7604D27E6FA0"
,
"type"
:
"Mesh"
,
"name"
:
"Cylinder"
,
"matrix"
:
[
0.0007962009985931218
,
0.0007962677045725286
,
0.9999995231628418
,
0
,
-0.9999997615814209
,
3.462185702574061e-7
,
0.0007962677045725286
,
0
,
2.210134084634774e-7
,
-0.9999997615814209
,
0.0007962008821777999
,
0
,
0
,
0
,
0
,
1
],
"geometry"
:
"EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5"
,
"material"
:
"3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655"
}],
"geometry"
:
"7149652B-DBD7-4CB7-A600-27A9AC005C95"
,
"material"
:
"CFBEAD4C-6695-4A99-887B-8161E2947225"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
5
,
0
,
1
]
"material"
:
"D98FC4D1-169E-420A-92EA-20E55009A46D"
},
{
"uuid"
:
"18FFA67C-F893-4E7A-8A76-8D996DEBE0C6"
,
"type"
:
"Mesh"
,
"name"
:
"Ball"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
5
,
35.54999923706055
,
1
],
"geometry"
:
"CABCC711-1331-4D4C-9FF6-409299F10C68"
,
"material"
:
"043B208C-1F83-42C6-802C-E0E35621C27C"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
5
,
35.54999923706055
,
1
]
"material"
:
"043B208C-1F83-42C6-802C-E0E35621C27C"
},
{
"uuid"
:
"6D660D49-39B8-40C3-95F6-E4E007AA8D79"
,
"type"
:
"Mesh"
,
"name"
:
"Paddle"
,
"geometry"
:
"A1D8B049-74DD-4B08-B5BC-8DCEC9AF0222"
,
"material"
:
"40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
5
,
159.54217529296875
,
1
]
"matrix"
:
[
2
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
5
,
159.5399932861328
,
1
],
"children"
:
[
{
"uuid"
:
"4F5F884C-9E1B-45E6-8F1E-4D538A46D8CB"
,
"type"
:
"Mesh"
,
"name"
:
"Cylinder"
,
"matrix"
:
[
0.0007962009985931218
,
0.0007962677045725286
,
0.9999995231628418
,
0
,
-0.9999997615814209
,
3.462185702574061e-7
,
0.0007962677045725286
,
0
,
2.210134084634774e-7
,
-0.9999997615814209
,
0.0007962008821777999
,
0
,
0
,
0
,
0
,
1
],
"geometry"
:
"EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5"
,
"material"
:
"3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655"
}],
"geometry"
:
"EFBF641D-F092-462E-B7FB-0BFAD1591EFC"
,
"material"
:
"40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB"
},
{
"uuid"
:
"B0BEAF69-8B5D-4D87-ADCA-FDE83A02762D"
,
"type"
:
"PointLight"
,
"name"
:
"PointLight 2"
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-116.54356384277344
,
69.48957061767578
,
-206.8248291015625
,
1
],
"color"
:
16777215
,
"intensity"
:
1
,
"distance"
:
0
,
"decay"
:
1
,
"matrix"
:
[
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
-116.54356384277344
,
69.48957061767578
,
-206.8248291015625
,
1
]
"decay"
:
1
}]
}
},
...
...
@@ -162,7 +197,7 @@
"31517222-A9A7-4EAF-B5F6-60751C0BABA3"
:
[
{
"name"
:
"Game Logic"
,
"source"
:
"var ball = this.getObjectByName( 'Ball' );
\n\n
var direction = new THREE.Vector3();
\n
direction.x = Math.random() - 0.5;
\n
direction.z = - 0.5;
\n
direction.normalize();
\n\n
var speed = new THREE.Vector3();
\n\n
//
\n\n
var group = new THREE.Group();
\n
this.add( group );
\n\n
var paddle = this.getObjectByName( 'Paddle' );
\n
group.add( paddle );
\n\n
var brick = this.getObjectByName( 'Brick' );
\n\n
for ( var j = 0; j < 8; j ++ ) {
\n\n\t
var material = new THREE.MeshPhongMaterial( { color: Math.random() * 0xffffff } );
\n\n\t
for ( var i = 0; i < 12; i ++ ) {
\n\t\t\n\t\t
var object = brick.clone();
\n\t\t
object.material = material;
\n\t\t
object.position.x = i * 22 - 120;
\n\t\t
object.position.z = j * 14 - 120;
\n\t\t
group.add( object );
\n\t\t\n\t
}
\n\t\n
}
\n\n
brick
.visible = false;
\n\n
//
\n\n
var raycaster = new THREE.Raycaster();
\n\n
function update( event ) {
\n\t\n\t
if ( ball.position.x < - 150 || ball.position.x > 150 ) direction.x = - direction.x;
\n\t
if ( ball.position.z < - 200 || ball.position.z > 200 ) direction.z = - direction.z;
\n\n\t
ball.position.x = Math.max( - 150, Math.min( 150, ball.position.x ) );
\n\t
ball.position.z = Math.max( - 200, Math.min( 200, ball.position.z ) );
\n\t\n\t
ball.position.add( speed.copy( direction ).multiplyScalar( event.delta / 4 ) );
\n\t\n\t
raycaster.set( ball.position, direction );
\n\t\n\t
var intersections = raycaster.intersectObjects( group.children );
\n\t\n\t
if ( intersections.length > 0 ) {
\n\t\n\t\t
var intersection = intersections[ 0 ];
\n\t\t\n\t\t
if ( intersection.distance < 5 ) {
\n\t\t\t\n\t\t\t
if ( intersection.object !== paddle ) {
\n\n\t\t\t\t
group.remove( intersection.object );
\n\t\t\t\t\n\t\t\t
}
\n\t\t\t\n\t\t\t
direction.reflect( intersection.face.normal );
\n\t\t\t\n\t\t
}
\n\t\t\n\t
}
\n\n
}"
"source"
:
"var ball = this.getObjectByName( 'Ball' );
\n\n
var direction = new THREE.Vector3();
\n
direction.x = Math.random() - 0.5;
\n
direction.z = - 0.5;
\n
direction.normalize();
\n\n
var speed = new THREE.Vector3();
\n\n
//
\n\n
var group = new THREE.Group();
\n
this.add( group );
\n\n
var paddle = this.getObjectByName( 'Paddle' );
\n
paddle.material.visible = false;
\n
group.add( paddle );
\n\n
var brick = this.getObjectByName( 'Brick' );
\n\n
for ( var j = 0; j < 8; j ++ ) {
\n\n\t
var material = new THREE.MeshPhongMaterial( { color: Math.random() * 0xffffff } );
\n\n\t
for ( var i = 0; i < 12; i ++ ) {
\n\t\t\n\t\t
var object = brick.clone();
\n\t\t
object.position.x = i * 22 - 120;
\n\t\t
object.position.z = j * 14 - 120;
\n\t\t
group.add( object );
\n\n\t\t
var cylinder = object.getObjectByName( 'Cylinder' );
\n\t\t
cylinder.material = material;
\n\n\t
}
\n\t\n
}
\n\n
brick.visible = false;
\n
brick.material
.visible = false;
\n\n
//
\n\n
var raycaster = new THREE.Raycaster();
\n\n
function update( event ) {
\n\t\n\t
if ( ball.position.x < - 150 || ball.position.x > 150 ) direction.x = - direction.x;
\n\t
if ( ball.position.z < - 200 || ball.position.z > 200 ) direction.z = - direction.z;
\n\n\t
ball.position.x = Math.max( - 150, Math.min( 150, ball.position.x ) );
\n\t
ball.position.z = Math.max( - 200, Math.min( 200, ball.position.z ) );
\n\t\n\t
ball.position.add( speed.copy( direction ).multiplyScalar( event.delta / 4 ) );
\n\t\n\t
raycaster.set( ball.position, direction );
\n\t\n\t
var intersections = raycaster.intersectObjects( group.children );
\n\t\n\t
if ( intersections.length > 0 ) {
\n\t\n\t\t
var intersection = intersections[ 0 ];
\n\t\t\n\t\t
if ( intersection.distance < 5 ) {
\n\t\t\t\n\t\t\t
if ( intersection.object !== paddle ) {
\n\n\t\t\t\t
group.remove( intersection.object );
\n\t\t\t\t\n\t\t\t
}
\n\t\t\t\n\t\t\t
direction.reflect( intersection.face.normal );
\n\t\t\t\n\t\t
}
\n\t\t\n\t
}
\n\n
}"
}]
}
}
\ No newline at end of file
editor/js/Sidebar.Geometry.js
浏览文件 @
7b97f379
...
...
@@ -146,42 +146,16 @@ Sidebar.Geometry = function ( editor ) {
parameters
.
clear
();
if
(
geometry
instanceof
THREE
.
BoxGeometry
)
{
if
(
Sidebar
.
Geometry
[
geometry
.
type
]
!==
undefined
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
BoxGeometry
(
signals
,
object
)
);
parameters
.
add
(
new
Sidebar
.
Geometry
[
geometry
.
type
]
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
CircleGeometry
)
{
}
else
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
CircleGeometry
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
CylinderGeometry
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
CylinderGeometry
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
SphereGeometry
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
SphereGeometry
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
IcosahedronGeometry
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
IcosahedronGeometry
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
PlaneGeometry
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
PlaneGeometry
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
TorusGeometry
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
TorusGeometry
(
signals
,
object
)
);
}
else
if
(
geometry
instanceof
THREE
.
TorusKnotGeometry
)
{
parameters
.
add
(
new
Sidebar
.
Geometry
.
TorusKnotGeometry
(
signals
,
object
)
);
parameters
.
add
(
new
Sidebar
.
Geometry
.
Modifiers
(
signals
,
object
)
);
}
parameters
.
add
(
new
Sidebar
.
Geometry
.
Modifiers
(
signals
,
object
)
);
}
else
{
container
.
setDisplay
(
'
none
'
);
...
...
examples/webgl_animation_cloth.html
浏览文件 @
7b97f379
...
...
@@ -291,7 +291,7 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
e
nabled
=
true
;
//
...
...
examples/webgl_animation_skinning_morph.html
浏览文件 @
7b97f379
...
...
@@ -144,7 +144,7 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
e
nabled
=
true
;
// STATS
...
...
examples/webgl_interactive_draggablecubes.html
浏览文件 @
7b97f379
...
...
@@ -112,8 +112,8 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
sortObjects
=
false
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
PCFShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
PCFShadowMap
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_lensflares.html
浏览文件 @
7b97f379
...
...
@@ -116,12 +116,7 @@
// lights
var
ambient
=
new
THREE
.
AmbientLight
(
0xffffff
);
ambient
.
color
.
setHSL
(
0.1
,
0.3
,
0.2
);
scene
.
add
(
ambient
);
var
dirLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.125
);
var
dirLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.05
);
dirLight
.
position
.
set
(
0
,
-
1
,
0
).
normalize
();
scene
.
add
(
dirLight
);
...
...
@@ -139,7 +134,7 @@
function
addLight
(
h
,
s
,
l
,
x
,
y
,
z
)
{
var
light
=
new
THREE
.
PointLight
(
0xffffff
,
1.5
,
45
00
);
var
light
=
new
THREE
.
PointLight
(
0xffffff
,
1.5
,
20
00
);
light
.
color
.
setHSL
(
h
,
s
,
l
);
light
.
position
.
set
(
x
,
y
,
z
);
scene
.
add
(
light
);
...
...
examples/webgl_lights_hemisphere.html
浏览文件 @
7b97f379
...
...
@@ -233,8 +233,8 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
C
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
c
ullFace
=
THREE
.
CullFaceBack
;
// STATS
...
...
examples/webgl_loader_ctm.html
浏览文件 @
7b97f379
...
...
@@ -125,7 +125,7 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
e
nabled
=
true
;
// STATS
...
...
examples/webgl_loader_gltf.html
浏览文件 @
7b97f379
此差异已折叠。
点击以展开。
examples/webgl_loader_ply.html
浏览文件 @
7b97f379
...
...
@@ -125,8 +125,8 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
C
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
c
ullFace
=
THREE
.
CullFaceBack
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_loader_stl.html
浏览文件 @
7b97f379
...
...
@@ -180,8 +180,8 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
C
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
c
ullFace
=
THREE
.
CullFaceBack
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_loader_utf8.html
浏览文件 @
7b97f379
...
...
@@ -126,8 +126,8 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
PCFShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
PCFShadowMap
;
// STATS
...
...
examples/webgl_materials_bumpmap.html
浏览文件 @
7b97f379
...
...
@@ -182,8 +182,8 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
C
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
c
ullFace
=
THREE
.
CullFaceBack
;
//
...
...
examples/webgl_materials_bumpmap_skin.html
浏览文件 @
7b97f379
...
...
@@ -185,8 +185,8 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
C
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
c
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
autoClear
=
false
;
...
...
examples/webgl_materials_cubemap_dynamic.html
浏览文件 @
7b97f379
...
...
@@ -194,8 +194,8 @@
// SHADOW
renderer
.
shadowMap
C
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
c
ullFace
=
THREE
.
CullFaceBack
;
renderer
.
shadowMap
.
e
nabled
=
true
;
// STATS
...
...
@@ -982,7 +982,7 @@
// render scene
renderer
.
autoClear
=
false
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
e
nabled
=
true
;
camera
.
lookAt
(
cameraTarget
);
...
...
@@ -991,7 +991,7 @@
renderer
.
clear
();
composer
.
render
(
0.1
);
renderer
.
shadowMap
E
nabled
=
false
;
renderer
.
shadowMap
.
e
nabled
=
false
;
}
...
...
examples/webgl_materials_normaldisplacementmap.html
浏览文件 @
7b97f379
...
...
@@ -220,8 +220,8 @@
//
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
PCFShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
PCFShadowMap
;
//
...
...
examples/webgl_morphtargets_md2.html
浏览文件 @
7b97f379
...
...
@@ -146,7 +146,7 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
e
nabled
=
true
;
// STATS
...
...
examples/webgl_morphtargets_md2_control.html
浏览文件 @
7b97f379
...
...
@@ -157,11 +157,11 @@
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
.
e
nabled
=
true
;
//renderer.shadowMap
C
ascade = true;
//renderer.shadowMap
T
ype = THREE.PCFSoftShadowMap;
//renderer.shadowMap
D
ebug = true;
//renderer.shadowMap
.c
ascade = true;
//renderer.shadowMap
.t
ype = THREE.PCFSoftShadowMap;
//renderer.shadowMap
.d
ebug = true;
// STATS
...
...
examples/webgl_shading_physical.html
浏览文件 @
7b97f379
...
...
@@ -339,8 +339,8 @@
//
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
PCFSoftShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
PCFSoftShadowMap
;
//
...
...
examples/webgl_shadowmap.html
浏览文件 @
7b97f379
...
...
@@ -142,8 +142,8 @@
//
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
PCFShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
PCFShadowMap
;
// STATS
...
...
examples/webgl_shadowmap_performance.html
浏览文件 @
7b97f379
...
...
@@ -134,8 +134,8 @@
//
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
PCFSoftShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
PCFSoftShadowMap
;
// STATS
...
...
examples/webgl_shadowmap_viewer.html
浏览文件 @
7b97f379
...
...
@@ -163,8 +163,8 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setClearColor
(
0x000000
);
renderer
.
shadowMap
E
nabled
=
true
;
renderer
.
shadowMap
T
ype
=
THREE
.
BasicShadowMap
;
renderer
.
shadowMap
.
e
nabled
=
true
;
renderer
.
shadowMap
.
t
ype
=
THREE
.
BasicShadowMap
;
// Mouse control
controls
=
new
THREE
.
OrbitControls
(
camera
,
renderer
.
domElement
);
...
...
src/cameras/CubeCamera.js
浏览文件 @
7b97f379
...
...
@@ -47,6 +47,8 @@ THREE.CubeCamera = function ( near, far, cubeResolution ) {
this
.
updateCubeMap
=
function
(
renderer
,
scene
)
{
if
(
this
.
parent
===
undefined
)
this
.
updateMatrixWorld
();
var
renderTarget
=
this
.
renderTarget
;
var
generateMipmaps
=
renderTarget
.
generateMipmaps
;
...
...
src/core/BufferAttribute.js
浏览文件 @
7b97f379
...
...
@@ -146,59 +146,59 @@ THREE.BufferAttribute.prototype = {
},
setX
:
function
(
index
,
x
)
{
this
.
array
[
index
*
this
.
itemSize
]
=
x
;
getX
:
function
(
index
)
{
return
this
;
return
this
.
array
[
index
*
this
.
itemSize
]
;
},
set
Y
:
function
(
index
,
y
)
{
set
X
:
function
(
index
,
x
)
{
this
.
array
[
index
*
this
.
itemSize
+
1
]
=
y
;
this
.
array
[
index
*
this
.
itemSize
]
=
x
;
return
this
;
},
setZ
:
function
(
index
,
z
)
{
this
.
array
[
index
*
this
.
itemSize
+
2
]
=
z
;
getY
:
function
(
index
)
{
return
this
;
return
this
.
array
[
index
*
this
.
itemSize
+
1
]
;
},
set
W
:
function
(
index
,
w
)
{
set
Y
:
function
(
index
,
y
)
{
this
.
array
[
index
*
this
.
itemSize
+
3
]
=
w
;
this
.
array
[
index
*
this
.
itemSize
+
1
]
=
y
;
return
this
;
},
get
X
:
function
(
index
)
{
get
Z
:
function
(
index
)
{
return
this
.
array
[
index
*
this
.
itemSize
];
return
this
.
array
[
index
*
this
.
itemSize
+
2
];
},
getY
:
function
(
index
)
{
setZ
:
function
(
index
,
z
)
{
return
this
.
array
[
index
*
this
.
itemSize
+
1
];
this
.
array
[
index
*
this
.
itemSize
+
2
]
=
z
;
return
this
;
},
get
Z
:
function
(
index
)
{
get
W
:
function
(
index
)
{
return
this
.
array
[
index
*
this
.
itemSize
+
2
];
return
this
.
array
[
index
*
this
.
itemSize
+
3
];
},
getW
:
function
(
index
)
{
setW
:
function
(
index
,
w
)
{
return
this
.
array
[
index
*
this
.
itemSize
+
3
];
this
.
array
[
index
*
this
.
itemSize
+
3
]
=
w
;
return
this
;
},
...
...
src/core/BufferGeometry.js
浏览文件 @
7b97f379
...
...
@@ -68,7 +68,7 @@ THREE.BufferGeometry.prototype = {
if
(
position
!==
undefined
)
{
matrix
.
applyTo
Buffer
(
position
);
matrix
.
applyTo
Vector3Array
(
position
.
array
);
position
.
needsUpdate
=
true
;
}
...
...
@@ -79,7 +79,7 @@ THREE.BufferGeometry.prototype = {
var
normalMatrix
=
new
THREE
.
Matrix3
().
getNormalMatrix
(
matrix
);
normalMatrix
.
applyTo
Buffer
(
normal
);
normalMatrix
.
applyTo
Vector3Array
(
normal
.
array
);
normal
.
needsUpdate
=
true
;
}
...
...
@@ -265,10 +265,10 @@ THREE.BufferGeometry.prototype = {
var
faceVertexUvs
=
geometry
.
faceVertexUvs
;
var
vertexColors
=
material
.
vertexColors
;
var
hasFaceVertexUv
=
faceVertexUvs
[
0
].
length
>
0
;
var
hasFaceVertexUv
=
faceVertexUvs
[
0
]
&&
faceVertexUvs
[
0
]
.
length
>
0
;
var
hasFaceVertexUv2
=
faceVertexUvs
[
1
]
&&
faceVertexUvs
[
1
].
length
>
0
;
var
hasFaceVertexNormals
=
faces
[
0
].
vertexNormals
.
length
==
3
;
var
hasFaceVertexNormals
=
faces
[
0
]
&&
faces
[
0
]
.
vertexNormals
.
length
==
3
;
var
positions
=
new
Float32Array
(
faces
.
length
*
3
*
3
);
this
.
addAttribute
(
'
position
'
,
new
THREE
.
BufferAttribute
(
positions
,
3
)
);
...
...
@@ -391,35 +391,55 @@ THREE.BufferGeometry.prototype = {
if
(
hasFaceVertexUv
===
true
)
{
var
uva
=
faceVertexUvs
[
0
][
i
][
0
];
var
uvb
=
faceVertexUvs
[
0
][
i
][
1
];
var
uvc
=
faceVertexUvs
[
0
][
i
][
2
];
var
vertexUvs
=
faceVertexUvs
[
0
][
i
];
uvs
[
i2
]
=
uva
.
x
;
uvs
[
i2
+
1
]
=
uva
.
y
;
if
(
vertexUvs
!==
undefined
)
{
uvs
[
i2
+
2
]
=
uvb
.
x
;
uvs
[
i2
+
3
]
=
uvb
.
y
;
var
uva
=
vertexUvs
[
0
];
var
uvb
=
vertexUvs
[
1
];
var
uvc
=
vertexUvs
[
2
];
uvs
[
i2
+
4
]
=
uvc
.
x
;
uvs
[
i2
+
5
]
=
uvc
.
y
;
uvs
[
i2
]
=
uva
.
x
;
uvs
[
i2
+
1
]
=
uva
.
y
;
uvs
[
i2
+
2
]
=
uvb
.
x
;
uvs
[
i2
+
3
]
=
uvb
.
y
;
uvs
[
i2
+
4
]
=
uvc
.
x
;
uvs
[
i2
+
5
]
=
uvc
.
y
;
}
else
{
THREE
.
warn
(
'
THREE.BufferGeometry.fromGeometry(): Undefined vertexUv
'
,
i
)
}
}
if
(
hasFaceVertexUv2
===
true
)
{
var
uva
=
faceVertexUvs
[
1
][
i
][
0
];
var
uvb
=
faceVertexUvs
[
1
][
i
][
1
];
var
uvc
=
faceVertexUvs
[
1
][
i
][
2
];
var
vertexUvs
=
faceVertexUvs
[
1
][
i
];
uvs2
[
i2
]
=
uva
.
x
;
uvs2
[
i2
+
1
]
=
uva
.
y
;
if
(
vertexUvs
!==
undefined
)
{
var
uva
=
vertexUvs
[
0
];
var
uvb
=
vertexUvs
[
1
];
var
uvc
=
vertexUvs
[
2
];
uvs2
[
i2
]
=
uva
.
x
;
uvs2
[
i2
+
1
]
=
uva
.
y
;
uvs2
[
i2
+
2
]
=
uvb
.
x
;
uvs2
[
i2
+
3
]
=
uvb
.
y
;
uvs2
[
i2
+
4
]
=
uvc
.
x
;
uvs2
[
i2
+
5
]
=
uvc
.
y
;
}
else
{
uvs2
[
i2
+
2
]
=
uvb
.
x
;
uvs2
[
i2
+
3
]
=
uvb
.
y
;
THREE
.
warn
(
'
THREE.BufferGeometry.fromGeometry(): Undefined vertexUv2
'
,
i
)
uvs2
[
i2
+
4
]
=
uvc
.
x
;
uvs2
[
i2
+
5
]
=
uvc
.
y
;
}
}
...
...
@@ -466,16 +486,16 @@ THREE.BufferGeometry.prototype = {
}
var
positions
=
this
.
attributes
.
position
;
var
positions
=
this
.
attributes
.
position
.
array
;
if
(
positions
)
{
var
bb
=
this
.
boundingBox
;
bb
.
makeEmpty
();
for
(
var
i
=
0
,
il
=
positions
.
length
/
positions
.
itemSize
;
i
<
il
;
i
++
)
{
for
(
var
i
=
0
,
il
=
positions
.
length
;
i
<
il
;
i
+=
3
)
{
vector
.
set
(
positions
.
getX
(
i
),
positions
.
getY
(
i
),
positions
.
getZ
(
i
)
);
vector
.
fromArray
(
positions
,
i
);
bb
.
expandByPoint
(
vector
);
}
...
...
@@ -491,7 +511,7 @@ THREE.BufferGeometry.prototype = {
if
(
isNaN
(
this
.
boundingBox
.
min
.
x
)
||
isNaN
(
this
.
boundingBox
.
min
.
y
)
||
isNaN
(
this
.
boundingBox
.
min
.
z
)
)
{
THREE
.
error
(
'
THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.
'
);
THREE
.
error
(
'
THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.
'
,
this
);
}
...
...
@@ -512,7 +532,7 @@ THREE.BufferGeometry.prototype = {
}
var
positions
=
this
.
attributes
.
position
;
var
positions
=
this
.
attributes
.
position
.
array
;
if
(
positions
)
{
...
...
@@ -520,9 +540,9 @@ THREE.BufferGeometry.prototype = {
var
center
=
this
.
boundingSphere
.
center
;
for
(
var
i
=
0
,
il
=
positions
.
length
/
positions
.
itemSize
;
i
<
il
;
i
++
)
{
for
(
var
i
=
0
,
il
=
positions
.
length
;
i
<
il
;
i
+=
3
)
{
vector
.
set
(
positions
.
getX
(
i
),
positions
.
getY
(
i
),
positions
.
getZ
(
i
)
);
vector
.
fromArray
(
positions
,
i
);
box
.
expandByPoint
(
vector
);
}
...
...
@@ -534,9 +554,9 @@ THREE.BufferGeometry.prototype = {
var
maxRadiusSq
=
0
;
for
(
var
i
=
0
,
il
=
positions
.
length
/
positions
.
itemSize
;
i
<
il
;
i
++
)
{
for
(
var
i
=
0
,
il
=
positions
.
length
;
i
<
il
;
i
+=
3
)
{
vector
.
set
(
positions
.
getX
(
i
),
positions
.
getY
(
i
),
positions
.
getZ
(
i
)
);
vector
.
fromArray
(
positions
,
i
);
maxRadiusSq
=
Math
.
max
(
maxRadiusSq
,
center
.
distanceToSquared
(
vector
)
);
}
...
...
@@ -545,7 +565,7 @@ THREE.BufferGeometry.prototype = {
if
(
isNaN
(
this
.
boundingSphere
.
radius
)
)
{
THREE
.
error
(
'
THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.
'
);
THREE
.
error
(
'
THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.
'
,
this
);
}
...
...
@@ -1087,11 +1107,25 @@ THREE.BufferGeometry.prototype = {
// standard BufferGeometry serialization
data
.
type
=
this
.
type
;
data
.
uuid
=
this
.
uuid
;
data
.
type
=
this
.
type
;
if
(
this
.
name
!==
''
)
data
.
name
=
this
.
name
;
data
.
data
=
{};
data
.
data
.
attributes
=
{};
if
(
this
.
parameters
!==
undefined
)
{
var
parameters
=
this
.
parameters
;
for
(
var
key
in
parameters
)
{
if
(
parameters
[
key
]
!==
undefined
)
data
[
key
]
=
parameters
[
key
];
}
return
data
;
}
data
.
data
=
{
attributes
:
{}
};
var
attributes
=
this
.
attributes
;
var
offsets
=
this
.
offsets
;
...
...
src/core/Geometry.js
浏览文件 @
7b97f379
...
...
@@ -803,8 +803,8 @@ THREE.Geometry.prototype = {
// standard Geometry serialization
data
.
type
=
this
.
type
;
data
.
uuid
=
this
.
uuid
;
data
.
type
=
this
.
type
;
if
(
this
.
name
!==
''
)
data
.
name
=
this
.
name
;
if
(
this
.
parameters
!==
undefined
)
{
...
...
src/core/Object3D.js
浏览文件 @
7b97f379
...
...
@@ -597,8 +597,8 @@ THREE.Object3D.prototype = {
// standard Object3D serialization
data
.
type
=
this
.
type
;
data
.
uuid
=
this
.
uuid
;
data
.
type
=
this
.
type
;
if
(
this
.
name
!==
''
)
data
.
name
=
this
.
name
;
if
(
JSON
.
stringify
(
this
.
userData
)
!==
'
{}
'
)
data
.
userData
=
this
.
userData
;
if
(
this
.
visible
!==
true
)
data
.
visible
=
this
.
visible
;
...
...
@@ -619,23 +619,22 @@ THREE.Object3D.prototype = {
// wrap serialized object with additional data
var
output
;
var
output
=
{}
;
if
(
isRootObject
)
{
output
=
{
metadata
:
metadata
,
geometries
:
extractFromCache
(
meta
.
geometries
),
materials
:
extractFromCache
(
meta
.
materials
),
object
:
data
};
output
.
metadata
=
metadata
;
}
else
{
var
geometries
=
extractFromCache
(
meta
.
geometries
);
var
materials
=
extractFromCache
(
meta
.
materials
);
output
=
{
object
:
data
};
if
(
geometries
.
length
>
0
)
output
.
geometries
=
geometries
;
if
(
materials
.
length
>
0
)
output
.
materials
=
materials
;
}
output
.
object
=
data
;
return
output
;
// extract data from the cache hash
...
...
src/extras/geometries/SphereBufferGeometry.js
浏览文件 @
7b97f379
...
...
@@ -40,7 +40,7 @@ THREE.SphereBufferGeometry = function ( radius, widthSegments, heightSegments, p
var
uvs
=
new
THREE
.
InterleavedBufferAttribute
(
vertexBuffer
,
2
,
6
);
this
.
addAttribute
(
'
uv
'
,
uvs
);
var
x
,
y
,
u
,
v
,
px
,
py
,
p
x
,
index
=
0
,
vertices
=
[],
normal
=
new
THREE
.
Vector3
();
var
x
,
y
,
u
,
v
,
px
,
py
,
p
z
,
index
=
0
,
vertices
=
[],
normal
=
new
THREE
.
Vector3
();
for
(
y
=
0
;
y
<=
heightSegments
;
y
++
)
{
...
...
@@ -73,7 +73,7 @@ THREE.SphereBufferGeometry = function ( radius, widthSegments, heightSegments, p
}
var
indices
=
[];
var
ul
;
for
(
y
=
0
,
ul
=
heightSegments
-
1
;
y
<
ul
;
y
++
)
{
for
(
x
=
0
;
x
<
widthSegments
;
x
++
)
{
...
...
src/materials/Material.js
浏览文件 @
7b97f379
...
...
@@ -121,8 +121,8 @@ THREE.Material.prototype = {
};
// standard Material serialization
data
.
type
=
this
.
type
;
data
.
uuid
=
this
.
uuid
;
data
.
type
=
this
.
type
;
if
(
this
.
name
!==
''
)
data
.
name
=
this
.
name
;
if
(
this
.
opacity
<
1
)
data
.
opacity
=
this
.
opacity
;
...
...
src/math/Matrix3.js
浏览文件 @
7b97f379
...
...
@@ -86,7 +86,7 @@ THREE.Matrix3.prototype = {
var
v1
;
return
function
applyToVector3Array
(
array
,
offset
,
length
)
{
return
function
(
array
,
offset
,
length
)
{
if
(
v1
===
undefined
)
v1
=
new
THREE
.
Vector3
();
if
(
offset
===
undefined
)
offset
=
0
;
...
...
@@ -94,15 +94,9 @@ THREE.Matrix3.prototype = {
for
(
var
i
=
0
,
j
=
offset
;
i
<
length
;
i
+=
3
,
j
+=
3
)
{
v1
.
x
=
array
[
j
];
v1
.
y
=
array
[
j
+
1
];
v1
.
z
=
array
[
j
+
2
];
v1
.
fromArray
(
array
,
j
);
v1
.
applyMatrix3
(
this
);
array
[
j
]
=
v1
.
x
;
array
[
j
+
1
]
=
v1
.
y
;
array
[
j
+
2
]
=
v1
.
z
;
v1
.
toArray
(
array
,
j
);
}
...
...
@@ -134,7 +128,7 @@ THREE.Matrix3.prototype = {
}
return
array
;
return
buffer
;
};
...
...
src/math/Matrix4.js
浏览文件 @
7b97f379
...
...
@@ -101,7 +101,7 @@ THREE.Matrix4.prototype = {
return
this
;
},
makeBasis
:
function
(
xAxis
,
yAxis
,
zAxis
)
{
this
.
set
(
...
...
@@ -469,7 +469,7 @@ THREE.Matrix4.prototype = {
var
v1
;
return
function
applyToVector3Array
(
array
,
offset
,
length
)
{
return
function
(
array
,
offset
,
length
)
{
if
(
v1
===
undefined
)
v1
=
new
THREE
.
Vector3
();
if
(
offset
===
undefined
)
offset
=
0
;
...
...
@@ -477,15 +477,9 @@ THREE.Matrix4.prototype = {
for
(
var
i
=
0
,
j
=
offset
;
i
<
length
;
i
+=
3
,
j
+=
3
)
{
v1
.
x
=
array
[
j
];
v1
.
y
=
array
[
j
+
1
];
v1
.
z
=
array
[
j
+
2
];
v1
.
fromArray
(
array
,
j
);
v1
.
applyMatrix4
(
this
);
array
[
j
]
=
v1
.
x
;
array
[
j
+
1
]
=
v1
.
y
;
array
[
j
+
2
]
=
v1
.
z
;
v1
.
toArray
(
array
,
j
);
}
...
...
@@ -517,7 +511,7 @@ THREE.Matrix4.prototype = {
}
return
array
;
return
buffer
;
};
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
7b97f379
...
...
@@ -963,13 +963,17 @@ THREE.WebGLRenderer = function ( parameters ) {
}
else
if
(
material
.
defaultAttributeValues
!==
undefined
)
{
if
(
material
.
defaultAttributeValues
[
key
]
.
length
===
2
)
{
if
(
material
.
defaultAttributeValues
[
key
]
!==
undefined
)
{
_gl
.
vertexAttrib2fv
(
programAttribute
,
material
.
defaultAttributeValues
[
key
]
);
if
(
material
.
defaultAttributeValues
[
key
].
length
===
2
)
{
}
else
if
(
material
.
defaultAttributeValues
[
key
].
length
===
3
)
{
_gl
.
vertexAttrib2fv
(
programAttribute
,
material
.
defaultAttributeValues
[
key
]
);
_gl
.
vertexAttrib3fv
(
programAttribute
,
material
.
defaultAttributeValues
[
key
]
);
}
else
if
(
material
.
defaultAttributeValues
[
key
].
length
===
3
)
{
_gl
.
vertexAttrib3fv
(
programAttribute
,
material
.
defaultAttributeValues
[
key
]
);
}
}
...
...
src/renderers/webgl/WebGLShadowMap.js
浏览文件 @
7b97f379
...
...
@@ -274,7 +274,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
webglObject
=
_renderList
[
j
];
object
=
webglObject
.
object
;
buffer
=
webglObject
.
buffer
;
buffer
=
_objects
.
geometries
.
get
(
object
)
;
// culling is overriden globally for all objects
// while rendering depth map
...
...
@@ -309,16 +309,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
}
_renderer
.
setMaterialFaces
(
objectMaterial
);
if
(
buffer
instanceof
THREE
.
BufferGeometry
)
{
_renderer
.
renderBufferDirect
(
shadowCamera
,
_lights
,
fog
,
material
,
buffer
,
object
);
}
else
{
_renderer
.
renderBuffer
(
shadowCamera
,
_lights
,
fog
,
material
,
buffer
,
object
);
}
_renderer
.
renderBufferDirect
(
shadowCamera
,
_lights
,
fog
,
material
,
buffer
,
object
);
}
...
...
@@ -363,18 +354,12 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
if
(
object
.
visible
)
{
var
webglObjects
=
_webglObjects
[
object
.
id
];
if
(
webglObjects
&&
object
.
castShadow
&&
(
object
.
frustumCulled
===
false
||
_frustum
.
intersectsObject
(
object
)
===
true
)
)
{
for
(
var
i
=
0
,
l
=
webglObjects
.
length
;
i
<
l
;
i
++
)
{
var
webglObject
=
_objects
.
objects
[
object
.
id
];
var
webglObject
=
webglObjects
[
i
];
if
(
webglObject
&&
object
.
castShadow
&&
(
object
.
frustumCulled
===
false
||
_frustum
.
intersectsObject
(
object
)
===
true
)
)
{
object
.
_modelViewMatrix
.
multiplyMatrices
(
shadowCamera
.
matrixWorldInverse
,
object
.
matrixWorld
);
_renderList
.
push
(
webglObject
);
}
object
.
_modelViewMatrix
.
multiplyMatrices
(
shadowCamera
.
matrixWorldInverse
,
object
.
matrixWorld
);
_renderList
.
push
(
webglObject
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录