24 #include "../system/RandGen.h"
55 "Class to provide Perlin noise functionalities.\n"
57 ".. method:: __init__(seed = -1)\n"
59 " Builds a Noise object. Seed is an optional argument. The seed value is used\n"
60 " as a seed for random number generation if it is equal to or greater than zero;\n"
61 " otherwise, time is used as a seed.\n"
63 " :arg seed: Seed for random number generation.\n"
68 static const char *kwlist[] = {
"seed",
nullptr};
71 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|l", (
char **)kwlist, &
seed)) {
83 Py_TYPE(
self)->tp_free((PyObject *)
self);
88 return PyUnicode_FromFormat(
"Noise - address: %p",
self->n);
92 ".. method:: turbulence1(v, freq, amp, oct=4)\n"
94 " Returns a noise value for a 1D element.\n"
96 " :arg v: One-dimensional sample point.\n"
98 " :arg freq: Noise frequency.\n"
99 " :type freq: float\n"
100 " :arg amp: Amplitude.\n"
101 " :type amp: float\n"
102 " :arg oct: Number of octaves.\n"
104 " :return: A noise value.\n"
109 static const char *kwlist[] = {
"seed",
nullptr};
111 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|I", (
char **)kwlist, &
seed)) {
112 PyErr_SetString(PyExc_TypeError,
"optional argument 1 must be of type int");
123 static const char *kwlist[] = {
"v",
"oct",
nullptr};
126 unsigned nbOctaves = 8;
128 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"d|I", (
char **)kwlist, &
x, &nbOctaves)) {
131 return PyFloat_FromDouble(
self->pn->turbulenceSmooth(
x, nbOctaves));
136 static const char *kwlist[] = {
"v",
"freq",
"amp",
"oct",
nullptr};
140 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"fff|I", (
char **)kwlist, &f1, &f2, &f3, &i)) {
143 return PyFloat_FromDouble(
self->n->turbulence1(f1, f2, f3, i));
147 ".. method:: turbulence2(v, freq, amp, oct=4)\n"
149 " Returns a noise value for a 2D element.\n"
151 " :arg v: Two-dimensional sample point.\n"
152 " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"
153 " :arg freq: Noise frequency.\n"
154 " :type freq: float\n"
155 " :arg amp: Amplitude.\n"
156 " :type amp: float\n"
157 " :arg oct: Number of octaves.\n"
159 " :return: A noise value.\n"
164 static const char *kwlist[] = {
"v",
"freq",
"amp",
"oct",
nullptr};
170 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"Off|I", (
char **)kwlist, &obj1, &f2, &f3, &i)) {
174 PyErr_SetString(PyExc_TypeError,
175 "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
178 float t =
self->n->turbulence2(vec, f2, f3, i);
179 return PyFloat_FromDouble(
t);
183 ".. method:: turbulence3(v, freq, amp, oct=4)\n"
185 " Returns a noise value for a 3D element.\n"
187 " :arg v: Three-dimensional sample point.\n"
188 " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"
189 " :arg freq: Noise frequency.\n"
190 " :type freq: float\n"
191 " :arg amp: Amplitude.\n"
192 " :type amp: float\n"
193 " :arg oct: Number of octaves.\n"
195 " :return: A noise value.\n"
200 static const char *kwlist[] = {
"v",
"freq",
"amp",
"oct",
nullptr};
206 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"Off|I", (
char **)kwlist, &obj1, &f2, &f3, &i)) {
210 PyErr_SetString(PyExc_TypeError,
211 "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
214 float t =
self->n->turbulence3(vec, f2, f3, i);
215 return PyFloat_FromDouble(
t);
219 ".. method:: smoothNoise1(v)\n"
221 " Returns a smooth noise value for a 1D element.\n"
223 " :arg v: One-dimensional sample point.\n"
225 " :return: A smooth noise value.\n"
230 static const char *kwlist[] = {
"v",
nullptr};
233 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"f", (
char **)kwlist, &f)) {
236 return PyFloat_FromDouble(
self->n->smoothNoise1(f));
240 ".. method:: smoothNoise2(v)\n"
242 " Returns a smooth noise value for a 2D element.\n"
244 " :arg v: Two-dimensional sample point.\n"
245 " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"
246 " :return: A smooth noise value.\n"
251 static const char *kwlist[] = {
"v",
nullptr};
255 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O", (
char **)kwlist, &obj)) {
259 PyErr_SetString(PyExc_TypeError,
260 "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
263 float t =
self->n->smoothNoise2(vec);
264 return PyFloat_FromDouble(
t);
268 ".. method:: smoothNoise3(v)\n"
270 " Returns a smooth noise value for a 3D element.\n"
272 " :arg v: Three-dimensional sample point.\n"
273 " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"
274 " :return: A smooth noise value.\n"
279 static const char *kwlist[] = {
"v",
nullptr};
283 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O", (
char **)kwlist, &obj)) {
287 PyErr_SetString(PyExc_TypeError,
288 "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
291 float t =
self->n->smoothNoise3(vec);
292 return PyFloat_FromDouble(
t);
298 METH_VARARGS | METH_KEYWORDS,
299 FrsNoise_turbulence1_doc},
302 METH_VARARGS | METH_KEYWORDS,
303 FrsNoise_turbulence2_doc},
306 METH_VARARGS | METH_KEYWORDS,
307 FrsNoise_turbulence3_doc},
310 METH_VARARGS | METH_KEYWORDS,
311 FrsNoise_smoothNoise1_doc},
314 METH_VARARGS | METH_KEYWORDS,
315 FrsNoise_smoothNoise2_doc},
318 METH_VARARGS | METH_KEYWORDS,
319 FrsNoise_smoothNoise3_doc},
320 {
"rand", (PyCFunction)
FrsNoise_drand, METH_VARARGS | METH_KEYWORDS,
nullptr},
321 {
"turbulence_smooth",
323 METH_VARARGS | METH_KEYWORDS,
325 {
nullptr,
nullptr, 0,
nullptr},
331 PyVarObject_HEAD_INIT(
nullptr, 0)
"Noise",
349 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
bool Vec3f_ptr_from_PyObject(PyObject *obj, Vec3f &vec)
bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f &vec)
static PyObject * FrsNoise_smoothNoise1(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
static PyObject * FrsNoise_smoothNoise2(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
static void FrsNoise_dealloc(BPy_FrsNoise *self)
static PyObject * FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
int FrsNoise_Init(PyObject *module)
static PyObject * FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
static PyObject * FrsNoise_repr(BPy_FrsNoise *self)
static PyObject * FrsNoise_drand(BPy_FrsNoise *, PyObject *args, PyObject *kwds)
PyDoc_STRVAR(FrsNoise_doc, "Class to provide Perlin noise functionalities.\n" "\n" ".. method:: __init__(seed = -1)\n" "\n" " Builds a Noise object. Seed is an optional argument. The seed value is used\n" " as a seed for random number generation if it is equal to or greater than zero;\n" " otherwise, time is used as a seed.\n" "\n" " :arg seed: Seed for random number generation.\n" " :type seed: int")
static PyObject * FrsNoise_turbulence_smooth(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
PyTypeObject FrsNoise_Type
static PyObject * FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
static PyObject * FrsNoise_smoothNoise3(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
static PyMethodDef BPy_FrsNoise_methods[]
static int FrsNoise_init(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White Noise
static struct PyModuleDef module
static unsigned long seed
static void srand48(long seedval)