30 #include "../generic/py_capi_utils.h"
31 #include "../generic/python_utildefines.h"
82 pygpu_state_blend_set_doc,
83 ".. function:: blend_set(mode)\n"
85 " Defines the fixed pipeline blending equation.\n"
87 " :param mode: The type of blend mode.\n"
88 " * ``NONE`` No blending.\n"
89 " * ``ALPHA`` The original color channels are interpolated according to the alpha "
91 " * ``ALPHA_PREMULT`` The original color channels are interpolated according to the "
92 "alpha value with the new colors pre-multiplied by this value.\n"
93 " * ``ADDITIVE`` The original color channels are added by the corresponding ones.\n"
94 " * ``ADDITIVE_PREMULT`` The original color channels are added by the corresponding ones "
95 "that are pre-multiplied by the alpha value.\n"
96 " * ``MULTIPLY`` The original color channels are multiplied by the corresponding ones.\n"
97 " * ``SUBTRACT`` The original color channels are subtracted by the corresponding ones.\n"
98 " * ``INVERT`` The original color channels are replaced by its complementary color.\n"
102 " :type mode: str\n");
114 ".. function:: blend_get()\n"
116 " Current blending equation.\n"
125 ".. function:: depth_test_set(mode)\n"
127 " Defines the depth_test equation.\n"
129 " :param mode: The depth test equation name.\n"
130 " Possible values are `NONE`, `ALWAYS`, `LESS`, `LESS_EQUAL`, `EQUAL`, "
131 "`GREATER` and `GREATER_EQUAL`.\n"
132 " :type mode: str\n");
144 ".. function:: blend_depth_test_get()\n"
146 " Current depth_test equation.\n"
155 ".. function:: depth_mask_set(value)\n"
157 " Write to depth component.\n"
159 " :param value: True for writing to the depth component.\n"
160 " :type near: bool\n");
172 ".. function:: depth_mask_set_get()\n"
174 " Writing status in the depth component.\n");
181 ".. function:: viewport_set(x, y, xsize, ysize)\n"
183 " Specifies the viewport of the active framebuffer.\n"
184 " Note: The viewport state is not saved upon framebuffer rebind.\n"
186 " :param x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
187 " :param width, height: width and height of the viewport_set.\n"
188 " :type x, y, xsize, ysize: int\n");
191 int x,
y, xsize, ysize;
192 if (!PyArg_ParseTuple(args,
"iiii:viewport_set", &
x, &
y, &xsize, &ysize)) {
201 ".. function:: viewport_get()\n"
203 " Viewport of the active framebuffer.\n");
209 PyObject *
ret = PyTuple_New(4);
211 PyLong_FromLong(viewport[0]),
212 PyLong_FromLong(viewport[1]),
213 PyLong_FromLong(viewport[2]),
214 PyLong_FromLong(viewport[3]));
219 ".. function:: line_width_set(width)\n"
221 " Specify the width of rasterized lines.\n"
223 " :param size: New width.\n"
224 " :type mode: float\n");
228 if (PyErr_Occurred()) {
237 ".. function:: line_width_get()\n"
239 " Current width of rasterized lines.\n");
243 return PyFloat_FromDouble((
double)
width);
247 ".. function:: point_size_set(size)\n"
249 " Specify the diameter of rasterized points.\n"
251 " :param size: New diameter.\n"
252 " :type mode: float\n");
255 float size = (
float)PyFloat_AsDouble(value);
256 if (PyErr_Occurred()) {
265 ".. function:: color_mask_set(r, g, b, a)\n"
267 " Enable or disable writing of frame buffer color components.\n"
269 " :param r, g, b, a: components red, green, blue, and alpha.\n"
270 " :type r, g, b, a: bool\n");
274 if (!PyArg_ParseTuple(args,
"pppp:color_mask_set", &
r, &g, &b, &
a)) {
283 ".. function:: face_culling_set(culling)\n"
285 " Specify whether none, front-facing or back-facing facets can be culled.\n"
287 " :param mode: `NONE`, `FRONT` or `BACK`.\n"
288 " :type mode: str\n");
301 ".. function:: front_facing_set(invert)\n"
303 " Specifies the orientation of front-facing polygons.\n"
305 " :param invert: True for clockwise polygons as front-facing.\n"
306 " :type mode: bool\n");
319 ".. function:: use_program_point_size(enable)\n"
321 " If enabled, the derived point size is taken from the (potentially clipped) "
322 "shader builtin gl_PointSize.\n"
324 " :param enable: True for shader builtin gl_PointSize.\n"
325 " :type enable: bool\n");
350 pygpu_state_depth_test_set_doc},
354 pygpu_state_depth_test_get_doc},
358 pygpu_state_depth_mask_set_doc},
362 pygpu_state_depth_mask_get_doc},
366 pygpu_state_viewport_set_doc},
370 pygpu_state_viewport_get_doc},
374 pygpu_state_line_width_set_doc},
378 pygpu_state_line_width_get_doc},
382 pygpu_state_point_size_set_doc},
386 pygpu_state_color_mask_set_doc},
390 pygpu_state_face_culling_set_doc},
394 pygpu_state_front_facing_set_doc},
395 {
"program_point_size_set",
398 pygpu_state_program_point_size_set_doc},
402 PyDoc_STRVAR(pygpu_state__tp_doc,
"This module provides access to the gpu state.");
404 PyModuleDef_HEAD_INIT,
405 .m_name =
"gpu.state",
406 .m_doc = pygpu_state__tp_doc,
typedef float(TangentPoint)[2]
_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 GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 width
_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 y
void GPU_program_point_size(bool enable)
void GPU_face_culling(eGPUFaceCullTest culling)
@ GPU_BLEND_ADDITIVE_PREMULT
@ GPU_BLEND_ALPHA_PREMULT
void GPU_blend(eGPUBlend blend)
void GPU_line_width(float width)
float GPU_line_width_get(void)
void GPU_depth_mask(bool depth)
void GPU_color_mask(bool r, bool g, bool b, bool a)
void GPU_viewport_size_get_i(int coords[4])
eGPUBlend GPU_blend_get(void)
void GPU_front_facing(bool invert)
void GPU_viewport(int x, int y, int width, int height)
void GPU_point_size(float size)
bool GPU_depth_mask_get(void)
@ GPU_DEPTH_GREATER_EQUAL
eGPUDepthTest GPU_depth_test_get(void)
void GPU_depth_test(eGPUDepthTest test)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static PyObject * pygpu_state_depth_mask_set(PyObject *UNUSED(self), PyObject *value)
static const struct PyC_StringEnumItems pygpu_state_faceculling_items[]
static PyObject * pygpu_state_viewport_set(PyObject *UNUSED(self), PyObject *args)
static PyObject * pygpu_state_blend_set(PyObject *UNUSED(self), PyObject *value)
static const struct PyC_StringEnumItems pygpu_state_depthtest_items[]
static PyObject * pygpu_state_front_facing_set(PyObject *UNUSED(self), PyObject *value)
static PyObject * pygpu_state_blend_get(PyObject *UNUSED(self))
static PyObject * pygpu_state_depth_mask_get(PyObject *UNUSED(self))
static PyObject * pygpu_state_depth_test_set(PyObject *UNUSED(self), PyObject *value)
PyDoc_STRVAR(pygpu_state_blend_set_doc, ".. function:: blend_set(mode)\n" "\n" " Defines the fixed pipeline blending equation.\n" "\n" " :param mode: The type of blend mode.\n" " * ``NONE`` No blending.\n" " * ``ALPHA`` The original color channels are interpolated according to the alpha " "value.\n" " * ``ALPHA_PREMULT`` The original color channels are interpolated according to the " "alpha value with the new colors pre-multiplied by this value.\n" " * ``ADDITIVE`` The original color channels are added by the corresponding ones.\n" " * ``ADDITIVE_PREMULT`` The original color channels are added by the corresponding ones " "that are pre-multiplied by the alpha value.\n" " * ``MULTIPLY`` The original color channels are multiplied by the corresponding ones.\n" " * ``SUBTRACT`` The original color channels are subtracted by the corresponding ones.\n" " * ``INVERT`` The original color channels are replaced by its complementary color.\n" " :type mode: str\n")
static PyObject * pygpu_state_point_size_set(PyObject *UNUSED(self), PyObject *value)
static PyObject * pygpu_state_face_culling_set(PyObject *UNUSED(self), PyObject *value)
static PyObject * pygpu_state_program_point_size_set(PyObject *UNUSED(self), PyObject *value)
static PyObject * pygpu_state_line_width_get(PyObject *UNUSED(self))
static PyObject * pygpu_state_viewport_get(PyObject *UNUSED(self), PyObject *UNUSED(args))
static struct PyMethodDef pygpu_state__tp_methods[]
static PyObject * pygpu_state_line_width_set(PyObject *UNUSED(self), PyObject *value)
static PyObject * pygpu_state_color_mask_set(PyObject *UNUSED(self), PyObject *args)
static PyModuleDef pygpu_state_module_def
static PyObject * pygpu_state_depth_test_get(PyObject *UNUSED(self))
PyObject * bpygpu_state_init(void)
static const struct PyC_StringEnumItems pygpu_state_blend_items[]
int PyC_ParseStringEnum(PyObject *o, void *p)
const char * PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, const int value)
int PyC_ParseBool(PyObject *o, void *p)
#define PyTuple_SET_ITEMS(op_arg,...)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)