0.7.0 - 0.7.1¶
In GSOC 2020 two releases were published. The goals of the project were:
- Standardize p5py API so it’s as close as possible to that of the Processing Language (Java Mode) while being reasonably pythonic (e.g. supporting some python-only features and syntax)
- Explore moving tessellation of shapes to OpenGL for improved performance
- Improve 3D support
We met all of these goals completely. In addition, the following stretch goals were completed:
- Implement a profiling harness to measure performance improvements
- Fix existing bugs
We are happy to announce another developmental release from Google Summer of Code! The project was supervised by Arihant Parsoya and Abhik Pal of the Processing Foundation. This release includes bug fixes, a refactored rendering pipeline with improved performance, new 3D capabilities, and new example code.
List of New APIs¶
New materials in P3D¶
normal_materialassigns a color to a pixel solely based on the normal vector of the fragment being rendered. Useful for debugging
basic_materialreturns a uniform color.
blinn_phong_materialis a material based on the Blinn-Phong reflection model. This is the most “realistic” material in p5py. Parameters to adjust it include
Lighting system in P3D¶
lightscreates default lights
ambient_lightis a light that’s uniform everywhere
directional_lightcomes from one direction: it is stronger when hitting a surface squarely, and weaker if it hits at a gentle angle.
point_lightcomes from one location and emits to all directions.
light_specularcontrols the color of the specular highlight
light_falloffcontrols how fast a light fades with distance
This release also includes contributions from @parsoyaarihant, @jeremydouglass, @tushar5526, @Hansimov, @ReneTC, @Andy-Python-Programmer, and @galaxyproduction. Thank you!
We are happy to announce another developmental release from Google Summer of Code! The project was supervised by Arihant Parsoya and Abhik Pal of the Processing Foundation. This is the final release for GSOC this year and includes API refactors, addtions, and bug fixes with compatibility and stability as a focus.
List of New APIs¶
- fract calculates the fractional part of a number. Contributed by @tushar5526
http_postmakes HTTP requests to the web. Contrbuted by @nakul-shahdadpuri
pop_styleare alternatives to the context manager syntax used by previous version. Accordingly,
push_matrixand pop_matrix can now both act as context managers and be directly called like in Processing or p5.js
The following additional signatures are added for compatibility with other Processing dialects
- line(x1, y1, x2, y2)
- line(x1, y1, z1, x2, y2, z2)
- ellipse(a, b, c, d, mode=None)
- circle(x, y, radius, mode=None)
- arc(x, y, width, height, start_angle, stop_angle, mode=None, ellipse_mode=None)
- image(img, x, y)
- image(img, x, y, w, h)
- triangle(x1, y1, x2, y2, x3, y3)
- quad(x1, y1, x2, y2, x3, y3, x4, y4)
- rect(x, y, w, h)
- square(x, y, side_length)
- bezier(x1, y1, x2, y2, x3, y3, x4, y4)
- bezier(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
- curve(x1, y1, x2, y2, x3, y3, x4, y4)
- curve(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
- camera(position_x, position_y, position_z, target_x, target_y, target_z, up_x, up_y, up_z)
- camera(position, target_position, up_vector)
- text(text_string, x, y)
- text(text_string, x, y, z)
The following functions can now take floats and tuples of arbitrary length
This release also includes contributions from @nakul-shahdadpuri, @tushar5526, and @parsoyaarihant. Thank you!