FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

major pmatrix work, still in progress, lots of errors · classicist/processing@6608255 · GitHub

Repository navigation

Commit 6608255

Browse files
committed
major pmatrix work, still in progress, lots of errors
1 parent fbd3e42 commit 6608255

9 files changed

Lines changed: 509 additions & 208 deletions

File tree

‎core/src/processing/core/PApplet.java‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7220,12 +7220,6 @@ public void applyMatrix(float n00, float n01, float n02, float n03,
72207220
}
72217221

72227222

7223-
public void loadMatrix() {
7224-
if (recorder != null) recorder.loadMatrix();
7225-
g.loadMatrix();
7226-
}
7227-
7228-
72297223
public void printMatrix() {
72307224
if (recorder != null) recorder.printMatrix();
72317225
g.printMatrix();

‎core/src/processing/core/PGraphics.java‎

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ public class PGraphics extends PImage implements PConstants {
174174
protected boolean[] hints = new boolean[HINT_COUNT];
175175

176176

177+
// ........................................................
178+
179+
180+
177181
////////////////////////////////////////////////////////////
178182

179183
// STYLE PROPERTIES
@@ -283,9 +287,9 @@ public class PGraphics extends PImage implements PConstants {
283287
// ........................................................
284288

285289
// Shape placement properties
286-
290+
287291
// imageMode() is inherited from PImage
288-
292+
289293
/** The current rect mode (read-only) */
290294
public int rectMode;
291295

@@ -329,11 +333,10 @@ public class PGraphics extends PImage implements PConstants {
329333
public float specularR, specularG, specularB;
330334
public float emissiveR, emissiveG, emissiveB;
331335
public float shininess;
332-
333-
// ........................................................
334-
335-
// Style stack
336336

337+
338+
// Style stack
339+
337340
static final int STYLE_STACK_DEPTH = 64;
338341
PStyle[] styleStack = new PStyle[STYLE_STACK_DEPTH];
339342
int styleStackDepth;
@@ -355,15 +358,16 @@ public class PGraphics extends PImage implements PConstants {
355358
* Current model-view matrix transformation of the form m[row][column],
356359
* which is a "column vector" (as opposed to "row vector") matrix.
357360
*/
358-
public float m00, m01, m02, m03;
359-
public float m10, m11, m12, m13;
360-
public float m20, m21, m22, m23;
361-
public float m30, m31, m32, m33;
361+
// PMatrix matrix;
362+
// public float m00, m01, m02, m03;
363+
// public float m10, m11, m12, m13;
364+
// public float m20, m21, m22, m23;
365+
// public float m30, m31, m32, m33;
362366

363-
static final int MATRIX_STACK_DEPTH = 32;
364-
float[][] matrixStack = new float[MATRIX_STACK_DEPTH][16];
365-
float[][] matrixInvStack = new float[MATRIX_STACK_DEPTH][16];
366-
int matrixStackDepth;
367+
// static final int MATRIX_STACK_DEPTH = 32;
368+
// float[][] matrixStack = new float[MATRIX_STACK_DEPTH][16];
369+
// float[][] matrixInvStack = new float[MATRIX_STACK_DEPTH][16];
370+
// int matrixStackDepth;
367371

368372
// ........................................................
369373

@@ -737,7 +741,7 @@ protected void defaultSettings() { // ignore
737741
shape = 0;
738742

739743
// init matrices (must do before lights)
740-
matrixStackDepth = 0;
744+
//matrixStackDepth = 0;
741745

742746
rectMode(CORNER);
743747
ellipseMode(DIAMETER);
@@ -1137,14 +1141,14 @@ public void endShape(int mode) {
11371141
//////////////////////////////////////////////////////////////
11381142

11391143
// STYLE
1140-
1141-
1144+
1145+
11421146
public void style(PStyle s) {
1143-
if (s.smooth) {
1144-
smooth();
1145-
} else {
1146-
noSmooth();
1147-
}
1147+
// if (s.smooth) {
1148+
// smooth();
1149+
// } else {
1150+
// noSmooth();
1151+
// }
11481152

11491153
imageMode(s.imageMode);
11501154
rectMode(s.rectMode);
@@ -1200,15 +1204,15 @@ public void style(PStyle s) {
12001204
colorMode(s.colorMode,
12011205
s.colorModeX, s.colorModeY, s.colorModeZ, s.colorModeA);
12021206

1203-
// This is a bit assymetric, since there's no way to do "noFont()",
1207+
// This is a bit asymmetric, since there's no way to do "noFont()",
12041208
// and a null textFont will produce an error (since usually that means that
12051209
// the font couldn't load properly). So in some cases, the font won't be
12061210
// 'cleared' to null, even though that's technically correct.
12071211
if (s.textFont != null) {
12081212
textFont(s.textFont, s.textSize);
12091213
textLeading(s.textLeading);
12101214
}
1211-
// These don't requre a font to be set.
1215+
// These don't require a font to be set.
12121216
textAlign(s.textAlign, s.textAlignY);
12131217
textMode(s.textMode);
12141218
}
@@ -1926,9 +1930,9 @@ protected void splineSegment(int offset, int start, PMatrix3D basis,
19261930
float z4 = splineVertices[offset+3][Z];
19271931
float z0 = splineVertices[start][Z];
19281932

1929-
float zplot1 = m10*z1 + m11*z2 + m12*z3 + m13*z4;
1930-
float zplot2 = m20*z1 + m21*z2 + m22*z3 + m23*z4;
1931-
float zplot3 = m30*z1 + m31*z2 + m32*z3 + m33*z4;
1933+
float zplot1 = basis.m10*z1 + basis.m11*z2 + basis.m12*z3 + basis.m13*z4;
1934+
float zplot2 = basis.m20*z1 + basis.m21*z2 + basis.m22*z3 + basis.m23*z4;
1935+
float zplot3 = basis.m30*z1 + basis.m31*z2 + basis.m32*z3 + basis.m33*z4;
19321936

19331937
vertex(x0, y0, z0);
19341938
for (int j = 0; j < segments; j++) {
@@ -3032,7 +3036,7 @@ public void scale(float x, float y, float z) {
30323036

30333037

30343038
static final String ERROR_PUSHMATRIX_OVERFLOW =
3035-
"Too many calls to pushMatrix(), the maximum is " + MATRIX_STACK_DEPTH + ".";
3039+
"Too many calls to pushMatrix().";
30363040
static final String ERROR_PUSHMATRIX_UNDERFLOW =
30373041
"Too many calls to popMatrix(), and not enough to pushMatrix().";
30383042

@@ -3077,14 +3081,14 @@ public void applyMatrix(float n00, float n01, float n02, float n03,
30773081

30783082

30793083
/**
3080-
* Loads the current matrix into m00, m01 etc (or modelview and
3081-
* projection when using 3D) so that the values can be read.
3084+
* Loads the current matrix into the local 'matrix' object so that the values
3085+
* can be used for other purposes.
30823086
* <P/>
30833087
* Note that there is no "updateMatrix" because that gets too
30843088
* complicated (unnecessary) when considering the 3D matrices.
30853089
*/
3086-
public void loadMatrix() {
3087-
}
3090+
// public void loadMatrix() {
3091+
// }
30883092

30893093

30903094
/**
@@ -3170,7 +3174,8 @@ public void printProjection() {
31703174
* scale(), or any other transformations.
31713175
*/
31723176
public float screenX(float x, float y) {
3173-
return m00*x + m01*y + m02;
3177+
methodError("screenX");
3178+
return 0;
31743179
}
31753180

31763181

@@ -3180,7 +3185,8 @@ public float screenX(float x, float y) {
31803185
* scale(), or any other transformations.
31813186
*/
31823187
public float screenY(float x, float y) {
3183-
return m10*x + m11*y + m12;
3188+
methodError("screenY");
3189+
return 0;
31843190
}
31853191

31863192

@@ -3295,7 +3301,7 @@ public PStyle getStyle() { // ignore
32953301

32963302

32973303
public void getStyle(PStyle s) { // ignore
3298-
s.smooth = smooth;
3304+
// s.smooth = smooth;
32993305

33003306
s.imageMode = imageMode;
33013307
s.rectMode = rectMode;
@@ -4040,14 +4046,14 @@ protected void backgroundImpl() {
40404046
// MESSAGES / ERRORS / LOGGING
40414047

40424048

4043-
HashMap<String, Object> errors;
4049+
static protected HashMap<String, Object> errors;
40444050

40454051

40464052
/**
40474053
* Show a renderer error, and keep track of it so that it's only shown once.
40484054
* @param msg the error message (which will be stored for later comparison)
40494055
*/
4050-
protected void showError(String msg) {
4056+
static protected void showError(String msg) {
40514057
if (errors == null) {
40524058
errors = new HashMap<String, Object>();
40534059
}
@@ -4058,20 +4064,20 @@ protected void showError(String msg) {
40584064
}
40594065

40604066

4061-
protected void depthError(String method) {
4067+
static protected void depthError(String method) {
40624068
showError(method + "() can only be used with a renderer that " +
40634069
"supports 3D, such as P3D or OPENGL.");
40644070
}
40654071

40664072

4067-
protected void depthErrorXYZ(String method) {
4073+
static protected void depthErrorXYZ(String method) {
40684074
showError(method + "(x, y, z) can only be used with a renderer that " +
40694075
"supports 3D, such as P3D or OPENGL. " +
40704076
"Use " + method + "(x, y) instead.");
40714077
}
40724078

40734079

4074-
protected void methodError(String method) {
4080+
static protected void methodError(String method) {
40754081
showError(method + "() is not available with this renderer.");
40764082
}
40774083

@@ -4081,7 +4087,7 @@ protected void methodError(String method) {
40814087
* other variations are). For instance, if vertex(x, y, u, v) is unavailable,
40824088
* but vertex(x, y) is just fine, it doesn't make sense to use methodError().
40834089
*/
4084-
protected void variationError(String str) {
4090+
static protected void variationError(String str) {
40854091
showError(str + " is not available with this renderer.");
40864092
}
40874093

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL