processing / processing/processing4
Depth sorting not working for lines in PDF or SVG export
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 494
- 派生
- 183
- 平均合并
- 4 小时 39 分钟
- 30 天内合并 PR
- 3
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 Ubuntu 22.04 上运行提供的 Processing 4.3 sketch,并在启用 ENABLE_DEPTH_SORT 的情况下比较屏幕、PDF 和 SVG 输出。跟踪线条在 PDF 和 SVG 导出路径中是如何提交并按深度排序的,然后验证重叠线条是否遵循其深度顺序,同时保持现有球体行为不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- computer-graphics
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100