#include "defines_app.h"

/* This is the place for global application structures if any,
   see engine/structures.h. Do not remove include line above. */

struct pixel_rgb_float {
	float r, g, b;								/*  Pixel float RGB */
};

struct planet_atmos_comp {
	float ammonia;								/* Planet atmosphere composition percentages */
	float argon;
	float carbon_dioxide;
	float carbon_monoxide;
	float helium;
	float hydrogen;
	float iodine;
	float krypton;
	float methane;
	float neon;
	float nitrogen;
	float oxygen;
	float ozone;
	float sulfur_dioxide;
	float water;
	float xenon;
};

struct planet_atmos_spec {
	double mass;								/* Planet atmomphere mass in kilograms */
	double volume;								/* Planet atmosphere volume in cubic kilometers */
	double density;								/* Planet atmosphere density in kilograms per cubic meter */

	double pressure;							/* Planet atmosphere pressure in millibars */

	struct pixel_rgba_8 rgb;						/* Planet atmosphere color in RGBA format */
};

struct planet_crust_comp {
	float aluminum;								/* Planet crust composition percentages */
	float ammonia;
	float antimony;
	float arsenic;
	float barium;
	float beryllium;
	float bismuth;
	float boron;
	float bromine;
	float cadmium;
	float calcium;
	float carbon;
	float cerium;
	float cesium;
	float chlorine;
	float chromium;
	float cobalt;
	float copper;
	float dysprosium;
	float erbium;
	float ethane;
	float europium;
	float fluorine;
	float gadolinium;
	float gallium;
	float germanium;
	float gold;
	float hafnium;
	float helium;
	float holmium;
	float hydrogen;
	float indium;
	float iodine;
	float iridium;
	float iron;
	float lanthanum;
	float lead;
	float lithium;
	float lutetium;
	float magnesium;
	float manganese;
	float mercury;
	float methane;
	float molybdenum;
	float neodymium;
	float nickel;
	float niobium;
	float nitrogen;
	float osmium;
	float oxygen;
	float palladium;
	float phosphorus;
	float platinum;
	float polonium;
	float potassium;
	float praseodymium;
	float protactinium;
	float radium;
	float radon;
	float rhenium;
	float rhodium;
	float rubidium;
	float ruthenium;
	float samarium;
	float scandium;
	float selenium;
	float silicon;
	float silver;
	float sodium;
	float strontium;
	float sulfur;
	float tantalum;
	float tellurium;
	float terbium;
	float thallium;
	float thorium;
	float thulium;
	float tin;
	float titanium;
	float tungsten;
	float uranium;
	float vanadium;
	float water;
	float ytterbium;
	float yttrium;
	float zinc;
	float zirconium;
};

struct planet_crust_spec {
	double albedo;								/* Planet albedo (0.1 - 1.0) */
	double radius;								/* Planet radius in kilometers */
	double radius_e;							/* Planet equatorial radius in kilometers */
	double radius_p;							/* Planet polar radius in kilometers */
	double temperature_e;							/* Planet effective (black-body) temperature in kelvin */
	double temperature_s;							/* Planet surface (greenhouse) temperature in kelvin */

	double mass;								/* Planet mass in kilograms */
	double area;								/* Planet surface area in square kilometers */
	double volume;								/* Planet volume in cubic kilometers */
	double density;								/* Planet density in kilograms per cubic meter */

	double rotation;							/* Planet rotation speed in meters per second */
	double flattening;							/* Planet flattening because of rotation */

	double speed;								/* Planet orbital speed in kilometers per second */
	double year;								/* Planet year length in seconds */
	double day;								/* Planet day length in seconds */

	float centripetal;							/* Planet centripetal acceleration in meters per second */
	float acceleration;							/* Planet gravity acceleration in meters per second */
	float velocity;								/* Planet surface escape velocity in meters per second */

	struct pixel_rgba_8 rgb;						/* Planet color in RGBA format */
};

struct planet_draw {
	int p_w, p_h;								/* Planet sphere preview dimensions in pixels */

	int e;									/* Planet sphere is earth like or not */
	int f;									/* Planet sphere turbulence type if earth like */

	unsigned int ca, cb, cc;						/* Planet sphere cache handles */
	unsigned int c;								/* Planet surface noise seed */
	unsigned int d;								/* Planet cloud noise seed */
	unsigned int g;								/* Planet surface noise type (for draw_sphere_*_cache()) */
	unsigned int h;								/* Planet cloud noise type (for draw_sphere_*_cache()) */

	double u;								/* Planet sphere turbulence factor */

	size_t p_t;								/* Planet sphere preview pixel buffer size in bytes */

	struct pixel_rgba_8 *p_p;						/* Planet sphere preview pixel buffer */

	struct region_copy_8 cp;						/* Planet sphere blitting structure */

	unsigned int cp_f[1];							/* Planet live font handles */

	struct text_2 cp_t[1];							/* Planet live font structures */

	struct point_4 cl_p[2];							/* Planet live line structures */

	struct circle_2 *cc_p;							/* Planet live blitting structures */
	struct circles_2 cc_s;
	struct subpoint_2 *cp_p;
	struct subpoints_2 cp_s;
};

struct planet {
	unsigned long id;							/* Planet id */
	unsigned long pd;							/* Planet parent object id */

	unsigned long satellites;						/* Planet satellite count */

	double planetarysize;							/* Planet system diameter */

	char *name;								/* Planet name */
	char *nick;								/* Planet nick name */

	size_t name_t;								/* Planet name length */
	size_t nick_t;								/* Planet nick name length */

	unsigned int type;							/* Planet or satellite type */

	double distance;							/* Planet distance from parent object in kilometers */
	double position;							/* Planet position in its orbit */
	double angle;								/* Planet position angle in degrees */

	struct planet_atmos_comp pa;						/* Planet atmosphere composition */
	struct planet_atmos_spec pp;						/* Planet atmosphere specs */

	struct planet_crust_comp pc;						/* Planet crust composition */
	struct planet_crust_spec ps;						/* Planet crust specs */

	struct planet_draw sd;							/* Planet drawing variables */

	struct planet **ca;							/* Planet satellites */
};

struct star_comp {
	float carbon;								/* Star composition percentages */
	float helium;
	float hydrogen;
	float iron;
	float magnesium;
	float neon;
	float nitrogen;
	float oxygen;
	float silicon;
	float sulfur;
};

struct star_spec {
	double bm;								/* Star mean Bt magnitude */
	double vm;								/* Star mean Vt magnitude */
	double jm;								/* Star magnitude in Johnson V */
	double bv;								/* Star BtVt index */

	double parallax;							/* Star trigonometrix parallax */

	double radius;								/* Star mean radius in kilometers */
	double radius_e;							/* Star equatorial radius in kilometers */
	double radius_p;							/* Star polar radius in kilometers */
	double magnitude;							/* Star absolute magnitude */
	double temperature;							/* Star temperature in kelvin */
	double luminance;							/* Star luminance in watts */

	double mass;								/* Star mass in kilograms */
	double area;								/* Star surface area in square kilometers */
	double volume;								/* Star volume in cubic kilometers */
	double energy;								/* Star energy to burn in joules */
	double lifetime;							/* Star lifetime in millions of years */

	double rotation;							/* Star rotation speed in meters per second */
	double flattening;							/* Star flattening because of rotation */

	float centripetal;							/* Star centripetal acceleration in meters per second */
	float acceleration;							/* Star gravity acceleration in meters per second */
	float velocity;								/* Star surface escape velocity in meters per second */

	struct pixel_rgba_8 rgb;						/* Star color in RGBA format */
};

struct star_draw {
	int p_w, p_h;								/* Star sphere preview dimensions in pixels */

	unsigned int c;								/* Star sphere noise seed */
	unsigned int ca;							/* Star sphere cache handles */

	size_t p_t;								/* Star sphere preview pixel buffer size in bytes */

	struct pixel_rgba_8 *p_p;						/* Star sphere preview pixel buffer */

	struct region_copy_8 cp;						/* Star sphere blitting structure */

	unsigned int cp_f[1];							/* Star live font handles */

	struct text_2 cp_t[1];							/* Star live font structures */

	struct point_4 cl_p[2];							/* Star live line structures */

	struct circle_2 *cc_p;							/* Star live blitting structures */
	struct circles_2 cc_s;
	struct subpoint_2 *cp_p;
	struct subpoints_2 cp_s;
};

struct star {
	unsigned long id;							/* Star id */
	unsigned long pd;							/* Star parent object id */

	unsigned long planets;							/* Star effective planet count */
	unsigned long created;							/* Star created planet count */

	double fusion;								/* Star nuclear fusion time placeholder */
	double solarsize;							/* Star system diameter */

	char *name;								/* Star name */
	char *nick;								/* Star nick name */
	char *solar;								/* Star solar system name */

	size_t name_t;								/* Star name length */
	size_t nick_t;								/* Star nick name length */
	size_t solar_t;								/* Star solar system name length */

	unsigned int class;							/* Star class (STAR_CLASS_*) */
	unsigned int type;							/* Star type (STAR_TYPE_*) */

	char spectral[2];							/* Star spectral type (STAR_SPECTRAL_*) */

	struct position sp;							/* Star position in container object */
	struct position sv;							/* Star velocity in container object */

	struct star_comp sc;							/* Star composition */
	struct star_spec ss;							/* Star specs */

	struct star_draw sd;							/* Star drawing variables */

	struct planet **pa;							/* Star planets */
};

struct galaxy_spec {
	double radius;								/* Galaxy arm radius */
	double length;								/* Galaxy arm length */
	double steps;								/* Galaxy arm steps */
	double sigma;								/* Galaxy arm randomness */
	double dispersion;							/* Galaxy arm dispersion */

	unsigned int arms;							/* Galaxy arms if spiral galaxy */
};

struct galaxy_draw {
	unsigned int sp_f[1];							/* Galaxy live font handles */

	struct text_2 sp_t[1];							/* Galaxy live font structures */

	struct subpoint_2 *sp_p;						/* Galaxy live blitting structures */
	struct subpoints_2 sp_s;
};

struct galaxy {
	unsigned long id;							/* Galaxy id */
	unsigned long pd;							/* Galaxy parent object id */

	unsigned long stars;							/* Galaxy star count */
	unsigned long solars;							/* Galaxy solar system count */

	char *name;								/* Galaxy name */
	char *nick;								/* Galaxy nick name */

	size_t name_t;								/* Galaxy name length */
	size_t nick_t;								/* Galaxy nick name length */

	char class[2];								/* Galaxy class (GALAXY_CLASS_*) */

	struct position gp;							/* Galaxy position in container object */
	struct position gd_a, gd_b;						/* Galaxy dimensions */

	struct galaxy_spec gs;							/* Galaxy specs */

	struct galaxy_draw sd;							/* Galaxy drawing variables */

	struct star **sa;							/* Galaxy stars */
};

struct universe {
	unsigned long id;							/* Universe id */

	unsigned long galaxies;							/* Universe galaxy count */

	struct galaxy **ga;							/* Universe galaxies */
};
