Compare commits
No commits in common. "5454729293d872540ef8a3e663212d3f9095d7d7" and "f0a2ec04b3044fb639f5273ee763a1fffc2fbde8" have entirely different histories.
5454729293
...
f0a2ec04b3
6 changed files with 17 additions and 16 deletions
10
Makefile
10
Makefile
|
@ -54,13 +54,13 @@ LDFLAGS += -lGL4Dummies $(shell sdl2-config --libs) -lSDL2_mixer -lSDL2_image
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Version finale avec optimisations (défaut)
|
# Par défaut
|
||||||
$(PROGNAME): CFLAGS += -O3
|
$(PROGNAME): CFLAGS += -Wall -Wextra -Wshadow -pedantic -g -Wsign-conversion -fanalyzer
|
||||||
$(PROGNAME): compilation
|
$(PROGNAME): compilation
|
||||||
|
|
||||||
# Débug
|
# Version finale avec optimisations
|
||||||
debug: CFLAGS += -Wall -Wextra -Wshadow -pedantic -g -Wsign-conversion -fanalyzer
|
release: CFLAGS += -O3
|
||||||
debug: compilation
|
release: compilation
|
||||||
|
|
||||||
compilation: $(OBJ)
|
compilation: $(OBJ)
|
||||||
$(CC) $(OBJ) $(LDFLAGS) -o $(PROGNAME)
|
$(CC) $(OBJ) $(LDFLAGS) -o $(PROGNAME)
|
||||||
|
|
BIN
images/kirby.jpg
BIN
images/kirby.jpg
Binary file not shown.
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 62 KiB |
|
@ -13,7 +13,7 @@ void callback(void *_, Uint8 *stream, int taille) {
|
||||||
(void)_;
|
(void)_;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
double moyenne_calcul = 0.;
|
float moyenne_calcul = 0.f;
|
||||||
for(signed short *stream16 = (signed short *)stream; i < taille / 2; ++i) {
|
for(signed short *stream16 = (signed short *)stream; i < taille / 2; ++i) {
|
||||||
moyenne_calcul += stream16[i] / ((1 << 15) - 1.);
|
moyenne_calcul += stream16[i] / ((1 << 15) - 1.);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
void kirbyRotation(int etat) {
|
void kirbyRotation(int etat) {
|
||||||
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
||||||
static int a = 0;
|
static int a = 0;
|
||||||
static GLfloat b = 0.f;
|
|
||||||
|
|
||||||
switch(etat) {
|
switch(etat) {
|
||||||
case GL4DH_INIT:
|
case GL4DH_INIT:
|
||||||
|
@ -53,7 +52,6 @@ void kirbyRotation(int etat) {
|
||||||
gl4duPushMatrix();
|
gl4duPushMatrix();
|
||||||
|
|
||||||
gl4duRotatef(135 - a, 0, 1, 0);
|
gl4duRotatef(135 - a, 0, 1, 0);
|
||||||
gl4duScalef(.23f + b, .23f + b, .23f + b);
|
|
||||||
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
gl4duSendMatrices();
|
gl4duSendMatrices();
|
||||||
|
@ -67,8 +65,8 @@ void kirbyRotation(int etat) {
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
a += 2;
|
a += 6;
|
||||||
b += 0.012f;
|
printf("rot=%d\n", 135-a);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -78,6 +76,7 @@ void kirbyRotation(int etat) {
|
||||||
|
|
||||||
void kirbyCredits(int etat) {
|
void kirbyCredits(int etat) {
|
||||||
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
||||||
|
static int a = 0;
|
||||||
|
|
||||||
switch(etat) {
|
switch(etat) {
|
||||||
case GL4DH_INIT:
|
case GL4DH_INIT:
|
||||||
|
@ -135,6 +134,8 @@ void kirbyCredits(int etat) {
|
||||||
gl4duPopMatrix();
|
gl4duPopMatrix();
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
|
a += 7;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -57,10 +57,10 @@ void kirby(int etat) {
|
||||||
if(musique[0] != 0 || musique[1] != 0) {
|
if(musique[0] != 0 || musique[1] != 0) {
|
||||||
s = (s - musique[0]) / (musique[1] - musique[0]) + .2f;
|
s = (s - musique[0]) / (musique[1] - musique[0]) + .2f;
|
||||||
if(s > musique[2]) {
|
if(s > musique[2]) {
|
||||||
s -= s / 7.f;
|
s -= s / 20.f;
|
||||||
}
|
}
|
||||||
if(s < musique[2]) {
|
if(s < musique[2]) {
|
||||||
s += s / 7.f;
|
s += s / 20.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
musique[1] = musique[1] < s ? s : musique[1];
|
musique[1] = musique[1] < s ? s : musique[1];
|
||||||
|
|
6
window.c
6
window.c
|
@ -25,11 +25,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
GL4DHanime animations[] = {
|
GL4DHanime animations[] = {
|
||||||
{ 6800, cube, NULL, NULL },
|
/* { 6800, cube, NULL, NULL },
|
||||||
{ 8500, voronoi, NULL, NULL },
|
{ 8500, voronoi, NULL, NULL },
|
||||||
{ 6000, polygone, NULL, NULL },
|
{ 6000, polygone, NULL, NULL },
|
||||||
{ 5000, kirby, NULL, NULL },
|
{ 5000, kirby, NULL, NULL }, */
|
||||||
{ 1700, kirbyRotation, NULL, NULL},
|
{ 1000, kirbyRotation, NULL, NULL},
|
||||||
{ 3000, kirbyCredits, NULL, NULL},
|
{ 3000, kirbyCredits, NULL, NULL},
|
||||||
{ 0, NULL, NULL, NULL }
|
{ 0, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue