-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
33 lines (30 loc) · 897 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!doctype html>
<html>
<script>
var Module = {
onRuntimeInitialized: function () {
const v = new Module.VectorInt();
const v2 = new Module.VectorInt();
const vv = new Module.VVInt();
v.push_back(10);
v.push_back(1);
v.push_back(3);
v.push_back(5);
v2.push_back(4);
v2.push_back(8);
v2.push_back(16);
vv.push_back(v);
vv.push_back(v2);
Module.print_array(v);
Module.print_array(v2);
Module.print_vvarray(vv);
// jsの配列をC++に直接渡す
var vertices = new Float32Array([1., 10, -23]); // Float型で渡す
Module.print_jsarray_double(vertices);
Module.print_jsarray_double(new Int32Array([1, 10, -23])); // Int型で渡す
Module.print_jsarray_double([1, 10, -23]); // リスト型で渡す
}
};
</script>
<script src="vector_from_js.js"></script>
</html>