-
Notifications
You must be signed in to change notification settings - Fork 1
/
cstack2.html
136 lines (116 loc) · 4.47 KB
/
cstack2.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nested Cloners</title>
<!-- Babylon.js -->
<script src="lib/hand-1.3.7.js"></script>
<script src="lib/cannon.js"></script>
<script src="lib/Oimo.js"></script>
<script src="lib/babylon.2.5.max.js"></script>
<script src="lib/babylon.marbleProceduralTexture.js"></script>
<script src="lib/dat.gui.min.js"></script>
<script src="src/cloner.js"></script>
<link rel="stylesheet" type="text/css" href="../ecmas6/lib/bootstrap/css/bootstrap.min.css">
<style>
html, body {
overflow: hidden;
width: 100%;
height: 100%;
margin: 0;
padding: 0px;
background-color: #333344;
}
#target { position: absolute; top: 0em; left: 0em; }
#btest { position: absolute; top: 6em; left: 15em; }
#btest2 { position: absolute; top: 8em; left: 15em; }
#sliderCount { position: absolute; top: 8em; left: 3em; }
#sliderGrowth { position: absolute; top: 10em; left: 3em; }
#renderCanvas {
width: 100%;
height: 100%;
padding: 0px;
}
.dg {
color: #00AA00;
text-shadow: none !important;
}
</style>
</head>
<body bgcolor="#333344" oncontextmenu="return false; ">
<canvas id="renderCanvas"></canvas>
<script>
var gui = new dat.GUI({
height : 5 * 32 - 1
});
var lin_params= {
caption:"",
count: 4,
PX: 0,
PY: 1.1,
PZ: 0,
SX:1,
SY:1,
SZ:1,
RX:0,
RY:Math.PI/12,
RZ:0,
interpolmode: "step",
offset:0,
growth: .8,
}
var rad_params= {
caption:"",
count: 8,
radius:6,
offset:0,
plane:"ZX",
startangle:0,
endangle:360,
align:true
}
function init_gui() {
var pcontroller={};
var scontroller={};
var rcontroller={};
gui.add(lin_params, 'caption').name("Clonertype: Linear");
gui.add(lin_params, 'count').min(0).max(20).step(1).onChange(function(value) { lc.count=value;});
gui.add(rad_params, 'caption').name("Clonertype: Radial");
gui.add(rad_params, 'count').min(0).max(10).step(1).onChange(function(value) {var ccc=lc.count; lc.count=0;cc.count=value;lc.count=ccc;});//var ccc=cc.count; cc.count=0; lc.count=value; cc.count=ccc;});
gui.add(rad_params, 'radius').min(0).max(20).step(1).onChange(function(value) {var ccc=lc.count; lc.count=0;cc.radius=value;lc.count=ccc;});
gui.add(rad_params, 'offset').min(-360).max(360).step(1).onChange(function(value) {var ccc=lc.count; lc.count=0;cc.offset=value;lc.count=ccc;});
gui.add(rad_params, 'startangle').min(0).max(360).step(.1).onChange(function(value) {var ccc=lc.count; lc.count=0;cc.startangle=value;lc.count=ccc;});
gui.add(rad_params, 'endangle').min(0).max(360).step(.1).onChange(function(value) {var ccc=lc.count; lc.count=0;cc.endangle=value;lc.count=ccc;});
}
init_gui();
var demo=new BABYLONX.Demoscene();
demo.init();
//demo._scene.debugLayer.show();
var lin_opts= {
iModeStep:true,
count:lin_params.count,
P: {x:0,y:0,z:1.1},
R: {x:0,y:0,z:0},
growth:1,
useInstances:true
}
var rad_opts= {
count:rad_params.count,
radius:rad_params.radius,
startangle: rad_params.startangle,
endangle: rad_params.endangle,
useInstances:true
}
var c=demo.createCube(1,BABYLON.Color3.FromHexString("#DAA520"));
var c2=demo.createCube(0.5,BABYLON.Color3.FromHexString("#5555FF"));
var co=demo.createCone(.5,BABYLON.Color3.FromHexString("#55FFDC"));
var cc0=new BABYLONX.LinearCloner([c,co,c2],demo.scene,lin_opts);
var cc=new BABYLONX.RadialCloner([cc0],demo.scene,rad_opts);
lin_opts.P={x:0,y:1.1,z:0};
var lc=new BABYLONX.LinearCloner([cc],demo.scene,lin_opts);
demo.scene.registerBeforeRender(function () {
lc.root.rotation.y+=0.002;
});
</script>
</body>
</html>