Space Sim
Loading...
Searching...
No Matches
mesh.h File Reference
#include "core/types.h"
#include "uthash/uthash.h"
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  CenterKey
struct  AuthorityEntry
struct  ChunkKey
struct  ChunkHash

Functions

void load_chunks (vec3 planet_origin, float planet_radius)
 Checks all chunks based on new Camera position, building a job list and then executing them based on ChunkScore.
void init_chunk_data ()
 Initializes and frees old ChunkData and hash tables.
bool free_parent (int lod, int i)
 Frees the parent of given LOD.
bool free_child (int lod, int i)
 Frees the child of given LOD.
bool free_current_parent (int lod, int i)
 Frees the given LOD (as a parent).
float calc_density (vec3 p)
 Copies the exact density function from the GPU to the CPU.
void mesh_atmosphere_sphere ()
 Creates an atmosphere sphere for rendering.
void create_new_planet_mesh (int lod, ivec3 chunk_center, int chunk_id, bool is_parent)
 Creates a mesh for a certain chunk.
float fbm (vec3 p)
int get_current_lod (ivec3 center)
void set_current_lod (ivec3 center, int lod)
ChunkHash * find_chunk_hash (ivec3 center, int lod)
void add_chunk_hash (ivec3 center, int lod, int id)
void replace_chunk_hash (ivec3 center, int lod, int id)
void delete_chunk_hash (ivec3 center, int lod)

Variables

AuthorityEntry * authority_map
ChunkHash * hash_table

Data Structure Documentation

◆ CenterKey

struct CenterKey

Definition at line 9 of file mesh.h.

Data Fields
int x
int y
int z

◆ AuthorityEntry

struct AuthorityEntry

Definition at line 13 of file mesh.h.

Data Fields
CenterKey key
int lod
UT_hash_handle hh

◆ ChunkKey

struct ChunkKey

Definition at line 21 of file mesh.h.

Data Fields
int x
int y
int z
int lod

◆ ChunkHash

struct ChunkHash

Definition at line 28 of file mesh.h.

Data Fields
ChunkKey key
int id
UT_hash_handle hh

Function Documentation

◆ fbm()

float fbm ( vec3 p)

Definition at line 139 of file density.comp.

References fbm(), fbm_noise(), noise(), NUM_OCTAVES, vec3_add(), and vec3_scale().

Referenced by density_fn(), fbm(), fbm(), and precompute_fbm_texture().

◆ get_current_lod()

int get_current_lod ( ivec3 center)
inline

Definition at line 51 of file mesh.h.

References authority_map, get_current_lod(), AuthorityEntry::lod, ivec3::x, ivec3::y, and ivec3::z.

Referenced by get_current_lod(), and load_chunks().

◆ set_current_lod()

void set_current_lod ( ivec3 center,
int lod )
inline

◆ find_chunk_hash()

ChunkHash * find_chunk_hash ( ivec3 center,
int lod )
inline

Definition at line 79 of file mesh.h.

References find_chunk_hash(), hash_table, lod, ivec3::x, ivec3::y, and ivec3::z.

Referenced by find_chunk_hash(), find_current_lod(), and load_chunks().

◆ add_chunk_hash()

void add_chunk_hash ( ivec3 center,
int lod,
int id )
inline

Definition at line 88 of file mesh.h.

References add_chunk_hash(), hash_table, ChunkHash::id, ChunkHash::key, lod, ivec3::x, ivec3::y, and ivec3::z.

Referenced by add_chunk_hash().

◆ replace_chunk_hash()

void replace_chunk_hash ( ivec3 center,
int lod,
int id )
inline

Definition at line 101 of file mesh.h.

References hash_table, ChunkHash::id, ChunkHash::key, lod, replace_chunk_hash(), ivec3::x, ivec3::y, and ivec3::z.

Referenced by load_chunks(), and replace_chunk_hash().

◆ delete_chunk_hash()

void delete_chunk_hash ( ivec3 center,
int lod )
inline

Variable Documentation

◆ authority_map

AuthorityEntry* authority_map
extern

Definition at line 617 of file mesh.c.

Referenced by get_current_lod(), init_chunk_data(), and set_current_lod().

◆ hash_table

ChunkHash* hash_table
extern