10 #include "../system/RandGen.h"
41 "Class to provide Perlin noise functionalities.\n"
43 ".. method:: __init__(seed = -1)\n"
45 " Builds a Noise object. Seed is an optional argument. The seed value is used\n"
46 " as a seed for random number generation if it is equal to or greater than zero;\n"
47 " otherwise, time is used as a seed.\n"
49 " :arg seed: Seed for random number generation.\n"
54 static const char *kwlist[] = {
"seed",
nullptr};
57 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|l", (
char **)kwlist, &
seed)) {
69 Py_TYPE(
self)->tp_free((PyObject *)
self);
74 return PyUnicode_FromFormat(
"Noise - address: %p",
self->n);
78 ".. method:: turbulence1(v, freq, amp, oct=4)\n"
80 " Returns a noise value for a 1D element.\n"
82 " :arg v: One-dimensional sample point.\n"
84 " :arg freq: Noise frequency.\n"
85 " :type freq: float\n"
86 " :arg amp: Amplitude.\n"
88 " :arg oct: Number of octaves.\n"
90 " :return: A noise value.\n"
95 static const char *kwlist[] = {
"seed",
nullptr};
97 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|I", (
char **)kwlist, &
seed)) {
98 PyErr_SetString(PyExc_TypeError,
"optional argument 1 must be of type int");
109 static const char *kwlist[] = {
"v",
"oct",
nullptr};
112 unsigned nbOctaves = 8;
114 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"d|I", (
char **)kwlist, &
x, &nbOctaves)) {
117 return PyFloat_FromDouble(
self->pn->turbulenceSmooth(
x, nbOctaves));
122 static const char *kwlist[] = {
"v",
"freq",
"amp",
"oct",
nullptr};
126 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"fff|I", (
char **)kwlist, &f1, &f2, &f3, &i)) {
129 return PyFloat_FromDouble(
self->n->turbulence1(f1, f2, f3, i));
133 ".. method:: turbulence2(v, freq, amp, oct=4)\n"
135 " Returns a noise value for a 2D element.\n"
137 " :arg v: Two-dimensional sample point.\n"
138 " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"
139 " :arg freq: Noise frequency.\n"
140 " :type freq: float\n"
141 " :arg amp: Amplitude.\n"
142 " :type amp: float\n"
143 " :arg oct: Number of octaves.\n"
145 " :return: A noise value.\n"
150 static const char *kwlist[] = {
"v",
"freq",
"amp",
"oct",
nullptr};
156 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"Off|I", (
char **)kwlist, &obj1, &f2, &f3, &i)) {
160 PyErr_SetString(PyExc_TypeError,
161 "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
164 float t =
self->n->turbulence2(vec, f2, f3, i);
165 return PyFloat_FromDouble(
t);
169 ".. method:: turbulence3(v, freq, amp, oct=4)\n"
171 " Returns a noise value for a 3D element.\n"
173 " :arg v: Three-dimensional sample point.\n"
174 " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"
175 " :arg freq: Noise frequency.\n"
176 " :type freq: float\n"
177 " :arg amp: Amplitude.\n"
178 " :type amp: float\n"
179 " :arg oct: Number of octaves.\n"
181 " :return: A noise value.\n"
186 static const char *kwlist[] = {
"v",
"freq",
"amp",
"oct",
nullptr};
192 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"Off|I", (
char **)kwlist, &obj1, &f2, &f3, &i)) {
196 PyErr_SetString(PyExc_TypeError,
197 "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
200 float t =
self->n->turbulence3(vec, f2, f3, i);
201 return PyFloat_FromDouble(
t);
205 ".. method:: smoothNoise1(v)\n"
207 " Returns a smooth noise value for a 1D element.\n"
209 " :arg v: One-dimensional sample point.\n"
211 " :return: A smooth noise value.\n"
216 static const char *kwlist[] = {
"v",
nullptr};
219 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"f", (
char **)kwlist, &f)) {
222 return PyFloat_FromDouble(
self->n->smoothNoise1(f));
226 ".. method:: smoothNoise2(v)\n"
228 " Returns a smooth noise value for a 2D element.\n"
230 " :arg v: Two-dimensional sample point.\n"
231 " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"
232 " :return: A smooth noise value.\n"
237 static const char *kwlist[] = {
"v",
nullptr};
241 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O", (
char **)kwlist, &obj)) {
245 PyErr_SetString(PyExc_TypeError,
246 "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
249 float t =
self->n->smoothNoise2(vec);
250 return PyFloat_FromDouble(
t);
254 ".. method:: smoothNoise3(v)\n"
256 " Returns a smooth noise value for a 3D element.\n"
258 " :arg v: Three-dimensional sample point.\n"
259 " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"
260 " :return: A smooth noise value.\n"
265 static const char *kwlist[] = {
"v",
nullptr};
269 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O", (
char **)kwlist, &obj)) {
273 PyErr_SetString(PyExc_TypeError,
274 "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
277 float t =
self->n->smoothNoise3(vec);
278 return PyFloat_FromDouble(
t);
284 METH_VARARGS | METH_KEYWORDS,
285 FrsNoise_turbulence1_doc},
288 METH_VARARGS | METH_KEYWORDS,
289 FrsNoise_turbulence2_doc},
292 METH_VARARGS | METH_KEYWORDS,
293 FrsNoise_turbulence3_doc},
296 METH_VARARGS | METH_KEYWORDS,
297 FrsNoise_smoothNoise1_doc},
300 METH_VARARGS | METH_KEYWORDS,
301 FrsNoise_smoothNoise2_doc},
304 METH_VARARGS | METH_KEYWORDS,
305 FrsNoise_smoothNoise3_doc},
306 {
"rand", (PyCFunction)
FrsNoise_drand, METH_VARARGS | METH_KEYWORDS,
nullptr},
307 {
"turbulence_smooth",
309 METH_VARARGS | METH_KEYWORDS,
311 {
nullptr,
nullptr, 0,
nullptr},
317 PyVarObject_HEAD_INIT(
nullptr, 0)
"Noise",
335 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
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Noise
static unsigned long seed
static void srand48(long seedval)
static struct PyModuleDef module