Skip to content

Commit 657c8e3

Browse files
committedOct 31, 2011
got brain centered on screen rotating around the center
1 parent 8a03458 commit 657c8e3

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed
 

‎Grid.js

+24
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,28 @@ var Grid = {
1414
to: 42,
1515
step: 2
1616
},
17+
18+
set_low : function(){
19+
x = {from:-1, to:1, step:.1};
20+
y = {from:-1, to:1, step:.1};
21+
z = {from:-1, to:1, step:.1};
22+
}
23+
1724
};
25+
26+
//Grid.set_low();
27+
28+
//manual rotation
29+
Rot = {
30+
x: 4.2,
31+
y: 6.1,
32+
z: 0
33+
}
34+
35+
//Manual translation
36+
Trans = {
37+
x: -30,
38+
y: -30,
39+
z: -21
40+
41+
}

‎isosurface.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ function mapReduce() {
183183
});
184184
}
185185

186+
187+
188+
186189
//called once all workers information has been aggregated
187190
function render(data) {
188191
var vertices = data.vertices,
@@ -200,7 +203,7 @@ function render(data) {
200203
fn = formData.fn,
201204
isolevel = formData.isolevel;
202205

203-
206+
204207
//draw scene
205208
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
206209
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
@@ -211,10 +214,16 @@ function render(data) {
211214
if (formData.rotate) {
212215
rx += rdx;
213216
ry += rdy;
217+
//rx = Rot.x;
218+
//ry = Rot.y;
214219
}
215220

216-
elMatrix.multiply(THREE.Matrix4.rotationXMatrix(rx), THREE.Matrix4.rotationYMatrix(ry));
221+
// elMatrix.multiplySelf(THREE.Matrix4.translationMatrix(Rot.x,Rot.y,Rot.z));
217222

223+
//elMatrix.multiplySelf(THREE.Matrix4.rotationXMatrix(rx))
224+
//elMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(ry))
225+
elMatrix.multiply(THREE.Matrix4.rotationXMatrix(rx), THREE.Matrix4.rotationYMatrix(ry));
226+
elMatrix.multiplySelf(THREE.Matrix4.translationMatrix(Trans.x,Trans.y,Trans.z));
218227
viewMatrix.multiply(camera.matrix, elMatrix);
219228

220229
//send matrices

0 commit comments

Comments
 (0)
Please sign in to comment.