From a3bc83d1a574344063be252ba8e354986190b410 Mon Sep 17 00:00:00 2001 From: LemurPwned Date: Tue, 10 Dec 2024 17:46:10 +0100 Subject: [PATCH 1/2] adding 1/f noise binding .pyis --- cmtj/__init__.pyi | 13 +++++++++++++ cmtj/noise/__init__.pyi | 17 ++++++++++++++--- setup.py | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/cmtj/__init__.pyi b/cmtj/__init__.pyi index 4d4312a..d90861f 100644 --- a/cmtj/__init__.pyi +++ b/cmtj/__init__.pyi @@ -479,6 +479,19 @@ class Layer: """ ... + def createBufferedAlphaNoise(self, bufferSize: int) -> None: + """Create a buffered alpha noise generator.""" + ... + + def setAlphaNoise(self, alpha: float, std: float, scale: float, axis: Axis) -> None: + """Set alpha noise for the layer. + :param alpha: Alpha parameter + :param std: Standard deviation + :param scale: Scale + :param axis: Axis, by default all axes are used + """ + ... + def setAnisotropyDriver(self, driver: ScalarDriver) -> None: """Set anisotropy driver for the layer. It's scalar. The axis is determined in the layer constructor""" diff --git a/cmtj/noise/__init__.pyi b/cmtj/noise/__init__.pyi index 596e85f..0ebc17e 100644 --- a/cmtj/noise/__init__.pyi +++ b/cmtj/noise/__init__.pyi @@ -7,10 +7,10 @@ class BufferedAlphaNoise: def fillBuffer(self) -> None: """Fill the buffer with the noise. This method is called only once.""" ... + def tick(self) -> float: """Produce the next sample of the noise.""" ... - pass class VectorAlphaNoise: """Create a vector alpha noise generator. Alpha can be in [0, 2].""" @@ -22,15 +22,26 @@ class VectorAlphaNoise: std: float, scale: float, axis: cmtj.Axis = cmtj.Axis.all, - ) -> None: ... + ) -> None: + """Kasdin algorithm for vector alpha noise generation. + + :param bufferSize: Buffer size + :param alpha: Alpha parameter + :param std: Standard deviation + :param scale: Scale + :param axis: Axis, by default all axes are used + """ + ... + def getPrevSample(self) -> cmtj.CVector: """Get the previous sample of the noise in a vector form.""" ... + def getScale(self) -> float: """Get the scale of the noise.""" ... + def tick(self) -> float: ... def tickVector(self) -> cmtj.CVector: """Get the next sample of the noise in a vector form.""" ... - pass diff --git a/setup.py b/setup.py index 58e7dc2..a65bb01 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import Extension, find_namespace_packages, setup from setuptools.command.build_ext import build_ext -__version__ = "1.6.0" +__version__ = "1.6.1" """ As per https://github.com/pybind/python_example From ea21ef3bfd500d22ab4fcf33eff2234070a5576f Mon Sep 17 00:00:00 2001 From: Jakub Date: Tue, 10 Dec 2024 17:48:53 +0100 Subject: [PATCH 2/2] Update cmtj/__init__.pyi Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- cmtj/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmtj/__init__.pyi b/cmtj/__init__.pyi index d90861f..6be0f2d 100644 --- a/cmtj/__init__.pyi +++ b/cmtj/__init__.pyi @@ -483,7 +483,7 @@ class Layer: """Create a buffered alpha noise generator.""" ... - def setAlphaNoise(self, alpha: float, std: float, scale: float, axis: Axis) -> None: + def setAlphaNoise(self, alpha: float, std: float, scale: float, axis: Axis = Axis.all) -> None: """Set alpha noise for the layer. :param alpha: Alpha parameter :param std: Standard deviation