Skip to content

Commit

Permalink
Merge branch 'master' into breaking-0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer authored Nov 23, 2024
2 parents 468555a + 252d40e commit f8e5519
Show file tree
Hide file tree
Showing 16 changed files with 774 additions and 712 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
- Added `MetaMesh` to store non-vertex metadata in a GeometryBasics Mesh object. These are now produced by MeshIO for `.obj` files, containing information from `.mtl` files.
- Renamed `Tesselation/tesselation` to `Tessellation/tessellation` [GeometryBasics#227](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/227) [#4564](https://github.com/MakieOrg/Makie.jl/pull/4564)
- Added `Makie.mesh` option for `MetaMesh` which applies some of the bundled information [#4368](https://github.com/MakieOrg/Makie.jl/pull/4368), [#4496](https://github.com/MakieOrg/Makie.jl/pull/4496)

- `Voronoiplot`s automatic colors are now defined based on the underlying point set instead of only those generators appearing in the tessellation. This makes the selected colors consistent between tessellations when generators might have been deleted or added. [#4357](https://github.com/MakieOrg/Makie.jl/pull/4357)

## [Unreleased]

- `Voronoiplot`s automatic colors are now defined based on the underlying point set instead of only those generators appearing in the tessellation. This makes the selected colors consistent between tessellations when generators might have been deleted or added. [#4357](https://github.com/MakieOrg/Makie.jl/pull/4357)
- Fix uint16 overflow for over ~65k elements in WGLMakie picking [#4604](https://github.com/MakieOrg/Makie.jl/pull/4604).
- Improve performance for line plot in CairoMakie [#4601](https://github.com/MakieOrg/Makie.jl/pull/4601).
- Prevent more default actions when canvas has focus [#4602](https://github.com/MakieOrg/Makie.jl/pull/4602).
- Fix an error in `convert_arguments` for PointBased plots and 3D polygons [#4585](https://github.com/MakieOrg/Makie.jl/pull/4585).
- Fix polygon rendering issue of `crossbar(..., show_notch = true)` in CairoMakie [#4587](https://github.com/MakieOrg/Makie.jl/pull/4587).
Expand Down
389 changes: 188 additions & 201 deletions CairoMakie/src/utils.jl

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions WGLMakie/assets/mesh.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

in vec2 frag_uv;
in vec4 frag_color;

Expand Down Expand Up @@ -100,12 +103,17 @@ vec4 get_color(sampler2D color, vec2 uv, bool colorrange, sampler2D colormap){
}

flat in uint frag_instance_id;

vec2 encode_uint_to_float(uint value) {
float lower = float(value & 0xFFFFu) / 65535.0;
float upper = float(value >> 16u) / 65535.0;
return vec2(lower, upper);
}

vec4 pack_int(uint id, uint index) {
vec4 unpack;
unpack.x = float((id & uint(0xff00)) >> 8) / 255.0;
unpack.y = float((id & uint(0x00ff)) >> 0) / 255.0;
unpack.z = float((index & uint(0xff00)) >> 8) / 255.0;
unpack.w = float((index & uint(0x00ff)) >> 0) / 255.0;
unpack.rg = encode_uint_to_float(id);
unpack.ba = encode_uint_to_float(index);
return unpack;
}

Expand Down Expand Up @@ -143,7 +151,7 @@ void main()
fragment_color = pack_int(object_id, picking_index_from_uv(uniform_color, frag_uv));
} else
fragment_color = pack_int(object_id, frag_instance_id);

return;
}

Expand Down
5 changes: 4 additions & 1 deletion WGLMakie/assets/mesh.vert
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

out vec2 frag_uv;
out vec3 o_normal;
out vec3 o_camdir;
Expand Down Expand Up @@ -69,7 +72,7 @@ void process_clip_planes(vec3 world_pos) {
o_clip_distance[i] = dot(world_pos, clip_planes[i].xyz) - clip_planes[i].w;
}

// TODO: enable
// TODO: enable
// vec2 apply_uv_transform(Nothing t1, vec2 uv){ return uv; }
vec2 apply_uv_transform(mat3 transform, vec2 uv){ return (transform * vec3(uv, 1)).xy; }

Expand Down
5 changes: 3 additions & 2 deletions WGLMakie/assets/particles.vert
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
precision mediump float;
precision highp float;
precision highp int;

uniform mat4 projection;
uniform mat4 view;
Expand Down Expand Up @@ -76,7 +77,7 @@ vec4 vertex_color(float value, vec2 colorrange, sampler2D colormap){
}
}

// TODO: enable
// TODO: enable
// vec2 apply_uv_transform(Nothing t1, vec2 uv){ return uv; }
vec2 apply_uv_transform(mat3 transform, vec2 uv){ return (transform * vec3(uv, 1)).xy; }
// TODO: per element
Expand Down
15 changes: 11 additions & 4 deletions WGLMakie/assets/sprites.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

in vec4 frag_color;
in vec2 frag_uv;

Expand Down Expand Up @@ -92,12 +95,16 @@ float scaled_distancefield(bool distancefield, vec2 uv){
return 0.0;
}

vec2 encode_uint_to_float(uint value) {
float lower = float(value & 0xFFFFu) / 65535.0;
float upper = float(value >> 16u) / 65535.0;
return vec2(lower, upper);
}

vec4 pack_int(uint id, uint index) {
vec4 unpack;
unpack.x = float((id & uint(0xff00)) >> 8) / 255.0;
unpack.y = float((id & uint(0x00ff)) >> 0) / 255.0;
unpack.z = float((index & uint(0xff00)) >> 8) / 255.0;
unpack.w = float((index & uint(0x00ff)) >> 0) / 255.0;
unpack.rg = encode_uint_to_float(id);
unpack.ba = encode_uint_to_float(index);
return unpack;
}

Expand Down
5 changes: 4 additions & 1 deletion WGLMakie/assets/sprites.vert
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

uniform mat4 projection;
uniform mat4 view;
uniform int num_clip_planes;
Expand Down Expand Up @@ -79,7 +82,7 @@ void main(){

vec4 position_world = model * vec4(tovec3(get_pos()), 1);
process_clip_planes(position_world.xyz);

// Compute centre of billboard in clipping coordinates
// Always transform text/scatter position argument
vec4 data_point = get_preprojection() * position_world;
Expand Down
19 changes: 13 additions & 6 deletions WGLMakie/assets/volume.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

struct Nothing{ //Nothing type, to encode if some variable doesn't contain any data
bool _; //empty structs are not allowed
};
Expand Down Expand Up @@ -205,7 +208,7 @@ bool process_clip_planes(inout vec3 p1, inout vec3 p2)
p2 = p1;
return true;
}

// one outside - shorten segment
else if (d1 < 0.0)
// solve 0 = m * t + b = (d2 - d1) * t + d1 with t in (0, 1)
Expand Down Expand Up @@ -245,12 +248,16 @@ float min_bigger_0(vec3 v1, vec3 v2){
return min(x, min(y, z));
}

vec2 encode_uint_to_float(uint value) {
float lower = float(value & 0xFFFFu) / 65535.0;
float upper = float(value >> 16u) / 65535.0;
return vec2(lower, upper);
}

vec4 pack_int(uint id, uint index) {
vec4 unpack;
unpack.x = float((id & uint(0xff00)) >> 8) / 255.0;
unpack.y = float((id & uint(0x00ff)) >> 0) / 255.0;
unpack.z = float((index & uint(0xff00)) >> 8) / 255.0;
unpack.w = float((index & uint(0x00ff)) >> 0) / 255.0;
unpack.rg = encode_uint_to_float(id);
unpack.ba = encode_uint_to_float(index);
return unpack;
}

Expand All @@ -268,7 +275,7 @@ void main()
float solution = min_bigger_0(solution_1, solution_0);

vec3 start = back_position + solution * dir;

// if completely clipped discard this ray tracing attempt
if (process_clip_planes(start, back_position))
discard;
Expand Down
3 changes: 3 additions & 0 deletions WGLMakie/assets/volume.vert
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

out vec3 frag_vert;

uniform mat4 projection, view;
Expand Down
18 changes: 13 additions & 5 deletions WGLMakie/assets/voxel.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
precision highp float;
precision highp int;

// debug FLAGS
// #define DEBUG_RENDER_ORDER 2 // (0, 1, 2) - dimensions

Expand Down Expand Up @@ -100,12 +103,17 @@ bool is_clipped()
}

flat in uint frag_instance_id;

vec2 encode_uint_to_float(uint value) {
float lower = float(value & 0xFFFFu) / 65535.0;
float upper = float(value >> 16u) / 65535.0;
return vec2(lower, upper);
}

vec4 pack_int(uint id, uint index) {
vec4 unpack;
unpack.x = float((id & uint(0xff00)) >> 8) / 255.0;
unpack.y = float((id & uint(0x00ff)) >> 0) / 255.0;
unpack.z = float((index & uint(0xff00)) >> 8) / 255.0;
unpack.w = float((index & uint(0x00ff)) >> 0) / 255.0;
unpack.rg = encode_uint_to_float(id);
unpack.ba = encode_uint_to_float(index);
return unpack;
}

Expand Down Expand Up @@ -151,4 +159,4 @@ void main()
}

fragment_color = voxel_color;
}
}
4 changes: 3 additions & 1 deletion WGLMakie/assets/voxel.vert
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// debug FLAGS
// #define DEBUG_RENDER_ORDER
precision highp float;
precision highp int;

flat out vec3 o_normal;
out vec3 o_uvw;
Expand Down Expand Up @@ -169,4 +171,4 @@ void main() {
// map plane_vertex (-w/2 .. w/2 scale) back to 2d (scaled 0 .. w)
// if the normal is negative invert range (w .. 0)
o_tex_uv = transpose(orientations[dim]) * (vec3(-normal_dir, normal_dir, 1.0) * plane_vertex);
}
}
30 changes: 17 additions & 13 deletions WGLMakie/src/Lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
/// Linessegments
////////////////////////////////////////////////////////////////////////

return `precision mediump int;
precision highp float;
return `precision highp float;
precision highp int;
${attribute_decl}
Expand Down Expand Up @@ -101,7 +101,7 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
p2 = p1;
return;
}
// one outside - shorten segment
else if (d1 < 0.0)
{
Expand Down Expand Up @@ -239,8 +239,8 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
/// Lines
////////////////////////////////////////////////////////////////////////

return `precision mediump int;
precision highp float;
return `precision highp float;
precision highp int;
${attribute_decl}
Expand Down Expand Up @@ -385,7 +385,7 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
// distance from clip planes with negative clipped
d1 = dot(p1.xyz, clip_planes[i].xyz) - clip_planes[i].w * p1.w;
d2 = dot(p2.xyz, clip_planes[i].xyz) - clip_planes[i].w * p2.w;
// both outside - clip everything
if (d1 < 0.0 && d2 < 0.0) {
p2 = p1;
Expand All @@ -404,9 +404,9 @@ function lines_vertex_shader(uniforms, attributes, is_linesegments) {
isvalid[3] = false;
}
}
return;
}
}
////////////////////////////////////////////////////////////////////////
// Main
Expand Down Expand Up @@ -733,7 +733,7 @@ function lines_fragment_shader(uniforms, attributes) {
// uncomment for debug rendering
// #define DEBUG
precision mediump int;
precision highp int;
precision highp float;
precision mediump sampler2D;
precision mediump sampler3D;
Expand Down Expand Up @@ -854,12 +854,16 @@ function lines_fragment_shader(uniforms, attributes) {
return -10.0;
}
vec2 encode_uint_to_float(uint value) {
float lower = float(value & 0xFFFFu) / 65535.0;
float upper = float(value >> 16u) / 65535.0;
return vec2(lower, upper);
}
vec4 pack_int(uint id, uint index) {
vec4 unpack;
unpack.x = float((id & uint(0xff00)) >> 8) / 255.0;
unpack.y = float((id & uint(0x00ff)) >> 0) / 255.0;
unpack.z = float((index & uint(0xff00)) >> 8) / 255.0;
unpack.w = float((index & uint(0x00ff)) >> 0) / 255.0;
unpack.rg = encode_uint_to_float(id);
unpack.ba = encode_uint_to_float(index);
return unpack;
}
Expand Down
Loading

0 comments on commit f8e5519

Please sign in to comment.