gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/include/vob jni/Types.hxx lines/Lines.hx...


From: Matti Katila
Subject: [Gzz-commits] libvob/include/vob jni/Types.hxx lines/Lines.hx...
Date: Mon, 04 Aug 2003 09:47:51 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Matti Katila <address@hidden>   03/08/04 09:47:50

Modified files:
        include/vob/jni: Types.hxx 
        include/vob/lines: Lines.hxx 
        include/vob/vobs: Lines.hxx 

Log message:
        some lines

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Types.hxx.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/lines/Lines.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Lines.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: libvob/include/vob/jni/Types.hxx
diff -u libvob/include/vob/jni/Types.hxx:1.28 
libvob/include/vob/jni/Types.hxx:1.29
--- libvob/include/vob/jni/Types.hxx:1.28       Mon Aug  4 03:57:56 2003
+++ libvob/include/vob/jni/Types.hxx    Mon Aug  4 09:47:50 2003
@@ -100,7 +100,6 @@
     // Only TexAccum_JNI objects will be stored here
     extern ObjectStorer<Stats::TexAccum> texaccums;
 
-
     typedef ::Vob::Paper::Paper P; // g++3.2 doesn't like ::... inside
                                   // template param
     extern ObjectStorer<P> papers;
@@ -233,8 +232,16 @@
        out = jstr2stdstr(env, in);
     END_VOB_JNI_CONVERSION
 
-    START_VOB_JNI_CONVERSION(float *, "float []", jfloatArray) 
-      out = env->GetFloatArrayElements(in, 0);
+    START_VOB_JNI_CONVERSION(std::vector<float>, "float []", jfloatArray) 
+      jsize len = env->GetArrayLength(in);
+      int i = 0;
+      std::vector<float> floats;
+      jfloat *f = env->GetFloatArrayElements(in, 0);
+      for (i=0; i<len; i++) {
+       floats.push_back(f[i]);
+      }
+      env->ReleaseFloatArrayElements(in, f, 0);
+      out = floats;
     END_VOB_JNI_CONVERSION
 
 
Index: libvob/include/vob/lines/Lines.hxx
diff -u libvob/include/vob/lines/Lines.hxx:1.3 
libvob/include/vob/lines/Lines.hxx:1.4
--- libvob/include/vob/lines/Lines.hxx:1.3      Wed Jun 11 13:41:55 2003
+++ libvob/include/vob/lines/Lines.hxx  Mon Aug  4 09:47:50 2003
@@ -53,15 +53,15 @@
         GLuint textureId;
         float linewidth;
     public:
-        SimpleLine(GLuint textId, float l, float * points, int size): 
+        SimpleLine(GLuint textId, float l, vector<float> points): 
             textureId(textId), linewidth(l)
         { 
          if (textId <= 0) {
            cout << "Error in SimpleLine - TextId under or zero!"<< textId 
<<"\n";
            return;
          }
-         if (size != 6) {
-           cout << "Errorr in SimpleLine - not enough points!"<< size <<"\n";
+         if (points.size() != 6) {
+           cout << "Errorr in SimpleLine - not enough points!"<< points.size() 
<<"\n";
            return;
          } else {
 
@@ -113,13 +113,12 @@
          * @param joinStyle "Bevel", "Miter" or "Round"
          * @param lineWidth line's width
          * @param chain join first and last point
-         * @param points float array of points a,b,c etc. 
+         * @param points float vector of points a,b,c etc. 
          *          { ax,ay,az, bx,by,bz, cx,cy,cz, etc.. }
-         * @param size size of points array
          */
         ContinuousLine(GLuint textId, float lineWidth,
                       int joinStyle, bool chain,
-                       float * points, int size);
+                       vector<float> points);
 
 
         /** ContinuousLine is line constructed from various points. 
Index: libvob/include/vob/vobs/Lines.hxx
diff -u libvob/include/vob/vobs/Lines.hxx:1.2 
libvob/include/vob/vobs/Lines.hxx:1.3
--- libvob/include/vob/vobs/Lines.hxx:1.2       Wed Jun 11 13:41:56 2003
+++ libvob/include/vob/vobs/Lines.hxx   Mon Aug  4 09:47:50 2003
@@ -48,33 +48,29 @@
     float width;
     int joinStyle;
     bool chain;
-    float * points;
-    int numPoints;
+    vector<float> points;
 
     template<class F> void params(F &f) {
-      f(texId, width, joinStyle, chain, points, numPoints);
+      f(texId, width, joinStyle, chain, points);
     }
 
     template<class T> void render(const T &coords1) const {
       std::cout << "Foobar, ContinuousLine...\n";
 
-      float realPts[numPoints * 2];
-      int realNum;
-      for (int i=0,j=0; i<numPoints;) {
+      vector<float> pts;
+      for (unsigned int i=0; i<points.size(); i+=3) {
          ZPt tmp = coords1.transform( ZPt(points[i], points[i+1], 0) );
-         realPts[j] = tmp.x;
-         realPts[j+1] = tmp.y;
-         realPts[j+2] = tmp.z;
-         i+=2;
-         j+=3;
-         realNum = j+3;
+         std::cout << "Argh..";
+         pts.push_back(tmp.x);
+         pts.push_back(tmp.y);
+         pts.push_back(tmp.z);
       }
 
-      if (numPoints <= 4) {
-       Lines::SimpleLine l = Lines::SimpleLine(texId, width, realPts, realNum);
+      if (pts.size() <= 6) {
+       Lines::SimpleLine l = Lines::SimpleLine(texId, width, pts);
       } else {
        Lines::ContinuousLine l = 
-         Lines::ContinuousLine(texId, width, joinStyle, chain, realPts, 
realNum);
+         Lines::ContinuousLine(texId, width, joinStyle, chain, pts);
       }
 
       std::cout << "Foobar, ContinuousLine DONE...\n";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]