Skip to content

Commit

Permalink
Merge branch '0.9.7' of http://github.com/annasob/processing-js.git i…
Browse files Browse the repository at this point in the history
…nto ticket-229-closure

Conflicts:
	processing.js

TODO: sketch fonts, color.pde test
  • Loading branch information
notmasteryet committed Aug 15, 2010
2 parents 80b0422 + f5a6896 commit 9665b63
Show file tree
Hide file tree
Showing 149 changed files with 16,000 additions and 3,440 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Yuri Delendik
Zhibin Huang
John Turner
Mike Kamermans
Tom Brown
82 changes: 82 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
August 13, 2010 - Release 0.9.7

* Added saveStrings()
* Added textMode()
* Added 3D implementation to image()
* Added 3D implementation to PImage
* Added loadStrings()
* Added textAscent()
* Added textDescent()
* Added createFont / loadFont and PDE "development environment"
* Added parser test coverage to 55%
* Added PConstants parser optimization
* Added PVector constructor optimization
* Added PShapeSVG::parseMatrix
* Fixed SVG single path cutout not rendering correctly
* Fixed SVG color strings object
* Fixed SVG parsePoly Chrome bug
* Fixed SVG parsePath
* Fixed PImage.mask doesnt work given an object generated by PGraphics.get
* Fixed PImage functions to check this.isRemote
* Fixed 3D Lights
* Fixed make-check errors does not print array braces
* Fixed Chrome 3D rect error
* Fixed vertex 2D inline shape stroke and fill color
* Fixed background in draw doesn't redraw 3d
* Fixed Canvas not being painted when inside div
* Fixed readPixels call for "ref test"
* Fixed web color parsing behavior
* Fixed XMLElement type doesn't support one parameter string ctor
* Fixed tickle example is crashing using opera 10.53 on windows 7
* Fixed shaders so they pass shader validation
* Fixed frameRate() not changable outside of setup()
* Fixed Paser fails silently when keywords aren't in global member array
* Fixed Parser test speed on new parser's generated constructors
* Fixed Parser bug: in-class default scope is not "this" but the DOM window
* Change name of opaque pjs directive to "transparent" transparency "transparent background"
* Removed newWebGLArray wrapper
* Removed unsupported symbols
* Created JS only example documentation example

July 23, 2010 - Release 0.9.6

* Added PConstants Object
* Added PShape
* Added hint() - 3D
* Added ArrayList add(int index, Object value)
* Added ArrayList set(index, value)
* Added shape()
* Added shapeMode()
* Added loadShape()
* Added createGraphics() 3D support
* Added transparent backgrounds 3D support
* Added transparency directive to fix Moving On Curves example
* Added "IMAGE" to the global members array
* Added createFont()
* Added size() default width and height
* Added textAlign()
* Added pause-on-blur/focus for draw() and @pjs directive to reduce cpu usage
* Added textWidth() 3D
* Fixed tinylogLite so it doesn't slows down frame rate
* Fixed ajax() to check whether the data request was successful
* Fixed point does not render after text()
* Fixed ref tests broken on file:/// uri
* Fixed 2D ref tests
* Fixed p.splice
* Fixed exit() to remove the instance from the "Processing.instances"
* Fixed loading remote images security errors
* Fixed extra argument bug for a parseFloat line
* Fixed use of .moz* attributes
* Fixed p.arrayCopy()
* Fixed smooth and noSmooth
* Fixed strokeWeight for 2d point
* Fixed keyCode is not defined parser error
* Fixed parser errors when semicolon is missed
* Fixed parser bug on cast with space: (type) (something)
* Remove all occurances of typeof obj === 'undefined'
* Optimized performance by removing recursive calls when possible
* Optimized p.expand()
* Optimized p.parse(), introduce p.compile()
* Updated ref test runner for 3D tests
* Removed unnecessary whitespace from processing.js

June 16, 2010 - Release 0.9.4

* Added ellipse() 3D
Expand Down
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ VERSION ?= $(error Specify a version for your release (e.g., VERSION=0.5))

release: release-files zipped

release-files: pjs yui example release-docs
release-files: pjs yui closure example release-docs

zipped: release-files
gzip -c ./release/processing-${VERSION}.min.js > ./release/processing-${VERSION}.min.js.gz
Expand Down Expand Up @@ -61,7 +61,7 @@ yui: create-release
# check for any parsing errors in compiled version of processing.js
${JSSHELL} -f ${TOOLSDIR}/fake-dom.js -f ./release/processing-${VERSION}.min.js

check:
check: check-globals
${TOOLSDIR}/runtests.py ${JSSHELL}

check-release: yui
Expand All @@ -79,18 +79,22 @@ check-parser:
check-unit:
${TOOLSDIR}/runtests.py -u ${JSSHELL}

CLOSUREJAR ?= $(error Specify a valid path to a closure jar in ~/.profile: export CLOSUREJAR=~/compiler.jar)
CLOSUREJAR ?= $(error Specify a valid path to a Google closure jar file in ~/.profile: export CLOSUREJAR=~/compiler.jar)

SKETCHRUN ?= runSketch
SKETCHINPUT ?= $(error Specify an input filename in SKETCHINPUT when using package-sketch)
SKETCHOUTPUT ?= ${SKETCHINPUT}.js

check-closure: create-release
closure: create-release
java -jar ${CLOSUREJAR} --js=processing.js --js_output_file=./release/processing-${VERSION}.closure.js

check-closure: closure
java -jar ${CLOSUREJAR} --js=processing.js --js_output_file=./release/processing-closure.js
${TOOLSDIR}/runtests.py ${JSSHELL} -l ./release/processing-closure.js

compile-sketch:
${JSSHELL} -f processing.js -f ${TOOLSDIR}/jscompile.js < ${SKETCHINPUT} > ${SKETCHOUTPUT}
echo "Created ${SKETCHOUTPUT}"

package-sketch:
echo "function ${SKETCHRUN}(canvas) {" > ${SKETCHOUTPUT}.src
Expand All @@ -100,6 +104,7 @@ package-sketch:
echo "); } window['${SKETCHRUN}']=${SKETCHRUN};" >> ${SKETCHOUTPUT}.src
java -jar ${CLOSUREJAR} --js=${SKETCHOUTPUT}.src --js_output_file=${SKETCHOUTPUT} --compilation_level ADVANCED_OPTIMIZATIONS
rm ${SKETCHOUTPUT}.src
echo "Created ${SKETCHOUTPUT}"

# If you want to test just one file or dir, use |make check-one TEST=<file or dir>|
TEST ?= $(error Specify a test filename/dir in TEST when using check-test)
Expand All @@ -116,5 +121,11 @@ add-coverage: create-release
check-coverage: add-coverage
${TOOLSDIR}/runtests.py ${JSSHELL} -l ./release/processing-cv.js -c ./release/codecoverage.txt

check-globals:
${JSSHELL} -f ${TOOLSDIR}/fake-dom.js -f ${TOOLSDIR}/jsglobals.js -e "findDifference()" < processing.js

print-globals:
${JSSHELL} -f ${TOOLSDIR}/fake-dom.js -f ${TOOLSDIR}/jsglobals.js -e "printNames()" < processing.js

clean:
rm -fr ./release
4 changes: 2 additions & 2 deletions examples/basic/creategraphics.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2>CreateGraphics</h2>

void setup() {
size(200, 200);
pg = createGraphics(80, 80, P3D);
pg = createGraphics(80, 80);
}

void draw() {
Expand Down Expand Up @@ -47,7 +47,7 @@ <h2>CreateGraphics</h2>

void setup() {
size(200, 200);
pg = createGraphics(80, 80, P3D);
pg = createGraphics(80, 80);
}

void draw() {
Expand Down
38 changes: 22 additions & 16 deletions examples/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@
* the Processing.js engine.
*/

if ( window.addEventListener ) {
if (window.addEventListener) {
window.addEventListener("load", function() {
var scripts = document.getElementsByTagName("script");

for ( var i = 0; i < scripts.length; i++ ) {
if ( scripts[i].type == "application/processing" ) {
var canvasArray = Array.prototype.slice.call(document.getElementsByTagName("canvas"));
var canvas;
for (var i = 0, j = 0; i < scripts.length; i++) {
if (scripts[i].type == "application/processing") {
var src = scripts[i].getAttribute("target");
var canvas = scripts[i].nextSibling;

if ( src && src.indexOf("#") > -1 ) {
canvas = document.getElementById( src.substr( src.indexOf("#") + 1 ) );
} else {
while ( canvas && canvas.nodeName.toUpperCase() != "CANVAS" ) {
canvas = canvas.nextSibling;
if (src && src.indexOf("#") > -1) {
canvas = document.getElementById(src.substr(src.indexOf("#") + 1));
if (canvas) {
new Processing(canvas, scripts[i].text);
for (var k = 0; k< canvasArray.length; k++)
{
if (canvasArray[k] === canvas) {
// remove the canvas from the array so we dont override it in the else
canvasArray.splice(k,1);
}
}
}
}

if ( canvas ) {
new Processing(canvas, scripts[i].text);
}
} else {
if (canvasArray.length >= j) {
new Processing(canvasArray[j], scripts[i].text);
}
j++;
}
}
}
}, false);
Expand Down
124 changes: 124 additions & 0 deletions examples/js/3d.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../processing.js"></script>
<link rel="stylesheet" href="../style.css"/></head>
<body><h1><a href="http://processingjs.org/">Processing.js</a></h1>
<h2>Advanced processing.js via JavaScript</h2>

<p>Processing.js Cube</p>
<p><em>Note: runs via a web server or requres local files access in the web browser settings.</em></p>
<p>Converted to the JavaScript language from the Processing code<br>
Original souce code : <a href="http://processing.org/learning/3d/texturecube.html">TexturedCube</a> by Dave Bollinger.<br>
<canvas id="canvas1" width="200" height="200"></canvas>
</p>

<script id="script1" type="text/javascript">

// Attaching js code to the canvas by using a sketch object

var sketch = new Processing.Sketch();
// define 3D context
sketch.use3DContext = true;
// preload the images
sketch.imageCache.add("pjs.png");
// attach function (also, can be specified as the single parameter
// in the Processing.Sketch object constructor)
sketch.attachFunction = function(processing) {
var tex;
var rotx = Math.PI/4;
var roty = Math.PI/4;

processing.setup = function() {
processing.size(640, 360, processing.P3D);
tex = processing.loadImage("pjs.png");
processing.textureMode(processing.NORMALIZED);
processing.fill(255);
processing.stroke(processing.color(44,48,32));
};

processing.draw = function() {
processing.background(0);
processing.noStroke();
processing.translate(processing.width/2.0,
processing.height/2.0, -100);
processing.rotateX(rotx);
processing.rotateY(roty);
processing.scale(90);
texturedCube(tex);
}

function texturedCube(tex) {
processing.beginShape(processing.QUADS);
processing.texture(tex);

// Given one texture and six faces, we can easily set up the uv coordinates
// such that four of the faces tile "perfectly" along either u or v, but the other
// two faces cannot be so aligned. This code tiles "along" u, "around" the X/Z faces
// and fudges the Y faces - the Y faces are arbitrarily aligned such that a
// rotation along the X axis will put the "top" of either texture at the "top"
// of the screen, but is not otherwised aligned with the X/Z faces. (This
// just affects what type of symmetry is required if you need seamless
// tiling all the way around the cube)

// +Z "front" face
processing.vertex(-1, -1, 1, 0, 0);
processing.vertex( 1, -1, 1, 1, 0);
processing.vertex( 1, 1, 1, 1, 1);
processing.vertex(-1, 1, 1, 0, 1);

// -Z "back" face
processing.vertex( 1, -1, -1, 0, 0);
processing.vertex(-1, -1, -1, 1, 0);
processing.vertex(-1, 1, -1, 1, 1);
processing.vertex( 1, 1, -1, 0, 1);

// +Y "bottom" face
processing.vertex(-1, 1, 1, 0, 0);
processing.vertex( 1, 1, 1, 1, 0);
processing.vertex( 1, 1, -1, 1, 1);
processing.vertex(-1, 1, -1, 0, 1);

// -Y "top" face
processing.vertex(-1, -1, -1, 0, 0);
processing.vertex( 1, -1, -1, 1, 0);
processing.vertex( 1, -1, 1, 1, 1);
processing.vertex(-1, -1, 1, 0, 1);

// +X "right" face
processing.vertex( 1, -1, 1, 0, 0);
processing.vertex( 1, -1, -1, 1, 0);
processing.vertex( 1, 1, -1, 1, 1);
processing.vertex( 1, 1, 1, 0, 1);

// -X "left" face
processing.vertex(-1, -1, -1, 0, 0);
processing.vertex(-1, -1, 1, 1, 0);
processing.vertex(-1, 1, 1, 1, 1);
processing.vertex(-1, 1, -1, 0, 1);

processing.endShape();
}

// mouse event
processing.mouseDragged = function() {
var rate = 0.01;
rotx += (processing.pmouseY-processing.mouseY) * rate;
roty += (processing.mouseX-processing.pmouseX) * rate;
};
};

var canvas = document.getElementById("canvas1");
// attaching the sketch to the canvas
var p = new Processing(canvas, sketch);

</script>

<div style="height:0px;width:0px;overflow:hidden;"></div>

<pre id="code1"></pre>
<script>
document.getElementById("code1").textContent = document.getElementById("script1").text;
</script>
</body>
</html>
Binary file added examples/js/pjs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9665b63

Please sign in to comment.