Esempio n. 1
0
/**
 * @ingroup VuoSceneObject
 * Returns an ambient light with the specified @c color and @c brightness (typically between 0 and 1).
 */
VuoSceneObject VuoSceneObject_makeAmbientLight(VuoColor color, float brightness)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_AmbientLight;
	o.lightColor = color;
	o.lightBrightness = brightness;
	return o;
}
Esempio n. 2
0
/**
 * Returns a scene object representing deferred-rendered text.
 *
 * @threadAny
 */
VuoSceneObject VuoSceneObject_makeText(VuoText text, VuoFont font)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_Text;
	o.text = text;
	o.font = font;
	return o;
}
Esempio n. 3
0
/**
 * @ingroup VuoSceneObject
 * Returns a point light (uniform emission in all directions).
 *
 * @param color The light's color.
 * @param brightness The light's brightness multiplier (typically between 0 and 1).
 * @param position The light's position.
 * @param range The distance (in local coordinates) the light reaches.
 * @param sharpness The sharpness of the light's distance falloff.  0 means the light starts fading at distance 0 and ends at 2*lightRange.  1 means the falloff is instant.
 */
VuoSceneObject VuoSceneObject_makePointLight(VuoColor color, float brightness, VuoPoint3d position, float range, float sharpness)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_PointLight;
	o.lightColor = color;
	o.lightBrightness = brightness;
	o.lightRange = range;
	o.lightSharpness = MAX(MIN(sharpness,1),0);
	o.transform = VuoTransform_makeEuler(position, VuoPoint3d_make(0,0,0), VuoPoint3d_make(1,1,1));
	return o;
}
Esempio n. 4
0
/**
 * Returns an orthographic camera having the position and negative-rotation specified by @c transform (its scale is ignored).
 */
VuoSceneObject VuoSceneObject_makeOrthographicCamera(VuoText name, VuoTransform transform, float width, float distanceMin, float distanceMax)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_OrthographicCamera;
	o.name = name;
	o.transform = transform;
	o.cameraWidth = width;
	o.cameraDistanceMin = distanceMin;
	o.cameraDistanceMax = distanceMax;
	return o;
}
Esempio n. 5
0
/**
 * Returns a perspective camera having the position and negative-rotation specified by @c transform (its scale is ignored).
 */
VuoSceneObject VuoSceneObject_makePerspectiveCamera(VuoText name, VuoTransform transform, float fieldOfView, float distanceMin, float distanceMax)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_PerspectiveCamera;
	o.name = name;
	o.transform = transform;
	o.cameraFieldOfView = fieldOfView;
	o.cameraDistanceMin = distanceMin;
	o.cameraDistanceMax = distanceMax;
	return o;
}
Esempio n. 6
0
/**
 * @ingroup VuoSceneObject
 * Returns a spot light (emists only in the specified direction).
 *
 * @param color The light's color.
 * @param brightness The light's brightness multiplier (typically between 0 and 1).
 * @param transform The position and direction of the light.  (The transform's scale is ignored.)
 * @param cone Width (in radians) of the light's cone.
 * @param range The distance (in local coordinates) the light reaches.
 * @param sharpness The sharpness of the light's distance/cone falloff.  0 means the light starts fading at distance/angle 0 and ends at 2*range or 2*cone.  1 means the falloff is instant.
 */
VuoSceneObject VuoSceneObject_makeSpotlight(VuoColor color, float brightness, VuoTransform transform, float cone, float range, float sharpness)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_Spotlight;
	o.lightColor = color;
	o.lightBrightness = brightness;
	o.lightCone = cone;
	o.lightRange = range;
	o.lightSharpness = MAX(MIN(sharpness,1),0);
	o.transform = transform;
	return o;
}
Esempio n. 7
0
/**
 * Returns a stereoscopic camera having the position and negative-rotation specified by @c transform (its scale is ignored).
 */
VuoSceneObject VuoSceneObject_makeStereoCamera(VuoText name, VuoTransform transform, VuoReal fieldOfView, VuoReal distanceMin, VuoReal distanceMax, VuoReal confocalDistance, VuoReal intraocularDistance)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();
	o.type = VuoSceneObjectType_StereoCamera;
	o.name = name;
	o.transform = transform;
	o.cameraFieldOfView = fieldOfView;
	o.cameraDistanceMin = distanceMin;
	o.cameraDistanceMax = distanceMax;
	o.cameraConfocalDistance = confocalDistance;
	o.cameraIntraocularDistance = intraocularDistance;
	return o;
}
Esempio n. 8
0
/**
 * Returns a lit scene object with the specified @c image.
 *
 * @threadAnyGL
 */
VuoSceneObject VuoSceneObject_makeLitImage(VuoImage image, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal alpha, VuoColor highlightColor, VuoReal shininess)
{
	if (!image)
		return VuoSceneObject_makeEmpty();

	return VuoSceneObject_makeQuadWithNormals(
				VuoShader_makeLitImageShader(image, alpha, highlightColor, shininess),
				center,
				rotation,
				width,
				image->pixelsHigh * width/image->pixelsWide
			);
}
Esempio n. 9
0
/**
 * Returns an unlit scene object with the specified @c image.
 *
 * @threadAnyGL
 */
VuoSceneObject VuoSceneObject_makeImage(VuoImage image, VuoPoint3d center, VuoPoint3d rotation, VuoReal width, VuoReal alpha)
{
	if (!image)
		return VuoSceneObject_makeEmpty();

	VuoSceneObject object = VuoSceneObject_makeQuad(
				VuoShader_makeUnlitImageShader(image, alpha),
				center,
				rotation,
				width,
				image->pixelsHigh * width/image->pixelsWide
			);

	return object;
}
Esempio n. 10
0
/**
 * Creates a visible (mesh) scene object.
 */
VuoSceneObject VuoSceneObject_make(VuoMesh mesh, VuoShader shader, VuoTransform transform, VuoList_VuoSceneObject childObjects)
{
	VuoSceneObject o = VuoSceneObject_makeEmpty();

	o.type = VuoSceneObjectType_Mesh;

	o.mesh = mesh;

	if (mesh && !shader)
		o.shader = VuoShader_makeDefaultShader();
	else
		o.shader = shader;

	o.childObjects = childObjects;

	o.transform = transform;

	return o;
}
Esempio n. 11
0
					 "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
			));
	}
}