processing / processing/processing4

Depth sorting not working for lines in PDF or SVG export

Ouverte
#802 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug core
Langage dominant
Java
Étoiles
494
Forks
183
Merge moyen
4 h 39 min
PR mergées (30 j)
3

Description

Created by: PBernalPolo

Description

Rendering lines or spheres on the screen works fine. When we render spheres to PDF or SVG, they are depth sorted properly. However, lines are not depth sorted; they are drawn in the order of declaration.

Expected Behavior

Lines should also be drawn according to their depth ordering (at least with hint(ENABLE_DEPTH_SORT) enabled).

Current Behavior

Lines are currently drawn according to their declaration order (even with hint(ENABLE_DEPTH_SORT) enabled).

Steps to Reproduce

Comment/uncomment each line that appears in draw().

import processing.pdf.*;
import processing.svg.*;


void setup()
{
  size( 500 , 500 , P3D );
  hint( ENABLE_DEPTH_SORT );
}


void draw()
{
  // Choose one:
  //drawToScreen();
  drawToPDF();
  //drawToSVG();
}


void drawToPDF()
{
  // Here we generate the PDF document.
  beginRaw( PDF , "output.pdf" );
  drawMyStuff();
  endRaw();
  exit();
}


void drawToSVG()
{
  // Here we generate the SVG image.
  beginRaw( SVG , "output.svg" );
  drawMyStuff();
  endRaw();
  exit();
}


void drawToScreen()
{
  // Here we just draw to the screen.
  drawMyStuff();
}


void drawMyStuff()
{
  background(255);
  lights();
  strokeWeight( 50 );
  
  // First we draw the line that should be shown on top (black).
  stroke( 0 , 0 , 0 );
  line( 250 , 50 , 100 , 250 , 450 , 100 );
  
  // Then the line that should be shown behind (red).
  stroke( 255 , 0 , 0 );
  line( 50 , 250 , -100 , 450 , 250 , -100 );
  
  stroke( 0 , 0 , 0 );
  strokeWeight( 1 );
  
  // First, draw a green sphere that should appear on top.
  pushMatrix();
  fill( 0 , 255 , 0 );
  translate( width*4/10 , height*4/10 , 50 );
  sphere( 70 );
  popMatrix();
  
  // Then draw a blue sphere that should appear behind.
  pushMatrix();
  fill( 0 , 0 , 255 );
  translate( width*3/10 , height*3/10 , -50 );
  sphere( 70 );
  popMatrix();
}

Your Environment

  • Processing version: 4.3
  • Operating System and OS version: ubuntu 22.04

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter le sketch Processing 4.3 fourni sur Ubuntu 22.04 et comparez les sorties écran, PDF et SVG avec ENABLE_DEPTH_SORT activé. Suivez la manière dont les lignes sont soumises et triées par profondeur dans les chemins d’exportation PDF et SVG, puis vérifiez que les lignes qui se chevauchent respectent leur ordre de profondeur tandis que le comportement existant de la sphère reste inchangé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
computer-graphics
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.