Converted putt vector to SOL.
authorrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 3 Apr 2011 18:23:04 +0000 (18:23 +0000)
committerrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 3 Apr 2011 18:23:04 +0000 (18:23 +0000)
git-svn-id: https://s.snth.net/svn/neverball/branches/gles@3552 78b8d119-cf0a-0410-b17c-f493084dd1d7

data/geom/vect/vect [new file with mode: 0644]
data/geom/vect/vect.map [new file with mode: 0644]
data/geom/vect/vect.mtl [new file with mode: 0644]
data/geom/vect/vect.obj [new file with mode: 0644]
data/geom/vect/vect.png [new file with mode: 0644]
data/geom/vect/vect.wings [new file with mode: 0644]
putt/game.c
share/geom.c
share/geom.h

diff --git a/data/geom/vect/vect b/data/geom/vect/vect
new file mode 100644 (file)
index 0000000..081d77c
--- /dev/null
@@ -0,0 +1,7 @@
+0.8 0.8 0.8 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
+clamp-s clamp-t transparent
+45.0
diff --git a/data/geom/vect/vect.map b/data/geom/vect/vect.map
new file mode 100644 (file)
index 0000000..03bab7f
--- /dev/null
@@ -0,0 +1,4 @@
+{
+"classname" "worldspawn"
+"model" "geom/vect/vect.obj"
+}
diff --git a/data/geom/vect/vect.mtl b/data/geom/vect/vect.mtl
new file mode 100644 (file)
index 0000000..c5302eb
--- /dev/null
@@ -0,0 +1,11 @@
+# Exported from Wings 3D 1.4.1\r
+newmtl geom/vect/vect\r
+Ns 100.0\r
+d 1.0\r
+illum 2\r
+Kd 1.0 1.0 1.0\r
+Ka 1.0 1.0 1.0\r
+Ks 1.0 1.0 1.0\r
+Ke 0.0 0.0 0.0\r
+map_Kd vect.png\r
+\r
diff --git a/data/geom/vect/vect.obj b/data/geom/vect/vect.obj
new file mode 100644 (file)
index 0000000..1fd889f
--- /dev/null
@@ -0,0 +1,51 @@
+# Exported from Wings 3D 1.4.1\r
+mtllib vect.mtl\r
+o cube1\r
+#5 vertices, 6 faces\r
+v -1.00000000 -1.00000000 0.0000000e+0\r
+v -1.00000000 1.00000000 0.0000000e+0\r
+v 1.00000000 1.00000000 0.0000000e+0\r
+v 1.00000000 -1.00000000 0.0000000e+0\r
+v 0.0000000e+0 0.0000000e+0 2.00000000\r
+vt -1.3877788e-17 1.00000000\r
+vt 1.3877788e-17 1.00000000\r
+vt 2.7755576e-17 1.00000000\r
+vt 5.5511151e-17 4.4408921e-16\r
+vt 7.6327833e-17 1.00000000\r
+vt 2.2859681e-16 1.00000000\r
+vt 0.50000000 0.0000000e+0\r
+vt 0.50000000 0.0000000e+0\r
+vt 0.50000000 0.0000000e+0\r
+vt 1.00000000 2.2204460e-16\r
+vt 1.00000000 1.00000000\r
+vt 1.00000000 1.00000000\r
+vt 1.00000000 1.00000000\r
+vn 0.0000000e+0 -0.89442719 0.44721360\r
+vn 0.0000000e+0 0.0000000e+0 -1.00000000\r
+vn -0.89442719 0.0000000e+0 0.44721360\r
+vn 0.0000000e+0 0.0000000e+0 -1.00000000\r
+vn 0.0000000e+0 0.89442719 0.44721360\r
+vn -0.89442719 0.0000000e+0 0.44721360\r
+vn 0.0000000e+0 0.0000000e+0 -1.00000000\r
+vn 0.89442719 0.0000000e+0 0.44721360\r
+vn 0.0000000e+0 0.89442719 0.44721360\r
+vn 0.0000000e+0 0.0000000e+0 -1.00000000\r
+vn 0.0000000e+0 0.0000000e+0 -1.00000000\r
+vn 0.89442719 0.0000000e+0 0.44721360\r
+vn 0.0000000e+0 -0.89442719 0.44721360\r
+vn 0.0000000e+0 0.0000000e+0 -1.00000000\r
+vn 0.89442719 0.0000000e+0 0.44721360\r
+vn 0.0000000e+0 -0.89442719 0.44721360\r
+vn 0.0000000e+0 0.89442719 0.44721360\r
+vn -0.89442719 0.0000000e+0 0.44721360\r
+g cube1_geom/vect/vect\r
+usemtl geom/vect/vect\r
+s 1\r
+f 5/8/18 2/13/6 1/1/3\r
+f 5/9/15 4/13/12 3/5/8\r
+s 2\r
+f 1/10/2 3/6/10 4/4/14\r
+f 2/13/7 3/6/11 1/10/4\r
+s 3\r
+f 1/12/1 4/3/13 5/8/16\r
+f 5/7/17 3/11/9 2/2/5\r
diff --git a/data/geom/vect/vect.png b/data/geom/vect/vect.png
new file mode 100644 (file)
index 0000000..3269bda
Binary files /dev/null and b/data/geom/vect/vect.png differ
diff --git a/data/geom/vect/vect.wings b/data/geom/vect/vect.wings
new file mode 100644 (file)
index 0000000..e1393f9
Binary files /dev/null and b/data/geom/vect/vect.wings differ
index f8cd974..1a85ee1 100644 (file)
@@ -119,64 +119,25 @@ void game_free(void)
 
 /*---------------------------------------------------------------------------*/
 
-static void game_draw_vect_prim(const struct s_vary *fp, GLenum mode)
-{
-    float p[3];
-    float x[3];
-    float z[3];
-    float r;
-
-    v_cpy(p, fp->uv[ball].p);
-    v_cpy(x, view_e[0]);
-    v_cpy(z, view_e[2]);
-
-    r = fp->uv[ball].r;
-
-    glBegin(mode);
-    {
-        glColor4f(1.0f, 1.0f, 0.5f, 0.5f);
-        glVertex3f(p[0] - x[0] * r,
-                   p[1] - x[1] * r,
-                   p[2] - x[2] * r);
-
-        glColor4f(1.0f, 0.0f, 0.0f, 0.5f);
-        glVertex3f(p[0] + z[0] * view_m,
-                   p[1] + z[1] * view_m,
-                   p[2] + z[2] * view_m);
-
-        glColor4f(1.0f, 1.0f, 0.0f, 0.5f);
-        glVertex3f(p[0] + x[0] * r,
-                   p[1] + x[1] * r,
-                   p[2] + x[2] * r);
-    }
-    glEnd();
-}
-
 static const struct d_mtrl *game_draw_vect(const struct d_mtrl *mq,
                                            const struct s_vary *fp)
 {
     if (view_m > 0.f)
     {
-        glPushAttrib(GL_TEXTURE_BIT);
-        glPushAttrib(GL_POLYGON_BIT);
-        glPushAttrib(GL_LIGHTING_BIT);
-        glPushAttrib(GL_DEPTH_BUFFER_BIT);
+        glDisable(GL_LIGHTING);
+        glPushMatrix();
         {
-            glEnable(GL_COLOR_MATERIAL);
-            glDisable(GL_LIGHTING);
-            glDisable(GL_TEXTURE_2D);
-            glDepthMask(GL_FALSE);
-
-            glEnable(GL_DEPTH_TEST);
-            game_draw_vect_prim(fp, GL_TRIANGLES);
-
-            glDisable(GL_DEPTH_TEST);
-            game_draw_vect_prim(fp, GL_LINE_STRIP);
+            glTranslatef(fp->uv[ball].p[0],
+                         fp->uv[ball].p[1],
+                         fp->uv[ball].p[2]);
+            glRotatef(view_a, 0.0f, 1.0f, 0.0f);
+            glScalef(fp->uv[ball].r,
+                     fp->uv[ball].r * 0.1f, view_m);
+
+            mq = vect_draw(mq);
         }
-        glPopAttrib();
-        glPopAttrib();
-        glPopAttrib();
-        glPopAttrib();
+        glPopMatrix();
+        glEnable(GL_LIGHTING);
     }
     return mq;
 }
index 792848e..80bc6c3 100644 (file)
@@ -34,6 +34,7 @@ static struct s_full jump;
 static struct s_full goal;
 static struct s_full flag;
 static struct s_full mark;
+static struct s_full vect;
 static struct s_full back;
 
 static int back_state = 0;
@@ -47,10 +48,12 @@ void geom_init(void)
     sol_load_full(&goal, "geom/goal/goal.sol", 0);
     sol_load_full(&flag, "geom/flag/flag.sol", 0);
     sol_load_full(&mark, "geom/mark/mark.sol", 0);
+    sol_load_full(&vect, "geom/vect/vect.sol", 0);
 }
 
 void geom_free(void)
 {
+    sol_free_full(&vect);
     sol_free_full(&mark);
     sol_free_full(&flag);
     sol_free_full(&goal);
@@ -202,6 +205,13 @@ const struct d_mtrl *mark_draw(const struct d_mtrl *mq)
     return sol_draw(&mark.draw, mq, 1, 1);
 }
 
+const struct d_mtrl *vect_draw(const struct d_mtrl *mq)
+{
+    mq = sol_draw(&vect.draw, mq, 0, 1);
+    mq = sol_draw(&vect.draw, mq, 0, 0);
+    return mq;
+}
+
 const struct d_mtrl *back_draw(const struct d_mtrl *mq, float t)
 {
     glPushMatrix();
index 9b2e15b..ebdd8a6 100644 (file)
@@ -24,6 +24,7 @@ const struct d_mtrl *jump_draw(const struct d_mtrl *, float, int);
 const struct d_mtrl *swch_draw(const struct d_mtrl *, int, int);
 const struct d_mtrl *flag_draw(const struct d_mtrl *);
 const struct d_mtrl *mark_draw(const struct d_mtrl *);
+const struct d_mtrl *vect_draw(const struct d_mtrl *);
 const struct d_mtrl *back_draw(const struct d_mtrl *, float);
 
 /*---------------------------------------------------------------------------*/