Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merging in Andor's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
katzgrau committed Oct 2, 2012
2 parents 1c3df22 + cbe1e35 commit d004c24
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lab-1-webgl/index.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
var uniforms, attributes; var uniforms, attributes;
var setup = false; var setup = false;
var shaderMaterial; var shaderMaterial;
var totalPointsTransferred = 0;


var WIDTH = window.innerWidth; var WIDTH = window.innerWidth;
var HEIGHT = window.innerHeight; var HEIGHT = window.innerHeight;
Expand Down Expand Up @@ -155,7 +156,9 @@
} }


function onDocumentMouseWheel(event) { function onDocumentMouseWheel(event) {
fov -= event.detail * 0.5; var delta = (event.wheelDelta/360 || -event.detail/3);

fov -= delta * 0.5;
if (fov < 5) { if (fov < 5) {
fov = 5; fov = 5;
} else if (fov > 90) { } else if (fov > 90) {
Expand All @@ -165,6 +168,7 @@
} }


window.addEventListener('resize', onWindowResize, false); window.addEventListener('resize', onWindowResize, false);
window.addEventListener('mousewheel', onDocumentMouseWheel, false);
window.addEventListener('DOMMouseScroll', onDocumentMouseWheel, false); window.addEventListener('DOMMouseScroll', onDocumentMouseWheel, false);
} }


Expand Down Expand Up @@ -194,8 +198,11 @@
var totalPoints = attributes.size.value.length; var totalPoints = attributes.size.value.length;
var pointsToUpdate = attributes.size.value.length * (controlData.StreamData / 100); var pointsToUpdate = attributes.size.value.length * (controlData.StreamData / 100);


totalPointsTransferred++;
document.getElementById('frames').innerHTML = "frames: "+ totalPointsTransferred;

// I don't want to keep removing and adding points to the particle system, so // I don't want to keep removing and adding points to the particle system, so
// we're going to hide and undie them when necessary. // we're going to hide and unhide them when necessary.
for (var i = 0; i < totalPoints; i++) { for (var i = 0; i < totalPoints; i++) {
if (data.frame[i]) { if (data.frame[i]) {
attributes.size.value[i] = 0; attributes.size.value[i] = 0;
Expand Down Expand Up @@ -255,18 +262,29 @@
margin: 0 auto; margin: 0 auto;
} }



#notice { #notice {
position: absolute; position: absolute;
bottom: 10px; bottom: 20px;
left: 10px; left: 10px;
width: 400px; width: 400px;
color: #fff; color: #fff;
font-family: verdana; font-family: verdana;
font-size: 12px; font-size: 12px;
} }

#frames {
position: fixed;
font-family: verdana;
bottom: 0px;
left: 10px;
font-size: 12px;
color: #2fa0d5;
}
</style> </style>
</head> </head>
<body> <body>
<div id="frames" class="frames">frames:</div>
<div id="streamDiv"><input type="button" id="stream" value="Stream"/></div> <div id="streamDiv"><input type="button" id="stream" value="Stream"/></div>
<div id="container"></div> <div id="container"></div>
<div id="console"></div> <div id="console"></div>
Expand Down

0 comments on commit d004c24

Please sign in to comment.