Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Johnconstine
minigame-unity-webgl-transform
提交
f06de02e
M
minigame-unity-webgl-transform
项目概览
Johnconstine
/
minigame-unity-webgl-transform
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minigame-unity-webgl-transform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f06de02e
编写于
11月 04, 2022
作者:
ocean2o11
提交者:
GitHub
11月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete Demo/Benchmark/webgl directory
remove benchmark export
上级
54bbda8c
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
0 addition
and
1731 deletion
+0
-1731
Demo/Benchmark/webgl/TemplateData/Stats.js
Demo/Benchmark/webgl/TemplateData/Stats.js
+0
-48
Demo/Benchmark/webgl/TemplateData/Timer.js
Demo/Benchmark/webgl/TemplateData/Timer.js
+0
-44
Demo/Benchmark/webgl/TemplateData/UI.js
Demo/Benchmark/webgl/TemplateData/UI.js
+0
-40
Demo/Benchmark/webgl/TemplateData/UnityLoader.js
Demo/Benchmark/webgl/TemplateData/UnityLoader.js
+0
-1428
Demo/Benchmark/webgl/TemplateData/UnityProgress.js
Demo/Benchmark/webgl/TemplateData/UnityProgress.js
+0
-24
Demo/Benchmark/webgl/TemplateData/favicon.ico
Demo/Benchmark/webgl/TemplateData/favicon.ico
+0
-0
Demo/Benchmark/webgl/TemplateData/progressEmpty.Dark.png
Demo/Benchmark/webgl/TemplateData/progressEmpty.Dark.png
+0
-0
Demo/Benchmark/webgl/TemplateData/progressFull.Dark.png
Demo/Benchmark/webgl/TemplateData/progressFull.Dark.png
+0
-0
Demo/Benchmark/webgl/TemplateData/progressLogo.Dark.png
Demo/Benchmark/webgl/TemplateData/progressLogo.Dark.png
+0
-0
Demo/Benchmark/webgl/TemplateData/style.css
Demo/Benchmark/webgl/TemplateData/style.css
+0
-48
Demo/Benchmark/webgl/index.html
Demo/Benchmark/webgl/index.html
+0
-99
未找到文件。
Demo/Benchmark/webgl/TemplateData/Stats.js
已删除
100644 → 0
浏览文件 @
54bbda8c
var
Stats
=
{
Memory
:
{
init
:
function
(
initialHeapSize
){
this
.
element
=
UI
.
createSection
(
"
Memory (mb)
"
);
this
.
initialHeapSize
=
this
.
heapSize
=
initialHeapSize
;
this
.
updateInterval
=
setInterval
(()
=>
{
Stats
.
Memory
.
updateText
();
},
1000
);
this
.
updateText
();
},
updateText
:
function
(){
Stats
.
Memory
.
element
.
innerText
=
"
Initial Heap Size:
"
+
(
Stats
.
Memory
.
initialHeapSize
/
1024
/
1024
);
Stats
.
Memory
.
element
.
innerText
+=
"
\n
Heap Size:
"
+
(
gameInstance
.
Module
.
asmLibraryArg
.
getTotalMemory
()
/
1024
/
1024
);
Stats
.
Memory
.
element
.
innerText
+=
"
\n
High Watermark:
"
+
(
gameInstance
.
Module
.
HEAP32
[
gameInstance
.
Module
.
asmLibraryArg
.
DYNAMICTOP_PTR
>>
2
]
/
1024
/
1024
).
toFixed
(
0
);
}
},
Loading
:
{
timers
:
[],
init
:
function
(
Module
){
this
.
element
=
UI
.
createSection
(
"
Load Times (ms)
"
);
this
.
updateInterval
=
setInterval
(
function
(){
Stats
.
Loading
.
updateText
();
},
500
);
// UnityLoader.Job.schedule(Module, "wasmFrameworkDownloadFinished", ["downloadWasmFramework"], downloadFinishedJob.bind(null, "WebAssembly Framwork"));
UnityLoader
.
Job
.
schedule
(
Module
,
"
downloadFinished
"
,
[
"
downloadWasmCode
"
,
"
downloadData
"
,
"
downloadWasmFramework
"
],
this
.
downloadFinishedJob
);
},
term
:
function
(){
Stats
.
Loading
.
updateText
();
clearInterval
(
Stats
.
Loading
.
updateInterval
);
},
updateText
:
function
(){
Stats
.
Loading
.
element
.
innerText
=
""
;
Stats
.
Loading
.
timers
.
forEach
(
function
(
timer
)
{
Stats
.
Loading
.
element
.
innerText
+=
timer
.
toString
();
Stats
.
Loading
.
element
.
innerText
+=
"
\n
"
;
});
},
downloadFinishedJob
:
function
(
Module
,
job
)
{
Stats
.
Loading
.
timers
.
unshift
(
new
Timer
(
"
Data
"
,
Module
.
Jobs
[
"
downloadData
"
]),
new
Timer
(
"
Code
"
,
Module
.
Jobs
[
"
downloadWasmCode
"
]),
new
Timer
(
"
Framework
"
,
Module
.
Jobs
[
"
downloadWasmFramework
"
])
);
}
}
};
Demo/Benchmark/webgl/TemplateData/Timer.js
已删除
100644 → 0
浏览文件 @
54bbda8c
var
Timer
=
/** @class */
(
function
()
{
function
Timer
(
label
,
job
)
{
this
.
label
=
label
;
if
(
job
==
null
)
{
this
.
startTime
=
performance
.
now
();
}
else
{
this
.
job
=
job
;
this
.
set
(
job
.
starttime
,
job
.
endtime
);
}
}
Timer
.
prototype
.
start
=
function
()
{
this
.
startTime
=
performance
.
now
();
};
Timer
.
prototype
.
stop
=
function
()
{
this
.
endTime
=
performance
.
now
();
};
Timer
.
prototype
.
set
=
function
(
startTime
,
endTime
)
{
this
.
startTime
=
startTime
;
this
.
endTime
=
endTime
;
};
Timer
.
prototype
.
isDone
=
function
()
{
return
typeof
this
.
endTime
!=
"
undefined
"
;
};
Timer
.
prototype
.
toString
=
function
()
{
var
text
=
this
.
label
+
"
:
"
;
if
(
this
.
isDone
())
{
// text += (this.endTime - this.startTime).toFixed(2);
text
+=
(
this
.
endTime
-
this
.
startTime
).
toFixed
(
0
);
if
((
typeof
this
.
job
!==
"
undefined
"
)
&&
this
.
job
.
result
.
value
.
cached
)
{
text
+=
"
(from cache)
"
;
}
}
else
{
var
progress
=
((
performance
.
now
()
-
this
.
startTime
).
toFixed
(
2
)
/
1000
)
%
3
;
text
+=
"
in progress
"
;
for
(
i
=
0
;
i
<
progress
;
i
++
)
{
text
+=
"
.
"
;
}
}
return
text
;
};
return
Timer
;
}());
Demo/Benchmark/webgl/TemplateData/UI.js
已删除
100644 → 0
浏览文件 @
54bbda8c
var
UI
=
{
init
:
function
(
container
,
onQuit
){
this
.
container
=
container
;
this
.
main
=
document
.
createElement
(
"
div
"
);
this
.
main
.
id
=
"
overlay
"
;
this
.
main
.
style
.
bottom
=
"
0px
"
;
this
.
container
.
appendChild
(
this
.
main
);
// this.createButton("Reload with #no-cache");
this
.
createButton
(
"
X
"
,
function
()
{
onQuit
();
UI
.
container
.
removeChild
(
UI
.
main
);
});
if
(
!
UnityLoader
.
SystemInfo
.
mobile
)
this
.
createButton
(
"
Enable Fullscreen
"
,
function
(){
gameInstance
.
SetFullscreen
(
1
);
});
},
createButton
:
function
(
text
,
callback
)
{
var
button
=
document
.
createElement
(
"
button
"
);
button
.
className
=
"
button
"
;
var
t
=
document
.
createTextNode
(
text
);
button
.
appendChild
(
t
);
button
.
addEventListener
(
"
click
"
,
callback
);
this
.
main
.
appendChild
(
button
);
},
createSection
:
function
(
title
)
{
var
section
=
document
.
createElement
(
"
p
"
);
section
.
id
=
"
section
"
;
section
.
innerText
=
title
;
var
content
=
document
.
createElement
(
"
p
"
);
content
.
id
=
"
section-content
"
;
section
.
appendChild
(
content
);
this
.
main
.
appendChild
(
section
);
return
content
;
}
}
\ No newline at end of file
Demo/Benchmark/webgl/TemplateData/UnityLoader.js
已删除
100644 → 0
浏览文件 @
54bbda8c
此差异已折叠。
点击以展开。
Demo/Benchmark/webgl/TemplateData/UnityProgress.js
已删除
100644 → 0
浏览文件 @
54bbda8c
function
UnityProgress
(
gameObject
,
progress
)
{
if
(
!
gameObject
.
Module
)
return
;
if
(
!
gameObject
.
logo
)
{
gameObject
.
logo
=
document
.
createElement
(
"
div
"
);
gameObject
.
logo
.
className
=
"
logo
"
+
gameObject
.
Module
.
splashScreenStyle
;
gameObject
.
container
.
appendChild
(
gameObject
.
logo
);
}
if
(
!
gameObject
.
progress
)
{
gameObject
.
progress
=
document
.
createElement
(
"
div
"
);
gameObject
.
progress
.
className
=
"
progress
"
+
gameObject
.
Module
.
splashScreenStyle
;
gameObject
.
progress
.
empty
=
document
.
createElement
(
"
div
"
);
gameObject
.
progress
.
empty
.
className
=
"
empty
"
;
gameObject
.
progress
.
appendChild
(
gameObject
.
progress
.
empty
);
gameObject
.
progress
.
full
=
document
.
createElement
(
"
div
"
);
gameObject
.
progress
.
full
.
className
=
"
full
"
;
gameObject
.
progress
.
appendChild
(
gameObject
.
progress
.
full
);
gameObject
.
container
.
appendChild
(
gameObject
.
progress
);
}
gameObject
.
progress
.
full
.
style
.
width
=
(
100
*
progress
)
+
"
%
"
;
gameObject
.
progress
.
empty
.
style
.
width
=
(
100
*
(
1
-
progress
))
+
"
%
"
;
if
(
progress
==
1
)
gameObject
.
logo
.
style
.
display
=
gameObject
.
progress
.
style
.
display
=
"
none
"
;
}
\ No newline at end of file
Demo/Benchmark/webgl/TemplateData/favicon.ico
已删除
100644 → 0
浏览文件 @
54bbda8c
13.0 KB
Demo/Benchmark/webgl/TemplateData/progressEmpty.Dark.png
已删除
100644 → 0
浏览文件 @
54bbda8c
155 字节
Demo/Benchmark/webgl/TemplateData/progressFull.Dark.png
已删除
100644 → 0
浏览文件 @
54bbda8c
137 字节
Demo/Benchmark/webgl/TemplateData/progressLogo.Dark.png
已删除
100644 → 0
浏览文件 @
54bbda8c
2.3 KB
Demo/Benchmark/webgl/TemplateData/style.css
已删除
100644 → 0
浏览文件 @
54bbda8c
.webgl-content
*
{
border
:
0
;
margin
:
0
;
padding
:
0
}
.webgl-content
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
-webkit-transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);}
.webgl-content
.logo
,
.progress
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
-webkit-transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);}
.webgl-content
.logo
{
background
:
url('progressLogo.Light.png')
no-repeat
center
/
contain
;
width
:
154px
;
height
:
130px
;}
.webgl-content
.progress
{
height
:
18px
;
width
:
141px
;
margin-top
:
90px
;}
.webgl-content
.progress
.empty
{
background
:
url('progressEmpty.Light.png')
no-repeat
right
/
cover
;
float
:
right
;
width
:
100%
;
height
:
100%
;
display
:
inline-block
;}
.webgl-content
.progress
.full
{
background
:
url('progressFull.Light.png')
no-repeat
left
/
cover
;
float
:
left
;
width
:
0%
;
height
:
100%
;
display
:
inline-block
;}
.webgl-content
.logo.Dark
{
background-image
:
url('progressLogo.Dark.png')
;}
.webgl-content
.progress.Dark
.empty
{
background-image
:
url('progressEmpty.Dark.png')
;}
.webgl-content
.progress.Dark
.full
{
background-image
:
url('progressFull.Dark.png')
;}
.webgl-content
.footer
{
margin-top
:
5px
;
height
:
38px
;
line-height
:
38px
;
font-family
:
Helvetica
,
Verdana
,
Arial
,
sans-serif
;
font-size
:
18px
;}
.webgl-content
.footer
.webgl-logo
,
.title
,
.fullscreen
{
height
:
100%
;
display
:
inline-block
;
background
:
transparent
center
no-repeat
;}
.webgl-content
.footer
.webgl-logo
{
background-image
:
url('webgl-logo.png')
;
width
:
204px
;
float
:
left
;}
.webgl-content
.footer
.title
{
margin-right
:
10px
;
float
:
right
;}
.webgl-content
.footer
.fullscreen
{
background-image
:
url('fullscreen.png')
;
width
:
38px
;
float
:
right
;}
#overlay
{
position
:
absolute
;
left
:
0px
;
bottom
:
0px
;
background-color
:
#ababab80
;
font-family
:
Helvetica
,
Verdana
,
Arial
;
}
#section
{
color
:
#202050
;
background-color
:
#7d7d7d80
;
font-weight
:
bold
;
margin
:
6px
;
padding
:
4px
;
}
#section-content
{
font-weight
:
normal
;
}
.webgl-content
.button
{
/*border: 10px; margin: 10px; padding: 10px*/
position
:
absolute
;
top
:
0px
;
left
:
0px
;
padding
:
5px
;
color
:
#202050
;
background-color
:
#7d7d7d
;
}
Demo/Benchmark/webgl/index.html
已删除
100644 → 0
浏览文件 @
54bbda8c
<!DOCTYPE html>
<html
lang=
"en-us"
>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
<title>
Unity WebGL Player | Benchmark
</title>
<link
rel=
"shortcut icon"
href=
"TemplateData/favicon.ico"
>
<link
rel=
"stylesheet"
href=
"TemplateData/style.css"
>
<script
src=
"TemplateData/UnityProgress.js"
></script>
<!-- <script src="Build/UnityLoader.js"></script> -->
<script
src=
"TemplateData/UnityLoader.js"
></script>
<script
src=
"TemplateData/Timer.js"
></script>
<script
src=
"TemplateData/UI.js"
></script>
<script
src=
"TemplateData/Stats.js"
></script>
<script>
var
timeToScreen
=
new
Timer
(
"
Time to Screen
"
);
var
timeToInteractive
=
new
Timer
(
"
Time to Interactive
"
);
Stats
.
Loading
.
timers
.
push
(
timeToScreen
,
timeToInteractive
);
var
gameInstance
=
UnityLoader
.
instantiate
(
"
gameContainer
"
,
"
Build/webgl.json
"
,
{
onProgress
:
UnityProgress
,
compatibilityCheck
:
function
(
gameInstance
,
onsuccess
,
onerror
)
{
if
(
!
UnityLoader
.
SystemInfo
.
hasWebGL
)
{
gameInstance
.
popup
(
"
Your browser does not support WebGL
"
,
[{
text
:
"
OK
"
,
callback
:
onerror
}]);
}
else
if
([
"
Edge
"
,
"
Firefox
"
,
"
Chrome
"
,
"
Safari
"
].
indexOf
(
UnityLoader
.
SystemInfo
.
browser
)
==
-
1
)
{
gameInstance
.
popup
(
"
Please note that your browser is not currently supported for this Unity WebGL content. Press OK if you wish to continue anyway.
"
,
[{
text
:
"
OK
"
,
callback
:
onsuccess
}]);
}
else
{
UI
.
init
(
document
.
body
,
function
(){
Stats
.
Loading
.
term
();
});
Stats
.
Loading
.
init
(
gameInstance
.
Module
);
onsuccess
();
}
},
Module
:
{
cacheControl
:
{
"
default
"
:
"
immutable
"
},
// this does not work in 2018.3
wasmRequest
:
function
(
wasmInstantiate
,
callback
)
{
var
wasmInstantiation
=
new
Timer
(
"
WebAssembly Instantiation
"
);
Stats
.
Loading
.
timers
.
push
(
wasmInstantiation
);
wasmInstantiate
(
this
.
wasmBinary
).
then
(
function
(
result
)
{
wasmInstantiation
.
stop
();
callback
(
result
.
instance
);
});
},
onRuntimeInitialized
:
function
()
{
Module
=
this
;
var
engineInitialization
=
new
Timer
(
"
Engine Initialization
"
);
Stats
.
Loading
.
timers
.
push
(
engineInitialization
);
Stats
.
Memory
.
init
(
Module
.
TOTAL_MEMORY
);
Module
.
postRun
.
unshift
(
function
()
{
var
savedReallocBuffer
=
Module
.
reallocBuffer
;
Module
.
reallocBuffer
=
function
(
size
)
{
var
retValue
=
savedReallocBuffer
(
size
);
// TODO: notify runtime about heap resize
return
retValue
;
}
engineInitialization
.
stop
();
});
}
}
});
</script>
</head>
<body
style=
"background-color: black"
>
<div
class=
"webgl-content"
>
<div
id=
"gameContainer"
style=
"width: 1280px; height: 720px"
></div>
</div>
<script>
var
startLoadingTime
=
Date
.
now
();
var
timeToLoad
=
0
;
var
timeToStableFPS
=
0
;
var
lastFrame
=
0
;
function
SampleFrame
()
{
var
curTime
=
Date
.
now
();
if
(
timeToLoad
==
0
)
{
timeToLoad
=
curTime
-
startLoadingTime
;
timeToScreen
.
stop
();
console
.
log
(
"
Loading took
"
+
timeToLoad
+
"
ms
"
);
// LoadingTimes.element.innerText += "\nTime to first frame: " + (curTime - LoadingTimes.wasmDownloadEndTime);
}
if
(
timeToStableFPS
==
0
)
{
var
frameTime
=
curTime
-
lastFrame
;
if
(
frameTime
<
55
)
{
timeToStableFPS
=
curTime
-
startLoadingTime
-
timeToLoad
;
timeToInteractive
.
stop
();
Stats
.
Loading
.
term
();
console
.
log
(
"
Stabilizing took
"
+
timeToStableFPS
+
"
ms
"
);
// LoadingTimes.element.innerText += "\nTime to interactive: " + (curTime - LoadingTimes.wasmDownloadEndTime);
}
lastFrame
=
curTime
;
}
}
</script>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录