OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ocean.cpp File Reference
#include <complex>
#include <cstdio>
#include <cmath>
#include <random>
#include "fftwater.hpp"
#include "scattering.hpp"
#include "GLFFT/glfft.hpp"
#include "mesh.hpp"
#include "common.hpp"
#include "Timer.h"
#include "Text.h"
#include <jni.h>

Go to the source code of this file.

Macros

#define GLES_VERSION   3
 
#define SIZE_X   256
 
#define SIZE_Z   256
 
#define DIST_X   200.0f
 
#define DIST_Z   200.0f
 
#define NORMALMAP_FREQ_MOD   7.3f
 
#define AMPLITUDE   1.0f
 
#define WIND_SPEED_X   +26.0f
 
#define WIND_SPEED_Z   -22.0f
 

Functions

static void compute_frustum (vec4 *planes, const mat4 &mvp)
 
static void init_vao ()
 
static void app_init ()
 
static void app_update (float delta_time)
 
static void app_render (unsigned width, unsigned height, float total_time, unsigned mesh_index)
 
static void app_term ()
 
static void render_text (Text &text, const char *method, float current_time)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_ocean_Ocean_init (JNIEnv *, jclass, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_ocean_Ocean_step (JNIEnv *, jclass)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_ocean_Ocean_uninit (JNIEnv *, jclass)
 
double app_get_time ()
 

Variables

static FFTWaterwater
 
static Scatteringscatter
 
static Meshmesh [2]
 
static GLuint prog_quad
 
static GLuint prog_skydome
 
static GLuint vao_quad
 
static GLuint vbo_quad
 
static vec3 cam_pos = vec3(0.0f, 15.0f, 0.0f)
 
static float cam_rot_y = -0.6f
 
static float cam_rot_x = -0.1f
 
static vec3 cam_dir
 
static float total_time
 
static Timer timer
 
static unsigned phase = 0
 
static float method_timer = 0.0f
 
static unsigned surface_width
 
static unsigned surface_height
 
static Texttext
 

Macro Definition Documentation

#define AMPLITUDE   1.0f

Definition at line 51 of file ocean.cpp.

#define DIST_X   200.0f

Definition at line 45 of file ocean.cpp.

#define DIST_Z   200.0f

Definition at line 46 of file ocean.cpp.

#define GLES_VERSION   3

Definition at line 32 of file ocean.cpp.

#define NORMALMAP_FREQ_MOD   7.3f

Definition at line 50 of file ocean.cpp.

#define SIZE_X   256

Definition at line 41 of file ocean.cpp.

#define SIZE_Z   256

Definition at line 42 of file ocean.cpp.

#define WIND_SPEED_X   +26.0f

Definition at line 54 of file ocean.cpp.

#define WIND_SPEED_Z   -22.0f

Definition at line 55 of file ocean.cpp.

Function Documentation

double app_get_time ( )

Definition at line 337 of file ocean.cpp.

static void app_init ( )
static

Definition at line 146 of file ocean.cpp.

static void app_render ( unsigned  width,
unsigned  height,
float  total_time,
unsigned  mesh_index 
)
static

Definition at line 180 of file ocean.cpp.

static void app_term ( )
static

Definition at line 227 of file ocean.cpp.

static void app_update ( float  delta_time)
static

Definition at line 167 of file ocean.cpp.

static void compute_frustum ( vec4 planes,
const mat4 mvp 
)
static

Definition at line 71 of file ocean.cpp.

static void init_vao ( )
static

Definition at line 127 of file ocean.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_ocean_Ocean_init ( JNIEnv *  ,
jclass  ,
jint  width,
jint  height 
)

Definition at line 269 of file ocean.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_ocean_Ocean_step ( JNIEnv *  ,
jclass   
)

Definition at line 295 of file ocean.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_ocean_Ocean_uninit ( JNIEnv *  ,
jclass   
)

Definition at line 329 of file ocean.cpp.

static void render_text ( Text text,
const char *  method,
float  current_time 
)
static

Definition at line 251 of file ocean.cpp.

Variable Documentation

vec3 cam_dir
static

Definition at line 68 of file ocean.cpp.

vec3 cam_pos = vec3(0.0f, 15.0f, 0.0f)
static

Definition at line 66 of file ocean.cpp.

float cam_rot_x = -0.1f
static

Definition at line 67 of file ocean.cpp.

float cam_rot_y = -0.6f
static

Definition at line 67 of file ocean.cpp.

Mesh* mesh[2]
static

Definition at line 59 of file ocean.cpp.

float method_timer = 0.0f
static

Definition at line 247 of file ocean.cpp.

unsigned phase = 0
static

Definition at line 246 of file ocean.cpp.

GLuint prog_quad
static

Definition at line 61 of file ocean.cpp.

GLuint prog_skydome
static

Definition at line 62 of file ocean.cpp.

Scattering* scatter
static

Definition at line 58 of file ocean.cpp.

unsigned surface_height
static

Definition at line 248 of file ocean.cpp.

unsigned surface_width
static

Definition at line 248 of file ocean.cpp.

Text* text
static

Definition at line 249 of file ocean.cpp.

Timer timer
static

Definition at line 245 of file ocean.cpp.

float total_time
static

Definition at line 244 of file ocean.cpp.

GLuint vao_quad
static

Definition at line 63 of file ocean.cpp.

GLuint vbo_quad
static

Definition at line 64 of file ocean.cpp.

FFTWater* water
static

Definition at line 57 of file ocean.cpp.