hyperstellar 1.5.6__py3-none-win_amd64.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.
- hyperstellar/__init__.py +299 -0
- hyperstellar/__init__.pyi +1019 -0
- hyperstellar/_native/linux-x64/shaders/axis.frag +8 -0
- hyperstellar/_native/linux-x64/shaders/axis.vert +13 -0
- hyperstellar/_native/linux-x64/shaders/fragShader.frag +27 -0
- hyperstellar/_native/linux-x64/shaders/geoShader.geom +69 -0
- hyperstellar/_native/linux-x64/shaders/math.comp +2177 -0
- hyperstellar/_native/linux-x64/shaders/paint.comp +1214 -0
- hyperstellar/_native/linux-x64/shaders/quad.frag +26 -0
- hyperstellar/_native/linux-x64/shaders/quad.geom +149 -0
- hyperstellar/_native/linux-x64/shaders/quad.vert +39 -0
- hyperstellar/_native/linux-x64/shaders/vertexShader.vert +13 -0
- hyperstellar/_native/linux-x64/stellar.so +0 -0
- hyperstellar/_native/windows-x64/shaders/axis.frag +8 -0
- hyperstellar/_native/windows-x64/shaders/axis.vert +13 -0
- hyperstellar/_native/windows-x64/shaders/fragShader.frag +27 -0
- hyperstellar/_native/windows-x64/shaders/geoShader.geom +69 -0
- hyperstellar/_native/windows-x64/shaders/math.comp +2177 -0
- hyperstellar/_native/windows-x64/shaders/paint.comp +1214 -0
- hyperstellar/_native/windows-x64/shaders/quad.frag +26 -0
- hyperstellar/_native/windows-x64/shaders/quad.geom +149 -0
- hyperstellar/_native/windows-x64/shaders/quad.vert +39 -0
- hyperstellar/_native/windows-x64/shaders/vertexShader.vert +13 -0
- hyperstellar/_native/windows-x64/stellar.pyd +0 -0
- hyperstellar/debug.py +169 -0
- hyperstellar/jit.py +2010 -0
- hyperstellar/jit_linter.py +3 -0
- hyperstellar/py.typed +0 -0
- hyperstellar/shader.py +1356 -0
- hyperstellar/typed.py +152 -0
- hyperstellar-1.5.6.dist-info/METADATA +470 -0
- hyperstellar-1.5.6.dist-info/RECORD +35 -0
- hyperstellar-1.5.6.dist-info/WHEEL +5 -0
- hyperstellar-1.5.6.dist-info/licenses/LICENSE +24 -0
- hyperstellar-1.5.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
|
|
3
|
+
in vec2 fragTexCoord;
|
|
4
|
+
in vec4 fragColor;
|
|
5
|
+
in float fragSpeed;
|
|
6
|
+
|
|
7
|
+
out vec4 FragColor;
|
|
8
|
+
|
|
9
|
+
void main() {
|
|
10
|
+
// Circle if texcoord is non-zero (from circle emission)
|
|
11
|
+
bool isCircle = fragTexCoord != vec2(0.0);
|
|
12
|
+
|
|
13
|
+
if (isCircle) {
|
|
14
|
+
float dist = length(fragTexCoord);
|
|
15
|
+
|
|
16
|
+
// HARD EDGE: Discard everything outside the exact circle boundary
|
|
17
|
+
if (dist > 1.0) discard;
|
|
18
|
+
|
|
19
|
+
// No smoothstep - just use the original color with full opacity
|
|
20
|
+
FragColor = fragColor;
|
|
21
|
+
|
|
22
|
+
} else {
|
|
23
|
+
// Rectangle & polygon (texcoord = 0) - use color as-is
|
|
24
|
+
FragColor = fragColor;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
|
|
3
|
+
layout(points) in;
|
|
4
|
+
layout(triangle_strip, max_vertices = 64) out;
|
|
5
|
+
|
|
6
|
+
in vec2 vPosition[];
|
|
7
|
+
in vec2 vVelocity[];
|
|
8
|
+
in float vMass[];
|
|
9
|
+
in float vCharge[];
|
|
10
|
+
in int vVisualSkinType[];
|
|
11
|
+
in vec4 vVisualData[]; // x=rotation, y=angular_vel, z=width/radius, w=height/sides
|
|
12
|
+
in vec4 vColor[];
|
|
13
|
+
|
|
14
|
+
out vec2 fragTexCoord;
|
|
15
|
+
out vec4 fragColor;
|
|
16
|
+
out float fragSpeed;
|
|
17
|
+
|
|
18
|
+
uniform mat4 uProjection;
|
|
19
|
+
uniform mat4 uView;
|
|
20
|
+
|
|
21
|
+
const int SKIN_CIRCLE = 0;
|
|
22
|
+
const int SKIN_RECTANGLE = 1;
|
|
23
|
+
const int SKIN_POLYGON = 2;
|
|
24
|
+
const float PI = 3.14159265359;
|
|
25
|
+
|
|
26
|
+
void emitCircle(vec2 center, float radius, vec4 color, float speed) {
|
|
27
|
+
mat4 MVP = uProjection * uView;
|
|
28
|
+
|
|
29
|
+
// Bottom-left
|
|
30
|
+
gl_Position = MVP * vec4(center + vec2(-radius, -radius), 0.0, 1.0);
|
|
31
|
+
fragTexCoord = vec2(-1.0, -1.0);
|
|
32
|
+
fragColor = color;
|
|
33
|
+
fragSpeed = speed;
|
|
34
|
+
EmitVertex();
|
|
35
|
+
|
|
36
|
+
// Top-left
|
|
37
|
+
gl_Position = MVP * vec4(center + vec2(-radius, radius), 0.0, 1.0);
|
|
38
|
+
fragTexCoord = vec2(-1.0, 1.0);
|
|
39
|
+
fragColor = color;
|
|
40
|
+
fragSpeed = speed;
|
|
41
|
+
EmitVertex();
|
|
42
|
+
|
|
43
|
+
// Bottom-right
|
|
44
|
+
gl_Position = MVP * vec4(center + vec2(radius, -radius), 0.0, 1.0);
|
|
45
|
+
fragTexCoord = vec2(1.0, -1.0);
|
|
46
|
+
fragColor = color;
|
|
47
|
+
fragSpeed = speed;
|
|
48
|
+
EmitVertex();
|
|
49
|
+
|
|
50
|
+
// Top-right
|
|
51
|
+
gl_Position = MVP * vec4(center + vec2(radius, radius), 0.0, 1.0);
|
|
52
|
+
fragTexCoord = vec2(1.0, 1.0);
|
|
53
|
+
fragColor = color;
|
|
54
|
+
fragSpeed = speed;
|
|
55
|
+
EmitVertex();
|
|
56
|
+
|
|
57
|
+
EndPrimitive();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
void emitRectangle(vec2 center, float width, float height, float rotation, vec4 color, float speed) {
|
|
61
|
+
mat4 MVP = uProjection * uView;
|
|
62
|
+
|
|
63
|
+
float cosR = cos(rotation);
|
|
64
|
+
float sinR = sin(rotation);
|
|
65
|
+
float hw = width * 0.5;
|
|
66
|
+
float hh = height * 0.5;
|
|
67
|
+
|
|
68
|
+
vec2 corners[4];
|
|
69
|
+
corners[0] = vec2(-hw, -hh);
|
|
70
|
+
corners[1] = vec2( hw, -hh);
|
|
71
|
+
corners[2] = vec2(-hw, hh);
|
|
72
|
+
corners[3] = vec2( hw, hh);
|
|
73
|
+
|
|
74
|
+
for (int i = 0; i < 4; i++) {
|
|
75
|
+
vec2 rotated = vec2(
|
|
76
|
+
corners[i].x * cosR - corners[i].y * sinR,
|
|
77
|
+
corners[i].x * sinR + corners[i].y * cosR
|
|
78
|
+
);
|
|
79
|
+
gl_Position = MVP * vec4(center + rotated, 0.0, 1.0);
|
|
80
|
+
fragTexCoord = vec2(0.0);
|
|
81
|
+
fragColor = color;
|
|
82
|
+
fragSpeed = speed;
|
|
83
|
+
EmitVertex();
|
|
84
|
+
}
|
|
85
|
+
EndPrimitive();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void emitPolygon(vec2 center, float radius, int numSides, float rotation, vec4 color, float speed) {
|
|
89
|
+
mat4 MVP = uProjection * uView;
|
|
90
|
+
numSides = clamp(numSides, 3, 20);
|
|
91
|
+
|
|
92
|
+
vec2 pts[21];
|
|
93
|
+
for (int i = 0; i < numSides; i++) {
|
|
94
|
+
float angle = rotation + (2.0 * PI * float(i) / float(numSides));
|
|
95
|
+
pts[i] = center + vec2(cos(angle), sin(angle)) * radius;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (int i = 0; i < numSides; i++) {
|
|
99
|
+
gl_Position = MVP * vec4(pts[i], 0.0, 1.0);
|
|
100
|
+
fragColor = color;
|
|
101
|
+
fragSpeed = speed;
|
|
102
|
+
fragTexCoord = vec2(0.0);
|
|
103
|
+
EmitVertex();
|
|
104
|
+
|
|
105
|
+
gl_Position = MVP * vec4(center, 0.0, 1.0);
|
|
106
|
+
fragColor = color;
|
|
107
|
+
fragSpeed = speed;
|
|
108
|
+
fragTexCoord = vec2(0.0);
|
|
109
|
+
EmitVertex();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
gl_Position = MVP * vec4(pts[0], 0.0, 1.0);
|
|
113
|
+
fragColor = color;
|
|
114
|
+
fragSpeed = speed;
|
|
115
|
+
fragTexCoord = vec2(0.0);
|
|
116
|
+
EmitVertex();
|
|
117
|
+
|
|
118
|
+
EndPrimitive();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
void main() {
|
|
122
|
+
vec2 pos = vPosition[0];
|
|
123
|
+
vec2 vel = vVelocity[0];
|
|
124
|
+
float speed = length(vel);
|
|
125
|
+
int skinType = vVisualSkinType[0];
|
|
126
|
+
|
|
127
|
+
//LAYOUT: width/height in x/y, rotation/angular_vel in z/w
|
|
128
|
+
float param_x = vVisualData[0].x; // width or radius
|
|
129
|
+
float param_y = vVisualData[0].y; // height or numSides
|
|
130
|
+
float rotation = vVisualData[0].z; // ROTATION NOW IN Z
|
|
131
|
+
float angular_vel = vVisualData[0].w; // ANGULAR_VEL NOW IN W
|
|
132
|
+
|
|
133
|
+
vec4 color = vColor[0];
|
|
134
|
+
|
|
135
|
+
if (skinType == SKIN_CIRCLE) {
|
|
136
|
+
float radius = param_x;
|
|
137
|
+
emitCircle(pos, radius, color, speed);
|
|
138
|
+
}
|
|
139
|
+
else if (skinType == SKIN_RECTANGLE) {
|
|
140
|
+
float width = param_x;
|
|
141
|
+
float height = param_y;
|
|
142
|
+
emitRectangle(pos, width, height, rotation, color, speed);
|
|
143
|
+
}
|
|
144
|
+
else if (skinType == SKIN_POLYGON) {
|
|
145
|
+
float radius = param_x;
|
|
146
|
+
int numSides = int(param_y);
|
|
147
|
+
emitPolygon(pos, radius, numSides, rotation, color, speed);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
|
|
3
|
+
// These should match VAO setup from objects.cpp
|
|
4
|
+
layout(location = 0) in vec2 aPosition;
|
|
5
|
+
layout(location = 1) in vec2 aVelocity;
|
|
6
|
+
layout(location = 2) in float aMass;
|
|
7
|
+
layout(location = 3) in float aCharge;
|
|
8
|
+
layout(location = 4) in int aVisualSkinType;
|
|
9
|
+
layout(location = 5) in vec4 aVisualData;
|
|
10
|
+
layout(location = 6) in vec4 aColor;
|
|
11
|
+
layout(location = 7) in int aEquationID;
|
|
12
|
+
|
|
13
|
+
out vec2 vPosition;
|
|
14
|
+
out vec2 vVelocity;
|
|
15
|
+
out float vMass;
|
|
16
|
+
out float vCharge;
|
|
17
|
+
out int vVisualSkinType;
|
|
18
|
+
out vec4 vVisualData;
|
|
19
|
+
out vec4 vColor;
|
|
20
|
+
//Add rotation and angular velocity as separate outputs if needed
|
|
21
|
+
out float vRotation;
|
|
22
|
+
out float vAngularVelocity;
|
|
23
|
+
|
|
24
|
+
void main() {
|
|
25
|
+
vPosition = aPosition;
|
|
26
|
+
vVelocity = aVelocity;
|
|
27
|
+
vMass = aMass;
|
|
28
|
+
vCharge = aCharge;
|
|
29
|
+
vVisualSkinType = aVisualSkinType;
|
|
30
|
+
vVisualData = aVisualData;
|
|
31
|
+
vColor = aColor;
|
|
32
|
+
|
|
33
|
+
// Extract rotation and angular velocity from visualData
|
|
34
|
+
vRotation = aVisualData.x;
|
|
35
|
+
vAngularVelocity = aVisualData.y;
|
|
36
|
+
|
|
37
|
+
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
38
|
+
gl_PointSize = 10.0; // For point rendering fallback
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
layout(location = 0) in vec2 basePos;
|
|
3
|
+
uniform vec2 chargePos = vec2(0.0, 0.0);
|
|
4
|
+
uniform mat4 projection;
|
|
5
|
+
out vec2 v_basePos;
|
|
6
|
+
out vec2 v_chargePos;
|
|
7
|
+
void main()
|
|
8
|
+
{
|
|
9
|
+
vec4 hi = projection * vec4(basePos, 0.0, 1.0);
|
|
10
|
+
gl_Position = vec4(basePos, 0.0, 1.0);
|
|
11
|
+
v_basePos = basePos;
|
|
12
|
+
v_chargePos = chargePos;
|
|
13
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
layout (location = 0) in vec2 aPos;
|
|
3
|
+
layout (location = 1) in vec3 aColor;
|
|
4
|
+
layout (location = 2) in float aWidth;
|
|
5
|
+
|
|
6
|
+
uniform mat4 uProjView;
|
|
7
|
+
|
|
8
|
+
out vec3 color;
|
|
9
|
+
|
|
10
|
+
void main() {
|
|
11
|
+
gl_Position = uProjView * vec4(aPos, 0.0, 1.0);
|
|
12
|
+
color = aColor; // Pass color to fragment shader
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
|
|
3
|
+
in float magnitude;
|
|
4
|
+
in float chargeInfluence;
|
|
5
|
+
|
|
6
|
+
out vec4 FragColor;
|
|
7
|
+
|
|
8
|
+
void main() {
|
|
9
|
+
vec3 lowMagnitudeColor = vec3(0.0, 0.5, 1.0); // A vibrant blue
|
|
10
|
+
vec3 midMagnitudeColor = vec3(1.0, 1.0, 0.0); // A pure green
|
|
11
|
+
vec3 highMagnitudeColor = vec3(1.0, 0.5, 0.0); // An intense orange
|
|
12
|
+
|
|
13
|
+
float normalizedMagnitude = clamp(pow(magnitude, .9) * .1, 0.0, 1.0);
|
|
14
|
+
|
|
15
|
+
vec3 finalColor;
|
|
16
|
+
|
|
17
|
+
if (normalizedMagnitude <= 0.5) {
|
|
18
|
+
float t = normalizedMagnitude * 2.0;
|
|
19
|
+
finalColor = mix(lowMagnitudeColor, midMagnitudeColor, t);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
float t = (normalizedMagnitude - 0.5) * 2.0;
|
|
23
|
+
finalColor = mix(midMagnitudeColor, highMagnitudeColor, t);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
FragColor = vec4(finalColor, 1.0);
|
|
27
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#version 430 core
|
|
2
|
+
|
|
3
|
+
layout (points) in;
|
|
4
|
+
layout (line_strip, max_vertices = 5) out;
|
|
5
|
+
|
|
6
|
+
in vec2 v_basePos[]; // from vertex shader
|
|
7
|
+
uniform mat4 projection;
|
|
8
|
+
|
|
9
|
+
// Object data from C++
|
|
10
|
+
uniform int numCharges;
|
|
11
|
+
uniform vec2 objectPositions[200];
|
|
12
|
+
uniform float objectCharges[200];
|
|
13
|
+
|
|
14
|
+
out float magnitude;
|
|
15
|
+
out float chargeInfluence;
|
|
16
|
+
|
|
17
|
+
void main() {
|
|
18
|
+
vec2 basePos = v_basePos[0];
|
|
19
|
+
|
|
20
|
+
// Compute superposed electric field vector and charge influence
|
|
21
|
+
vec2 totalField = vec2(0.0);
|
|
22
|
+
chargeInfluence = 0.0;
|
|
23
|
+
|
|
24
|
+
for (int i = 0; i < numCharges; i++) {
|
|
25
|
+
vec2 r = basePos - objectPositions[i];
|
|
26
|
+
float d = length(r) + 1e-4; // Avoid division by zero
|
|
27
|
+
float inverseSquare = 1.0 / (d * d);
|
|
28
|
+
|
|
29
|
+
// Apply negative charge to flip the direction
|
|
30
|
+
totalField += -objectCharges[i] * normalize(r) * inverseSquare;
|
|
31
|
+
chargeInfluence += objectCharges[i] * inverseSquare;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
magnitude = length(totalField);
|
|
35
|
+
vec2 dir = (magnitude > 0.0) ? normalize(totalField) : vec2(0.0, 0.0);
|
|
36
|
+
|
|
37
|
+
// Scale arrow based on magnitude
|
|
38
|
+
float arrowLength = clamp(magnitude * 0.2, 0.001, 0.09);
|
|
39
|
+
vec2 tip = basePos + dir * arrowLength;
|
|
40
|
+
|
|
41
|
+
// Perpendicular for arrowhead
|
|
42
|
+
vec2 perp = vec2(-dir.y, dir.x);
|
|
43
|
+
float headLength = arrowLength / 3.0;
|
|
44
|
+
float headWidth = arrowLength / 6.0;
|
|
45
|
+
|
|
46
|
+
vec2 left = tip - dir * headLength + perp * headWidth;
|
|
47
|
+
vec2 right = tip - dir * headLength - perp * headWidth;
|
|
48
|
+
|
|
49
|
+
// Emit geometry (shaft + arrowhead)
|
|
50
|
+
magnitude = length(totalField);
|
|
51
|
+
chargeInfluence = chargeInfluence;
|
|
52
|
+
|
|
53
|
+
gl_Position = projection * vec4(basePos, 0.0, 1.0);
|
|
54
|
+
EmitVertex();
|
|
55
|
+
|
|
56
|
+
gl_Position = projection * vec4(tip, 0.0, 1.0);
|
|
57
|
+
EmitVertex();
|
|
58
|
+
|
|
59
|
+
gl_Position = projection * vec4(left, 0.0, 1.0);
|
|
60
|
+
EmitVertex();
|
|
61
|
+
|
|
62
|
+
gl_Position = projection * vec4(tip, 0.0, 1.0);
|
|
63
|
+
EmitVertex();
|
|
64
|
+
|
|
65
|
+
gl_Position = projection * vec4(right, 0.0, 1.0);
|
|
66
|
+
EmitVertex();
|
|
67
|
+
|
|
68
|
+
EndPrimitive();
|
|
69
|
+
}
|