Go to the documentation of this file.
32 #define _USE_MATH_DEFINES
39 #include <glad/glad.h>
62 #define STEP_LONGITUDE 22.5f
63 #define STEP_LATITUDE 22.5f
65 #define DIST_BALL (RADIUS * 2.f + RADIUS * 0.1f)
67 #define VIEW_SCENE_DIST (DIST_BALL * 3.f + 200.f)
68 #define GRID_SIZE (RADIUS * 4.5f)
69 #define BOUNCE_HEIGHT (RADIUS * 2.1f)
70 #define BOUNCE_WIDTH (RADIUS * 2.1f)
72 #define SHADOW_OFFSET_X -20.f
73 #define SHADOW_OFFSET_Y 10.f
74 #define SHADOW_OFFSET_Z 0.f
76 #define WALL_L_OFFSET 0.f
77 #define WALL_R_OFFSET 5.f
80 #define ANIMATION_SPEED 50.f
83 #define MAX_DELTA_T 0.02f
110 #define RAND_MAX 4095
120 return (deg - 360.
f);
131 return deg / 360 * (2 * M_PI);
174 #define BOING_DEBUG 0
223 2.
f * (
float) atan2(
RADIUS, 200.
f ),
231 vec3 center = { 0.f, 0.f, 0.f };
232 vec3 up = { 0.f, -1.f, 0.f };
310 double dt_total, dt2;
322 while( dt_total > 0.0 )
421 if (
ball_y_inc < 0 ) sign = -1.0;
else sign = 1.0;
424 if ( deg > 80 ) deg = 80;
425 if ( deg < 10 ) deg = 10;
446 static int colorToggle = 0;
464 if ( lat_deg >= 180 )
470 colorToggle = ! colorToggle;
515 printf(
"----------------------------------------------------------- \n" );
516 printf(
"lat = %f long_lo = %f long_hi = %f \n", lat_deg, long_lo, long_hi );
517 printf(
"vert_ne x = %.8f y = %.8f z = %.8f \n", vert_ne.
x, vert_ne.
y, vert_ne.
z );
518 printf(
"vert_nw x = %.8f y = %.8f z = %.8f \n", vert_nw.
x, vert_nw.
y, vert_nw.
z );
519 printf(
"vert_se x = %.8f y = %.8f z = %.8f \n", vert_se.
x, vert_se.
y, vert_se.
z );
520 printf(
"vert_sw x = %.8f y = %.8f z = %.8f \n", vert_sw.
x, vert_sw.
y, vert_sw.
z );
528 colorToggle = ! colorToggle;
544 const int rowTotal = 12;
545 const int colTotal = rowTotal;
548 const GLfloat z_offset = -40.0;
563 for ( col = 0; col <= colTotal; col++ )
628 exit( EXIT_FAILURE );
634 exit( EXIT_FAILURE );
676 exit( EXIT_SUCCESS );
const GLFWAPI GLFWvidmode * glfwGetVideoMode(GLFWmonitor *monitor)
Returns the current mode of the specified monitor.
double deg2rad(double deg)
void CrossProduct(vertex_t a, vertex_t b, vertex_t c, vertex_t *n)
GLFWAPI void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
#define GL_COLOR_BUFFER_BIT
void reshape(GLFWwindow *window, int w, int h)
GLfloat GLfloat GLfloat GLfloat v3
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
void cursor_position_callback(GLFWwindow *window, double x, double y)
#define GLFW_MOD_ALT
If this bit is set one or more Alt keys were held down.
GLFWAPI void glfwPollEvents(void)
Processes all pending events.
static void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f)
The header of the GLFW 3 API.
GLboolean GLboolean GLboolean b
DRAW_BALL_ENUM drawBallHow
static GLFWwindow * window
GLenum GLenum GLsizei void * row
void DrawBoingBallBand(GLfloat long_lo, GLfloat long_hi)
struct GLFWmonitor GLFWmonitor
double cos_deg(double deg)
GLFWAPI void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow *window, GLFWframebuffersizefun cbfun)
Sets the framebuffer resize callback for the specified window.
static void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
GLfloat TruncateDeg(GLfloat deg)
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
GLFWAPI GLFWmonitor * glfwGetPrimaryMonitor(void)
Returns the primary monitor.
static void set_ball_pos(GLfloat x, GLfloat y)
GLFWAPI void glfwGetWindowPos(GLFWwindow *window, int *xpos, int *ypos)
Retrieves the position of the client area of the specified window.
GLAPI int gladLoadGLLoader(GLADloadproc)
GLint GLsizei GLsizei height
void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
GLFWAPI GLFWmonitor * glfwGetWindowMonitor(GLFWwindow *window)
Returns the monitor that the window uses for full screen mode.
GLdouble GLdouble GLdouble w
struct GLFWwindow GLFWwindow
void *(* GLADloadproc)(const char *name)
GLboolean GLboolean GLboolean GLboolean a
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow *window, int numer, int denom)
Sets the aspect ratio of the specified window.
void key(GLFWwindow *window, int k, int s, int action, int mods)
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
static const textual_icon exit
double sin_deg(double deg)
void BounceBall(double dt)
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.
GLdouble GLdouble GLint GLint GLdouble v1
GLFWAPI void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the framebuffer of the specified window.
#define GL_DEPTH_BUFFER_BIT
void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow *window, int value)
Sets the close flag of the specified window.
GLFWAPI void glfwSetWindowMonitor(GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)
Sets the mode, monitor, video mode and placement of a window.
librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01