From e1961079e1a51951aa118719c52bd6704c0c981b Mon Sep 17 00:00:00 2001 From: Yoann Poupart Date: Tue, 17 Sep 2024 10:12:17 +0200 Subject: [PATCH 1/4] new build config --- pyproject.toml | 3 +++ setup.py | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0832368 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "numpy"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 9eb3d30..b539d97 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,8 @@ import sys from setuptools import setup, Extension -from setuptools.command.build_ext import build_ext as _build_ext -class build_ext(_build_ext): - def finalize_options(self): - _build_ext.finalize_options(self) - # Prevent numpy from thinking it is still in its setup process: - __builtins__.__NUMPY_SETUP__ = False - import numpy - self.include_dirs.append(numpy.get_include()) +import numpy if sys.platform != 'win32': compile_args = ['-funroll-loops'] @@ -60,13 +53,14 @@ def finalize_options(self): packages=['vec_noise'], setup_requires=['numpy'], install_requires=['numpy'], - cmdclass={'build_ext': build_ext}, ext_modules=[ Extension('vec_noise._simplex', ['_simplex.c'], extra_compile_args=compile_args, + include_dirs=[numpy.get_include()], ), Extension('vec_noise._perlin', ['_perlin.c'], extra_compile_args=compile_args, + include_dirs=[numpy.get_include()], ) ], ) From 50e64f0e985f8f5a21b0d53110b777b15cf8503a Mon Sep 17 00:00:00 2001 From: Yoann Poupart Date: Tue, 17 Sep 2024 10:13:41 +0200 Subject: [PATCH 2/4] fiex conflict with I from math.h --- _simplex.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/_simplex.c b/_simplex.c index 418e833..8f6b847 100644 --- a/_simplex.c +++ b/_simplex.c @@ -45,7 +45,7 @@ typedef struct _NoiseArgs { float noise2(float x, float y) { - int i1, j1, I, J, c; + int i1, j1, II, J, c; float s = (x + y) * F2; float i = floorf(x + s); float j = floorf(y + s); @@ -66,11 +66,11 @@ noise2(float x, float y) xx[1] = xx[0] - i1 + G2; yy[1] = yy[0] - j1 + G2; - I = (int) i & 255; + II = (int) i & 255; J = (int) j & 255; - g[0] = PERM[I + PERM[J]] % 12; - g[1] = PERM[I + i1 + PERM[J + j1]] % 12; - g[2] = PERM[I + 1 + PERM[J + 1]] % 12; + g[0] = PERM[II + PERM[J]] % 12; + g[1] = PERM[II + i1 + PERM[J + j1]] % 12; + g[2] = PERM[II + 1 + PERM[J + 1]] % 12; for (c = 0; c <= 2; c++) f[c] = 0.5f - xx[c]*xx[c] - yy[c]*yy[c]; @@ -92,7 +92,7 @@ noise2(float x, float y) float noise3(float x, float y, float z) { - int c, o1[3], o2[3], g[4], I, J, K; + int c, o1[3], o2[3], g[4], II, J, K; float f[4], noise[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float s = (x + y + z) * F3; float i = floorf(x + s); @@ -136,13 +136,13 @@ noise3(float x, float y, float z) pos[1][c] = pos[0][c] - o1[c] + G3; } - I = (int) i & 255; + II = (int) i & 255; J = (int) j & 255; K = (int) k & 255; - g[0] = PERM[I + PERM[J + PERM[K]]] % 12; - g[1] = PERM[I + o1[0] + PERM[J + o1[1] + PERM[o1[2] + K]]] % 12; - g[2] = PERM[I + o2[0] + PERM[J + o2[1] + PERM[o2[2] + K]]] % 12; - g[3] = PERM[I + 1 + PERM[J + 1 + PERM[K + 1]]] % 12; + g[0] = PERM[II + PERM[J + PERM[K]]] % 12; + g[1] = PERM[II + o1[0] + PERM[J + o1[1] + PERM[o1[2] + K]]] % 12; + g[2] = PERM[II + o2[0] + PERM[J + o2[1] + PERM[o2[2] + K]]] % 12; + g[3] = PERM[II + 1 + PERM[J + 1 + PERM[K + 1]]] % 12; for (c = 0; c <= 3; c++) { f[c] = 0.6f - pos[c][0]*pos[c][0] - pos[c][1]*pos[c][1] - pos[c][2]*pos[c][2]; @@ -226,15 +226,15 @@ noise4(float x, float y, float z, float w) { float z4 = z0 - 1.0f + 4.0f*G4; float w4 = w0 - 1.0f + 4.0f*G4; - int I = (int)i & 255; + int II = (int)i & 255; int J = (int)j & 255; int K = (int)k & 255; int L = (int)l & 255; - int gi0 = PERM[I + PERM[J + PERM[K + PERM[L]]]] & 0x1f; - int gi1 = PERM[I + i1 + PERM[J + j1 + PERM[K + k1 + PERM[L + l1]]]] & 0x1f; - int gi2 = PERM[I + i2 + PERM[J + j2 + PERM[K + k2 + PERM[L + l2]]]] & 0x1f; - int gi3 = PERM[I + i3 + PERM[J + j3 + PERM[K + k3 + PERM[L + l3]]]] & 0x1f; - int gi4 = PERM[I + 1 + PERM[J + 1 + PERM[K + 1 + PERM[L + 1]]]] & 0x1f; + int gi0 = PERM[II + PERM[J + PERM[K + PERM[L]]]] & 0x1f; + int gi1 = PERM[II + i1 + PERM[J + j1 + PERM[K + k1 + PERM[L + l1]]]] & 0x1f; + int gi2 = PERM[II + i2 + PERM[J + j2 + PERM[K + k2 + PERM[L + l2]]]] & 0x1f; + int gi3 = PERM[II + i3 + PERM[J + j3 + PERM[K + k3 + PERM[L + l3]]]] & 0x1f; + int gi4 = PERM[II + 1 + PERM[J + 1 + PERM[K + 1 + PERM[L + 1]]]] & 0x1f; float t0, t1, t2, t3, t4; t0 = 0.6f - x0*x0 - y0*y0 - z0*z0 - w0*w0; From 7d8cd47271f9088ccf39c650a7e78cb5e1c7dfcb Mon Sep 17 00:00:00 2001 From: Yoann Poupart Date: Tue, 17 Sep 2024 10:14:23 +0200 Subject: [PATCH 3/4] version bump --- __init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index faa075c..49cb915 100644 --- a/__init__.py +++ b/__init__.py @@ -8,7 +8,7 @@ Copyright (c) 2017, Zev Benjamin """ -__version__ = "1.1.4" +__version__ = "1.1.5" from . import _perlin, _simplex diff --git a/setup.py b/setup.py index b539d97..0034213 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='vec_noise', - version='1.1.4', + version='1.1.5', description='Vectorized Perlin noise for Python', long_description='''\ This is a fork of Casey Duncan's noise library that vectorizes all of the noise From e137660663d021612b7c84f915635144c414b215 Mon Sep 17 00:00:00 2001 From: Yoann Poupart Date: Tue, 17 Sep 2024 10:21:44 +0200 Subject: [PATCH 4/4] changelog --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index d025c6c..193fe73 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +1.1.5 -- September 17, 2024 + + - Fix build config + 1.1.4 -- August 1, 2017 - Fix Python 3 crash