Skip to content

Commit aacc920

Browse files
committed
added the WebGL build with multithreads and simd enabled.
1 parent be1d6b8 commit aacc920

File tree

168 files changed

+1742651
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+1742651
-26
lines changed
Binary file not shown.
Binary file not shown.

webgl_example/Build/opencvforunityexample.loader.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
665 Bytes
Loading

webgl_example/TemplateData/style.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
body { padding: 0; margin: 0 }
22
#unity-container { position: absolute }
33
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4-
#unity-container.unity-mobile { width: 100%; height: 100% }
4+
#unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
55
#unity-canvas { background: #231F20 }
66
.unity-mobile #unity-canvas { width: 100%; height: 100% }
77
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
@@ -10,7 +10,7 @@ body { padding: 0; margin: 0 }
1010
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
1111
#unity-footer { position: relative }
1212
.unity-mobile #unity-footer { display: none }
13-
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
13+
#unity-logo-title-footer { float:left; width: 102px; height: 38px; background: url('unity-logo-title-footer.png') no-repeat center }
1414
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15-
#unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
15+
#unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
1616
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
Loading
-2.88 KB
Binary file not shown.
1.63 KB
Loading

webgl_example/index.html

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6-
<title>Unity WebGL Player | OpenCVForUnityExample2.5.9</title>
6+
<title>Unity Web Player | OpenCVForUnityExample2.5.9</title>
77
<link rel="shortcut icon" href="TemplateData/favicon.ico">
88
<link rel="stylesheet" href="TemplateData/style.css">
99
</head>
1010
<body>
1111
<div id="unity-container" class="unity-desktop">
12-
<canvas id="unity-canvas" width=960 height=600></canvas>
12+
<canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
1313
<div id="unity-loading-bar">
1414
<div id="unity-logo"></div>
1515
<div id="unity-progress-bar-empty">
@@ -18,18 +18,13 @@
1818
</div>
1919
<div id="unity-warning"> </div>
2020
<div id="unity-footer">
21-
<div id="unity-webgl-logo"></div>
21+
<div id="unity-logo-title-footer"></div>
2222
<div id="unity-fullscreen-button"></div>
2323
<div id="unity-build-title">OpenCVForUnityExample2.5.9</div>
2424
</div>
2525
</div>
2626
<script>
27-
var container = document.querySelector("#unity-container");
2827
var canvas = document.querySelector("#unity-canvas");
29-
var loadingBar = document.querySelector("#unity-loading-bar");
30-
var progressBarFull = document.querySelector("#unity-progress-bar-full");
31-
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
32-
var warningBanner = document.querySelector("#unity-warning");
3328

3429
// Shows a temporary message banner/ribbon for a few seconds, or
3530
// a permanent error message on top of the canvas if type=='error'.
@@ -38,6 +33,7 @@
3833
// way that non-critical warnings and error messages are presented to the
3934
// user.
4035
function unityShowBanner(msg, type) {
36+
var warningBanner = document.querySelector("#unity-warning");
4137
function updateBannerVisibility() {
4238
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
4339
}
@@ -58,6 +54,7 @@
5854
var buildUrl = "Build";
5955
var loaderUrl = buildUrl + "/opencvforunityexample.loader.js";
6056
var config = {
57+
arguments: [],
6158
dataUrl: buildUrl + "/opencvforunityexample.data.unityweb",
6259
frameworkUrl: buildUrl + "/opencvforunityexample.framework.js.unityweb",
6360
codeUrl: buildUrl + "/opencvforunityexample.wasm.unityweb",
@@ -82,38 +79,40 @@
8279
meta.name = 'viewport';
8380
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
8481
document.getElementsByTagName('head')[0].appendChild(meta);
85-
container.className = "unity-mobile";
82+
document.querySelector("#unity-container").className = "unity-mobile";
8683
canvas.className = "unity-mobile";
8784

8885
// To lower canvas resolution on mobile devices to gain some
8986
// performance, uncomment the following line:
9087
// config.devicePixelRatio = 1;
9188

92-
unityShowBanner('WebGL builds are not supported on mobile devices.');
89+
9390
} else {
9491
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
95-
9692
canvas.style.width = "960px";
9793
canvas.style.height = "600px";
9894
}
9995

100-
loadingBar.style.display = "block";
96+
document.querySelector("#unity-loading-bar").style.display = "block";
10197

10298
var script = document.createElement("script");
10399
script.src = loaderUrl;
104100
script.onload = () => {
105101
createUnityInstance(canvas, config, (progress) => {
106-
progressBarFull.style.width = 100 * progress + "%";
107-
}).then((unityInstance) => {
108-
loadingBar.style.display = "none";
109-
fullscreenButton.onclick = () => {
110-
unityInstance.SetFullscreen(1);
111-
};
112-
}).catch((message) => {
113-
alert(message);
114-
});
115-
};
102+
document.querySelector("#unity-progress-bar-full").style.width = 100 * progress + "%";
103+
}).then((unityInstance) => {
104+
document.querySelector("#unity-loading-bar").style.display = "none";
105+
document.querySelector("#unity-fullscreen-button").onclick = () => {
106+
unityInstance.SetFullscreen(1);
107+
};
108+
109+
}).catch((message) => {
110+
alert(message);
111+
});
112+
};
113+
116114
document.body.appendChild(script);
115+
117116
</script>
118117
</body>
119118
</html>
Binary file not shown.

webgl_example_threads/Build/opencvforunityexample.framework.js

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)