hyperstellar 0.1.63__tar.gz → 0.1.65__tar.gz

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 (18) hide show
  1. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/PKG-INFO +1 -1
  2. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/_native/windows-x64/shaders/math.comp +67 -124
  3. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/_native/windows-x64/stellar.pyd +0 -0
  4. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar.egg-info/PKG-INFO +1 -1
  5. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/pyproject.toml +3 -1
  6. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/LICENSE +0 -0
  7. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/README.md +0 -0
  8. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/__init__.py +0 -0
  9. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/__init__.pyi +0 -0
  10. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/_native/windows-x64/shaders/quad.frag +0 -0
  11. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/_native/windows-x64/shaders/quad.geom +0 -0
  12. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/_native/windows-x64/shaders/quad.vert +0 -0
  13. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar/py.typed +0 -0
  14. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar.egg-info/SOURCES.txt +0 -0
  15. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar.egg-info/dependency_links.txt +0 -0
  16. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/hyperstellar/src/hyperstellar.egg-info/top_level.txt +0 -0
  17. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/setup.cfg +0 -0
  18. {hyperstellar-0.1.63 → hyperstellar-0.1.65}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperstellar
3
- Version: 0.1.63
3
+ Version: 0.1.65
4
4
  Summary: GPU-accelerated physics simulation engine
5
5
  Author-email: Aiden Jabari <Jabariaiden15@email.com>
6
6
  License: MIT License
@@ -1481,7 +1481,7 @@ CollisionInfo detectCollision(Object objA, Object objB, int objIndexB)
1481
1481
  }
1482
1482
 
1483
1483
  // ============================================================================
1484
- // NEW: RESEARCH-GRADE COLLISION RESOLUTION SYSTEM
1484
+ // RESEARCH-GRADE COLLISION RESOLUTION SYSTEM
1485
1485
  // ============================================================================
1486
1486
 
1487
1487
  // ============================================================================
@@ -1868,148 +1868,95 @@ void main() {
1868
1868
  float new_rotation = rotation + new_angular_vel * uDt;
1869
1869
  new_rotation = mod(new_rotation, 2.0 * PI); // Wrap rotation
1870
1870
 
1871
- // ========================================================================
1872
- // WORLD BOUNDARIES
1873
- // ========================================================================
1874
- const vec2 world_min = vec2(-1000000.0, -1000000.0);
1875
- const vec2 world_max = vec2(1000000.0, 1000000.0);
1876
- const float boundary_friction = 0.95;
1877
-
1878
- // X boundaries
1879
- if (new_pos.x < world_min.x) {
1880
- new_pos.x = world_min.x;
1881
- new_vel.x = abs(new_vel.x) * uRestitution;
1882
- new_vel.y *= boundary_friction;
1883
- }
1884
- else if (new_pos.x > world_max.x) {
1885
- new_pos.x = world_max.x;
1886
- new_vel.x = -abs(new_vel.x) * uRestitution;
1887
- new_vel.y *= boundary_friction;
1888
- }
1889
-
1890
- // Y boundaries
1891
- if (new_pos.y < world_min.y) {
1892
- new_pos.y = world_min.y;
1893
- new_vel.y = abs(new_vel.y) * uRestitution;
1894
- new_vel.x *= boundary_friction;
1895
- }
1896
- else if (new_pos.y > world_max.y) {
1897
- new_pos.y = world_max.y;
1898
- new_vel.y = -abs(new_vel.y) * uRestitution;
1899
- new_vel.x *= boundary_friction;
1900
- }
1901
-
1902
1871
  // ========================================================================
1903
1872
  // CONSTRAINT RESOLUTION (UNCHANGED)
1904
1873
  // ========================================================================
1905
1874
  applyConstraints(new_pos, new_vel, objectIndex, originalPos);
1906
1875
 
1907
- // ========================================================================
1908
- // NEW: COLLISION SYSTEM - FIXED FOR PARALLEL EXECUTION
1909
- // ========================================================================
1910
-
1911
- // Strategy:
1912
- // 1. Each thread only modifies its OWN object's velocity
1913
- // 2. Use impulses that conserve momentum without modifying other objects
1914
- // 3. Position correction happens AFTER all velocity updates
1915
-
1916
- vec2 collision_vel = new_vel;
1917
- bool had_collision = false;
1918
-
1919
- // Check collisions with ALL other objects (not just higher indices)
1920
- for (int i = 0; i < uNumObjects; i++) {
1921
- if (i == objectIndex) continue; // Skip self
1922
-
1923
- Object other = objectsIn[i];
1924
-
1925
- // Detect collision
1926
- CollisionInfo collision = detectCollision(selfNew, other, i);
1876
+ // ========================================================================
1877
+ // COLLISION HANDLING - Keep selfNew for circles, but fix stickiness for rectangles
1878
+ // ========================================================================
1879
+ vec2 collision_vel = new_vel;
1880
+ vec2 final_pos = new_pos; // Accumulate corrections (prevents feedback loop)
1881
+ bool had_collision = false;
1927
1882
 
1928
- if (collision.hasCollision) {
1929
- had_collision = true;
1883
+ for (int i = 0; i < uNumObjects; i++) {
1884
+ if (i == objectIndex) continue;
1930
1885
 
1931
- // Get collision properties
1932
- CollisionProperties propsA = collisionProps[objectIndex];
1933
- CollisionProperties propsB = collisionProps[i];
1886
+ Object other = objectsIn[i];
1934
1887
 
1935
- // Calculate effective properties
1936
- float restitution = min(propsA.restitution, propsB.restitution);
1937
- float friction = sqrt(propsA.friction * propsB.friction);
1888
+ // Keep your selfNew detection - this is what made circles bouncy
1889
+ CollisionInfo collision = detectCollision(selfNew, other, i); // <--- selfNew here
1938
1890
 
1939
- // Get masses
1940
- float massA = mass;
1941
- float massB = max(EPSILON, other.mass);
1942
-
1943
- // Relative velocity
1944
- vec2 relativeVel = other.velocity - collision_vel;
1945
- float velocityAlongNormal = dot(relativeVel, collision.normal);
1946
-
1947
- // Only resolve if moving toward each other
1948
- if (velocityAlongNormal < 0.0) {
1949
- // Calculate impulse (standard rigid body physics)
1950
- float e = clamp(restitution, 0.0, 1.0);
1951
- float j = -(1.0 + e) * velocityAlongNormal;
1952
- j /= (1.0 / massA + 1.0 / massB);
1891
+ if (collision.hasCollision) {
1892
+ had_collision = true;
1893
+
1894
+ CollisionProperties propsA = collisionProps[objectIndex];
1895
+ CollisionProperties propsB = collisionProps[i];
1896
+
1897
+ float restitution = min(propsA.restitution, propsB.restitution);
1898
+ float friction = sqrt(propsA.friction * propsB.friction);
1899
+
1900
+ float massA = mass;
1901
+ float massB = max(EPSILON, other.mass);
1953
1902
 
1954
- // Apply impulse to THIS object only
1955
- vec2 impulse = j * collision.normal;
1956
- collision_vel -= impulse / massA;
1903
+ // Velocity impulse (asymmetric - only affect this object)
1904
+ vec2 relativeVel = other.velocity - collision_vel;
1905
+ float velAlongNormal = dot(relativeVel, collision.normal);
1957
1906
 
1958
- // Friction
1959
- if (friction > 0.0) {
1960
- vec2 tangent = relativeVel - collision.normal * dot(relativeVel, collision.normal);
1961
- float tangentLength = length(tangent);
1907
+ if (velAlongNormal < 0.0) { // approaching
1908
+ float e = clamp(restitution, 0.0, 1.0);
1909
+ float j = -(1.0 + e) * velAlongNormal / (1.0 / massA + 1.0 / massB);
1962
1910
 
1963
- if (tangentLength > EPSILON) {
1964
- tangent = normalize(tangent);
1965
- float vt = dot(relativeVel, tangent);
1966
-
1967
- float jt = -vt * friction;
1968
- jt /= (1.0 / massA + 1.0 / massB);
1969
-
1970
- // Coulomb friction limit
1971
- float maxFriction = abs(j) * friction;
1972
- jt = clamp(jt, -maxFriction, maxFriction);
1973
-
1974
- vec2 frictionImpulse = jt * tangent;
1975
- collision_vel -= frictionImpulse / massA;
1911
+ collision_vel -= (j * collision.normal) / massA;
1912
+
1913
+ // Friction - conservative
1914
+ if (friction > 0.0) {
1915
+ vec2 tangent = relativeVel - collision.normal * dot(relativeVel, collision.normal);
1916
+ float tLen = length(tangent);
1917
+ if (tLen > EPSILON) {
1918
+ tangent = normalize(tangent);
1919
+ float vt = dot(relativeVel, tangent);
1920
+ float jt = -vt * friction / (1.0 / massA + 1.0 / massB);
1921
+ float maxJt = abs(j) * friction;
1922
+ jt = clamp(jt, -maxJt, maxJt);
1923
+ collision_vel -= (jt * tangent) / massA;
1924
+ }
1976
1925
  }
1977
1926
  }
1978
- }
1979
-
1980
- // POSITION CORRECTION - only for deep penetrations
1981
- // Move THIS object away from penetration
1982
- const float slop = 0.01;
1983
- const float percent = 0.4;
1984
-
1985
- if (collision.penetration > slop) {
1986
- float totalMass = massA + massB;
1987
- vec2 correction = collision.normal * (collision.penetration - slop) * percent;
1988
1927
 
1989
- // The correction is weighted by the inverse mass ratio
1990
- new_pos -= correction * (massB / totalMass);
1928
+ // Position correction - ACCUMULATED + rectangle-tuned values
1929
+ const float slop = 0.025; // Increased to reduce micro-corrections on flat edges
1930
+ const float percent = 0.75; // Stronger push to separate cleanly
1931
+
1932
+ if (collision.penetration > slop) {
1933
+ float totalMass = massA + massB;
1934
+ vec2 correction = collision.normal * (collision.penetration - slop) * percent * (massB / totalMass);
1935
+
1936
+ // Force correction direction away from the other object
1937
+ if (dot(collision.normal, other.position - selfNew.position) < 0.0) {
1938
+ correction = -correction;
1939
+ }
1940
+
1941
+ final_pos -= correction;
1942
+ }
1991
1943
  }
1992
1944
  }
1993
- }
1994
-
1995
- // Apply collision-modified velocity
1996
- if (had_collision) {
1997
- new_vel = sanitizeVec2(collision_vel);
1998
- }
1945
+
1946
+ if (had_collision) {
1947
+ new_vel = sanitizeVec2(collision_vel);
1948
+ }
1949
+ new_pos = sanitizeVec2(final_pos); // Apply all corrections at once
1999
1950
 
2000
- // ========================================================================
2001
- // REST OF CODE(boundaries, final write, etc.)
2002
- // ========================================================================
1951
+ // ========================================================================
1952
+ // REST OF CODE(boundaries, final write, etc.)
1953
+ // ========================================================================
2003
1954
 
2004
1955
  // Age out old contacts for this object
2005
1956
  if (uEnableWarmStart == 1) {
2006
1957
  ageContacts(objectIndex);
2007
1958
  }
2008
1959
 
2009
- // REMOVED: The second collision loop that was causing double-resolution
2010
- // We no longer need to check i < objectIndex because all pairs are
2011
- // processed exactly once in the loop above
2012
-
2013
1960
  // Apply the collision-corrected state
2014
1961
  new_pos = sanitizeVec2(new_pos);
2015
1962
  new_vel = sanitizeVec2(new_vel);
@@ -2047,8 +1994,4 @@ if (had_collision) {
2047
1994
  objectsOut[gid]._pad1 = 0;
2048
1995
  objectsOut[gid]._padEnd[0] = 0;
2049
1996
  objectsOut[gid]._padEnd[1] = 0;
2050
- }
2051
-
2052
- // ============================================================================
2053
- // END OF RESEARCH-GRADE COLLISION SYSTEM
2054
- // ============================================================================
1997
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperstellar
3
- Version: 0.1.63
3
+ Version: 0.1.65
4
4
  Summary: GPU-accelerated physics simulation engine
5
5
  Author-email: Aiden Jabari <Jabariaiden15@email.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyperstellar"
7
- version = "0.1.63"
7
+ version = "0.1.65"
8
8
  description = "GPU-accelerated physics simulation engine"
9
9
  readme = "README.md"
10
10
  authors = [{name = "Aiden Jabari", email = "Jabariaiden15@email.com"}]
@@ -61,6 +61,8 @@ where = ["hyperstellar/src"]
61
61
 
62
62
 
63
63
 
64
+
65
+
64
66
 
65
67
 
66
68
 
File without changes
File without changes
File without changes