/** * Returns a scene object that renders a quad with the specified shader. * * The quad includes normals, tangents, or bitangents. * * @param shader The shader used to render the object. * @param center The object's center, specified in scene coordinates. * @param rotation The object's rotation, specified in degrees. * @param width The object's width, specified in scene coordinates. * @param height The object's height, specified in scene coordinates. * @return The quad scene object. * * @threadAnyGL */ VuoSceneObject VuoSceneObject_makeQuadWithNormals(VuoShader shader, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal height) { return VuoSceneObject_make( VuoMesh_makeQuad(), shader, VuoTransform_makeEuler( center, VuoPoint3d_multiply(rotation, M_PI/180.), VuoPoint3d_make(width,height,1) ), NULL ); }
/** * Returns a scene object consisting of 6 child objects (square quads), each with its own shader. */ VuoSceneObject VuoSceneObject_makeCube(VuoTransform transform, VuoShader frontShader, VuoShader leftShader, VuoShader rightShader, VuoShader backShader, VuoShader topShader, VuoShader bottomShader) { VuoList_VuoSceneObject cubeChildObjects = VuoListCreate_VuoSceneObject(); VuoMesh quadMesh = VuoMesh_makeQuad(); // Front Face { VuoSceneObject so = VuoSceneObject_make( quadMesh, frontShader, VuoTransform_makeEuler(VuoPoint3d_make(0,0,.5), VuoPoint3d_make(0,0,0), VuoPoint3d_make(1,1,1)), NULL ); VuoListAppendValue_VuoSceneObject(cubeChildObjects, so); } // Left Face { VuoSceneObject so = VuoSceneObject_make( quadMesh, leftShader, VuoTransform_makeEuler(VuoPoint3d_make(-.5,0,0), VuoPoint3d_make(0,-M_PI/2.,0), VuoPoint3d_make(1,1,1)), NULL ); VuoListAppendValue_VuoSceneObject(cubeChildObjects, so); } // Right Face { VuoSceneObject so = VuoSceneObject_make( quadMesh, rightShader, VuoTransform_makeEuler(VuoPoint3d_make(.5,0,0), VuoPoint3d_make(0,M_PI/2.,0), VuoPoint3d_make(1,1,1)), NULL ); VuoListAppendValue_VuoSceneObject(cubeChildObjects, so); } // Back Face { VuoSceneObject so = VuoSceneObject_make( quadMesh, backShader, VuoTransform_makeEuler(VuoPoint3d_make(0,0,-.5), VuoPoint3d_make(0,M_PI,0), VuoPoint3d_make(1,1,1)), NULL ); VuoListAppendValue_VuoSceneObject(cubeChildObjects, so); } // Top Face { VuoSceneObject so = VuoSceneObject_make( quadMesh, topShader, VuoTransform_makeEuler(VuoPoint3d_make(0,.5,0), VuoPoint3d_make(-M_PI/2.,0,0), VuoPoint3d_make(1,1,1)), NULL ); VuoListAppendValue_VuoSceneObject(cubeChildObjects, so); } // Bottom Face { VuoSceneObject so = VuoSceneObject_make( quadMesh, bottomShader, VuoTransform_makeEuler(VuoPoint3d_make(0,-.5,0), VuoPoint3d_make(M_PI/2.,0,0), VuoPoint3d_make(1,1,1)), NULL ); VuoListAppendValue_VuoSceneObject(cubeChildObjects, so); } return VuoSceneObject_make(NULL, NULL, transform, cubeChildObjects); }
* 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 ); }