
/*

  ---- Raytrace / CScene source ----

*/

#include "Main.h"

//---- CScene

CScene::CScene()
{
	//- Set up linked lists of objects

	firstSphere = NULL;
	lastSphere  = NULL;
	firstLight = NULL;
	lastLight  = NULL;
	numLights  = 0;
}

//---- addLight

CLight *CScene::addLight( float x, float y, float z )
{
	//- Create light object in this scene

	CLight *light = new CLight( this, x, y, z );

	//- Add to internal list of lights

	if( firstLight == NULL )  //  No linked list - set this to the start and the end of the list
	{
		firstLight = light;
		lastLight  = light;
	}
	else  //  Linked list exists - Add to end of linked list
	{
		lastLight->LL_next = light;
		lastLight = light;
	}

	lastLight->LL_next = NULL;

	numLights ++;

	return light;
}

//---- addSphere

CSphere *CScene::addSphere( float x, float y, float z, float r )
{
	//- Create light object in this scene

	CSphere *sphere = new CSphere( this, x, y, z, r );

	//- Add to internal list of lights

	if( firstSphere == NULL )  //  No linked list - set this to the start and the end of the list
	{
		firstSphere = sphere;
		lastSphere  = sphere;
	}
	else  //  Linked list exists - Add to end of linked list
	{
		lastSphere->LL_next = sphere;
		lastSphere = sphere;
	}

	lastSphere->LL_next = NULL;

	numSpheres ++;

	return sphere;
}

void CScene::cameraPos( float x, float y, float z )
{
	cam_x = x;
	cam_y = y;
	cam_z = z;
}

void CScene::cameraLookAt( float x, float y, float z )
{

}

void CScene::cameraDirection( float x, float y, float z )
{

}

