processing / processing/processing4
Flat rendering on PGraphics3D of PShapes created from PGraphics2D
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 494
- Forks
- 183
- Ø Merge
- 4 Std. 39 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
Created by: onimatrix
Calling createShape() directly will use the Applet renderer.
If this renderer is set to be of type P2D, the resulting shape seems to ignore any z value set to it's vertices.
I'm guessing that this shape contains some optimizations aimed at 2D rendering.
There should be a warning when using this kind of "flat" PShape on a P3D renderer.
Maybe even a different PShape class to make it foolproof.
Also, it would be great if 3D PShapes could be created without needing to reference a PGraphics3D that is in the "draw state".
Here's a piece of code to replicate the issue:
PGraphics g3D;
PShape shape;
void setup()
{
size(800, 600, P2D);
g3D = createGraphics(width, height, P3D);
//g3D.beginDraw(); // uncomment to fix flatness
shape = createShape(); // change to g3D.createShape(); to fix flatness
//g3D.endDraw(); // uncomment to fix flatness
shape.beginShape(LINE_STRIP);
shape.vertex(0, 0, 0);
shape.vertex(200, 0, 0);
shape.vertex(200, 0, 200);
shape.endShape(CLOSE);
}
void draw()
{
g3D.beginDraw();
g3D.background(255);
g3D.translate(width / 2, height / 3, 0);
g3D.rotateY(((frameCount % 400) / 400.0f) * TWO_PI);
g3D.shape(shape);
g3D.endDraw();
image(g3D, 0, 0, width, height);
}
- Processing version: 4.2
- Operating System and OS version: Windows 10
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe zunächst den bereitgestellten Sketch aus und vergleiche createShape() mit g3D.createShape(), einschließlich des beginDraw()-Falls. Verfolge die Einstiegspunkte createShape(), PGraphics2D, PGraphics3D und PShape, um zu bestimmen, wo die flache Form ausgewählt wird; abgeschlossen ist die Aufgabe, wenn der P3D-Anwendungsfall explizit behandelt wird, mit der angeforderten Warnung oder einem eindeutig unterstützten Pfad zur Erstellung einer 3D-Form.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- computer-graphics
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100