Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
cbb962ed
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,发现更多精彩内容 >>
提交
cbb962ed
编写于
5月 17, 2019
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modularize.js: Enable example dependencies.
上级
a8a6aec4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
124 addition
and
54 deletion
+124
-54
examples/jsm/shaders/UnpackDepthRGBAShader.js
examples/jsm/shaders/UnpackDepthRGBAShader.js
+53
-0
examples/jsm/utils/ShadowMapViewer.js
examples/jsm/utils/ShadowMapViewer.js
+2
-2
utils/modularize.js
utils/modularize.js
+69
-52
未找到文件。
examples/jsm/shaders/UnpackDepthRGBAShader.js
0 → 100644
浏览文件 @
cbb962ed
/**
* @author alteredq / http://alteredqualia.com/
*
* Unpack RGBA depth shader
* - show RGBA encoded depth as monochrome color
*/
var
UnpackDepthRGBAShader
=
{
uniforms
:
{
"
tDiffuse
"
:
{
value
:
null
},
"
opacity
"
:
{
value
:
1.0
}
},
vertexShader
:
[
"
varying vec2 vUv;
"
,
"
void main() {
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
].
join
(
"
\n
"
),
fragmentShader
:
[
"
uniform float opacity;
"
,
"
uniform sampler2D tDiffuse;
"
,
"
varying vec2 vUv;
"
,
"
#include <packing>
"
,
"
void main() {
"
,
"
float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );
"
,
"
gl_FragColor = vec4( vec3( depth ), opacity );
"
,
"
}
"
].
join
(
"
\n
"
)
};
export
{
UnpackDepthRGBAShader
};
examples/jsm/utils/ShadowMapViewer.js
浏览文件 @
cbb962ed
...
...
@@ -37,9 +37,9 @@ import {
Scene
,
ShaderMaterial
,
Texture
,
UniformsUtils
,
UnpackDepthRGBAShader
UniformsUtils
}
from
"
../../../build/three.module.js
"
;
import
{
UnpackDepthRGBAShader
}
from
"
../shaders/UnpackDepthRGBAShader.js
"
;
var
ShadowMapViewer
=
function
(
light
)
{
...
...
utils/modularize.js
浏览文件 @
cbb962ed
...
...
@@ -3,72 +3,75 @@
*/
var
fs
=
require
(
'
fs
'
);
THREE
=
require
(
'
../build/three.js
'
);
var
srcFolder
=
__dirname
+
'
/../examples/js/
'
;
var
dstFolder
=
__dirname
+
'
/../examples/jsm/
'
;
var
files
=
[
{
path
:
'
controls/DragControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/DeviceOrientationControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/EditorControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/FirstPersonControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/FlyControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/OrbitControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/MapControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/OrthographicTrackballControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/PointerLockControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/TrackballControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
controls/TransformControls.js
'
,
ignoreList
:
[]
},
{
path
:
'
exporters/GLTFExporter.js
'
,
ignoreList
:
[
'
AnimationClip
'
,
'
Camera
'
,
'
Geometry
'
,
'
Material
'
,
'
Mesh
'
,
'
Object3D
'
,
'
RGBFormat
'
,
'
Scenes
'
,
'
ShaderMaterial
'
,
'
VertexColors
'
]
},
{
path
:
'
exporters/MMDExporter.js
'
,
ignoreList
:
[]
},
{
path
:
'
exporters/OBJExporter.js
'
,
ignoreList
:
[]
},
{
path
:
'
exporters/PLYExporter.js
'
,
ignoreList
:
[]
},
{
path
:
'
exporters/STLExporter.js
'
,
ignoreList
:
[]
},
{
path
:
'
exporters/TypedGeometryExporter.js
'
,
ignoreList
:
[]
},
{
path
:
'
loaders/BVHLoader.js
'
,
ignoreList
:
[
'
Bones
'
]
},
{
path
:
'
loaders/PCDLoader.js
'
,
ignoreList
:
[]
},
{
path
:
'
loaders/GLTFLoader.js
'
,
ignoreList
:
[
'
NoSide
'
,
'
Matrix2
'
,
'
DDSLoader
'
]
},
{
path
:
'
loaders/OBJLoader.js
'
,
ignoreList
:
[]
},
{
path
:
'
loaders/MTLLoader.js
'
,
ignoreList
:
[
'
BackSide
'
,
'
DoubleSide
'
,
'
ClampToEdgeWrapping
'
,
'
MirroredRepeatWrapping
'
]
},
{
path
:
'
loaders/PLYLoader.js
'
,
ignoreList
:
[
'
Mesh
'
]
},
{
path
:
'
loaders/STLLoader.js
'
,
ignoreList
:
[
'
Mesh
'
,
'
MeshPhongMaterial
'
,
'
VertexColors
'
]
},
{
path
:
'
loaders/SVGLoader.js
'
,
ignoreList
:
[]
},
{
path
:
'
loaders/TGALoader.js
'
,
ignoreList
:
[]
},
{
path
:
'
loaders/VRMLLoader.js
'
,
ignoreList
:
[]
},
{
path
:
'
pmrem/PMREMCubeUVPacker.js
'
,
ignoreList
:
[]
},
{
path
:
'
pmrem/PMREMGenerator.js
'
,
ignoreList
:
[]
},
{
path
:
'
renderers/CSS2DRenderer.js
'
,
ignoreList
:
[]
},
{
path
:
'
renderers/CSS3DRenderer.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/BufferGeometryUtils.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/GeometryUtils.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/MathUtils.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/SceneUtils.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/ShadowMapViewer.js
'
,
ignoreList
:
[
'
DirectionalLight
'
,
'
SpotLight
'
]
},
{
path
:
'
utils/SkeletonUtils.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/TypedArrayUtils.js
'
,
ignoreList
:
[]
},
{
path
:
'
utils/UVsDebug.js
'
,
ignoreList
:
[
'
SphereBufferGeometry
'
]
},
{
path
:
'
controls/DragControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/DeviceOrientationControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/EditorControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/FirstPersonControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/FlyControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/OrbitControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/MapControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/OrthographicTrackballControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/PointerLockControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/TrackballControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
controls/TransformControls.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
exporters/GLTFExporter.js
'
,
dependencies
:
[],
ignoreList
:
[
'
AnimationClip
'
,
'
Camera
'
,
'
Geometry
'
,
'
Material
'
,
'
Mesh
'
,
'
Object3D
'
,
'
RGBFormat
'
,
'
Scenes
'
,
'
ShaderMaterial
'
,
'
VertexColors
'
]
},
{
path
:
'
exporters/MMDExporter.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
exporters/OBJExporter.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
exporters/PLYExporter.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
exporters/STLExporter.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
exporters/TypedGeometryExporter.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/BVHLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
Bones
'
]
},
{
path
:
'
loaders/PCDLoader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/GLTFLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
NoSide
'
,
'
Matrix2
'
,
'
DDSLoader
'
]
},
{
path
:
'
loaders/OBJLoader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/MTLLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
BackSide
'
,
'
DoubleSide
'
,
'
ClampToEdgeWrapping
'
,
'
MirroredRepeatWrapping
'
]
},
{
path
:
'
loaders/PLYLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
Mesh
'
]
},
{
path
:
'
loaders/STLLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
Mesh
'
,
'
MeshPhongMaterial
'
,
'
VertexColors
'
]
},
{
path
:
'
loaders/SVGLoader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/TGALoader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/VRMLLoader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
pmrem/PMREMCubeUVPacker.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
pmrem/PMREMGenerator.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
shaders/UnpackDepthRGBAShader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
renderers/CSS2DRenderer.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
renderers/CSS3DRenderer.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/BufferGeometryUtils.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/GeometryUtils.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/MathUtils.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/SceneUtils.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/ShadowMapViewer.js
'
,
dependencies
:
[
{
name
:
'
UnpackDepthRGBAShader
'
,
module
:
'
shaders/UnpackDepthRGBAShader
'
}
],
ignoreList
:
[
'
DirectionalLight
'
,
'
SpotLight
'
]
},
{
path
:
'
utils/SkeletonUtils.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/TypedArrayUtils.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
utils/UVsDebug.js
'
,
dependencies
:
[],
ignoreList
:
[
'
SphereBufferGeometry
'
]
},
];
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
var
file
=
files
[
i
];
convert
(
file
.
path
,
file
.
ignoreList
);
convert
(
file
.
path
,
file
.
dependencies
,
file
.
ignoreList
);
}
//
function
convert
(
path
,
ignoreList
)
{
function
convert
(
path
,
exampleDependencies
,
ignoreList
)
{
var
contents
=
fs
.
readFileSync
(
srcFolder
+
path
,
'
utf8
'
);
var
classNames
=
[];
var
d
ependencies
=
{};
var
coreD
ependencies
=
{};
// imports
...
...
@@ -97,7 +100,7 @@ function convert( path, ignoreList ) {
if
(
p1
===
'
Math
'
)
{
d
ependencies
[
'
_Math
'
]
=
true
;
coreD
ependencies
[
'
_Math
'
]
=
true
;
return
'
_Math.
'
;
...
...
@@ -113,7 +116,7 @@ function convert( path, ignoreList ) {
if
(
ignoreList
.
includes
(
p1
)
)
return
match
;
d
ependencies
[
p1
]
=
true
;
if
(
p1
in
THREE
)
coreD
ependencies
[
p1
]
=
true
;
return
`new
${
p1
}
(`
;
...
...
@@ -129,13 +132,13 @@ function convert( path, ignoreList ) {
if
(
p2
===
'
Math
'
||
p2
===
'
_Math
'
)
{
d
ependencies
[
'
_Math
'
]
=
true
;
coreD
ependencies
[
'
_Math
'
]
=
true
;
return
'
_Math
'
;
}
d
ependencies
[
p2
]
=
true
;
if
(
p2
in
THREE
)
coreD
ependencies
[
p2
]
=
true
;
// console.log( match, p2 );
...
...
@@ -145,13 +148,27 @@ function convert( path, ignoreList ) {
//
var
keys
=
Object
.
keys
(
d
ependencies
)
var
keys
=
Object
.
keys
(
coreD
ependencies
)
.
filter
(
value
=>
!
classNames
.
includes
(
value
)
)
.
map
(
value
=>
value
===
'
_Math
'
?
'
Math as _Math
'
:
value
)
.
map
(
value
=>
'
\n\t
'
+
value
)
.
sort
()
.
toString
();
// core imports
var
imports
=
`import {
${
keys
}
\n} from "../../../build/three.module.js";`
;
// example imports
for
(
var
dependency
of
exampleDependencies
)
{
imports
+=
`\nimport {
${
dependency
.
name
}
} from "../
${
dependency
.
module
}
.js";`
;
}
// exports
var
exports
=
`export {
${
classNames
.
join
(
"
,
"
)}
};\n`
;
var
output
=
contents
.
replace
(
'
_IMPORTS_
'
,
keys
?
imports
:
''
)
+
'
\n
'
+
exports
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录