/** *@file * vuo.math.noise node implementation. * * @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleDetails({ "name" : "Make Noise", "description" : "Generates noise.", "keywords" : [ ], "version" : "1.0.0", "node": { "isInterface" : false } }); void nodeEvent ( VuoInputData(VuoNoise, "white") noise, VuoOutputData(VuoReal) value ) { // do something }
/** * @file * vuo.type.list.point3d.real.x node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title": "Convert 3D Point List to Real List", "description": "Creates a list of real numbers using the X coordinate of the input list of 3D points.", "version": "1.0.0" }); void nodeEvent ( VuoInputData(VuoList_VuoPoint3d) point3d, VuoOutputData(VuoList_VuoReal) x ) { *x = VuoListCreate_VuoReal(); unsigned long count = VuoListGetCount_VuoPoint3d(point3d); for (unsigned long i = 1; i <= count; ++i) VuoListAppendValue_VuoReal(*x, VuoListGetValue_VuoPoint3d(point3d, i).x); }
/** * @file * vuo.test.releaseWithoutRegister node implementation. * * @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the GNU Lesser General Public License (LGPL) version 2 or later. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Release without Register", "description" : "This node class contains an intentional bug for testing.", "version" : "1.0.0", "node": { "isInterface" : false } }); void nodeEvent ( VuoOutputData(VuoInteger) outEvent ) { char *x = malloc(1); VuoRelease(x); // intentional bug *outEvent = 0; }
"title" : "Find Minimum", "keywords" : [ "less", "least", "small", "few", "low", "<", "bottom", "lower", "limit", "bound", "range" ], "version" : "1.0.0", "genericTypes" : { "VuoGenericType1" : { "defaultType" : "VuoReal", "compatibleTypes" : [ "VuoInteger", "VuoReal" ] } }, "node": { "isInterface" : false } }); void nodeEvent ( VuoInputData(VuoList_VuoGenericType1) terms, VuoOutputData(VuoGenericType1) min ) { unsigned long termsCount = VuoListGetCount_VuoGenericType1(terms); VuoGenericType1 *termsArray = (VuoGenericType1 *)malloc(termsCount * sizeof(VuoGenericType1)); for (unsigned long i = 0; i < termsCount; ++i) termsArray[i] = VuoListGetValueAtIndex_VuoGenericType1(terms, i+1); *min = VuoGenericType1_min(termsArray, termsCount); free(termsArray); }
#include "node.h" #include "VuoPoint3d.h" VuoModuleMetadata({ "title" : "Get 3D Object Bounds", "keywords" : [ "box", "aabb", "axis", "collider", "collision", "volume" ], "version" : "1.0.0", "node": { "isInterface" : false, "exampleCompositions" : [ "DisplaySceneWithFloor.vuo" ] } }); void nodeEvent ( VuoInputData(VuoSceneObject) object, VuoOutputData(VuoPoint3d) center, VuoOutputData(VuoReal) width, VuoOutputData(VuoReal) height, VuoOutputData(VuoReal) depth ) { VuoBox bounds = VuoSceneObject_bounds(object); *center = bounds.center; *width = bounds.size.x; *height = bounds.size.y; *depth = bounds.size.z; }
* @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" #include "VuoMakeVerticesFromPositions.h" VuoModuleMetadata({ "title" : "Make Point Vertices", "keywords" : [ ], "version" : "1.0.0", "genericTypes" : { "VuoGenericType1" : { "compatibleTypes" : [ "VuoPoint2d", "VuoPoint3d" ] } }, "node": { "isInterface" : false } }); void nodeEvent ( VuoInputData(VuoList_VuoGenericType1) positions, VuoOutputData(VuoVertices) vertices ) { *vertices = VuoMakeVerticesFromPositions_VuoGenericType1(positions, VuoVertices_Points); }
/** * @file * vuo.type.list.real.integer node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title": "Convert Real List to Integer List", "description": "Outputs a list containing integer approximations of the input list's real numbers. Real numbers are rounded to the nearest integer.", "version": "1.0.0" }); void nodeEvent ( VuoInputData(VuoList_VuoReal) reals, VuoOutputData(VuoList_VuoInteger) integers ) { *integers = VuoListCreate_VuoInteger(); unsigned long count = VuoListGetCount_VuoReal(reals); for (unsigned long i = 1; i <= count; ++i) VuoListAppendValue_VuoInteger(*integers, lround(VuoListGetValue_VuoReal(reals, i))); }
/** * @file * vuo.list.reverse node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Reverse List", "keywords" : [ "backward", "invert", "reorder" ], "version" : "1.0.0", "node" : { "exampleCompositions" : [ "ReverseGradient.vuo" ] } }); void nodeEvent ( VuoInputData(VuoList_VuoGenericType1) list, VuoOutputData(VuoList_VuoGenericType1) reversedList ) { *reversedList = VuoListCopy_VuoGenericType1(list); VuoListReverse_VuoGenericType1(*reversedList); }
#include "node.h" VuoModuleMetadata({ "title" : "Multiply", "keywords" : [ "product", "times", "*", "arithmetic", "calculate" ], "version" : "2.0.0", "genericTypes" : { "VuoGenericType1" : { "defaultType" : "VuoReal", "compatibleTypes" : [ "VuoInteger", "VuoReal" ] } }, "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoList_VuoGenericType1) values, VuoOutputData(VuoGenericType1) product ) { unsigned long termsCount = VuoListGetCount_VuoGenericType1(values); *product = 1; if (termsCount) for (unsigned long i = 1; i <= termsCount; ++i) *product *= VuoListGetValue_VuoGenericType1(values, i); }
* For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Make 3D Object", "keywords" : [ "mesh", "model", "vertices", "shader", "texture", "draw", "opengl", "scenegraph", "graphics" ], "version" : "2.0.0", "node": { "isInterface" : false, "exampleCompositions" : [ "DisplaySquare.vuo", "SpinSphere.vuo" ] } }); void nodeEvent ( VuoInputData(VuoMesh) mesh, VuoInputData(VuoShader) shader, VuoInputData(VuoTransform) transform, VuoOutputData(VuoSceneObject) object ) { *object = VuoSceneObject_make( mesh, shader, transform, NULL ); }
"title" : "Count Executions", "description" : "Keeps track of how many times this node has been executed, and outputs that count.", "keywords" : [ ], "version" : "1.0.0", "dependencies" : [ ], "node": { "isInterface" : false } }); VuoInteger * nodeInstanceInit() { VuoInteger *countState = (VuoInteger *) malloc(sizeof(VuoInteger)); VuoRegister(countState, free); *countState = 0; return countState; } void nodeInstanceEvent ( VuoInstanceData(VuoInteger *) countState, VuoOutputData(VuoInteger) count ) { *count = ++(**countState); } void nodeInstanceFini(VuoInstanceData(VuoInteger *) countState) { }
* vuo.transform.combine node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Combine Transforms", "keywords" : [ "composite", "product", "multiply", "merge" ], "version" : "1.0.0", "node": { "exampleCompositions" : [ "TiltAndOrbitCube.vuo" ] } }); void nodeEvent ( VuoInputData(VuoList_VuoTransform) transforms, VuoOutputData(VuoTransform) composite ) { *composite = VuoTransform_makeIdentity(); unsigned long transformCount = VuoListGetCount_VuoTransform(transforms); for (unsigned long i = 1; i <= transformCount; ++i) *composite = VuoTransform_composite(*composite, VuoListGetValue_VuoTransform(transforms, i)); }
/** * @file * vuo.data.share node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Share Value", "keywords" : [ "splitter", "input splitter", "output splitter", "hold", "pass", "preserve", "keep", "constant", "identity", "convert" ], "version" : "1.0.0" }); void nodeEvent ( VuoInputData(VuoGenericType1) value, VuoOutputData(VuoGenericType1) sameValue ) { *sameValue = value; }
* @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Make Cube", "keywords" : [ "box", "d6", "hexahedron", "Platonic", "rectangular", "square" ], "version" : "1.0.0", "node": { "isInterface" : false } }); void nodeEvent ( VuoInputData(VuoTransform) transform, VuoInputData(VuoShader) frontShader, VuoInputData(VuoShader) leftShader, VuoInputData(VuoShader) rightShader, VuoInputData(VuoShader) backShader, VuoInputData(VuoShader) topShader, VuoInputData(VuoShader) bottomShader, VuoOutputData(VuoSceneObject) cube ) { *cube = VuoSceneObject_makeCube(transform, frontShader, leftShader, rightShader, backShader, topShader, bottomShader); }
* @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" #include "VuoImageRenderer.h" VuoModuleMetadata({ "title" : "Get Image Size", "keywords" : [ "width", "height", "dimensions" ], "version" : "1.0.0", "node" : { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoImage) image, VuoOutputData(VuoInteger) width, VuoOutputData(VuoInteger) height ) { if (!image) return; *width = image->pixelsWide; *height = image->pixelsHigh; }
/** * @file * vuo.transform.get.translation.2d node implementation. * * @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Get 2D Transform Translation", "keywords" : [ ], "version" : "1.0.0", "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoTransform2d) transform, VuoOutputData(VuoPoint2d) translation ) { *translation = transform.translation; }
* @file * vuo.logic.areAnyTrue node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Are Any True", "keywords" : [ "boolean", "condition", "test", "check", "gate", "or", "||", "0", "1", "false" ], "version" : "2.0.0", "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoList_VuoBoolean) values, VuoOutputData(VuoBoolean) anyTrue ) { *anyTrue = false; unsigned long termsCount = VuoListGetCount_VuoBoolean(values); for (unsigned long i = 1; i <= termsCount; ++i) *anyTrue = *anyTrue || VuoListGetValue_VuoBoolean(values, i); }
#include "VuoAudioSamples.h" #include "VuoList_VuoAudioSamples.h" #include <OpenGL/CGLMacro.h> VuoModuleMetadata({ "title" : "Make Image from Channels", "keywords" : [ "waveform", "amplitudes" ], "version" : "1.0.0" }); void nodeEvent ( VuoInputData(VuoList_VuoAudioSamples) channels, VuoOutputData(VuoImage) image ) { VuoInteger rows = VuoListGetCount_VuoAudioSamples(channels); if (!rows) { *image = NULL; return; } VuoInteger columns = VuoListGetValueAtIndex_VuoAudioSamples(channels, 1).sampleCount; unsigned char *pixels = (unsigned char *)calloc(1, rows*columns); for (VuoInteger row = 0; row < rows; ++row) { VuoAudioSamples rowSamples = VuoListGetValueAtIndex_VuoAudioSamples(channels, row+1);
* For more information, see http://vuo.org/license. */ #include "node.h" #include "VuoSceneObject.h" VuoModuleMetadata({ "title" : "Change All Shaders", "keywords" : [ "swap", "replace", "texture", "material" ], "version" : "2.0.0", "node": { "exampleCompositions" : [ "PaintSceneWithCheckerboard.vuo", "CompareCameras.vuo" ] } }); void nodeEvent ( VuoInputData(VuoSceneObject) object, VuoInputData(VuoShader) shader, VuoOutputData(VuoSceneObject) shadedObject ) { VuoSceneObject copy = VuoSceneObject_copy(object); VuoSceneObject_apply(©, ^(VuoSceneObject *currentObject, float modelviewMatrix[16]){ currentObject->shader = shader; }); *shadedObject = copy; }
* @file * vuo.midi.get.pitchBend node implementation. * * @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" #include "VuoMidiPitchBend.h" VuoModuleMetadata({ "title" : "Get Pitch Bend Values", "keywords" : [ "wheel", "semitone", "wholetone", "tone", "frequency", "synthesizer", "sequencer", "music", "instrument" ], "version" : "1.0.0", "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoMidiPitchBend) pitchBend, VuoOutputData(VuoInteger) channel, VuoOutputData(VuoInteger) value ) { *channel = pitchBend.channel; *value = pitchBend.value; }
* This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" #include "VuoMidiNote.h" VuoModuleMetadata({ "title" : "Get Note Values", "keywords" : [ "pitch", "tone", "synthesizer", "music", "instrument" ], "version" : "1.0.0", "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoMidiNote) note, VuoOutputData(VuoInteger) channel, VuoOutputData(VuoBoolean) isNoteOn, VuoOutputData(VuoInteger) velocity, VuoOutputData(VuoInteger) noteNumber ) { *channel = note.channel; *isNoteOn = note.isNoteOn; *velocity = note.velocity; *noteNumber = note.noteNumber; }
#include "node.h" VuoModuleMetadata({ "title" : "Copy 3D Object with Transforms", "keywords" : [ "duplicate", "clone", "array", "instance", "instantiate", "populate", "replicate" ], "version" : "2.0.0", "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoInputData(VuoSceneObject) object, VuoInputData(VuoList_VuoTransform) transforms, VuoOutputData(VuoSceneObject) copies ) { *copies = VuoSceneObject_makeEmpty(); copies->childObjects = VuoListCreate_VuoSceneObject(); for(int i = 0; i < VuoListGetCount_VuoTransform(transforms); i++) { VuoTransform transform = VuoListGetValue_VuoTransform(transforms, i+1); VuoListAppendValue_VuoSceneObject(copies->childObjects, VuoSceneObject_make( object.mesh, object.shader, transform, object.childObjects ));
/** * @file * vuo.vertices.make.square node implementation. * * @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Make Square Mesh", "keywords" : [ "quad", "rectangle", "plane", "4-gon", "4gon", "shape", "billboard", "sprite" ], "version" : "2.0.0", "node": { "exampleCompositions" : [ ] } }); void nodeEvent ( VuoOutputData(VuoMesh) mesh ) { *mesh = VuoMesh_makeQuad(); }
"title" : "Mix Audio Channels", "keywords" : [ "sound", "music", "merge", "combine" ], "version" : "1.0.0", "dependencies" : [ "VuoAudio" ], "node": { "isInterface" : false, "exampleCompositions" : [ "PanAudio.vuo" ], } }); void nodeEvent ( VuoInputData(VuoList_VuoAudioSamples) audioSamples, VuoOutputData(VuoAudioSamples) mixedSamples ) { unsigned int channelCount = VuoListGetCount_VuoAudioSamples(audioSamples); *mixedSamples = VuoAudioSamples_alloc(VuoAudioSamples_bufferSize); for(unsigned int n = 0; n < (*mixedSamples).sampleCount; n++) (*mixedSamples).samples[n] = 0.; for(unsigned int i = 0; i < channelCount; i++) { VuoAudioSamples as = VuoListGetValueAtIndex_VuoAudioSamples(audioSamples, i+1); for(unsigned int n = 0; n < as.sampleCount; n++) (*mixedSamples).samples[n] += as.samples[n];
* For more information, see http://vuo.org/license. */ #include "node.h" #include "VuoGlContext.h" #include <OpenGL/CGLMacro.h> #include <stdio.h> VuoModuleMetadata({ "title" : "Text Contains", "keywords" : [ "has", "search", "str", "string" ], "version" : "1.0.0", "description": "Returns true if `text` contains `value`, false otherwise.", "node" : { "exampleCompositions" : [ "" ] } }); void nodeEvent ( VuoInputData(VuoText) text, VuoInputData(VuoText) value, VuoOutputData(VuoBoolean) contains ) { if(text == NULL || value == NULL) *contains = false; else *contains = strstr(text, value) != NULL; }
"compatibleTypes": [ "VuoBoolean", "VuoInteger", "VuoReal", "VuoText" ] }, "VuoGenericType4" : { "defaultType" : "VuoReal", "compatibleTypes": [ "VuoBoolean", "VuoInteger", "VuoReal", "VuoText" ] } }, "node": { "exampleCompositions": [ "ReceiveOsc.vuo" ] } }); void nodeEvent ( VuoInputData(VuoOscMessage) message, VuoOutputData(VuoText) address, VuoOutputData(VuoGenericType1) data1, VuoOutputData(VuoGenericType2) data2, VuoOutputData(VuoGenericType3) data3, VuoOutputData(VuoGenericType4) data4 ) { *address = message->address; int dataCount = VuoOscMessage_getDataCount(message); if (1 <= dataCount) *data1 = VuoGenericType1_valueFromJson(VuoOscMessage_getDataJson(message, 1)); if (2 <= dataCount) *data2 = VuoGenericType2_valueFromJson(VuoOscMessage_getDataJson(message, 2));
*/ #include "node.h" VuoModuleMetadata({ "title" : "Append Lists", "keywords" : [ "concatenate", "combine", "join", "together", "merge" ], "version" : "1.0.0", "node" : { "exampleCompositions" : [ "SpliceSquares.vuo" ] } }); void nodeEvent ( VuoInputData(VuoList_VuoGenericType1) list1, VuoInputData(VuoList_VuoGenericType1) list2, VuoOutputData(VuoList_VuoGenericType1) combinedList ) { *combinedList = VuoListCreate_VuoGenericType1(); unsigned long list1Count = VuoListGetCount_VuoGenericType1(list1); for (unsigned long i = 1; i <= list1Count; ++i) VuoListAppendValue_VuoGenericType1(*combinedList, VuoListGetValue_VuoGenericType1(list1, i)); unsigned long list2Count = VuoListGetCount_VuoGenericType1(list2); for (unsigned long i = 1; i <= list2Count; ++i) VuoListAppendValue_VuoGenericType1(*combinedList, VuoListGetValue_VuoGenericType1(list2, i)); }
#include "VuoLayer.h" VuoModuleMetadata({ "title" : "Copy Layer", "keywords" : [ "duplicate", "array", "instance", "instantiate", "populate" ], "version" : "1.0.0", "node": { "isInterface" : false } }); void nodeEvent ( VuoInputData(VuoLayer) layer, VuoInputData(VuoList_VuoTransform2d) transforms, VuoOutputData(VuoList_VuoLayer) copies ) { *copies = VuoListCreate_VuoLayer(); unsigned long transform_length = VuoListGetCount_VuoTransform2d(transforms); for(int i = 0; i < transform_length; i++) { VuoLayer o; o.sceneObject = layer.sceneObject; o.sceneObject.transform = VuoTransform_makeFrom2d(VuoListGetValueAtIndex_VuoTransform2d(transforms, i+1)); VuoListAppendValue_VuoLayer(*copies, o); } }
/** * @file * vuo.type.list.real.point3d.y node implementation. * * @copyright Copyright © 2012–2015 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title": "Convert Real List to 3D Point List", "description": "Creates a list of 3D points using the input real numbers as the Y coordinate, and 0 as the X and Z coordinates.", "version": "1.0.0" }); void nodeEvent ( VuoInputData(VuoList_VuoReal) y, VuoOutputData(VuoList_VuoPoint3d) point3d ) { *point3d = VuoListCreate_VuoPoint3d(); unsigned long count = VuoListGetCount_VuoReal(y); for (unsigned long i = 1; i <= count; ++i) VuoListAppendValue_VuoPoint3d(*point3d, VuoPoint3d_make(0, VuoListGetValue_VuoReal(y, i), 0)); }
* @copyright Copyright © 2012–2014 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see http://vuo.org/license. */ #include "node.h" VuoModuleMetadata({ "title" : "Vuoize Text", "description" : "Takes a text string and Vuoizes it (by prepending the word 'Vuo').", "keywords" : [ ], "version" : "1.0.0", "dependencies" : [ ], "node": { "isInterface" : false } }); void nodeEvent ( VuoInputData(VuoText) text, VuoOutputData(VuoText) vuoizedText ) { VuoText texts[2] = { "Vuo", text }; *vuoizedText = VuoText_append(texts, 2); }