Ported the mtrl loft to putt.
authorrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 3 Apr 2011 15:59:17 +0000 (15:59 +0000)
committerrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 3 Apr 2011 15:59:17 +0000 (15:59 +0000)
git-svn-id: https://s.snth.net/svn/neverball/branches/gles@3550 78b8d119-cf0a-0410-b17c-f493084dd1d7

Makefile
ball/game_draw.c
putt/game.c
putt/st_conf.c

index 3f37d2b..852397c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -342,8 +342,7 @@ DESKTOPS := $(basename $(wildcard dist/*.desktop.in))
 
 #------------------------------------------------------------------------------
 
-all : $(BALL_TARG) $(MAPC_TARG) sols locales desktops
-#all : $(BALL_TARG) $(PUTT_TARG) $(MAPC_TARG) sols locales desktops
+all : $(BALL_TARG) $(PUTT_TARG) $(MAPC_TARG) sols locales desktops
 
 $(BALL_TARG) : $(BALL_OBJS)
        $(CC) $(ALL_CFLAGS) -o $(BALL_TARG) $(BALL_OBJS) $(LDFLAGS) $(ALL_LIBS)
index b5cf215..4d83063 100644 (file)
@@ -39,7 +39,6 @@ static const struct d_mtrl *game_draw_balls(const struct d_mtrl *mq,
     m_basis(ball_M, vary->uv[0].e[0], vary->uv[0].e[1], vary->uv[0].e[2]);
     m_basis(pend_M, vary->uv[0].E[0], vary->uv[0].E[1], vary->uv[0].E[2]);
 
-    glPushAttrib(GL_LIGHTING_BIT);
     glPushMatrix();
     {
         glTranslatef(vary->uv[0].p[0],
@@ -53,7 +52,6 @@ static const struct d_mtrl *game_draw_balls(const struct d_mtrl *mq,
         mq = ball_draw(mq, ball_M, pend_M, bill_M, t);
     }
     glPopMatrix();
-    glPopAttrib();
 
     return mq;
 }
index 80652ee..fd0157a 100644 (file)
@@ -152,7 +152,8 @@ static void game_draw_vect_prim(const struct s_vary *fp, GLenum mode)
     glEnd();
 }
 
-static void game_draw_vect(const struct s_vary *fp)
+static const struct d_mtrl *game_draw_vect(const struct d_mtrl *mq,
+                                           const struct s_vary *fp)
 {
     if (view_m > 0.f)
     {
@@ -177,10 +178,12 @@ static void game_draw_vect(const struct s_vary *fp)
         glPopAttrib();
         glPopAttrib();
     }
+    return mq;
 }
 
-static void game_draw_balls(const struct s_vary *fp,
-                            const float *bill_M, float t)
+static const struct d_mtrl *game_draw_balls(const struct d_mtrl *mq,
+                                            const struct s_vary *fp,
+                                            const float *bill_M, float t)
 {
     static const GLfloat color[5][4] = {
         { 1.0f, 1.0f, 1.0f, 0.7f },
@@ -214,7 +217,7 @@ static void game_draw_balls(const struct s_vary *fp,
                          fp->uv[ui].r);
 
                 glColor4fv(color[ui]);
-                ball_draw(ball_M, pend_M, bill_M, t);
+                mq = ball_draw(mq, ball_M, pend_M, bill_M, t);
             }
             glPopMatrix();
         }
@@ -233,7 +236,7 @@ static void game_draw_balls(const struct s_vary *fp,
                           color[ui][1],
                           color[ui][2], 0.5f);
 
-                mark_draw();
+                mq = mark_draw(mq);
             }
             glPopMatrix();
         }
@@ -241,9 +244,12 @@ static void game_draw_balls(const struct s_vary *fp,
 
     glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
     glDisable(GL_COLOR_MATERIAL);
+
+    return mq;
 }
 
-static void game_draw_goals(const struct s_base *fp)
+static const struct d_mtrl *game_draw_goals(const struct d_mtrl *mq,
+                                            const struct s_base *fp)
 {
     int zi;
 
@@ -254,13 +260,15 @@ static void game_draw_goals(const struct s_base *fp)
             glTranslatef(fp->zv[zi].p[0],
                          fp->zv[zi].p[1],
                          fp->zv[zi].p[2]);
-            flag_draw();
+            mq = flag_draw(mq);
         }
         glPopMatrix();
     }
+    return mq;
 }
 
-static void game_draw_jumps(const struct s_base *fp)
+static const struct d_mtrl *game_draw_jumps(const struct d_mtrl *mq,
+                                            const struct s_base *fp)
 {
     float t = 0.001f * SDL_GetTicks();
     int ji;
@@ -274,13 +282,15 @@ static void game_draw_jumps(const struct s_base *fp)
                          fp->jv[ji].p[2]);
 
             glScalef(fp->jv[ji].r, 1.f, fp->jv[ji].r);
-            jump_draw(t, !jump_e);
+            mq = jump_draw(mq, t, !jump_e);
         }
         glPopMatrix();
     }
+    return mq;
 }
 
-static void game_draw_swchs(const struct s_vary *fp)
+static const struct d_mtrl *game_draw_swchs(const struct d_mtrl *mq,
+                                            const struct s_vary *fp)
 {
     int xi;
 
@@ -298,10 +308,11 @@ static void game_draw_swchs(const struct s_vary *fp)
                          xp->base->p[2]);
 
             glScalef(xp->base->r, 1.f, xp->base->r);
-            swch_draw(xp->f, xp->e);
+            mq = swch_draw(mq, xp->f, xp->e);
         }
         glPopMatrix();
     }
+    return mq;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -316,6 +327,7 @@ void game_draw(int pose, float t)
     const float light_p[4] = { 8.f, 32.f, 8.f, 0.f };
 
     const struct s_draw *fp = &file.draw;
+    const struct d_mtrl *mq = sol_draw_enable();
 
     float fov = FOV;
 
@@ -344,7 +356,7 @@ void game_draw(int pose, float t)
         glPushMatrix();
         {
             glTranslatef(view_p[0], view_p[1], view_p[2]);
-            back_draw(0);
+            mq = back_draw(mq, 0);
         }
         glPopMatrix();
 
@@ -353,14 +365,7 @@ void game_draw(int pose, float t)
 
         /* Draw the floor. */
 
-        sol_draw(fp, 0, 1);
-
-        if (config_get_d(CONFIG_SHADOW) && !pose)
-        {
-            shad_draw_set();
-            sol_shad(fp, ball);
-            shad_draw_clr();
-        }
+        mq = sol_draw(fp, mq, 0, 1);
 
         /* Draw the game elements. */
 
@@ -369,8 +374,8 @@ void game_draw(int pose, float t)
 
         if (pose == 0)
         {
-            game_draw_balls(fp->vary, T, t);
-            game_draw_vect(fp->vary);
+            mq = game_draw_balls(mq, fp->vary, T, t);
+            mq = game_draw_vect(mq, fp->vary);
         }
 
         glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,   a);
@@ -382,9 +387,9 @@ void game_draw(int pose, float t)
         glDisable(GL_LIGHTING);
         glDepthMask(GL_FALSE);
         {
-            game_draw_goals(fp->base);
-            game_draw_jumps(fp->base);
-            game_draw_swchs(fp->vary);
+            mq = game_draw_goals(mq, fp->base);
+            mq = game_draw_jumps(mq, fp->base);
+            mq = game_draw_swchs(mq, fp->vary);
         }
         glDepthMask(GL_TRUE);
         glEnable(GL_LIGHTING);
@@ -393,6 +398,8 @@ void game_draw(int pose, float t)
     glPopMatrix();
     glPopAttrib();
     video_pop_matrix();
+
+    sol_draw_disable(mq);
 }
 
 /*---------------------------------------------------------------------------*/
index ffbfddb..c1f37b4 100644 (file)
@@ -254,7 +254,7 @@ static void conf_paint(int id, float st)
 {
     video_push_persp((float) config_get_d(CONFIG_VIEW_FOV), 0.1f, FAR_DIST);
     {
-        back_draw(0);
+        back_draw_easy();
     }
     video_pop_matrix();
     gui_paint(id);