#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stddef.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
Go to the source code of this file.
|
static void | error_callback (int error, const char *description) |
|
static void | generate_heightmap__circle (float *center_x, float *center_y, float *size, float *displacement) |
|
static void | init_map (void) |
|
static void | key_callback (GLFWwindow *window, int key, int scancode, int action, int mods) |
|
int | main (int argc, char **argv) |
|
static void | make_mesh (GLuint program) |
|
static GLuint | make_shader (GLenum type, const char *text) |
|
static GLuint | make_shader_program (const char *vs_text, const char *fs_text) |
|
static void | update_map (int num_iter) |
|
static void | update_mesh (void) |
|
#define DISPLACEMENT_SIGN_LIMIT (0.3f) |
#define MAP_NUM_VERTICES (80) |
#define MAX_CIRCLE_SIZE (5.0f) |
#define MAX_DISPLACEMENT (1.0f) |
#define NUM_ITER_AT_A_TIME (1) |
static void error_callback |
( |
int |
error, |
|
|
const char * |
description |
|
) |
| |
|
static |
static void generate_heightmap__circle |
( |
float * |
center_x, |
|
|
float * |
center_y, |
|
|
float * |
size, |
|
|
float * |
displacement |
|
) |
| |
|
static |
static void key_callback |
( |
GLFWwindow * |
window, |
|
|
int |
key, |
|
|
int |
scancode, |
|
|
int |
action, |
|
|
int |
mods |
|
) |
| |
|
static |
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
static GLuint make_shader |
( |
GLenum |
type, |
|
|
const char * |
text |
|
) |
| |
|
static |
static GLuint make_shader_program |
( |
const char * |
vs_text, |
|
|
const char * |
fs_text |
|
) |
| |
|
static |
static void update_map |
( |
int |
num_iter | ) |
|
|
static |
const char* fragment_shader_text |
|
static |
Initial value:=
"#version 150\n"
"out vec4 color;\n"
"void main()\n"
"{\n"
" color = vec4(0.2, 1.0, 0.2, 1.0); \n"
"}\n"
Definition at line 67 of file heightmap.c.
Initial value:= {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
Definition at line 94 of file heightmap.c.
Initial value:= {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
Definition at line 86 of file heightmap.c.
const char* vertex_shader_text |
|
static |
Initial value:=
"#version 150\n"
"uniform mat4 project;\n"
"uniform mat4 modelview;\n"
"in float x;\n"
"in float y;\n"
"in float z;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = project * modelview * vec4(x, y, z, 1.0);\n"
"}\n"
Definition at line 54 of file heightmap.c.