Enabled SOL billboards on items.
authorrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 2 Apr 2011 17:01:39 +0000 (17:01 +0000)
committerrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 2 Apr 2011 17:01:39 +0000 (17:01 +0000)
Added experimental highlight to coin to enhance visibility at low res (320x240).  I don't really expect this feature to be popular.

git-svn-id: https://s.snth.net/svn/neverball/branches/gles@3548 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/game_draw.c
data/item/coin/coin-glow [new file with mode: 0644]
data/item/coin/coin-glow.png [new file with mode: 0644]
data/item/coin/coin.map
share/item.c
share/item.h

index 7b9cb6b..d794918 100644 (file)
@@ -55,9 +55,9 @@ static void game_draw_balls(const struct s_vary *vary,
     glPopAttrib();
 }
 
-static void game_draw_items(const struct s_vary *vary, float t)
+static void game_draw_items(const struct s_vary *vary,
+                            const float *bill_M, float t)
 {
-    float r = 360.f * t;
     int hi;
 
     glPushAttrib(GL_LIGHTING_BIT);
@@ -73,8 +73,7 @@ static void game_draw_items(const struct s_vary *vary, float t)
                         glTranslatef(vary->hv[hi].p[0],
                                      vary->hv[hi].p[1],
                                      vary->hv[hi].p[2]);
-                        glRotatef(r, 0.0f, 1.0f, 0.0f);
-                        item_draw(&vary->hv[hi], r);
+                        item_draw(&vary->hv[hi], bill_M, t);
                     }
                     glPopMatrix();
                 }
@@ -92,8 +91,7 @@ static void game_draw_items(const struct s_vary *vary, float t)
                         glTranslatef(vary->hv[hi].p[0],
                                      vary->hv[hi].p[1],
                                      vary->hv[hi].p[2]);
-                        glRotatef(r, 0.0f, 1.0f, 0.0f);
-                        item_draw(&vary->hv[hi], r);
+                        item_draw(&vary->hv[hi], bill_M, t);
                     }
                     glPopMatrix();
                 }
@@ -111,8 +109,7 @@ static void game_draw_items(const struct s_vary *vary, float t)
                         glTranslatef(vary->hv[hi].p[0],
                                      vary->hv[hi].p[1],
                                      vary->hv[hi].p[2]);
-                        glRotatef(r, 0.0f, 1.0f, 0.0f);
-                        item_draw(&vary->hv[hi], r);
+                        item_draw(&vary->hv[hi], bill_M, t);
                     }
                     glPopMatrix();
                 }
@@ -398,14 +395,14 @@ static void game_draw_fore(const struct game_draw *gd,
             break;
 
         case POSE_NONE:
-            /* Draw the coins. */
-
-            game_draw_items(draw->vary, t);
-
             /* Draw the floor. */
 
             sol_draw(draw, 0, 1);
 
+            /* Draw the coins. */
+
+            game_draw_items(draw->vary, M, t);
+
             /* Fall through. */
 
         case POSE_BALL:
diff --git a/data/item/coin/coin-glow b/data/item/coin/coin-glow
new file mode 100644 (file)
index 0000000..8e473ff
--- /dev/null
@@ -0,0 +1,7 @@
+1.0 1.0 1.0 1.0
+0.2 0.2 0.2 1.0
+0.0 0.0 0.0 1.0
+0.0 0.0 0.0 1.0
+0.0
+additive clamp-s clamp-t transparent 
+45.0
diff --git a/data/item/coin/coin-glow.png b/data/item/coin/coin-glow.png
new file mode 100644 (file)
index 0000000..830f8ca
Binary files /dev/null and b/data/item/coin/coin-glow.png differ
index cf5bd54..33b4fb4 100644 (file)
@@ -2,3 +2,21 @@
 "classname" "worldspawn"
 "model" "item/coin/coin.obj"
 }
+{
+"classname" "info_null"
+"origin" "0 0 0"
+"height" "0.6 0.0 0.0"
+"width" "0.6 0.0 0.0"
+"zrot" "0.0 135.0 0.0"
+"time" "1.0"
+"image" "item/coin/coin-glow"
+}
+{
+"classname" "info_null"
+"origin" "0 0 0"
+"height" "0.5 0.0 0.0"
+"width" "0.5 0.0 0.0"
+"zrot" "0.0 -180.0 0.0"
+"time" "1.0"
+"image" "item/coin/coin-glow"
+}
index 8af06db..87b2cfe 100644 (file)
@@ -98,7 +98,7 @@ void item_push(int type)
     glEnable(GL_COLOR_MATERIAL);
 }
 
-void item_draw(const struct v_item *hp, float r)
+void item_draw(const struct v_item *hp, const GLfloat *M, float t)
 {
     struct s_draw *draw = NULL;
     float c[3];
@@ -113,7 +113,19 @@ void item_draw(const struct v_item *hp, float r)
     item_color(hp, c);
 
     glColor3fv(c);
-    sol_draw(draw, 0, 1);
+
+    glDepthMask(GL_FALSE);
+    {
+        sol_bill(draw, M, t);
+    }
+    glDepthMask(GL_TRUE);
+
+    glPushMatrix();
+    {
+        glRotatef(360.0f * t, 0.0f, 1.0f, 0.0f);
+        sol_draw(draw, 0, 1);
+    }
+    glPopMatrix();
 }
 
 void item_pull(void)
index 4d72414..2959ed4 100644 (file)
@@ -24,7 +24,7 @@ void item_init(void);
 void item_free(void);
 
 void item_push(int);
-void item_draw(const struct v_item *, float);
+void item_draw(const struct v_item *, const float *, float);
 void item_pull(void);
 
 #endif