Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
292e51c5
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,体验更适合开发者的 AI 搜索 >>
提交
292e51c5
编写于
2月 24, 2021
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: VR code clean up.
上级
7f802ff5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
17 deletion
+29
-17
editor/js/Viewport.VR.js
editor/js/Viewport.VR.js
+2
-2
editor/js/libs/three.html.js
editor/js/libs/three.html.js
+22
-13
editor/sw.js
editor/sw.js
+5
-2
未找到文件。
editor/js/Viewport.VR.js
浏览文件 @
292e51c5
...
...
@@ -26,8 +26,8 @@ class VR {
group
=
new
THREE
.
Group
();
editor
.
sceneHelpers
.
add
(
group
);
const
mesh
=
new
HTMLMesh
(
document
.
getElementById
(
'
sidebar
'
)
);
mesh
.
position
.
set
(
1
,
1.5
,
0
);
const
mesh
=
new
HTMLMesh
(
document
.
getElementById
(
'
sidebar
'
)
,
300
,
700
);
mesh
.
position
.
set
(
1
,
1.5
,
-
0.5
);
mesh
.
rotation
.
y
=
-
0.5
;
group
.
add
(
mesh
);
...
...
editor/js/libs/three.html.js
浏览文件 @
292e51c5
import
{
CanvasTexture
,
Mesh
,
MeshBasicMaterial
,
PlaneGeometry
,
sRGBEncoding
}
from
'
../../../build/three.module.js
'
;
import
*
as
THREE
from
'
../../../build/three.module.js
'
;
class
HTMLMesh
extends
Mesh
{
class
HTMLMesh
extends
THREE
.
Mesh
{
constructor
(
dom
)
{
constructor
(
dom
,
width
,
height
)
{
dom
.
style
.
width
=
width
+
'
px
'
;
dom
.
style
.
height
=
height
+
'
px
'
;
const
texture
=
new
HTMLTexture
(
dom
);
const
geometry
=
new
PlaneGeometry
(
texture
.
image
.
width
*
0.001
,
texture
.
image
.
height
*
0.001
);
const
material
=
new
MeshBasicMaterial
(
{
map
:
texture
,
toneMapped
:
false
}
);
dom
.
style
.
width
=
''
;
dom
.
style
.
height
=
''
;
const
geometry
=
new
THREE
.
PlaneGeometry
(
texture
.
image
.
width
*
0.002
,
texture
.
image
.
height
*
0.002
);
const
material
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
texture
,
toneMapped
:
false
}
);
super
(
geometry
,
material
);
...
...
@@ -21,15 +21,18 @@ class HTMLMesh extends Mesh {
}
class
HTMLTexture
extends
CanvasTexture
{
class
HTMLTexture
extends
THREE
.
CanvasTexture
{
constructor
(
dom
)
{
super
(
html2canvas
(
dom
)
);
this
.
dom
=
dom
;
this
.
encoding
=
sRGBEncoding
;
this
.
anisotropy
=
16
;
this
.
encoding
=
THREE
.
sRGBEncoding
;
this
.
minFilter
=
THREE
.
LinearFilter
;
this
.
magFilter
=
THREE
.
LinearFilter
;
}
...
...
@@ -117,6 +120,12 @@ function html2canvas( element ) {
if
(
string
!==
''
)
{
if
(
style
.
textTransform
===
'
uppercase
'
)
{
string
=
string
.
toUpperCase
();
}
context
.
font
=
style
.
fontSize
+
'
'
+
style
.
fontFamily
;
context
.
textBaseline
=
'
top
'
;
context
.
fillStyle
=
style
.
color
;
...
...
editor/sw.js
浏览文件 @
292e51c5
...
...
@@ -100,6 +100,7 @@ const assets = [
'
./js/libs/tern-threejs/threejs.js
'
,
'
./js/libs/signals.min.js
'
,
'
./js/libs/three.html.js
'
,
'
./js/libs/ui.js
'
,
'
./js/libs/ui.three.js
'
,
...
...
@@ -126,6 +127,7 @@ const assets = [
'
./js/Menubar.Play.js
'
,
'
./js/Menubar.Examples.js
'
,
'
./js/Menubar.Help.js
'
,
'
./js/Menubar.View.js
'
,
'
./js/Menubar.Status.js
'
,
'
./js/Resizer.js
'
,
'
./js/Sidebar.js
'
,
...
...
@@ -169,6 +171,7 @@ const assets = [
'
./js/Viewport.Camera.js
'
,
'
./js/Viewport.Info.js
'
,
'
./js/Viewport.ViewHelper.js
'
,
'
./js/Viewport.VR.js
'
,
'
./js/Command.js
'
,
'
./js/commands/AddObjectCommand.js
'
,
...
...
@@ -212,7 +215,7 @@ self.addEventListener( 'install', async function () {
cache
.
add
(
asset
).
catch
(
function
()
{
console
.
error
(
'
[SW] Cound
\'
t cache:
'
,
asset
);
console
.
warn
(
'
[SW] Cound
\'
t cache:
'
,
asset
);
}
);
...
...
@@ -233,7 +236,7 @@ async function cacheFirst( request ) {
if
(
cachedResponse
===
undefined
)
{
console
.
error
(
'
[SW] Not cached:
'
,
request
.
url
);
console
.
warn
(
'
[SW] Not cached:
'
,
request
.
url
);
return
fetch
(
request
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录