ftp.nice.ch/pub/next/science/chemistry/BeakerBoy.0.31.s.tar.gz#/BeakerBoy.0.31.s/BBBeakerCamera.m

This is BBBeakerCamera.m in view mode; [Download] [Up]

/* BBBeakerCamera.m				 
 *
 * Here is the view that shows us the nice molecules.
 *
 * For more interface-info see the header file. More in depth information
 * can be found in the source-code.
 *
 * Written by: 		Thomas Engel
 * Created:    		28.10.1993 (Copyleft)
 * Last modified: 	25.05.1994
 */

#import "BBBeakerCamera.h"
#import "BBAppManager.h"
#import "Preferences.subproj/BBPreferencesManager.h"
#import "Preferences.subproj/BBDefaultCamera.h"
#import "Rotator.subproj/BBRotator.h"
#import "BBBeaker.h"
#import "BBBeakerShape.h"
#import "BBBackgroundShape.h"

@implementation BBBeakerCamera

- createWorldFor:aBeaker	
{
	// Let's setup some basics. First the Lights. Ambient and Spotlight
	// Then some color and other settings.
	
	RtPoint	fromPoint;
	RtPoint	toPoint;
	NXColor	background;
	id		aShape;
	
	// Here is the camera..
	
	fromPoint[0] = 0.0;
	fromPoint[1] = 0.0;
	fromPoint[2] = -40.0;

	toPoint[0] = 0.0;
	toPoint[1] = 0.0;
	toPoint[2] = 0.0;

	// Here we create the WorldShape and delete the old one.
	// We will use no clipping by default!
	
	beakerShape = [BBBeakerShape new];
	[[self setWorldShape:beakerShape] free];

	[self setEyeAt:fromPoint toward:toPoint roll:0.0];
	[self setProjection:N3D_Perspective];
	[self setClipPlanesNear:RI_EPSILON far:RI_INFINITY];
	
	// Now some Background coloring...
	
	background = [[[[NXApp delegate] preferences]
									 findDefaultFor:self]
									 backgroundColor];
									 
	[self setBackgroundColor:background];
	[self setDrawBackgroundColor:YES];

	// This is a real hack for printing other colors than black background!
	// Only use it if you really have to. It really is stupid. But it works.
	
	if( [[[[NXApp delegate] preferences]
							findDefaultFor:self]
							doesPrintBackgroundColor] )
	{
		aShape = [BBBackgroundShape new];
		[aShape setBackgroundColor:background];
		[aShape group:beakerShape];
	}
	[self setHider:N3D_HiddenRendering];
	
	[self display];
	return self;
}

- addShape:aShape
{
	[aShape group:beakerShape];
	return self;
}

- renderSelf:(RtToken)context
{
	return self;
}

@end

/*
 * History: 24.05.94 Added background color hack.
 *
 *			07.05.94 Fits new naming style and has new init method.
 *
 *			27.03.94 Cleaned up the init method.
 *
 *			26.03.94 Removed the setEyeZ method and switched to the original
 *					 NeXT methods getEyeAt....
 *
 *			17.01.94 Moved the camera and light to the -z side.
 *
 *			28.12.93 Removed the rotator settings and moved them to the
 *					 cameraWindow.
 *
 *
 * Bugs: - Yes.
 */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.