Skip to content

Commit

Permalink
centered object, cached array lengths in loops, changed Pointt to Poi…
Browse files Browse the repository at this point in the history
…nt, removed Point class from pjs.
  • Loading branch information
Andor committed Jun 16, 2010
1 parent a8301fa commit b17efae
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 110 deletions.
37 changes: 5 additions & 32 deletions processing.js
Expand Up @@ -325,7 +325,7 @@
// Work-around for Minefield. using ctx.VERTEX_PROGRAM_POINT_SIZE
// in Minefield does nothing and does not report any errors.
var VERTEX_PROGRAM_POINT_SIZE = 0x8642;
var POINT_SMOOTH = 0x0B10;
// var POINT_SMOOTH = 0x0B10;

// Get padding and border style widths for mouse offsets
if (document.defaultView && document.defaultView.getComputedStyle) {
Expand Down Expand Up @@ -4005,7 +4005,7 @@
// We declare our own constants since Minefield doesn't
// do anything when curContext.VERTEX_PROGRAM_POINT_SIZE is used.
curContext.enable(VERTEX_PROGRAM_POINT_SIZE);
curContext.enable(POINT_SMOOTH);
// curContext.enable(POINT_SMOOTH);

// Create the program objects to render 2D (points, lines) and
// 3D (spheres, boxes) shapes. Because 2D shapes are not lit,
Expand Down Expand Up @@ -4480,10 +4480,7 @@
////////////////////////////////////////////////////////////////////////////

p.setMatrices = function(){
// viewing transformation needs to have Y flipped
// becuase that's what Processing does.
var view = new PMatrix3D();
view.scale(1, -1, 1);
view.apply(modelView.array());
view.transpose();

Expand Down Expand Up @@ -4520,7 +4517,7 @@
// viewing transformation needs to have Y flipped
// becuase that's what Processing does.
var view = new PMatrix3D();
view.scale(1, -1, 1);
//view.scale(1, -1, 1);
view.apply(modelView.array());
view.transpose();

Expand Down Expand Up @@ -5007,13 +5004,13 @@
// Vector drawing functions
////////////////////////////////////////////////////////////////////////////

p.Point = function Point(x, y) {
/* p.Point = function Point(x, y) {
this.x = x;
this.y = y;
this.copy = function() {
return new Point(x, y);
};
};
};*/

p.endBuffer = function(xyz,rgb,norm){

Expand Down Expand Up @@ -5041,30 +5038,6 @@
return o;
};

p.points = function(buff){
curContext.useProgram(programObject2D);

var view = new PMatrix3D();
view.scale(1, -1, 1);
view.apply(modelView.array());
view.transpose();

var normalMatrix = new PMatrix3D();
normalMatrix.set(view);
normalMatrix.invert();
normalMatrix.transpose();

uniformMatrix(programObject2D, "normalTransform", false, normalMatrix.array());
uniformMatrix(programObject2D, "view", false, view.array());

vertexAttribPointer(programObject2D, "aVertex", 3, buff.posBuffer);
vertexAttribPointer(programObject2D, "aColor", 3, buff.colBuffer);
vertexAttribPointer(programObject2D, "aNormal", 3, buff.normBuffer);

curContext.drawArrays(curContext.POINTS, 0, buff.size/3);
}


p.point = function point(x, y, z, cx, cy, cz) {
if (p.use3DContext) {
var model = new PMatrix3D();
Expand Down

0 comments on commit b17efae

Please sign in to comment.