-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshadows.htm
47 lines (39 loc) · 1.27 KB
/
shadows.htm
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
<html>
<head>
<title>loEngine Shadow Testing</title>
<script src="lo/loMath.src.js"></script>
<script src="lo/loEngine.src.js"></script>
<script src="lo/loEngineDisp.src.js"></script>
<script type="application/javascript">
$ = function(e){ return document.getElementsByName(e)[0] || document.getElementById(e) }
function demoSetup()
{
var canvas = $('loDemo');
if( !canvas )
{
console.log('Failed to get canvas!');
return;
}
var ctx = canvas.getContext("2d");
var myPointLight = loCreatePointLight( 400, 0 );
var shape = loCreatePoly( 200, 200, 100, 12 );
shape.rotate( 5 )
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Reset styles
ctx.fillStyle = "#fff";
ctx.strokeStyle = "#000";
loDrawShadow( ctx, shape, myPointLight.pos, $('loOcc').checked ? 'o' : 's' )
if( $('loDraw').checked )
loDraw( ctx, shape, '#888' );
}
</script>
</head>
<body onload="demoSetup()">
<canvas id="loDemo" width="400" height="400">
Sorry, your browser doesn't support canvas technology
</canvas>
<div name="loMisc"></div>
<label><input name="loOcc" type=checkbox onclick="javascript:demoSetup();" checked> Occluded</label><br>
<label><input name="loDraw" type=checkbox onclick="javascript:demoSetup();" checked> Draw Shape</label><br>
</body>
</html>