/* 
 * ***** BEGIN GPL LICENSE BLOCK *****
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 * All rights reserved.
 *
 * Contributors: Matt Ebb
 *
 * ***** END GPL LICENSE BLOCK *****
 */

struct Render;
struct Photon;
struct LampRen;
struct World;

void init_photonmap(struct Render *re);
void free_photonmap(struct Render *re);
 
void photonmap_gather(struct ShadeInput *shi, struct ShadeResult *shr);

typedef struct PhotonEmitter {
	struct LampRen *lar;
	struct World *wrld;
	int type;
} PhotonEmitter;

#define PHOTON_EMITTER_LAMP		1
#define PHOTON_EMITTER_SKY		2

typedef struct PhotonTemp {
	char type;
	float co[3];
	float col[3];
	float vec_in[3];
} PhotonTemp;

typedef struct PhotonProcess
{
	struct PhotonProcess *next, *prev;
	
	int count_diffuse;
	int count_caustic;
	int count_total;
	int depth;
	int max_photons_diffuse;
	int max_photons_caustic;
	int max_total;
	int max_depth;
	float col[3];
	int type;
	int flag;
	float last_ior;
	
	short thread;
	float ray_maxsize;
	int num_emitters;
	
	int working;
	int done;
	
	PhotonEmitter *photon_emitters;
	PhotonTemp *photon_temp_cache;
	
} PhotonProcess;

typedef struct PhotonRangeData
{
    float *density;
	float *col;
    float squared_radius;
	float *n;
	struct Photon *photon_data;
} PhotonRangeData;

/* PhotonProcess->type */
#define PHOTON_DIFFUSE	0
#define PHOTON_CAUSTIC	1

/* PhotonProcess->flag */
#define PHOTON_DO_DIRECT	1

/*
    float *point_data;
	float *vec;
	float softness;
    short falloff_type;
	short noise_influence;
	float *age;
	int point_data_used;
	int offset;
*/

