Files
GR-raytracing/src/catalog.h
T

56 lines
1.8 KiB
C

#ifndef CATALOG_H
#define CATALOG_H
#include <stddef.h>
typedef struct {
double direction[3];
double temperature_K;
double amplitude;
} Star;
enum { CATALOG_ALL_SKY_RA_TILES = 360, CATALOG_ALL_SKY_DEC_TILES = 180 };
typedef struct {
Star *stars;
size_t count;
int state; /* 0: not requested, 1: loaded, -1: absent or unreadable. */
} CatalogTile;
typedef enum {
STAR_CATALOG_MEMORY,
STAR_CATALOG_ALL_SKY
} StarCatalogKind;
typedef struct {
Star *stars;
size_t count;
StarCatalogKind kind;
char *all_sky_root;
CatalogTile *tiles;
} StarCatalog;
typedef int (*CatalogTileVisitor)(const Star *stars, size_t count,
int fully_contained, void *context);
/*
* Synthetic lensing fixture: stars lie on the union of 10-degree longitude
* and latitude lines, sampled every 2 degrees. The eight longitude/hemisphere
* octants alternate between red and blue blackbody temperatures. Blue stars'
* scale compensates for their greater visible blackbody radiance.
*/
int catalog_write_octant_grid(const char *path);
int catalog_load_csv(StarCatalog *catalog, const char *path);
/* The directory contains tile_raRRR_decDDD.csv plus optional .done markers.
* Tiles are loaded only after a source triangle intersects them. */
int catalog_load_all_sky(StarCatalog *catalog, const char *directory);
/* Visit only 1-degree all-sky tiles that can intersect this source triangle.
* Call with load_missing=1 before parallel rendering, then 0 inside workers. */
int catalog_visit_source_triangle(StarCatalog *catalog,
const double direction[3][3],
int load_missing, CatalogTileVisitor visitor,
void *context);
void catalog_destroy(StarCatalog *catalog);
#endif