/* BBBackgroundShape.m				 
 *
 * Renders a sphere that will serve as our background color..
 *
 * For more interface-info see the header file. More in depth information
 * can be found in the source-code.
 *
 * Written by: 		Thomas Engel
 * Created:    		24.05.1994 (Copyleft)
 * Last modified: 	24.05.1994
 */


#import "BBBackgroundShape.h"

@implementation BBBackgroundShape

- renderSelf:(RtToken)context
{
	// We will only render a sphere that is very very big.
	
	RiColor( backgroundColor );
	RiSphere( 10000, -10000, 10000, 360.0, RI_NULL );
	
	return self;
}

- setBackgroundColor:(NXColor)aColor
{
	NXConvertColorToRGB( aColor,
						 &backgroundColor[0], 
						 &backgroundColor[1], 
						 &backgroundColor[2] );
	[self setSurfaceType:N3D_FacetedSolids andDescendants:YES];

	// We will use a constant shader to get the same color at every place.
	
	if( !ourShader )
	{
		ourShader = [N3DShader new];
		[ourShader setShader:"constant"];
		[(N3DShape *)self setShader:ourShader];
	}	

	return self;
}

@end

/*
 * History: 24.05.94 Written to fix NeXTs background bug.
 *
 *
 * Bugs: - Nop
 */