stage 6 background initial
This commit is contained in:
parent
577f0ef204
commit
5cfb3cbb1a
14 changed files with 3318 additions and 18 deletions
BIN
gfx/stage6/towertop.png
Normal file
BIN
gfx/stage6/towertop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 MiB |
BIN
gfx/stage6/towertop0.xcf
Normal file
BIN
gfx/stage6/towertop0.xcf
Normal file
Binary file not shown.
BIN
models/towertop.blend
Normal file
BIN
models/towertop.blend
Normal file
Binary file not shown.
3171
models/towertop.obj
Normal file
3171
models/towertop.obj
Normal file
File diff suppressed because it is too large
Load diff
|
@ -52,6 +52,8 @@ set(SRCs
|
|||
stages/stage3_events.c
|
||||
stages/stage4.c
|
||||
stages/stage4_events.c
|
||||
stages/stage6.c
|
||||
stages/stage6_events.c
|
||||
resource/resource.c
|
||||
resource/texture.c
|
||||
resource/animation.c
|
||||
|
|
|
@ -22,6 +22,7 @@ StageInfo stages[] = {
|
|||
{3, stage2_loop, False, "Stage 3", "Through the Tunnel of Light", {0, 0, 0}},
|
||||
{4, stage3_loop, False, "Stage 4", "Forgotten Mansion", {0, 0, 0}},
|
||||
{5, stage4_loop, False, "Stage 5", "Climbing the Tower of Babel", {1, 1, 1}},
|
||||
{6, stage6_loop, False, "Stage 6", "Roof of the World", {1, 1, 1}},
|
||||
|
||||
{0, NULL, False, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -57,5 +57,6 @@ void stage1_loop();
|
|||
void stage2_loop();
|
||||
void stage3_loop();
|
||||
void stage4_loop();
|
||||
void stage6_loop();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,25 +70,8 @@ void stage3_fountain_draw(Vector pos) {
|
|||
|
||||
Vector **stage3_lake_pos(Vector pos, float maxrange) {
|
||||
Vector p = {0, 600, 0};
|
||||
Vector d;
|
||||
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
d[i] = p[i] - pos[i];
|
||||
|
||||
if(length(d) > maxrange) {
|
||||
return NULL;
|
||||
} else {
|
||||
Vector **list = calloc(2, sizeof(Vector*));
|
||||
|
||||
list[0] = malloc(sizeof(Vector));
|
||||
for(i = 0; i < 3; i++)
|
||||
(*list[0])[i] = p[i];
|
||||
list[1] = NULL;
|
||||
|
||||
return list;
|
||||
}
|
||||
return single3dpos(pos, maxrange, p);
|
||||
}
|
||||
|
||||
void stage3_lake_draw(Vector pos) {
|
||||
|
|
79
src/stages/stage6.c
Normal file
79
src/stages/stage6.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#include "stage6.h"
|
||||
#include "stage6_events.h"
|
||||
|
||||
#include "stage.h"
|
||||
#include "stageutils.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
static Stage3D bgcontext;
|
||||
|
||||
Vector **stage6_towertop_pos(Vector pos, float maxrange) {
|
||||
Vector p = {0, 0, 70};
|
||||
|
||||
return single3dpos(pos, maxrange, p);
|
||||
}
|
||||
|
||||
void stage6_towertop_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towertop")->gltex);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(pos[0], pos[1], pos[2]);
|
||||
glScalef(28,28,28);
|
||||
draw_model("towertop");
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void stage6_draw() {
|
||||
set_perspective(&bgcontext, 100, 1000);
|
||||
draw_stage3d(&bgcontext, 30000);
|
||||
|
||||
float w = 0.01;
|
||||
float f = 1;
|
||||
if(bgcontext.cx[2] >= 290) {
|
||||
f = 0;
|
||||
if(bgcontext.crot[2] >= 360)
|
||||
w = 0;
|
||||
}
|
||||
|
||||
|
||||
bgcontext.cx[0] += -230*w*f*sin(w*global.frames-M_PI/2);
|
||||
bgcontext.cx[1] += 230*w*f*cos(w*global.frames-M_PI/2);
|
||||
bgcontext.cx[2] += w*f*140/M_PI;
|
||||
|
||||
bgcontext.crot[2] += 180/M_PI*w;
|
||||
|
||||
printf("%f\n", creal(bgcontext.crot[2]));
|
||||
}
|
||||
|
||||
void stage6_start() {
|
||||
init_stage3d(&bgcontext);
|
||||
|
||||
add_model(&bgcontext, stage6_towertop_draw, stage6_towertop_pos);
|
||||
|
||||
// bgcontext.cx[0] = 230;
|
||||
bgcontext.cx[1] = -230;
|
||||
bgcontext.crot[0] = 90;
|
||||
bgcontext.crot[2] = -40;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void stage6_end() {
|
||||
free_stage3d(&bgcontext);
|
||||
}
|
||||
|
||||
void stage6_loop() {
|
||||
stage_loop(stage_get(6), stage6_start, stage6_end, stage6_draw, stage6_events, NULL, 5700);
|
||||
}
|
13
src/stages/stage6.h
Normal file
13
src/stages/stage6.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#ifndef STAGE6_H
|
||||
#define STAGE6_H
|
||||
|
||||
void stage6_loop();
|
||||
|
||||
#endif
|
13
src/stages/stage6_events.c
Normal file
13
src/stages/stage6_events.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#include "stage6_events.h"
|
||||
#include "stage6.h"
|
||||
#include <global.h>
|
||||
|
||||
void stage6_events() {
|
||||
}
|
13
src/stages/stage6_events.h
Normal file
13
src/stages/stage6_events.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#ifndef STAGE6_EVENTS_H
|
||||
#define STAGE6_EVENTS_H
|
||||
|
||||
void stage6_events();
|
||||
|
||||
#endif
|
|
@ -114,3 +114,25 @@ Vector **linear3dpos(Vector q, float maxrange, Vector p, Vector r) {
|
|||
|
||||
return list;
|
||||
}
|
||||
|
||||
Vector **single3dpos(Vector q, float maxrange, Vector p) {
|
||||
Vector d;
|
||||
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
d[i] = p[i] - q[i];
|
||||
|
||||
if(length(d) > maxrange) {
|
||||
return NULL;
|
||||
} else {
|
||||
Vector **list = calloc(2, sizeof(Vector*));
|
||||
|
||||
list[0] = malloc(sizeof(Vector));
|
||||
for(i = 0; i < 3; i++)
|
||||
(*list[0])[i] = p[i];
|
||||
list[1] = NULL;
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -44,4 +44,6 @@ void draw_stage3d(Stage3D *s, float maxrange);
|
|||
void free_stage3d(Stage3D *s);
|
||||
|
||||
Vector **linear3dpos(Vector q, float maxrange, Vector p, Vector r);
|
||||
|
||||
Vector **single3dpos(Vector q, float maxrange, Vector p);
|
||||
#endif
|
Loading…
Reference in a new issue