processing / processing/processing4
Depth sorting not working for lines in PDF or SVG export
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Java
- Estrelas
- 497
- Forks
- 183
- Merge médio
- 4h 39min
- PRs com merge (30d)
- 3
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece executando o sketch fornecido do Processing 4.3 no Ubuntu 22.04 e compare as saídas de tela, PDF e SVG com ENABLE_DEPTH_SORT habilitado. Rastreie como as linhas são submetidas e ordenadas por profundidade nos caminhos de exportação PDF e SVG e, em seguida, verifique se as linhas sobrepostas seguem sua ordenação de profundidade, enquanto o comportamento existente da esfera permanece inalterado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- java
- Domínio
- computer-graphics
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 35/100