Package: tachyon / 0.99~b6+dsx-9

upstream-parse-tpoly.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: parse -- tpoly
 Correct the tachyon parser for tpoly data files.
Origin: vendor, Debian
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2014-10-26

--- a/demosrc/parse.c
+++ b/demosrc/parse.c
@@ -617,6 +617,19 @@
   return PARSENOERR;
 }
 
+static errcode FILEGetVector(FILE * ifp, apivector * v1) {
+  float a, b, c;
+
+  if (fscanf(ifp, "%f %f %f", &a, &b, &c) != 3)
+    return PARSEBADSYNTAX;
+
+  v1->x=a;
+  v1->y=b;
+  v1->z=c;
+
+  return PARSENOERR;
+}
+
 static errcode GetVector(parsehandle * ph, apivector * v1) {
   float a, b, c;
  
@@ -1848,9 +1861,9 @@
     totalpolys++;
     v=0; 
      
-    rc |= GetVector(ph, &v0);
-    rc |= GetVector(ph, &v1);
-    rc |= GetVector(ph, &v2);
+    rc |= FILEGetVector(ifp, &v0);
+    rc |= FILEGetVector(ifp, &v1);
+    rc |= FILEGetVector(ifp, &v2);
 
     Scale3d(&scale, &v0);
     Scale3d(&scale, &v1);