add tag scene bones

This commit is contained in:
Mylloon 2023-05-19 13:14:48 +02:00
parent dda5e2cab0
commit e8a0c35f4a
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
6 changed files with 51 additions and 5 deletions

View file

@ -11,6 +11,9 @@ extern GLuint _dims[];
// Scène de manifestation
void manif(int);
// Scène du tag sur le mur
void tag(int);
// Crédits de fin
void credits(int);

8
main.c
View file

@ -20,9 +20,11 @@ int main(int argc, char *argv[]) {
}
// Animations
GL4DHanime animations[] = {{10000, manif, NULL, NULL},
{2000, manif, credits, zoom_in},
{9500, credits, NULL, NULL},
GL4DHanime animations[] = {{10000, manif, NULL, NULL}, // Manifestation
{2000, manif, tag, zoom_in}, // Transition
{2000, tag, NULL, NULL}, // Tag
{2000, tag, credits, zoom_in}, // Transition
{9500, credits, NULL, NULL}, // Crédits
{0, NULL, NULL, NULL}};
gl4dhInit(animations, _dims[0], _dims[1], init);

4
shaders/tag.fs Normal file
View file

@ -0,0 +1,4 @@
#version 330
void main() {
}

4
shaders/tag.vs Normal file
View file

@ -0,0 +1,4 @@
#version 330
void main() {
}

View file

@ -61,14 +61,13 @@ static void init(void) {
gl4duGenMatrix(GL_FLOAT, matrix_proj);
gl4duGenMatrix(GL_FLOAT, matrix_model);
gl4duGenMatrix(GL_FLOAT, matrix_view);
glEnable(GL_DEPTH_TEST);
}
static void draw(void) {
static double t0 = 0;
double dt = get_dt(&t0, GL_TRUE);
glEnable(GL_DEPTH_TEST);
glClearColor(0.2f, 0.2f, 0.8f, 1); // couleur ciel
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(_pId);

34
src/tag.c Normal file
View file

@ -0,0 +1,34 @@
#include "../includes/animations.h"
static GLuint _pId = 0;
static void init(void);
static void draw(void);
void tag(int state) {
switch (state) {
case GL4DH_INIT:
init();
break;
case GL4DH_DRAW:
draw();
break;
default:
break;
}
}
static void init(void) {
_pId = gl4duCreateProgram("<vs>shaders/tag.vs", "<fs>shaders/tag.fs", NULL);
}
static void draw(void) {
glEnable(GL_DEPTH_TEST);
glClearColor(0.2f, 0.2f, 0.2f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(_pId);
glUseProgram(0);
}