|
Space Sim
|
#include <SDL2/SDL.h>#include <GL/glew.h>#include <SDL2/SDL_events.h>#include <SDL2/SDL_mouse.h>#include <SDL2/SDL_video.h>#include "utilities/mathf.h"#include <math.h>#include <stdbool.h>#include "core/init.h"#include "core/types.h"#include "mesh/mesh.h"#include "core/shaders.h"#include "mesh/marching_cubes.h"#include "stb/stb_image.h"#include "nuklear/nuklear.h"#include "nuklear/nuklear_sdl_gl3.h"Go to the source code of this file.
Functions | |
| GLuint | load_texture (const char *path, GLenum iformat, GLenum format, GLenum type) |
| GLuint | load_cubemap (const char *path) |
| float | power_law (float min_m, float max_m, float alpha) |
| void | init_random () |
| float | rand_normal () |
| void | init_water_grid (int N, int L, float A) |
| Initializes the water grid at the start of the simulation with a wind direction. | |
| float | angular_velocity (vec2 pos, vec2 w, float len2) |
| void | fft_textures (GLuint pi, GLuint po) |
| Performs a bit reversal and FFTs the water group. | |
| void | update_water_fft (float t) |
| Updates the water grid and FFTs it once per frame. | |
| void | precompute_fbm_texture () |
| vec3 | random3 (vec3 p) |
| float | worley (vec3 p) |
| void | precompute_worley_texture () |
| float | fade (float t) |
| void | make_perm () |
| float | wrap_256 (float t) |
| float | noise3d (vec3 p) |
| void | precompute_perlin_texture () |
| void | init_globals () |
| bool | init (SDL_Window **window, SDL_GLContext *context) |
Variables | |
| float | MASS = 0.0f |
| struct nk_context * | NK_CTX = NULL |
| bool | NUKLEAR_HOVERED = false |
| vec4 * | water_fft_arr = NULL |
| float * | phi = NULL |
| WaterData | WATER_DATA |
| vec3 * | out_arr = NULL |
| GLuint * | CURRENT_WATER_FFT_TEXTURE = NULL |
| float * | fbm_tex = NULL |
| vec4 * | worley_tex = NULL |
| int | permutations [PERLIN_TEXTURE_SIZE] |
| vec3 | gradients [12] |
| float * | perlin_tex |
| GLuint load_texture | ( | const char * | path, |
| GLenum | iformat, | ||
| GLenum | format, | ||
| GLenum | type ) |
Definition at line 19 of file init.c.
References load_texture().
Referenced by init(), and load_texture().
| GLuint load_cubemap | ( | const char * | path | ) |
Definition at line 57 of file init.c.
References load_cubemap().
Referenced by init(), and load_cubemap().
| float power_law | ( | float | min_m, |
| float | max_m, | ||
| float | alpha ) |
Definition at line 103 of file init.c.
References power_law().
Referenced by init_random(), and power_law().
| void init_random | ( | ) |
Definition at line 114 of file init.c.
References Particle::acc, BODY_COUNT, GLOBALS, init_random(), MASS, Globals::mass_pow, Particle::mat, Globals::max_mass, Globals::min_mass, ParticleData::p, Particle::p_m, PARTICLE_SSBO, PD, power_law(), Globals::radius, radius, vec3_cross(), vec3_normalize(), vec3_scale(), Particle::vel, vec4::w, vec3::x, vec4::x, vec3::y, vec4::y, vec3::z, and vec4::z.
Referenced by display_main_menu(), init(), and init_random().
| float rand_normal | ( | ) |
Definition at line 177 of file init.c.
References rand_normal().
Referenced by init_water_grid(), and rand_normal().
Definition at line 256 of file init.c.
References angular_velocity(), vec2::x, and vec2::y.
Referenced by angular_velocity().
| void precompute_fbm_texture | ( | ) |
Definition at line 350 of file init.c.
References fbm(), fbm_tex, FBM_TEXTURE, FBM_TEXTURE_SIZE, and precompute_fbm_texture().
Referenced by init(), and precompute_fbm_texture().
Definition at line 380 of file init.c.
References random3(), s, vec3_dot(), and vec3_scale().
| float worley | ( | vec3 | p | ) |
Definition at line 400 of file init.c.
References MIN, random3(), vec3_add(), vec3_length(), vec3_sub(), worley(), vec3::x, vec3::y, and vec3::z.
Referenced by precompute_worley_texture(), and worley().
| void precompute_worley_texture | ( | ) |
Definition at line 434 of file init.c.
References precompute_worley_texture(), vec3_scale(), worley(), worley_tex, WORLEY_TEXTURE, and WORLEY_TEXTURE_SIZE.
Referenced by init(), and precompute_worley_texture().
| float fade | ( | float | t | ) |
| void make_perm | ( | ) |
Definition at line 477 of file init.c.
References make_perm(), PERLIN_TEXTURE_SIZE, permutations, and temp.
Referenced by make_perm(), and precompute_perlin_texture().
| float wrap_256 | ( | float | t | ) |
| float noise3d | ( | vec3 | p | ) |
Definition at line 507 of file init.c.
References fade(), gradients, noise3d(), PERLIN_TEXTURE_SIZE, permutations, t0, vec3_dot(), ivec3::x, vec3::x, ivec3::y, vec3::y, ivec3::z, and vec3::z.
Referenced by noise3d(), and precompute_perlin_texture().
| void precompute_perlin_texture | ( | ) |
Definition at line 613 of file init.c.
References make_perm(), noise3d(), perlin_tex, PERLIN_TEXTURE, PERLIN_TEXTURE_SIZE, precompute_perlin_texture(), and vec3_scale().
Referenced by init(), and precompute_perlin_texture().
| void init_globals | ( | ) |
Definition at line 644 of file init.c.
References GLOBALS, init_globals(), Globals::mass_pow, Globals::max_mass, Globals::min_mass, Globals::particle_toggle, Globals::planet_meshing_toggle, Globals::radius, Globals::sky_toggle, and Globals::water_toggle.
Referenced by init(), and init_globals().
| bool init | ( | SDL_Window ** | window, |
| SDL_GLContext * | context ) |
Definition at line 659 of file init.c.
References FBMLayer::amp, PerlinLayer::amp, WarpLayer::amp, ATMOSPHERE_EBO, ATMOSPHERE_RES, ATMOSPHERE_VAO, ATMOSPHERE_VBO, BIT_REVERSAL_COMPUTE_SHADER, BLOOM2_FBO, BLOOM2_HEIGHT, BLOOM2_TEXTURE, BLOOM2_WIDTH, BLOOM_FBO, BLOOM_HEIGHT, BLOOM_TEXTURE, BLOOM_WIDTH, BLUR2_FBO, BLUR2_TEXTURE, BLUR_FBO, BLUR_TEXTURE, BOUNDS_COMPUTE_SHADER, BOUNDS_SSBO, CAM_UBO, CHUNK_DATA_FLAG, CHUNK_DATA_SSBO, CHUNK_WORLD_SIZE, CHUNK_ZERO_COMPUTE_SHADER, COM_COMPUTE_SHADER, COMPOSITE_DEPTH_TEXTURE, COMPOSITE_FBO, COMPOSITE_TEXTURE, create_compute_shader(), CUBEMAP_TEXTURE, DENSITY_SSBO, DENSITY_VERTEX_SSBO, DEPTH_TEXTURE, EDGE_TABLE, MarchingCubesData::EDGE_TABLE, EDGE_TO_VERTICES, MarchingCubesData::EDGE_TO_VERTICES, GPUChunk::emitted_chunks, EXP_LOOKUP_TEXTURE, PlanetData::fbm_count, PlanetData::fbm_layers, FBM_TEXTURE, FBM_TEXTURE_SIZE, FBMLayer::freq, PerlinLayer::freq, WarpLayer::freq0, WarpLayer::freq1, WarpLayer::freq2, FS_VAO, HISTORY_FBO, HISTORY_TEXTURE, ID_TEXTURE, init(), init_chunk_data(), init_globals(), init_random(), init_shaders(), init_water_grid(), load_cubemap(), load_texture(), LOD_DENSITY_SIZES, GPUChunk::lod_dist, LOD_RES, LOD_VERTEX_SIZES, LODMAX, MAIN_COMPUTE_SHADER, MAIN_FBO, MAIN_TEXTURE, MAIN_VAO, MAIN_VBO, MARCHING_CUBES_SSBO, MAX_CHUNKS, MAX_CHUNKS_LOD, MESH_EBO, MESH_RES, MESH_VAO, MESH_VBO, MORTON_COMPUTE_SHADER, MORTON_PING_SSBO, MORTON_SSBO, NEXT_COMPUTE_SHADER, NK_CTX, NODE_COUNTER_SSBO, NODE_SSBO, WarpLayer::offset0, WarpLayer::offset1, WarpLayer::offset2, PARTICLE_SSBO, PlanetData::perlin_count, PlanetData::perlin_layers, PERLIN_TEXTURE, PERLIN_TEXTURE_SIZE, PLANET_DATA, PLANET_DATA_SSBO, WaterVertex::pos, POS_COMPUTE_SHADER, POSTPROCESS_FBO, POSTPROCESS_TEXTURE, precompute_fbm_texture(), precompute_perlin_texture(), precompute_worley_texture(), RADIX_COMPUTE_SHADER, RADIX_FINAL_COMPUTE_SHADER, RADIX_GLOBAL_COMPUTE_SHADER, RADIX_SSBO, RENDER_UBO, res, ROCK_AO_TEXTURE, ROCK_DIFFUSE_TEXTURE, ROCK_NORMAL_TEXTURE, ROCK_SPECULAR_TEXTURE, SCREEN_HEIGHT, SCREEN_WIDTH, SHADOW_MAP_FBO, SHADOW_MAP_SIZE, SHADOW_MAP_TEXTURE, SKY_CUBEMAP, SKY_FBO, SKY_VAO, SKY_VBO, SPACE_CAM_UBO, SPAWN_COMPUTE_SHADER, SPHERE_TEXTURE, PlanetData::sun_color, PlanetData::sun_dir, TREE_COMPUTE_SHADER, TREE_COUNT_COMPUTE_SHADER, MarchingCubesData::TRIANGLE_TABLE, TRIANGLE_TABLE, PlanetData::warp_count, PlanetData::warp_layers, WATER_COMPUTE_SHADER, WATER_DATA, WATER_EBO, WATER_FFT_COMPUTE_SHADER, WATER_FFT_L, WATER_FFT_PING_TEXTURE, WATER_FFT_PING_TEXTURE_2, WATER_FFT_PONG_TEXTURE, WATER_FFT_PONG_TEXTURE_2, WATER_FFT_TEXTURE_SIZE, water_index_count, water_quad_count, WATER_RES, WATER_SSBO, WATER_VAO, WATER_VBO, WORLEY_TEXTURE, WORLEY_TEXTURE_SIZE, and ZERO_COMPUTE_SHADER.
| float MASS = 0.0f |
Definition at line 112 of file init.c.
Referenced by init_random().
| struct nk_context* NK_CTX = NULL |
Definition at line 170 of file init.c.
Referenced by display_main_menu(), init(), and process_input().
| bool NUKLEAR_HOVERED = false |
Definition at line 171 of file init.c.
Referenced by display_main_menu(), and process_input().
| vec4* water_fft_arr = NULL |
Definition at line 173 of file init.c.
Referenced by init_water_grid().
| float* phi = NULL |
Definition at line 174 of file init.c.
Referenced by init_water_grid().
| WaterData WATER_DATA |
Definition at line 187 of file init.c.
Referenced by init(), and init_water_grid().
| float* fbm_tex = NULL |
Definition at line 346 of file init.c.
Referenced by density_fn(), main(), precompute_fbm_texture(), and sample_fbm_density().
| vec4* worley_tex = NULL |
Definition at line 377 of file init.c.
Referenced by main(), and precompute_worley_texture().
| int permutations[PERLIN_TEXTURE_SIZE] |
Definition at line 474 of file init.c.
Referenced by make_perm(), and noise3d().
| vec3 gradients[12] |
| float* perlin_tex |
Definition at line 610 of file init.c.
Referenced by density_fn(), main(), precompute_perlin_texture(), and sample_density().