#define SUBSYSTEM APPLICATION_EXEC "_sphere: "

#define DRAW_CACHE_TYPE_NONE 0							/* Sphere cache types */
#define DRAW_CACHE_TYPE_SOLID 1
#define DRAW_CACHE_TYPE_2D 2
#define DRAW_CACHE_TYPE_3D 3

struct n_cache_t {
	uint8_t a;								/* Sphere cache alpha value */

	double n;								/* Sphere cache height value */

	struct position o, p;							/* Sphere cache pixel coordinates */
};

struct n_cache {
	unsigned int c;								/* Sphere cache type (DRAW_NOISE_TYPE_*) */

	int w, h;								/* Sphere cache dimensions */

	double d;								/* Sphere cache zoom */
	double e;								/* Sphere cache equatorial flattening */
	double f;								/* Sphere cache polar flattening */

	struct n_cache_t *s;							/* Sphere cache per pixel data */
};

static unsigned int c_nch = 0;							/* Sphere caches created */
static struct n_cache **a_nch = NULL;						/* Sphere cache structures */

static uint32_t draw_sphere_pixel_blur(struct pixel_rgba_8 *, struct pixel_rgba_8 *, int);
static double draw_sphere_cache_create_turbulence(double, double, double, double, double, int, int);
static unsigned int draw_sphere_cache_create(unsigned int, int, int, double, double, double);
static unsigned int draw_sphere_cache_create_op(void);
static void draw_sphere_cache_create_edge(int, int, double, double, double, double, struct n_cache_t *);

/* noise.c */
double noise_perlin_get_2d(double, double, unsigned int);
double noise_perlin_get_3d(double, double, double, unsigned int);
double noise_simplex_get_3d(double, double, double, double);
