lavavu-osmesa 1.9.9__cp313-cp313-manylinux_2_28_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. lavavu/LavaVuPython.py +561 -0
  2. lavavu/_LavaVuPython.cpython-313-x86_64-linux-gnu.so +0 -0
  3. lavavu/__init__.py +15 -0
  4. lavavu/__main__.py +12 -0
  5. lavavu/amalgamate.py +15 -0
  6. lavavu/aserver.py +359 -0
  7. lavavu/control.py +1731 -0
  8. lavavu/convert.py +888 -0
  9. lavavu/dict.json +2528 -0
  10. lavavu/font.bin +0 -0
  11. lavavu/html/LavaVu-amalgamated.css +282 -0
  12. lavavu/html/OK-min.js +99 -0
  13. lavavu/html/baseviewer.js +307 -0
  14. lavavu/html/control.css +104 -0
  15. lavavu/html/control.js +340 -0
  16. lavavu/html/dat-gui-light-theme.css +68 -0
  17. lavavu/html/dat.gui.min.js +2 -0
  18. lavavu/html/draw.js +2259 -0
  19. lavavu/html/drawbox.js +1039 -0
  20. lavavu/html/emscripten-template.js +184 -0
  21. lavavu/html/emscripten.css +92 -0
  22. lavavu/html/favicon.ico +0 -0
  23. lavavu/html/gl-matrix-min.js +47 -0
  24. lavavu/html/gui.css +25 -0
  25. lavavu/html/menu.js +615 -0
  26. lavavu/html/server.js +226 -0
  27. lavavu/html/stats.min.js +5 -0
  28. lavavu/html/styles.css +58 -0
  29. lavavu/html/webview-template.html +43 -0
  30. lavavu/html/webview.html +43 -0
  31. lavavu/lavavu.py +6200 -0
  32. lavavu/osmesa/LavaVuPython.py +561 -0
  33. lavavu/osmesa/_LavaVuPython.cpython-313-x86_64-linux-gnu.so +0 -0
  34. lavavu/osmesa/__init__.py +0 -0
  35. lavavu/points.py +191 -0
  36. lavavu/server.py +343 -0
  37. lavavu/shaders/default.frag +14 -0
  38. lavavu/shaders/default.vert +17 -0
  39. lavavu/shaders/fontShader.frag +20 -0
  40. lavavu/shaders/fontShader.vert +18 -0
  41. lavavu/shaders/lineShader.frag +39 -0
  42. lavavu/shaders/lineShader.vert +26 -0
  43. lavavu/shaders/pointShader.frag +127 -0
  44. lavavu/shaders/pointShader.vert +53 -0
  45. lavavu/shaders/triShader.frag +153 -0
  46. lavavu/shaders/triShader.vert +49 -0
  47. lavavu/shaders/volumeShader.frag +400 -0
  48. lavavu/shaders/volumeShader.vert +5 -0
  49. lavavu/tracers.py +207 -0
  50. lavavu/vutils.py +211 -0
  51. lavavu_osmesa-1.9.9.dist-info/METADATA +323 -0
  52. lavavu_osmesa-1.9.9.dist-info/RECORD +65 -0
  53. lavavu_osmesa-1.9.9.dist-info/WHEEL +5 -0
  54. lavavu_osmesa-1.9.9.dist-info/entry_points.txt +2 -0
  55. lavavu_osmesa-1.9.9.dist-info/licenses/LICENSE.md +179 -0
  56. lavavu_osmesa-1.9.9.dist-info/top_level.txt +1 -0
  57. lavavu_osmesa.libs/libLLVM-17-51492e70.so +0 -0
  58. lavavu_osmesa.libs/libOSMesa-f6a8f160.so.8.0.0 +0 -0
  59. lavavu_osmesa.libs/libdrm-b0291a67.so.2.4.0 +0 -0
  60. lavavu_osmesa.libs/libffi-3a37023a.so.6.0.2 +0 -0
  61. lavavu_osmesa.libs/libglapi-520b284c.so.0.0.0 +0 -0
  62. lavavu_osmesa.libs/libpcre2-8-516f4c9d.so.0.7.1 +0 -0
  63. lavavu_osmesa.libs/libselinux-d0805dcb.so.1 +0 -0
  64. lavavu_osmesa.libs/libtinfo-3a2cb85b.so.6.1 +0 -0
  65. lavavu_osmesa.libs/libzstd-76b78bac.so.1.4.4 +0 -0
@@ -0,0 +1,127 @@
1
+ uniform int uPointType;
2
+ uniform float uOpacity;
3
+ uniform float uBrightness;
4
+ uniform float uContrast;
5
+ uniform float uSaturation;
6
+ uniform float uAmbient;
7
+ uniform float uDiffuse;
8
+ uniform float uSpecular;
9
+ uniform bool uOpaque;
10
+ uniform bool uTextured;
11
+ uniform sampler2D uTexture;
12
+ uniform vec3 uClipMin;
13
+ uniform vec3 uClipMax;
14
+ uniform vec3 uLightPos;
15
+
16
+ in vec4 vColour;
17
+ in vec3 vVertex;
18
+ in vec2 vTexCoord;
19
+ in float vPointSize;
20
+ in vec3 vPosEye;
21
+ in float vPointType;
22
+
23
+ out vec4 outColour;
24
+
25
+ void calcColour(vec3 colour, float alpha)
26
+ {
27
+ //Brightness adjust
28
+ colour += uBrightness;
29
+ //Saturation & Contrast adjust
30
+ const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
31
+ vec3 AvgLumin = vec3(0.5, 0.5, 0.5);
32
+ vec3 intensity = vec3(dot(colour, LumCoeff));
33
+ colour = mix(intensity, colour, uSaturation);
34
+ colour = mix(AvgLumin, colour, uContrast);
35
+
36
+ if (uOpaque)
37
+ alpha = 1.0;
38
+
39
+ outColour = vec4(colour, alpha);
40
+ }
41
+
42
+ void main(void)
43
+ {
44
+ //Clip planes in X/Y/Z
45
+ if (any(lessThan(vVertex, uClipMin)) || any(greaterThan(vVertex, uClipMax))) discard;
46
+
47
+ float alpha = vColour.a;
48
+ if (uOpacity > 0.0) alpha *= uOpacity;
49
+ outColour = vColour;
50
+
51
+ int pointType = uPointType;
52
+ if (vPointType >= 0.0) pointType = int(floor(vPointType + 0.5)); //Round back to nearest int
53
+
54
+ //Textured?
55
+ if (uTextured && vTexCoord.y >= 0.0)
56
+ {
57
+ vec4 tColour;
58
+ if (vTexCoord.x < 0.0)
59
+ tColour = texture(uTexture, gl_PointCoord); //Point sprite mode
60
+ else
61
+ tColour = texture(uTexture, vTexCoord);
62
+
63
+ //Blend with colour
64
+ outColour = mix(tColour, outColour, 1.0-tColour.a);
65
+ alpha = outColour.a;
66
+ }
67
+
68
+ //Flat, square points, fastest, skip lighting
69
+ if (pointType == 4)
70
+ {
71
+ calcColour(outColour.rgb, alpha);
72
+ return;
73
+ }
74
+
75
+ //Circular points...
76
+ //Calculate normal from point/tex coordinates
77
+ vec3 N;
78
+ N.xy = gl_PointCoord * 2.0 - vec2(1.0);
79
+ float R = dot(N.xy, N.xy);
80
+ //Discard if outside circle
81
+ if (R > 1.0) discard;
82
+ //Anti-aliased edges for sphere types
83
+ if (pointType > 1)
84
+ {
85
+ float edge = vPointSize - R * vPointSize;
86
+ if (edge <= 4.0)
87
+ alpha *= (0.25 * edge);
88
+ }
89
+
90
+ //Discard if transparent (outside circle)
91
+ if (alpha < 0.01) discard;
92
+
93
+ if (pointType < 2)
94
+ {
95
+ //Circular with no light/shading, just blur
96
+ if (pointType == 0)
97
+ alpha *= 1.0-sqrt(R); //Gaussian
98
+ else //TODO: allow disable blur for circular points
99
+ alpha *= 1.0-R; //Linear
100
+
101
+ calcColour(outColour.rgb, alpha);
102
+ return;
103
+ }
104
+
105
+ //Calculate diffuse lighting component
106
+ N.z = sqrt(1.0-R);
107
+ float diffuse = 1.0;
108
+ vec3 lightDir = normalize(uLightPos - vPosEye);
109
+ diffuse = max(0.0, dot(lightDir, N));
110
+
111
+ //Calculate specular lighting component
112
+ if (pointType == 3 && diffuse > 0.0)
113
+ {
114
+ vec3 specular = vec3(0.0,0.0,0.0);
115
+ float shininess = 200.0; //Size of highlight
116
+ vec3 specolour = vec3(1.0, 1.0, 1.0); //Color of light
117
+ //Normalize the half-vector
118
+ //vec3 halfVector = normalize(vPosEye + lightDir);
119
+ vec3 halfVector = normalize(vec3(0.0, 0.0, 1.0) + lightDir);
120
+ //Compute cosine (dot product) with the normal
121
+ float NdotHV = max(dot(N, halfVector), 0.0);
122
+ specular = specolour * pow(NdotHV, shininess);
123
+ calcColour(outColour.rgb * diffuse + specular, alpha);
124
+ }
125
+ else
126
+ calcColour(outColour.rgb * diffuse, alpha);
127
+ }
@@ -0,0 +1,53 @@
1
+ in vec3 aVertexPosition;
2
+ in vec4 aVertexColour;
3
+ in vec2 aVertexTexCoord;
4
+
5
+ uniform mat4 uMVMatrix;
6
+ uniform mat4 uPMatrix;
7
+
8
+ out vec4 vColour;
9
+
10
+ uniform int uPointDist; // Scale by distance
11
+
12
+ in float aSize;
13
+ in float aPointType;
14
+
15
+ uniform float uPointScale; // scale to calculate size in pixels
16
+
17
+ uniform vec4 uColour;
18
+ uniform float uOpacity;
19
+
20
+ out vec3 vVertex;
21
+ out vec2 vTexCoord;
22
+ out float vPointSize;
23
+ out vec3 vPosEye;
24
+ out float vPointType;
25
+
26
+ void main(void)
27
+ {
28
+ float pSize = abs(aSize);
29
+
30
+ // calculate window-space point size
31
+ vec4 mvPosition = uMVMatrix * vec4(aVertexPosition, 1.0);
32
+ vec3 posEye = mvPosition.xyz;
33
+ float dist = 1.0;
34
+ if (uPointDist > 0)
35
+ dist = length(posEye);
36
+ //Limit scaling, overly large points are very slow to render
37
+ //gl_PointSize = max(1.0, min(40.0, uPointScale * pSize / dist));
38
+
39
+ gl_PointSize = uPointScale * pSize / dist;
40
+ gl_Position = uPMatrix * mvPosition;
41
+
42
+ vPosEye = posEye;
43
+ vPointType = aPointType;
44
+ vPointSize = gl_PointSize;
45
+ vVertex = aVertexPosition.xyz;
46
+ vTexCoord = aVertexTexCoord;
47
+
48
+ if (uColour.a > 0.0)
49
+ vColour = uColour;
50
+ else
51
+ vColour = vec4(aVertexColour.rgb, aVertexColour.a);
52
+ }
53
+
@@ -0,0 +1,153 @@
1
+ in vec4 vColour;
2
+ in vec3 vNormal;
3
+ in vec3 vPosEye;
4
+ in vec3 vVertex;
5
+ in vec2 vTexCoord;
6
+ in vec3 vLightPos;
7
+
8
+ uniform float uOpacity;
9
+ uniform bool uLighting;
10
+ uniform float uBrightness;
11
+ uniform float uContrast;
12
+ uniform float uSaturation;
13
+ uniform float uAmbient;
14
+ uniform float uDiffuse;
15
+ uniform float uSpecular;
16
+ uniform float uShininess;
17
+
18
+ uniform bool uTextured;
19
+ uniform sampler2D uTexture;
20
+ uniform vec3 uClipMin;
21
+ uniform vec3 uClipMax;
22
+ uniform bool uOpaque;
23
+ uniform vec4 uLight;
24
+
25
+ #define isnan3(v) any(isnan(v))
26
+ flat in vec4 vFlatColour;
27
+ uniform bool uFlat;
28
+ out vec4 outColour;
29
+
30
+ uniform bool uCalcNormal;
31
+
32
+ void calcColour(vec3 colour, float alpha)
33
+ {
34
+ //Brightness adjust
35
+ colour += uBrightness;
36
+ //Saturation & Contrast adjust
37
+ const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
38
+ vec3 AvgLumin = vec3(0.5, 0.5, 0.5);
39
+ vec3 intensity = vec3(dot(colour, LumCoeff));
40
+ colour = mix(intensity, colour, uSaturation);
41
+ colour = mix(AvgLumin, colour, uContrast);
42
+
43
+ //Gamma correction
44
+ //https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_reflection_model#OpenGL_Shading_Language_code_sample
45
+ //const float screenGamma = 2.2; // Assume the monitor is calibrated to the sRGB color space
46
+ //vec3 colorGammaCorrected = pow(color, vec3(1.0 / screenGamma));
47
+
48
+ outColour = vec4(colour, alpha);
49
+ }
50
+
51
+ void main(void)
52
+ {
53
+ //Clip planes in X/Y/Z
54
+ if (any(lessThan(vVertex, uClipMin)) || any(greaterThan(vVertex, uClipMax))) discard;
55
+
56
+ vec4 fColour = vColour;
57
+ if (uFlat)
58
+ fColour = vFlatColour;
59
+ float alpha = fColour.a;
60
+ if (uTextured && vTexCoord.x > -1.0) //Null texcoord (-1,-1)
61
+ {
62
+ //With this blending mode, texture is blended over base colour,
63
+ //and colour opacity has no effect on texture opacity
64
+ //All desired texture opacity must be built in to the texture data
65
+ //(Could add another blend mode if we want a dynamic texture opacity)
66
+ vec4 tColour = texture(uTexture, vTexCoord);
67
+ if (fColour.a > 0.01)
68
+ {
69
+ //Additive blend alpha channel
70
+ alpha = fColour.a + tColour.a * (1.0 - fColour.a);
71
+
72
+ //Blend the texure colour with the fragment colour using texture alpha
73
+ fColour.rgb = vec3(mix(fColour.rgb, tColour.rgb, tColour.a));
74
+ }
75
+ else
76
+ {
77
+ //Disable all blending if the base colour opacity <= 0.01
78
+ fColour = tColour;
79
+ alpha = tColour.a;
80
+ }
81
+ }
82
+
83
+ if (uOpacity > 0.0) alpha *= uOpacity;
84
+ if (uOpaque) alpha = 1.0;
85
+ if (alpha < 0.01) discard;
86
+
87
+ if (!uLighting)
88
+ {
89
+ calcColour(fColour.rgb, alpha);
90
+ return;
91
+ }
92
+
93
+ vec3 lightColour = uLight.xyz;
94
+
95
+ //Light direction
96
+ vec3 lightDir = normalize(vLightPos - vPosEye);
97
+
98
+ //Calculate diffuse lighting
99
+ vec3 N = normalize(vNormal);
100
+
101
+ //Default normal...
102
+ if (uCalcNormal || dot(N,N) < 0.01 || isnan3(N))
103
+ {
104
+ //Requires extension in WebGL: OES_standard_derivatives
105
+ vec3 fdx = vec3(dFdx(vPosEye.x),dFdx(vPosEye.y),dFdx(vPosEye.z));
106
+ vec3 fdy = vec3(dFdy(vPosEye.x),dFdy(vPosEye.y),dFdy(vPosEye.z));
107
+ N = normalize(cross(fdx,fdy));
108
+ }
109
+
110
+ //Modified to use energy conservation adjustment
111
+ //https://learnopengl.com/Advanced-Lighting/Advanced-Lighting
112
+ const float kPi8 = 3.14159265 * 8.0;
113
+
114
+ //Calculate diffuse component
115
+ //Single side or two-sided lighting with abs()?
116
+ float diffuse = dot(N, lightDir);
117
+ if (uLight.w < 0.5)
118
+ diffuse = abs(diffuse);
119
+ else
120
+ diffuse = max(diffuse, 0.0);
121
+
122
+ //Compute the specular term
123
+ if (diffuse > 0.0 && uSpecular > 0.0)
124
+ {
125
+ //Specular power, higher is more focused/shiny
126
+ float shininess = 256.0 * clamp(uShininess, 0.0, 1.0);
127
+ vec3 specolour = lightColour; //Color of light - use the same as diffuse/ambient
128
+ //Blinn-Phong
129
+ vec3 viewDir = normalize(-vPosEye);
130
+ //Normalize the half-vector
131
+ vec3 halfVector = normalize(lightDir + viewDir);
132
+
133
+ //Compute cosine (dot product) with the normal
134
+ float NdotHV = dot(N, halfVector);
135
+ //Single side or two-sided lighting with abs()?
136
+ if (uLight.w < 0.5)
137
+ NdotHV = abs(NdotHV);
138
+ else
139
+ NdotHV = max(NdotHV, 0.0);
140
+
141
+ //Energy conservation adjustment (more focused/shiny highlight will be brighter)
142
+ float energyConservation = ( 8.0 + shininess) / kPi8;
143
+ //Multiplying specular by diffuse prevents bands at edges for low shininess
144
+ float spec = diffuse * uSpecular * energyConservation * pow(NdotHV, shininess);
145
+
146
+ //Final colour - specular + diffuse + ambient
147
+ calcColour(lightColour * (fColour.rgb * (uAmbient + uDiffuse * diffuse) + vec3(spec)), alpha);
148
+ }
149
+ else
150
+ //Final colour - diffuse + ambient only
151
+ calcColour(lightColour * fColour.rgb * (uAmbient + diffuse * uDiffuse), alpha);
152
+ }
153
+
@@ -0,0 +1,49 @@
1
+ in vec3 aVertexPosition;
2
+ in vec3 aVertexNormal;
3
+ in vec4 aVertexColour;
4
+ in vec2 aVertexTexCoord;
5
+ flat out vec4 vFlatColour;
6
+
7
+ uniform mat4 uMVMatrix;
8
+ uniform mat4 uPMatrix;
9
+ uniform mat4 uNMatrix;
10
+
11
+ uniform vec4 uLightPos;
12
+
13
+ out vec4 vColour;
14
+ out vec3 vNormal;
15
+ out vec3 vPosEye;
16
+ out vec2 vTexCoord;
17
+ out vec3 vVertex;
18
+ out vec3 vLightPos;
19
+
20
+ void main(void)
21
+ {
22
+ vec4 mvPosition = uMVMatrix * vec4(aVertexPosition, 1.0);
23
+ vPosEye = vec3(mvPosition) / mvPosition.w;
24
+ gl_Position = uPMatrix * mvPosition;
25
+
26
+ vNormal = normalize(mat3(uNMatrix) * aVertexNormal);
27
+
28
+ //This shader only applies attribute colour
29
+ //uColour is set for other/custom shaders
30
+ //Note uOpacity is "alpha" prop, "oapcity" is passed via attrib
31
+ vColour = aVertexColour;
32
+ vTexCoord = aVertexTexCoord;
33
+ vFlatColour = vColour;
34
+ vVertex = aVertexPosition;
35
+
36
+ //Head light, lightPos=(0,0,0) - vPosEye
37
+ //vec3 lightDir = normalize(uLightPos.xyz - vPosEye);
38
+ if (uLightPos.w < 0.5)
39
+ {
40
+ //Light follows camera - default mode
41
+ vLightPos = uLightPos.xyz;
42
+ }
43
+ else
44
+ {
45
+ //Fixed Scene Light, when lightpos.w set to 1.0
46
+ vLightPos = (uMVMatrix * vec4(uLightPos.xyz, 1.0)).xyz;
47
+ }
48
+ }
49
+