Vuo
1.2.1
|
VuoShader C type definition.
Classes | |
struct | VuoSubshader |
References to shader source code and shader code uploaded to the GPU. More... | |
struct | VuoShaderUniform |
Holds values to eventually be assigned to a GL Program Object's uniforms. More... | |
struct | _VuoShader |
A graphics shader program, specifying how to render a 3D object. More... | |
union | VuoShaderUniform.value |
Typedefs | |
typedef struct _VuoShader * | VuoShader |
A graphics shader program, specifying how to render a 3D object. | |
Functions | |
Creating standard shaders | |
VuoShader | VuoShader_makeDefaultShader (void) |
Returns a shared instance of the default (unlit checkerboard) shader. | |
VuoShader | VuoShader_makeUnlitImageShader (VuoImage image, VuoReal alpha) |
Returns a shader that renders objects with an image (ignoring lighting). | |
VuoShader | VuoShader_makeUnlitAlphaPassthruImageShader (VuoImage image, bool flipped) |
Returns a shader that renders objects with an image (ignoring lighting). | |
VuoShader | VuoShader_makeGlTextureRectangleShader (VuoImage image, VuoReal alpha) |
Returns a shader that renders objects with an image (ignoring lighting). | |
VuoShader | VuoShader_makeGlTextureRectangleAlphaPassthruShader (VuoImage image, bool flipped) |
Returns a shader that renders objects with an image (ignoring lighting). | |
VuoShader | VuoShader_makeUnlitColorShader (VuoColor color) |
Returns a shader that renders a solid color . | |
VuoShader | VuoShader_makeUnlitCircleShader (VuoColor color, VuoReal sharpness) |
Returns a shader that renders a solid color circle. | |
VuoShader | VuoShader_makeUnlitRoundedRectangleShader (VuoColor color, VuoReal sharpness, VuoReal roundness, VuoReal aspect) |
Returns a shader that renders a solid color rounded rectangle. | |
VuoShader | VuoShader_makeLitColorShader (VuoColor diffuseColor, VuoColor highlightColor, VuoReal shininess) |
Returns a shader that renders a color with lighting. | |
VuoShader | VuoShader_makeLitImageShader (VuoImage image, VuoReal alpha, VuoColor highlightColor, VuoReal shininess) |
Returns a shader that renders an image with lighting. | |
VuoShader | VuoShader_makeLitImageDetailsShader (VuoImage image, VuoReal alpha, VuoImage specularImage, VuoImage normalImage) |
Returns a shader that renders an image with lighting and surface details. | |
VuoShader | VuoShader_makeLinearGradientShader (VuoList_VuoColor colors, VuoPoint2d start, VuoPoint2d end, VuoReal noiseAmount) |
Returns a shader that renders a linear gradient using the provided colors and start and end coordinates. | |
VuoShader | VuoShader_makeRadialGradientShader (VuoList_VuoColor colors, VuoPoint2d center, VuoReal radius, VuoReal width, VuoReal height, VuoReal noiseAmount) |
Returns a shader that renders a radial gradient using the provided colors, center point, and radius. | |
VuoShader | VuoShader_makeFrostedGlassShader (void) |
Returns a frosted glass shader. | |
void | VuoShader_setFrostedGlassShaderValues (VuoShader shader, VuoColor color, VuoReal brightness, VuoReal noiseTime, VuoReal noiseAmount, VuoReal noiseScale, VuoReal chromaticAberration, VuoInteger iterations) |
Sets parameters for the frosted glass shader. | |
Using shaders | |
bool | VuoShader_isTransformFeedback (VuoShader shader) |
Returns true if each of shader 's defined inputPrimitiveMode s has a vertex shader (and optionally a geometry shader) but lacks a fragment shader. | |
unsigned int | VuoShader_getExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode) |
Returns the number of primitives the geometry shader is expected to produce per invocation. | |
bool | VuoShader_getMayChangeOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode) |
Returns true if the geometry shader may not output the expected primitive count. | |
bool | VuoShader_getAttributeLocations (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, int *positionLocation, int *normalLocation, int *tangentLocation, int *bitangentLocation, int *textureCoordinateLocation) |
Outputs the shader program's vertex attribute locations (the same values as glGetAttribLocation() ). | |
bool | VuoShader_activate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, VuoGlProgram *outputProgram) |
Activates the shader program (glUseProgram() ) on the specified glContext , binds the shader's images to texture units, and uploads its unforms, so that the shader is ready for use in rendering. | |
void | VuoShader_deactivate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext) |
Deactivates the shader program on the specified glContext , and unbinds the shader's images from their texture units. | |
void | VuoShader_cleanupContext (VuoGlContext glContext) |
Returns the context's shader state to normal (and clears VuoShader's internal cache). | |
void | VuoShader_setUniform_VuoImage (VuoShader shader, const char *uniformIdentifier, const VuoImage image) |
Sets a VuoImage input value on the specified shader . | |
void | VuoShader_setUniform_VuoBoolean (VuoShader shader, const char *uniformIdentifier, const VuoBoolean boolean) |
Sets a bool uniform value on the specified shader . | |
void | VuoShader_setUniform_VuoInteger (VuoShader shader, const char *uniformIdentifier, const VuoInteger integer) |
Sets an int uniform value on the specified shader . | |
void | VuoShader_setUniform_VuoReal (VuoShader shader, const char *uniformIdentifier, const VuoReal real) |
Sets a float uniform value on the specified shader . | |
void | VuoShader_setUniform_VuoPoint2d (VuoShader shader, const char *uniformIdentifier, const VuoPoint2d point2d) |
Sets a vec2 uniform value on the specified shader . | |
void | VuoShader_setUniform_VuoPoint3d (VuoShader shader, const char *uniformIdentifier, const VuoPoint3d point3d) |
Sets a vec3 uniform value on the specified shader . | |
void | VuoShader_setUniform_VuoPoint4d (VuoShader shader, const char *uniformIdentifier, const VuoPoint4d point4d) |
Sets a vec4 uniform value on the specified shader . | |
void | VuoShader_setUniform_VuoColor (VuoShader shader, const char *uniformIdentifier, const VuoColor color) |
Sets a color uniform value on the specified shader accepting a VuoColor. | |
VuoShader | VuoShader_make_VuoColor (VuoColor color) |
Creates an unlit color shader object. | |
VuoShader | VuoShader_make_VuoShader (VuoShader shader) |
Returns the passed shader (does not make a copy). | |
VuoShader | VuoShader_make_VuoImage (VuoImage image) |
Creates an unlit image shader. | |
VuoImage | VuoShader_getUniform_VuoImage (VuoShader shader, const char *uniformIdentifier) |
Returns the VuoImage for the specified uniformIdentifier , or NULL if none matches. | |
VuoPoint2d | VuoShader_samplerCoordinatesFromVuoCoordinates (VuoPoint2d vuoCoordinates, VuoImage image) |
Converts the provided vuoCoordinates into GLSL Sampler Coordinates relative to the provided image . | |
VuoReal | VuoShader_samplerSizeFromVuoSize (VuoReal vuoSize) |
Converts an x-axis distance in Vuo Coordinates into GLSL Sampler Coordinates. | |
Summary, serialization, and reference counting | |
char * | VuoShader_getSummary (const VuoShader value) |
Returns a summary of the shader: the text description provided to VuoShader_make. | |
VuoShader | VuoShader_makeFromJson (struct json_object *js) |
Decodes the JSON object js , expected to contain a 64-bit integer (memory address or 0), to create a new VuoShader . | |
struct json_object * | VuoShader_getJson (const VuoShader value) |
Encodes value as a JSON object. | |
VuoShader | VuoShader_makeFromString (const char *str) |
Automatically generated function. | |
char * | VuoShader_getString (const VuoShader value) |
Automatically generated function. | |
void | VuoShader_retain (VuoShader value) |
Automatically generated function. | |
void | VuoShader_release (VuoShader value) |
Automatically generated function. | |
Creating shaders from GLSL source code | |
#define | VUOSHADER_GLSL_SOURCE(version, source) "#version " #version "\n" #source |
A macro to facilitate defining a GLSL shader in a C source file. | |
VuoShader | VuoShader_make (const char *name) |
Creates a shader object, which contains multiple GL Program Objects. | |
void | VuoShader_addSource (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const char *vertexShaderSource, const char *geometryShaderSource, const char *fragmentShaderSource) |
Associates GLSL shader source code with the specified inputPrimitiveMode of the specified shader . | |
void | VuoShader_setExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const unsigned int expectedOutputPrimitiveCount) |
Specifies the number of primitives the geometry shader is expected to produce per invocation. | |
void | VuoShader_setMayChangeOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const bool mayChangeOutputPrimitiveCount) |
Specifies whether the geometry shader may dynamically choose to skip outputting some primitives or output additional primitives. | |