mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
mouseButton, open(), link(), depth() messages, matrix naming, error on 1.1
This commit is contained in:
@@ -425,34 +425,6 @@ public class PdeBase {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static public File getProcessingHome() {
|
||||
File home = new File(System.getProperty("user.home"));
|
||||
|
||||
File phome = null;
|
||||
|
||||
// NOTE if this location changes, be sure to note the change
|
||||
// in the default preferences.txt because it mentions this path
|
||||
if (PdeBase.platform == PdeBase.MACOSX) {
|
||||
// on macosx put the sketchbook in the "Documents" folder
|
||||
//phome = new File(home, "Documents" + File.separator + "Processing");
|
||||
|
||||
} else if (PdeBase.platform == PdeBase.WINDOWS) {
|
||||
// on windows put the sketchbook in the "My Documents" folder
|
||||
phome = new File(home, "My Documents" + File.separator + "Processing");
|
||||
|
||||
} else {
|
||||
// for linux et al, make a dot folder
|
||||
// if people don't like things being buried, they can move the sketches
|
||||
// but the prefs will stay hidden in the dot folder
|
||||
phome = new File(home, ".processing");
|
||||
}
|
||||
if (!phome.exists()) phome.mkdirs();
|
||||
return phome;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// .................................................................
|
||||
|
||||
|
||||
@@ -527,12 +499,8 @@ public class PdeBase {
|
||||
url = sb.toString();
|
||||
}
|
||||
}
|
||||
//System.out.println("trying to open " + url);
|
||||
com.apple.mrj.MRJFileUtils.openURL(url);
|
||||
|
||||
//} else if (platform == MACOS9) {
|
||||
//com.apple.mrj.MRJFileUtils.openURL(url);
|
||||
|
||||
} else if (PdeBase.isLinux()) {
|
||||
// how's mozilla sound to ya, laddie?
|
||||
//Runtime.getRuntime().exec(new String[] { "mozilla", url });
|
||||
@@ -546,8 +514,6 @@ public class PdeBase {
|
||||
} catch (IOException e) {
|
||||
PdeBase.showWarning("Could not open URL",
|
||||
"An error occurred while trying to open\n" + url, e);
|
||||
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,14 +191,14 @@ LIBRARIES=../../build/$PLATFORM/work/libraries
|
||||
|
||||
|
||||
# PARTICLES LIBRARY
|
||||
echo Build particles library...
|
||||
cd ../lib/particles
|
||||
$JIKES -target 1.1 +D -d . *.java
|
||||
rm -f library/particles.jar
|
||||
zip -r0q library/particles.jar simong
|
||||
rm -rf simong
|
||||
mkdir -p $LIBRARIES/particles/library/
|
||||
cp library/particles.jar $LIBRARIES/particles/library/
|
||||
#echo Build particles library...
|
||||
#cd ../lib/particles
|
||||
#$JIKES -target 1.1 +D -d . *.java
|
||||
#rm -f library/particles.jar
|
||||
#zip -r0q library/particles.jar simong
|
||||
#rm -rf simong
|
||||
#mkdir -p $LIBRARIES/particles/library/
|
||||
#cp library/particles.jar $LIBRARIES/particles/library/
|
||||
|
||||
pwd
|
||||
|
||||
|
||||
@@ -200,14 +200,14 @@ LIBRARIES=../../build/$PLATFORM/work/libraries
|
||||
|
||||
|
||||
# PARTICLES LIBRARY
|
||||
echo Build particles library...
|
||||
cd ../lib/particles
|
||||
$JIKES -target 1.1 +D -d . *.java
|
||||
rm -f library/particles.jar
|
||||
zip -r0q library/particles.jar simong
|
||||
rm -rf simong
|
||||
mkdir -p $LIBRARIES/particles/library/
|
||||
cp library/particles.jar $LIBRARIES/particles/library/
|
||||
#echo Build particles library...
|
||||
#cd ../lib/particles
|
||||
#$JIKES -target 1.1 +D -d . *.java
|
||||
#rm -f library/particles.jar
|
||||
#zip -r0q library/particles.jar simong
|
||||
#rm -rf simong
|
||||
#mkdir -p $LIBRARIES/particles/library/
|
||||
#cp library/particles.jar $LIBRARIES/particles/library/
|
||||
|
||||
echo
|
||||
echo Done.
|
||||
@@ -40,6 +40,13 @@ ABOUT REV 0083 -
|
||||
+ shininess(float shiney) takes a float from 0..1 to specify
|
||||
the level of shininess for the current material
|
||||
|
||||
- link() now works when running as an application. also added
|
||||
open(String filename) which will attempt to launch an application
|
||||
using the shell, or open(String args[]) which will do the same
|
||||
with several command line args.
|
||||
|
||||
-
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
|
||||
@@ -223,14 +223,14 @@ LIBRARIES=..\\..\\build\\$PLATFORM\\work\\libraries
|
||||
|
||||
|
||||
# PARTICLES LIBRARY
|
||||
echo Build particles library...
|
||||
cd ../lib/particles
|
||||
$JIKES -target 1.1 +D -d . *.java
|
||||
rm -f library/particles.jar
|
||||
zip -r0q library/particles.jar simong
|
||||
rm -rf simong
|
||||
mkdir -p $LIBRARIES/particles/library/
|
||||
cp library/particles.jar $LIBRARIES/particles/library/
|
||||
#echo Build particles library...
|
||||
#cd ../lib/particles
|
||||
#$JIKES -target 1.1 +D -d . *.java
|
||||
#rm -f library/particles.jar
|
||||
#zip -r0q library/particles.jar simong
|
||||
#rm -rf simong
|
||||
#mkdir -p $LIBRARIES/particles/library/
|
||||
#cp library/particles.jar $LIBRARIES/particles/library/
|
||||
|
||||
echo
|
||||
echo Done.
|
||||
|
||||
+156
-29
@@ -61,7 +61,6 @@ public class PApplet extends Applet
|
||||
public static final float javaVersion =
|
||||
new Float(javaVersionName).floatValue();
|
||||
|
||||
|
||||
/**
|
||||
* Current platform in use, one of the
|
||||
* PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER.
|
||||
@@ -210,6 +209,15 @@ public class PApplet extends Applet
|
||||
*/
|
||||
public boolean firstMouse;
|
||||
|
||||
/**
|
||||
* Last mouse button pressed, one of LEFT, CENTER, or RIGHT.
|
||||
* <P>
|
||||
* If running on Mac OS, a ctrl-click will be interpreted as
|
||||
* the righthand mouse button (unlike Java, which reports it as
|
||||
* the left mouse).
|
||||
*/
|
||||
public int mouseButton;
|
||||
|
||||
public boolean mousePressed;
|
||||
public MouseEvent mouseEvent;
|
||||
|
||||
@@ -655,8 +663,8 @@ public class PApplet extends Applet
|
||||
return;
|
||||
|
||||
} catch (ClassNotFoundException e) { }
|
||||
size(iwidth, iheight, P2D); // fall-through case
|
||||
}
|
||||
size(iwidth, iheight, P2D); // fall-through case
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,8 +820,21 @@ public class PApplet extends Applet
|
||||
paint(screen);
|
||||
}
|
||||
|
||||
//synchronized public void paint(Graphics screen) {
|
||||
public void paint(Graphics screen) {
|
||||
if (javaVersion < 1.3f) {
|
||||
screen.setColor(new Color(64, 64, 64));
|
||||
Dimension size = getSize();
|
||||
screen.fillRect(0, 0, size.width, size.height);
|
||||
screen.setColor(Color.white);
|
||||
screen.setFont(new Font("Dialog", Font.PLAIN, 9));
|
||||
screen.drawString("You need to install", 5, 15);
|
||||
screen.drawString("Java 1.3 or later", 5, 25);
|
||||
screen.drawString("to view this content.", 5, 35);
|
||||
screen.drawString("Click here to visit", 5, 50);
|
||||
screen.drawString("java.com and install.", 5, 60);
|
||||
return;
|
||||
}
|
||||
|
||||
//System.out.println("PApplet.paint()");
|
||||
if (THREAD_DEBUG) println(Thread.currentThread().getName() +
|
||||
" 5a enter paint");
|
||||
@@ -1163,6 +1184,21 @@ public class PApplet extends Applet
|
||||
mouseY = event.getY();
|
||||
mouseEvent = event;
|
||||
|
||||
int button = event.getButton();
|
||||
if (button == 1) {
|
||||
mouseButton = LEFT;
|
||||
} else if (button == 2) {
|
||||
mouseButton = CENTER;
|
||||
} else if (button == 3) {
|
||||
mouseButton = RIGHT;
|
||||
}
|
||||
// if running on macos, allow ctrl-click as right mouse
|
||||
if ((platform == MACOSX) || (platform == MACOS9)) {
|
||||
if (mouseEvent.isPopupTrigger()) {
|
||||
mouseButton = RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
mouseEventMethods.handle(new Object[] { event });
|
||||
/*
|
||||
for (int i = 0; i < libraryCount; i++) {
|
||||
@@ -1226,6 +1262,9 @@ public class PApplet extends Applet
|
||||
* mousePressed, and mouseEvent will no longer be set.
|
||||
*/
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (javaVersion < 1.3f) {
|
||||
link("http://java.com/");
|
||||
}
|
||||
checkMouseEvent(e);
|
||||
}
|
||||
|
||||
@@ -1572,44 +1611,132 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Link to an external page without all the muss. Currently
|
||||
* only works for applets, but eventually should be implemented
|
||||
* for applications as well, using code from PdeBase.
|
||||
*/
|
||||
public void link(String here) {
|
||||
if (!online) {
|
||||
System.err.println("Can't open " + here);
|
||||
System.err.println("link() only works inside a web browser");
|
||||
return;
|
||||
}
|
||||
link(here, null);
|
||||
}
|
||||
|
||||
try {
|
||||
getAppletContext().showDocument(new URL(here));
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Could not open " + here);
|
||||
e.printStackTrace();
|
||||
/**
|
||||
* Link to an external page without all the muss.
|
||||
* <P>
|
||||
* When run with an applet, uses the browser to open the url,
|
||||
* for applications, attempts to launch a browser with the url.
|
||||
* <P>
|
||||
* Works on Mac OS X and Windows. For Linux, use:
|
||||
* <PRE>open(new String[] { "firefox", url });</PRE>
|
||||
* or whatever you want as your browser, since Linux doesn't
|
||||
* yet have a standard method for launching URLs.
|
||||
*/
|
||||
public void link(String url, String frame) {
|
||||
if (online) {
|
||||
try {
|
||||
if (frame == null) {
|
||||
getAppletContext().showDocument(new URL(url));
|
||||
} else {
|
||||
getAppletContext().showDocument(new URL(url), frame);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not open " + url);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (platform == WINDOWS) {
|
||||
// the following uses a shell execute to launch the .html file
|
||||
// note that under cygwin, the .html files have to be chmodded +x
|
||||
// after they're unpacked from the zip file. i don't know why,
|
||||
// and don't understand what this does in terms of windows
|
||||
// permissions. without the chmod, the command prompt says
|
||||
// "Access is denied" in both cygwin and the "dos" prompt.
|
||||
//Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" +
|
||||
// referenceFile + ".html");
|
||||
|
||||
// open dos prompt, give it 'start' command, which will
|
||||
// open the url properly. start by itself won't work since
|
||||
// it appears to need cmd
|
||||
Runtime.getRuntime().exec("cmd /c start " + url);
|
||||
|
||||
} else if ((platform == MACOSX) || (platform == MACOS9)) {
|
||||
//com.apple.mrj.MRJFileUtils.openURL(url);
|
||||
try {
|
||||
Class mrjFileUtils = Class.forName("com.apple.mrj.MRJFileUtils");
|
||||
Method openMethod =
|
||||
mrjFileUtils.getMethod("openURL", new Class[] { String.class });
|
||||
openMethod.invoke(null, new Object[] { url });
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Can't open URLs for this platform");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not open " + url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void link(String here, String there) {
|
||||
if (!online) {
|
||||
System.err.println("Can't open " + here);
|
||||
System.err.println("link() only works inside a web browser");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
getAppletContext().showDocument(new URL(here), there);
|
||||
/**
|
||||
* Attempt to open a file using the platform's shell.
|
||||
*/
|
||||
public void open(String filename) {
|
||||
if (platform == WINDOWS) {
|
||||
// just launching the .html file via the shell works
|
||||
// but make sure to chmod +x the .html files first
|
||||
// also place quotes around it in case there's a space
|
||||
// in the user.dir part of the url
|
||||
try {
|
||||
Runtime.getRuntime().exec("cmd /c \"" + filename + "\"");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not open " + filename);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Could not open " + here);
|
||||
e.printStackTrace();
|
||||
} else if ((platform == MACOSX) || (platform == MACOS9)) {
|
||||
// prepend file:// on this guy since it's a file
|
||||
String url = "file://" + filename;
|
||||
|
||||
// replace spaces with %20 for the file url
|
||||
// otherwise the mac doesn't like to open it
|
||||
// can't just use URLEncoder, since that makes slashes into
|
||||
// %2F characters, which is no good. some might say "useless"
|
||||
if (url.indexOf(' ') != -1) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
char c[] = url.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == ' ') {
|
||||
sb.append("%20");
|
||||
} else {
|
||||
sb.append(c[i]);
|
||||
}
|
||||
}
|
||||
url = sb.toString();
|
||||
}
|
||||
link(url);
|
||||
|
||||
} else {
|
||||
open(new String[] { filename });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Launch a process using a platforms shell, and an array of
|
||||
* args passed on the command line.
|
||||
*/
|
||||
public Process open(String args[]) {
|
||||
try {
|
||||
return Runtime.getRuntime().exec(args);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not open " + join(args, ' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -1789,7 +1789,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
|
||||
public void rotate(float angle, float vx, float vy, float vz) {
|
||||
throw new RuntimeException("rotate(angle, x, y, z) " +
|
||||
"can only be used with depth()");
|
||||
"can only be used with P3D or OPENGL");
|
||||
}
|
||||
|
||||
|
||||
@@ -1877,7 +1877,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
float n20, float n21, float n22, float n23,
|
||||
float n30, float n31, float n32, float n33) {
|
||||
throw new RuntimeException("applyMatrix() with a 4x4 matrix " +
|
||||
"can only be used with depth()");
|
||||
"can only be used with OPENGL or P3D");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -809,13 +809,6 @@ public class PGraphics2 extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clears pixel buffer. Also clears the stencil and zbuffer
|
||||
* if they exist. Their existence is more accurate than using 'depth'
|
||||
* to test whether to clear them, because if they're non-null,
|
||||
* it means that depth() has been called somewhere in the program,
|
||||
* even if noDepth() was called before draw() exited.
|
||||
*/
|
||||
public void clear() {
|
||||
g2.setColor(new Color(backgroundColor));
|
||||
g2.fillRect(0, 0, width, height);
|
||||
|
||||
@@ -35,13 +35,13 @@ public class PGraphics3 extends PGraphics {
|
||||
public PMatrix modelview; // = new PMatrix(MATRIX_STACK_DEPTH);
|
||||
|
||||
public PMatrix camera; // = new PMatrix();
|
||||
public PMatrix inverseCamera; // = new PMatrix();
|
||||
public PMatrix cameraInv; // = new PMatrix();
|
||||
|
||||
// ........................................................
|
||||
// Lighting-related variables
|
||||
|
||||
// inverse model matrix
|
||||
public PMatrix inverseModelview; // = new PMatrix(MATRIX_STACK_DEPTH);
|
||||
public PMatrix modelviewInv; // = new PMatrix(MATRIX_STACK_DEPTH);
|
||||
|
||||
// store the facing direction to speed rendering
|
||||
boolean useBackfaceCulling = false;
|
||||
@@ -78,7 +78,7 @@ public class PGraphics3 extends PGraphics {
|
||||
public PMatrix projection = new PMatrix();
|
||||
|
||||
// These two matrices always point to either the modelview
|
||||
// or the inverseModelview, but they are swapped during
|
||||
// or the modelviewInv, but they are swapped during
|
||||
// when in camera maniuplation mode. That way camera transforms
|
||||
// are automatically accumulated in inverse on the modelview matrix.
|
||||
public PMatrix forwardTransform;
|
||||
@@ -227,7 +227,7 @@ public class PGraphics3 extends PGraphics {
|
||||
*/
|
||||
public PGraphics3() {
|
||||
forwardTransform = modelview;
|
||||
reverseTransform = inverseModelview;
|
||||
reverseTransform = modelviewInv;
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ public class PGraphics3 extends PGraphics {
|
||||
// super will add the listeners to the applet, and call resize()
|
||||
super(iwidth, iheight, parent);
|
||||
forwardTransform = modelview;
|
||||
reverseTransform = inverseModelview;
|
||||
reverseTransform = modelviewInv;
|
||||
//resize(iwidth, iheight);
|
||||
//projection = new PMatrix();
|
||||
}
|
||||
@@ -310,10 +310,10 @@ public class PGraphics3 extends PGraphics {
|
||||
// making this again here because things are weird
|
||||
projection = new PMatrix();
|
||||
modelview = new PMatrix(MATRIX_STACK_DEPTH);
|
||||
inverseModelview = new PMatrix(MATRIX_STACK_DEPTH);
|
||||
modelviewInv = new PMatrix(MATRIX_STACK_DEPTH);
|
||||
|
||||
camera = new PMatrix();
|
||||
inverseCamera = new PMatrix();
|
||||
cameraInv = new PMatrix();
|
||||
|
||||
// set up the default camera
|
||||
camera();
|
||||
@@ -365,7 +365,7 @@ public class PGraphics3 extends PGraphics {
|
||||
super.beginFrame();
|
||||
|
||||
modelview.set(camera);
|
||||
inverseModelview.set(inverseCamera);
|
||||
modelviewInv.set(cameraInv);
|
||||
|
||||
// clear out the lights, they'll have to be turned on again
|
||||
lightCount = 0;
|
||||
@@ -415,7 +415,7 @@ public class PGraphics3 extends PGraphics {
|
||||
public void angleMode(int mode) {
|
||||
super.angleMode(mode);
|
||||
modelview.angleMode(mode);
|
||||
inverseModelview.angleMode(mode);
|
||||
modelviewInv.angleMode(mode);
|
||||
projection.angleMode(mode);
|
||||
}
|
||||
*/
|
||||
@@ -425,7 +425,7 @@ public class PGraphics3 extends PGraphics {
|
||||
|
||||
manipulatingCamera = false;
|
||||
forwardTransform = modelview;
|
||||
reverseTransform = inverseModelview;
|
||||
reverseTransform = modelviewInv;
|
||||
|
||||
//cameraMode(PERSPECTIVE);
|
||||
perspective();
|
||||
@@ -454,7 +454,7 @@ public class PGraphics3 extends PGraphics {
|
||||
*/
|
||||
//public void postSetup() {
|
||||
//modelview.storeResetValue();
|
||||
//inverseModelview.storeResetValue();
|
||||
//modelviewInv.storeResetValue();
|
||||
//}
|
||||
|
||||
|
||||
@@ -694,13 +694,6 @@ public class PGraphics3 extends PGraphics {
|
||||
splineVertexCount = 3;
|
||||
}
|
||||
|
||||
// 'flat' may be a misnomer here because it's actually just
|
||||
// calculating whether z is zero for all the spline points,
|
||||
// so that it knows whether to calculate all three params,
|
||||
// or just two for x and y.
|
||||
//if (spline_vertices_flat) {
|
||||
//if (z != 0) spline_vertices_flat = false;
|
||||
//}
|
||||
float vertex[] = splineVertices[splineVertexCount];
|
||||
|
||||
vertex[MX] = x;
|
||||
@@ -722,17 +715,14 @@ public class PGraphics3 extends PGraphics {
|
||||
vertex[SW] = strokeWeight;
|
||||
}
|
||||
|
||||
// this complicated "if" construct may defeat the purpose
|
||||
if (textureImage != null) {
|
||||
vertex[U] = textureU;
|
||||
vertex[V] = textureV;
|
||||
}
|
||||
|
||||
//if (normalChanged) {
|
||||
vertex[NX] = normalX;
|
||||
vertex[NY] = normalY;
|
||||
vertex[NZ] = normalZ;
|
||||
//}
|
||||
|
||||
splineVertexCount++;
|
||||
|
||||
@@ -760,17 +750,38 @@ public class PGraphics3 extends PGraphics {
|
||||
/**
|
||||
* See notes with the bezier() function.
|
||||
*/
|
||||
public void bezierVertex(float x, float y) {
|
||||
spline_vertex(x, y, 0, true);
|
||||
public void bezierVertex(float x2, float y2,
|
||||
float x3, float y3,
|
||||
float x4, float y4) {
|
||||
bezierVertex(x2, y2, 0, x3, y3, 0, x4, y4, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See notes with the bezier() function.
|
||||
*/
|
||||
public void bezierVertex(float x, float y, float z) {
|
||||
spline_vertex(x, y, z, true);
|
||||
public void bezierVertex(float x2, float y2, float z2,
|
||||
float x3, float y3, float z3,
|
||||
float x4, float y4, float z4) {
|
||||
if (splineVertexCount > 0) {
|
||||
float vertex[] = splineVertices[splineVertexCount-1];
|
||||
spline_vertex(vertex[MX], vertex[MY], vertex[MZ], true);
|
||||
|
||||
} else if (vertexCount > 0) {
|
||||
// make sure there's at least a call to vertex()
|
||||
float vertex[] = vertices[vertexCount-1];
|
||||
spline_vertex(vertex[MX], vertex[MY], vertex[MZ], true);
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("A call to vertex() must be used " +
|
||||
"before bezierVertex()");
|
||||
}
|
||||
spline_vertex(x2, y2, z2, true);
|
||||
spline_vertex(x3, y3, z3, true);
|
||||
spline_vertex(x4, y4, z4, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See notes with the curve() function.
|
||||
*/
|
||||
@@ -1388,10 +1399,10 @@ public class PGraphics3 extends PGraphics {
|
||||
// Multiply by TRANSPOSE!
|
||||
// It's just one of those things. Model normals should be multiplied by the
|
||||
// inverse transpose of the modelview matrix to get world normals.
|
||||
float nx = inverseModelview.m00*v[NX] + inverseModelview.m10*v[NY] + inverseModelview.m20*v[NZ] + inverseModelview.m30;
|
||||
float ny = inverseModelview.m01*v[NX] + inverseModelview.m11*v[NY] + inverseModelview.m21*v[NZ] + inverseModelview.m31;
|
||||
float nz = inverseModelview.m02*v[NX] + inverseModelview.m12*v[NY] + inverseModelview.m22*v[NZ] + inverseModelview.m32;
|
||||
float nw = inverseModelview.m03*v[NX] + inverseModelview.m13*v[NY] + inverseModelview.m23*v[NZ] + inverseModelview.m33;
|
||||
float nx = modelviewInv.m00*v[NX] + modelviewInv.m10*v[NY] + modelviewInv.m20*v[NZ] + modelviewInv.m30;
|
||||
float ny = modelviewInv.m01*v[NX] + modelviewInv.m11*v[NY] + modelviewInv.m21*v[NZ] + modelviewInv.m31;
|
||||
float nz = modelviewInv.m02*v[NX] + modelviewInv.m12*v[NY] + modelviewInv.m22*v[NZ] + modelviewInv.m32;
|
||||
float nw = modelviewInv.m03*v[NX] + modelviewInv.m13*v[NY] + modelviewInv.m23*v[NZ] + modelviewInv.m33;
|
||||
|
||||
v[NX] = nx;
|
||||
v[NY] = ny;
|
||||
@@ -2123,10 +2134,10 @@ public class PGraphics3 extends PGraphics {
|
||||
float x3, float y3, float z3,
|
||||
float x4, float y4, float z4) {
|
||||
beginShape(LINE_STRIP);
|
||||
bezierVertex(x1, y1, z1);
|
||||
bezierVertex(x2, y2, z2);
|
||||
bezierVertex(x3, y3, z3);
|
||||
bezierVertex(x4, y4, z4);
|
||||
vertex(x1, y1, z1);
|
||||
bezierVertex(x2, y2, z2,
|
||||
x3, y3, z3,
|
||||
x4, y4, z4);
|
||||
endShape();
|
||||
}
|
||||
|
||||
@@ -2317,7 +2328,7 @@ public class PGraphics3 extends PGraphics {
|
||||
}
|
||||
// Do this to the inverse regardless of the lights
|
||||
// to keep stack pointers in sync
|
||||
inverseModelview.push();
|
||||
modelviewInv.push();
|
||||
}
|
||||
|
||||
|
||||
@@ -2328,7 +2339,7 @@ public class PGraphics3 extends PGraphics {
|
||||
}
|
||||
// Do this to the inverse regardless of the lights
|
||||
// to keep stack pointers in sync
|
||||
inverseModelview.pop();
|
||||
modelviewInv.pop();
|
||||
}
|
||||
|
||||
|
||||
@@ -2392,7 +2403,7 @@ public class PGraphics3 extends PGraphics {
|
||||
public void cameraMode(int mode) {
|
||||
resetProjection();
|
||||
modelview.identity();
|
||||
inverseModelview.identity();
|
||||
modelviewInv.identity();
|
||||
|
||||
if (mode == PERSPECTIVE) {
|
||||
//System.out.println("setting camera to perspective");
|
||||
@@ -2427,7 +2438,7 @@ public class PGraphics3 extends PGraphics {
|
||||
} else {
|
||||
//projection.identity();
|
||||
manipulatingCamera = true;
|
||||
forwardTransform = inverseCamera; //inverseModelview;
|
||||
forwardTransform = cameraInv; //modelviewInv;
|
||||
reverseTransform = camera; //modelview;
|
||||
//cameraMode = CUSTOM;
|
||||
}
|
||||
@@ -2450,7 +2461,7 @@ public class PGraphics3 extends PGraphics {
|
||||
else {
|
||||
manipulatingCamera = false;
|
||||
forwardTransform = modelview;
|
||||
reverseTransform = inverseModelview;
|
||||
reverseTransform = modelviewInv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2617,11 +2628,11 @@ public class PGraphics3 extends PGraphics {
|
||||
0, 0, 0, 1);
|
||||
modelview.invTranslate(eyeX, eyeY, eyeZ);
|
||||
|
||||
inverseModelview.applyMatrix(x0, x1, x2, 0,
|
||||
modelviewInv.applyMatrix(x0, x1, x2, 0,
|
||||
y0, y1, y2, 0,
|
||||
z0, z1, z2, 0,
|
||||
0, 0, 0, 1);
|
||||
inverseModelview.translate(eyeX, eyeY, eyeZ);
|
||||
modelviewInv.translate(eyeX, eyeY, eyeZ);
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -2839,9 +2850,9 @@ public class PGraphics3 extends PGraphics {
|
||||
|
||||
public void lightDirection(int num, float x, float y, float z) {
|
||||
// Multiply by inverse transpose.
|
||||
lightNX[num] = inverseModelview.m00*x + inverseModelview.m10*y + inverseModelview.m20*z + inverseModelview.m30;
|
||||
lightNY[num] = inverseModelview.m01*x + inverseModelview.m11*y + inverseModelview.m21*z + inverseModelview.m31;
|
||||
lightNZ[num] = inverseModelview.m02*x + inverseModelview.m12*y + inverseModelview.m22*z + inverseModelview.m32;
|
||||
lightNX[num] = modelviewInv.m00*x + modelviewInv.m10*y + modelviewInv.m20*z + modelviewInv.m30;
|
||||
lightNY[num] = modelviewInv.m01*x + modelviewInv.m11*y + modelviewInv.m21*z + modelviewInv.m31;
|
||||
lightNZ[num] = modelviewInv.m02*x + modelviewInv.m12*y + modelviewInv.m22*z + modelviewInv.m32;
|
||||
float norm = mag(lightNX[num], lightNY[num], lightNZ[num]);
|
||||
if (norm == 0 || norm == 1) return;
|
||||
lightNX[num] /= norm;
|
||||
@@ -3254,14 +3265,14 @@ public class PGraphics3 extends PGraphics {
|
||||
protected void lightDirection(int num, float x, float y, float z) {
|
||||
// Multiply by inverse transpose.
|
||||
lightNX[num] =
|
||||
inverseModelview.m00*x + inverseModelview.m10*y +
|
||||
inverseModelview.m20*z + inverseModelview.m30;
|
||||
modelviewInv.m00*x + modelviewInv.m10*y +
|
||||
modelviewInv.m20*z + modelviewInv.m30;
|
||||
lightNY[num] =
|
||||
inverseModelview.m01*x + inverseModelview.m11*y +
|
||||
inverseModelview.m21*z + inverseModelview.m31;
|
||||
modelviewInv.m01*x + modelviewInv.m11*y +
|
||||
modelviewInv.m21*z + modelviewInv.m31;
|
||||
lightNZ[num] =
|
||||
inverseModelview.m02*x + inverseModelview.m12*y +
|
||||
inverseModelview.m22*z + inverseModelview.m32;
|
||||
modelviewInv.m02*x + modelviewInv.m12*y +
|
||||
modelviewInv.m22*z + modelviewInv.m32;
|
||||
|
||||
float norm = mag(lightNX[num], lightNY[num], lightNZ[num]);
|
||||
if (norm == 0 || norm == 1) return;
|
||||
|
||||
+33
-32
@@ -27,34 +27,10 @@ o image(String name) and textFont(String name)
|
||||
o do we change to font(arial, 12) ?
|
||||
X remove angleMode() ?
|
||||
X be consistent about getXxx() methods
|
||||
_ just use the variable names.. don't do overkill on fillR et al
|
||||
_ or just what functions are actually made public
|
||||
_ is fillRi needed? it's pretty goofy..
|
||||
X just use the variable names.. don't do overkill on fillR et al
|
||||
X or just what functions are actually made public
|
||||
X is fillRi needed? it's pretty goofy..
|
||||
X how to handle full screen (opengl especially) or no screen (for scripts)
|
||||
_ expose api to launch files, folders, URLs
|
||||
X use with/in place of link()
|
||||
_ call it open()
|
||||
X what to call firstMouse
|
||||
_ implement rightMouse?
|
||||
_ yes, mouseButton = LEFT, CENTER, or RIGHT
|
||||
|
||||
_ should we include a from and to for the directional light?
|
||||
|
||||
_ rename video.Camera to video.Video ?
|
||||
_ VideoInput VideoOutput, SoundInput, SoundOutput or AudioInput/AudioOutput
|
||||
_ should nf() handle commas as well?
|
||||
_ yes, and add nf(int what) so that non-padded version works
|
||||
_ but don't put commas into the zero-padded version
|
||||
_ make nf/nfs/nfp not so weird
|
||||
_ nf(PLUS, ...) nf(PAD, ...) nfc(PLUS, ...)
|
||||
|
||||
_ make the 1.4 code in PApplet load via reflection
|
||||
_ noCursor seems to be broken on the mac?
|
||||
|
||||
_ don't let users on < 1.3 load JAVA2D, or < 1.4 load OPENGL
|
||||
_ error when running on 1.1...
|
||||
_ You need to install Java 1.3 or later to view this content.
|
||||
_ Click here to visit java.com and install.
|
||||
|
||||
tweaking up simong light code
|
||||
o what's up with resetLights?
|
||||
@@ -63,13 +39,32 @@ o preApplyMatrix, invApplyMatrix?
|
||||
o applyMatrixPre and applyMatrixIn
|
||||
o rotateXInv is ugly..
|
||||
o irotateX?, papplyMatrix?
|
||||
_ make inverseCamera into cameraInv
|
||||
|
||||
wednesday evening
|
||||
X expose api to launch files, folders, URLs
|
||||
X use with/in place of link()
|
||||
X call it open()
|
||||
X what to call firstMouse
|
||||
X implement rightMouse?
|
||||
X yes, mouseButton = LEFT, CENTER, or RIGHT
|
||||
X error when running on 1.1...
|
||||
X You need to install Java 1.3 or later to view this content.
|
||||
X Click here to visit java.com and install.
|
||||
X make inverseCamera into cameraInv
|
||||
X fix messages referring to depth()
|
||||
X route all of them through a single function rather than current waste
|
||||
|
||||
_ rename video.Camera to video.Video ?
|
||||
_ VideoInput VideoOutput, SoundInput, SoundOutput or AudioInput/AudioOutput
|
||||
_ should nf() handle commas as well?
|
||||
_ yes, and add nf(int what) so that non-padded version works
|
||||
_ but don't put commas into the zero-padded version
|
||||
_ make nf/nfs/nfp not so weird
|
||||
_ nf(PLUS, ...) nf(PAD, ...) nfc(PLUS, ...)
|
||||
_ should we include a from and to for the directional light?
|
||||
|
||||
_ fix bezierVertex() in P3D for newer api
|
||||
_ fix shapes in P3D
|
||||
|
||||
_ fix messages referring to depth()
|
||||
_ route all of them through a single function rather than current waste
|
||||
_ fix shapes in P3D (line loop, polygons, etc)
|
||||
|
||||
_ fix the flicker in java2d mode
|
||||
X is it because the lock was taken off (g) in PApplet?
|
||||
@@ -92,6 +87,11 @@ _ i.e. ABGR_EXT might allow for just two shifts instead of 4
|
||||
_ allow access to native pixel buffer in opengl and power of 2
|
||||
_ so that no need to copy/update everything
|
||||
|
||||
_ make the 1.4 code in PApplet load via reflection
|
||||
_ doesn't appear necessary with 1.3 applets
|
||||
|
||||
_ noCursor seems to be broken on the mac?
|
||||
|
||||
_ make get/getImpl for PGraphics/PGraphics2
|
||||
_ make sure there's a loadPixels/updatePixels in PGraphics2
|
||||
_ rewrite getImpl/setImpl inside opengl
|
||||
@@ -181,6 +181,7 @@ _ sphere() and box() should set normals and take textures
|
||||
_ background color seems to be wrong?
|
||||
_ check this once lighting actually works
|
||||
|
||||
_ don't let users on < 1.3 load JAVA2D, or < 1.4 load OPENGL
|
||||
|
||||
PApplet
|
||||
_ printarr() of null array crashes without an error
|
||||
|
||||
+4
-2
@@ -6,11 +6,13 @@ o and check in the preproc'd code to cvs?
|
||||
X need to add classes dir to cp for jikes make (on win and linux)
|
||||
X get both versions of size() properly detected on export
|
||||
X get latest sonia from amit
|
||||
X remove particles from current processing
|
||||
X move netscape library out of libs and into build/shared
|
||||
|
||||
_ remove PdeXxx prefixes on names, make PdeBase into just "Processing"
|
||||
|
||||
_ remove particles from current processing
|
||||
_ move netscape library out of libs and into build/shared
|
||||
_ placement of 100x100 items is odd
|
||||
_ happens with P3D and maybe also P2D?
|
||||
|
||||
_ update .exe to use new class/package
|
||||
_ update .app to use new class/package
|
||||
|
||||
Reference in New Issue
Block a user