processing / processing/processing4
Depth sorting not working for lines in PDF or SVG export
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 494
- Fork
- 183
- Merge trung bình
- 4 giờ 39 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách chạy sketch Processing 4.3 được cung cấp trên Ubuntu 22.04 và so sánh đầu ra trên màn hình, PDF và SVG khi ENABLE_DEPTH_SORT được bật. Theo dõi cách các đường được gửi và sắp xếp theo độ sâu trong các đường dẫn xuất PDF và SVG, sau đó xác minh rằng các đường chồng lấp tuân theo thứ tự độ sâu của chúng trong khi hành vi hiện tại của hình cầu vẫn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- computer-graphics
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 35/100