Пример #1
0
struct nodeInstanceData *nodeInstanceInit(void)
{
	struct nodeInstanceData *context = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData));

	context->glContext = VuoGlContext_use();

	context->sceneRenderer = VuoSceneRenderer_make(context->glContext);
	VuoRetain(context->sceneRenderer);

	VuoRegister(context, free);
	return context;
}
Пример #2
0
struct nodeInstanceData * nodeInstanceInit(void)
{
    struct nodeInstanceData * instance = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData));
    VuoRegister(instance, free);

    instance->glContext = VuoGlContext_use();

    instance->imageRenderer = VuoImageRenderer_make(instance->glContext);
    VuoRetain(instance->imageRenderer);

    return instance;
}
Пример #3
0
struct nodeInstanceData * nodeInstanceInit(void)
{
	struct nodeInstanceData * instance = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData));
	VuoRegister(instance, free);

	instance->glContext = VuoGlContext_use();

	instance->imageRenderer = VuoImageRenderer_make(instance->glContext);
	VuoRetain(instance->imageRenderer);

	instance->shader = VuoShader_makeUnlitColorShader( VuoColor_makeWithRGBA(1.,1.,1.,1.) );
	VuoRetain(instance->shader);

	return instance;
}
struct nodeInstanceData * nodeInstanceInit(void)
{
	struct nodeInstanceData * instance = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData));
	VuoRegister(instance, free);

	instance->glContext = VuoGlContext_use();

	instance->imageRenderer = VuoImageRenderer_make(instance->glContext);
	VuoRetain(instance->imageRenderer);

	VuoList_VuoColor colors = VuoListCreate_VuoColor();
	VuoRetain(colors);

	instance->shader = VuoShader_makeRadialGradientShader(colors, VuoPoint2d_make(0., 0.), 1., 1., 1.);
	VuoRetain(instance->shader);

	VuoRelease(colors);

	return instance;
}
Пример #5
0
/**
 * Returns a color-mapped copy of @a image.  (Or, if @a colors is empty, returns @a image.)
 */
VuoImage VuoImage_mapColors(VuoImage image, VuoList_VuoColor colors, VuoReal filterOpacity)
{
	if (!image)
		return NULL;

	if (!colors)
		return image;

	VuoGlContext glContext = VuoGlContext_use();
	VuoImageRenderer imageRenderer = VuoImageRenderer_make(glContext);
	VuoRetain(imageRenderer);

	static const char * fragmentShaderSource = VUOSHADER_GLSL_SOURCE(120,

		uniform float gradientCount;
		uniform sampler2D image;		// the unfiltered image
		uniform sampler2D gradientStrip;// the gradient strip to map against
		uniform float amount;			// the amount to mix gradient and image
		varying vec4 fragmentTextureCoordinate;

		// https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color
		float brightness(vec3 col)
		{
			// Digital CCIR601 (gives more weight to the green and red components):
			return 0.299*col.r + 0.587*col.g + 0.114*col.b;
		}

		void main(void)
		{
			vec4 orig = texture2D(image, fragmentTextureCoordinate.xy);

			float lum = brightness(orig.rgb);

			float gradientWidth = (1./gradientCount)/2.;
			lum = lum * (1-gradientWidth*2) + gradientWidth;

			vec4 color = texture2D(gradientStrip, vec2(clamp(lum, gradientWidth, 1-gradientWidth), .5));

			gl_FragColor = mix(orig, color, amount) * orig.a;
		}
Пример #6
0
	context->serverName = newServerName;
	VuoRetain(context->serverName);

	VuoSyphonServer_setName(context->syphonServer, newServerName);
}


struct nodeInstanceData * nodeInstanceInit
(
		VuoInputData(VuoText, "") serverName
)
{
	struct nodeInstanceData *context = (struct nodeInstanceData *)calloc(1,sizeof(struct nodeInstanceData));
	VuoRegister(context, free);

	context->glContext = VuoGlContext_use();

	context->syphonServer = VuoSyphonServer_make(serverName, context->glContext);
	VuoRetain(context->syphonServer);

	return context;
}

void nodeInstanceEvent
(
		VuoInputData(VuoText, "") serverName,
		VuoInputData(VuoImage) sendImage,
		VuoInputEvent({"eventBlocking":"none","data":"sendImage"}) sendImageEvent,
		VuoInstanceData(struct nodeInstanceData *) context
)
{