[Fencommits] libvob: At least something can be seen :o)

Matti J. Katila majukati at cc.jyu.fi
Tue Feb 7 23:05:24 EET 2006


Tue Feb  7 22:03:29 EET 2006  Matti J. Katila <majukati at cc.jyu.fi>
  * At least something can be seen :o)

diff -rN -u libvob-old/org/nongnu/libvob/gl/GL.java libvob-new/org/nongnu/libvob/gl/GL.java
--- libvob-old/org/nongnu/libvob/gl/GL.java	2006-02-07 23:05:22.269584326 +0200
+++ libvob-new/org/nongnu/libvob/gl/GL.java	2006-02-07 22:10:35.000000000 +0200
@@ -172,6 +172,10 @@
      */
     public static final int RENDERABLE_VS = 0x6000000;
 
+    /** The mask for different renderables.
+     */
+    public static final int RMASK = GL.RENDERABLE0 | GL.RENDERABLE1 | GL.RENDERABLE2 | GL.RENDERABLE3 | GL.RENDERABLEN | GL.RENDERABLE_VS;
+    
     static ArrayList queue = new ArrayList();
 
     /** Because objects have to be released by the same thread
diff -rN -u libvob-old/org/nongnu/libvob/gl/GLRen.java libvob-new/org/nongnu/libvob/gl/GLRen.java
--- libvob-old/org/nongnu/libvob/gl/GLRen.java	2006-02-07 23:05:22.263585231 +0200
+++ libvob-new/org/nongnu/libvob/gl/GLRen.java	2006-02-07 22:10:35.000000000 +0200
@@ -38,19 +38,19 @@
 
     public static Vob createCallList(String s) {
 	if (GraphicsAPI.getInstance() instanceof LWJGL_API) {
-	    return LWJGLRen.createCallList(s, LWJGLRen.NONE);
+	    return LWJGLRen.createCallList(s);
 	}
 	return createCallList(GL.createDisplayList(s));
     }
     public static Vob createCallListCoorded(String s) {
 	if (GraphicsAPI.getInstance() instanceof LWJGL_API) {
-	    return LWJGLRen.createCallList(s, LWJGLRen.COORDER);
+	    return LWJGLRen.createCallListCoorder(s);
 	}
 	return createCallListCoorded(GL.createDisplayList(s));
     }
     public static Vob createCallListBoxCoorded(String s) {
 	if (GraphicsAPI.getInstance() instanceof LWJGL_API) {
-	    return LWJGLRen.createCallList(s, LWJGLRen.BOX_COORDER);
+	    return LWJGLRen.createCallListBoxCoorder(s);
 	}
 	return createCallListBoxCoorded(GL.createDisplayList(s));
     }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/CallGL.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/CallGL.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/CallGL.java	2006-02-07 23:05:22.261585533 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/CallGL.java	2006-02-07 22:10:35.000000000 +0200
@@ -33,7 +33,7 @@
 import org.nongnu.libvob.VobScene;
 import org.nongnu.libvob.Vob.RenderInfo;
 
-public class CallGL extends AbstractVob {
+public class CallGL extends AbstractVob implements LWJGLRen.Vob0 {
 
     private static boolean Begin;
 
@@ -620,5 +620,13 @@
     {
 	return callList;
     }
+
+    public void render(int callList) {
+	// push attrib?
+	checkGlError("before call list in callgl render");
+	GL11.glCallList(callList);
+	checkGlError("after call list in callgl render");
+	// pop attrib?
+    }
     
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/Coorder.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/Coorder.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/Coorder.java	2006-02-07 23:05:22.256586286 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/Coorder.java	2006-02-07 22:10:35.000000000 +0200
@@ -2,6 +2,11 @@
 
 package org.nongnu.libvob.gl.impl.lwjgl;
 
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import org.lwjgl.util.vector.Vector2f;
+import org.lwjgl.util.vector.Vector3f;
 import org.nongnu.libvob.gl.GLVobCoorder;
 import org.nongnu.libvob.gl.impl.lwjgl.LwjglRenderer.TransformProxy;
 
@@ -13,10 +18,52 @@
  */
 public class Coorder {
 
-    private Transform tr; 
+    static private Transform root = new Transform() {
+
+	public void setYourself(Coorder base, int index, int[] inds, float[] floats) {
+	}
+	public boolean shouldBeDrawn() {
+	    return true;
+	}
+	public Vector3f transform(Vector3f p) {
+	    return p;
+	}
+	public void vertex(Vector3f p) {
+	}
+	public boolean isNonlinear() {
+	    return false;
+	}
+	public float nonlinearity(Vector3f p, float radius) {
+	    return 0;
+	}
+	public boolean canPerformGL() {
+	    return true;
+	}
+	public boolean performGL() {
+	    return true;
+	}
+
+	public Transform getInverse() {
+	    return this;
+	}
+	public void dump(PrintStream out) {
+	    System.
+	    out.print("Root");
+	}
+
+	Vector2f sq = new Vector2f(1,1);
+	public Vector2f getSqSize() {
+	    return sq;
+	}
+    };
+    
+    private Transform[] tr; 
     
     public Coorder(GLVobCoorder from, TransformProxy transProxy) {
+	tr = new Transform[from.ninds];
 
+	tr[0] = root;
+	
 	for (int i = 1, lastIndSize = 1; i < from.inds.length && i<from.ninds; i+=lastIndSize) {
 	    // System.out.print(inds[i]+" ");
 	    // if ((i % 10) == 0) System.out.println();
@@ -25,10 +72,8 @@
 	    lastIndSize = from.getIndSize(type);	    
 	    Transform tr1 = transProxy.instantiate(type);
 	    tr1.setYourself(this, i, from.inds, from.floats);
-
-	    Transform tr2 = null;
-	    int cs2;
-
+	    
+	    tr[i] = tr1;
 	}
     }
 
@@ -38,11 +83,12 @@
      */
     public static Coorder lerp(Coorder c1, Coorder c2,
 	    int[] interps, float fract) {
-	return null;
+	System.out.println("to be implemented.");
+	return c1;
     }
 
     public Transform getTransform(int cs0) {
-	return null;
+	return tr[cs0];
     }
 
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/LwjglRenderer.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/LwjglRenderer.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/LwjglRenderer.java	2006-02-07 23:05:22.255586437 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/LwjglRenderer.java	2006-02-07 22:10:35.000000000 +0200
@@ -4,6 +4,7 @@
 
 package org.nongnu.libvob.gl.impl.lwjgl;
 
+import java.awt.Dimension;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -49,6 +50,10 @@
  */
 public class LwjglRenderer {
 
+    public static boolean dbg = false;
+    
+    static private void p(String s) { System.out.println("LwjglRen:: "+s); }
+    
     public class TransformFactory {
 	Transform instantiate(int type) {
 	    switch(type) {
@@ -146,38 +151,51 @@
     }
 
     public void render(LWJGL_VobMap map, int[] interps,
-	    GLVobCoorder from, GLVobCoorder to, float fract) {
+	    GLVobCoorder from, GLVobCoorder to, float fract, Dimension dimension) {
 
 	// creates the coordinate systems according to given animation fraction.
 	// this coordinate system is the one that is linearly interpolated.
 	Coorder c = createCoorder(from, to, interps, fract);
 
 	// render vobs to coordinates
-	realRender(c, map);
+	realRender(c, map, dimension);
 	
 	transProxy.clear();
     }
 
     
-    private void realRender(Coorder c, LWJGL_VobMap map) {
+    private void realRender(Coorder c, LWJGL_VobMap map, Dimension d) {
+	GL11.glViewport(0, 0, d.width, d.height);
+	GL11.glMatrixMode(GL11.GL_PROJECTION);
+	GL11.glLoadIdentity();
+	GL11.glOrtho(0, d.width, d.height, 0, 10000, -10000);
+	GL11.glMatrixMode(GL11.GL_MODELVIEW);
+	GL11.glLoadIdentity();
+
+
+
 	int lastVobSize = 1;
-	for (int i=0; i<map.list.length && i<map.getSize() && map.list[i] != 0; i+= lastVobSize)
+	for (int i=0; i<map.getSize(); i+= lastVobSize)
 	{
 	    int vob = map.list[i];
 	    int code = map.list[i] & ~GL.RMASK;
 	    
 	    if ((vob & GL.RMASK) == GL.RENDERABLE0) {	
-		GL11.glCallList(code);
+		LWJGLRen.Vob0 v = (LWJGLRen.Vob0)map.index2vob[i];
+		if (dbg) p("Render 0: "+v.getClass().getName());
+		v.render(code);
 		lastVobSize = 1;
 	    } else if ((vob & GL.RMASK) == GL.RENDERABLE1) {	
 		int cs0 = map.list[i+1];
 		LWJGLRen.Vob1 v = (LWJGLRen.Vob1)map.index2vob[i];
+		if (dbg) p("Render 1: "+v.getClass().getName());
 		v.render(c.getTransform(cs0), code);
 		lastVobSize = 2;
 	    } else if ((vob & GL.RMASK) == GL.RENDERABLE2) {	
 		int cs0 = map.list[i+1];
 		int cs1 = map.list[i+2];
 		LWJGLRen.Vob2 v = (LWJGLRen.Vob2)map.index2vob[i];
+		if (dbg) p("Render 2: "+v.getClass().getName());
 		v.render(c.getTransform(cs0), c.getTransform(cs1), code);
 		lastVobSize = 3;
 	    } else if ((vob & GL.RMASK) == GL.RENDERABLE3) {	
@@ -185,15 +203,16 @@
 		int cs1 = map.list[i+2];
 		int cs2 = map.list[i+3];
 		LWJGLRen.Vob3 v = (LWJGLRen.Vob3)map.index2vob[i];
+		if (dbg) p("Render 3: "+v.getClass().getName());
 		v.render(c.getTransform(cs0), c.getTransform(cs1), c.getTransform(cs2), code);
 		lastVobSize = 4;
 	    } else if ((vob & GL.RMASK) == GL.RENDERABLEN) {	
 		int ncs = map.list[i+1];
 		System.out.println("renderable N ");
+//		if (dbg) p("Render 0: "+v.getClass().getName());
 		lastVobSize = ncs;
 	    } else if ((vob & GL.RMASK) == GL.RENDERABLE_VS) {	
 		throw new Error("un impl.");
-		
 	    } else throw new Error("out of vobs...");
 	}
 	
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/Transform.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/Transform.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/Transform.java	2006-02-07 23:05:22.258585985 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/Transform.java	2006-02-07 22:10:35.000000000 +0200
@@ -7,6 +7,8 @@
 
 
 import java.io.OutputStream;
+import java.io.PrintStream;
+
 import org.lwjgl.util.vector.Vector2f;
 import org.lwjgl.util.vector.Vector3f;
 
@@ -90,7 +92,7 @@
     /**
      * Print this coordinate system into the given ostream.
      */
-    void dump(OutputStream out);
+    void dump(PrintStream out);
 
     /**
      * Get the size of the "unit square" of this coordinate system. For most
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/BoxTransform.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/BoxTransform.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/BoxTransform.java	2006-02-07 23:05:22.250587191 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/BoxTransform.java	2006-02-07 22:10:35.000000000 +0200
@@ -1,6 +1,7 @@
 package org.nongnu.libvob.gl.impl.lwjgl.trans.linear;
 
 import java.io.OutputStream;
+import java.io.PrintStream;
 
 import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
@@ -10,57 +11,61 @@
 
 public class BoxTransform implements Transform {
 
+    private Transform parent;
+    private float z,x,y,w,h;
     public void setYourself(Coorder base, int index, int[] inds, float[] floats) {
-	System.out.println("box");
+//	System.out.println("box");
+	
+	int floatInd = inds[index+2];
+	int parentCS = inds[index+1];
+	parent = base.getTransform(parentCS);
+	z = floats[floatInd];
+	x = floats[floatInd+1];
+	y = floats[floatInd+2];
+	w = floats[floatInd+5];
+	h = floats[floatInd+6];
+
     }
 
     public boolean shouldBeDrawn() {
-	// TODO Auto-generated method stub
-	return false;
+	return true;
     }
 
     public Vector3f transform(Vector3f p) {
-	// TODO Auto-generated method stub
 	return null;
     }
 
     public void vertex(Vector3f p) {
-	// TODO Auto-generated method stub
-
     }
 
     public boolean isNonlinear() {
-	// TODO Auto-generated method stub
 	return false;
     }
 
     public float nonlinearity(Vector3f p, float radius) {
-	// TODO Auto-generated method stub
 	return 0;
     }
 
     public boolean canPerformGL() {
-	// TODO Auto-generated method stub
-	return false;
+	return true;
     }
 
     public boolean performGL() {
+	parent.performGL();
+//	System.out.println("trans "+x+", "+y+", "+z);
+	GL11.glTranslatef(x,y,z);
 	return true;
     }
 
     public Transform getInverse() {
-	// TODO Auto-generated method stub
 	return null;
     }
 
-    public void dump(OutputStream out) {
-	// TODO Auto-generated method stub
-
+    public void dump(PrintStream out) {
     }
 
     public Vector2f getSqSize() {
-	// TODO Auto-generated method stub
-	return null;
+	return parent.getSqSize();
     }
 
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/OrthoBoxTransform.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/OrthoBoxTransform.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/OrthoBoxTransform.java	2006-02-07 23:05:22.253586739 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/OrthoBoxTransform.java	2006-02-07 22:10:35.000000000 +0200
@@ -1,7 +1,9 @@
 package org.nongnu.libvob.gl.impl.lwjgl.trans.linear;
 
 import java.io.OutputStream;
+import java.io.PrintStream;
 
+import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
 import org.lwjgl.util.vector.Vector3f;
 import org.nongnu.libvob.gl.impl.lwjgl.Coorder;
@@ -9,58 +11,66 @@
 
 public class OrthoBoxTransform implements Transform {
 
+    private Transform parent;
+    private float z,x,y,xs,ys,w,h;
     public void setYourself(Coorder base, int index, int[] inds, float[] floats) {
-	System.out.println("orthobox");
+//	System.out.println("orthobox");
+
+	int floatInd = inds[index+2];
+	int parentCS = inds[index+1];
+	parent = base.getTransform(parentCS);
+	z = floats[floatInd];
+	x = floats[floatInd+1];
+	y = floats[floatInd+2];
+	xs = floats[floatInd+3];
+	ys = floats[floatInd+4];
+	w = floats[floatInd+5];
+	h = floats[floatInd+6];
     }
 
     public boolean shouldBeDrawn() {
-	// TODO Auto-generated method stub
-	return false;
+	return true;
     }
 
     public Vector3f transform(Vector3f p) {
-	// TODO Auto-generated method stub
 	return null;
     }
 
     public void vertex(Vector3f p) {
-	// TODO Auto-generated method stub
-	
     }
 
     public boolean isNonlinear() {
-	// TODO Auto-generated method stub
 	return false;
     }
 
     public float nonlinearity(Vector3f p, float radius) {
-	// TODO Auto-generated method stub
 	return 0;
     }
 
     public boolean canPerformGL() {
-	// TODO Auto-generated method stub
-	return false;
+	return true;
     }
 
     public boolean performGL() {
-	// TODO Auto-generated method stub
-	return false;
+	parent.performGL();
+//	System.out.println("trans "+x+", "+y+", "+z);
+//	System.out.println("scale "+xs+", "+ys);
+	GL11.glTranslatef(x,y,z);
+	GL11.glScalef(xs,ys,0);
+	return true;
     }
 
     public Transform getInverse() {
-	// TODO Auto-generated method stub
 	return null;
     }
 
-    public void dump(OutputStream out) {
-	// TODO Auto-generated method stub
-	
+    public void dump(PrintStream out) {
     }
 
+    Vector2f sq = new Vector2f();
     public Vector2f getSqSize() {
-	// TODO Auto-generated method stub
-	return null;
+	sq.set(w,h);
+	return sq;
     }
 
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/ScaleTransform.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/ScaleTransform.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/ScaleTransform.java	2006-02-07 23:05:22.254586588 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/ScaleTransform.java	2006-02-07 22:10:35.000000000 +0200
@@ -1,6 +1,7 @@
 package org.nongnu.libvob.gl.impl.lwjgl.trans.linear;
 
 import java.io.OutputStream;
+import java.io.PrintStream;
 
 import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
@@ -10,19 +11,20 @@
 
 public class ScaleTransform implements Transform {
 
+    private Transform parent;
     private float xs, ys, zs;
     public void setYourself(Coorder base, int index, int[] inds, float[] floats) {
-	System.out.println("scale");
+//	System.out.println("scale");
 	int floatInd = inds[index+2];
-	int parent = inds[index+1];
+	int parentCS = inds[index+1];
+	parent = base.getTransform(parentCS);
 	xs = floats[floatInd];
 	ys = floats[floatInd+1];
 	zs = floats[floatInd+2];
     }
 
     public boolean shouldBeDrawn() {
-	// TODO Auto-generated method stub
-	return false;
+	return true;
     }
 
     public Vector3f transform(Vector3f p) {
@@ -31,17 +33,13 @@
     }
 
     public void vertex(Vector3f p) {
-	// TODO Auto-generated method stub
-
     }
 
     public boolean isNonlinear() {
-	// TODO Auto-generated method stub
 	return false;
     }
 
     public float nonlinearity(Vector3f p, float radius) {
-	// TODO Auto-generated method stub
 	return 0;
     }
 
@@ -50,23 +48,25 @@
     }
 
     public boolean performGL() {
+	parent.performGL();
+//	System.out.println("scale "+xs+", "+ys+", "+zs);
 	GL11.glScalef(xs,ys,zs);
 	return true;
     }
 
     public Transform getInverse() {
-	// TODO Auto-generated method stub
 	return null;
     }
 
-    public void dump(OutputStream out) {
-	// TODO Auto-generated method stub
-
+    public void dump(PrintStream out) {
+	out.print("(scale "+xs+", "+ys+", "+zs+")");
     }
 
     public Vector2f getSqSize() {
-	// TODO Auto-generated method stub
-	return null;
+	Vector2f ret = parent.getSqSize();
+	ret.x *= xs;
+	ret.y *= ys;
+	return ret;
     }
 
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/TranslateTransform.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/TranslateTransform.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/TranslateTransform.java	2006-02-07 23:05:22.252586890 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/trans/linear/TranslateTransform.java	2006-02-07 22:10:35.000000000 +0200
@@ -1,6 +1,7 @@
 package org.nongnu.libvob.gl.impl.lwjgl.trans.linear;
 
 import java.io.OutputStream;
+import java.io.PrintStream;
 
 import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
@@ -10,18 +11,20 @@
 
 public class TranslateTransform implements Transform {
 
+    private Transform parent;
     private float x=0, y=0, z=0;
     public void setYourself(Coorder base, int index, int[] inds, float[] floats) {
-	System.out.println("translate");
+//	System.out.println("translate");
 	int floatInd = inds[index+2];
-	int parent = inds[index+1];
+	int parentCS = inds[index+1];
+	parent = base.getTransform(parentCS);
 	x = floats[floatInd];
 	y = floats[floatInd+1];
 	z = floats[floatInd+2];
     }
 
     public boolean shouldBeDrawn() {
-	return false;
+	return true;
     }
 
     public Vector3f transform(Vector3f p) {
@@ -44,6 +47,8 @@
     }
 
     public boolean performGL() {
+	parent.performGL();
+//	System.out.println("trans: "+x+", "+y+", "+z);
 	GL11.glTranslatef(x,y,z);
 	return true;
     }
@@ -52,12 +57,12 @@
 	return null;
     }
 
-    public void dump(OutputStream out) {
+    public void dump(PrintStream out) {
 	
     }
 
     public Vector2f getSqSize() {
-	return null;
+	return parent.getSqSize();
     }
 
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/CallListBoxCoorder.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/CallListBoxCoorder.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/CallListBoxCoorder.java	2006-02-07 23:05:22.249587342 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/CallListBoxCoorder.java	2006-02-07 22:10:35.000000000 +0200
@@ -28,7 +28,5 @@
 	}
 	GL11.glPopMatrix();
 	CallGL.checkGlError("After boxcoorded calling list ");
-
     }
-    
 }
diff -rN -u libvob-old/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/NonFilledRectangleVob.java libvob-new/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/NonFilledRectangleVob.java
--- libvob-old/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/NonFilledRectangleVob.java	2006-02-07 23:05:22.248587493 +0200
+++ libvob-new/org/nongnu/libvob/gl/impl/lwjgl/vobs/trivial/NonFilledRectangleVob.java	2006-02-07 22:10:35.000000000 +0200
@@ -8,6 +8,7 @@
 import org.lwjgl.opengl.GL11;
 import org.lwjgl.util.vector.Vector2f;
 import org.nongnu.libvob.AbstractVob;
+import org.nongnu.libvob.VobScene;
 import org.nongnu.libvob.Vob.RenderInfo;
 import org.nongnu.libvob.gl.impl.lwjgl.CallGL;
 import org.nongnu.libvob.gl.impl.lwjgl.LWJGLRen;
@@ -32,6 +33,12 @@
 	this.b1 = b1;
     }
 
+    public int putGL(VobScene vs, int cs1) {
+	// it's not clear what should be returned in here!
+	// if 0 is returned, this vob is skipped.
+	return cs1;
+    }
+    
     public void render(Transform t, int callList) {
 	CallGL.checkGlError("Before NonFilledRect");
 	GL11.glPushMatrix();
diff -rN -u libvob-old/org/nongnu/libvob/impl/gl/GLVobCoorderBase.java libvob-new/org/nongnu/libvob/impl/gl/GLVobCoorderBase.java
--- libvob-old/org/nongnu/libvob/impl/gl/GLVobCoorderBase.java	2006-02-07 23:05:22.272583874 +0200
+++ libvob-new/org/nongnu/libvob/impl/gl/GLVobCoorderBase.java	2006-02-07 22:10:35.000000000 +0200
@@ -29,6 +29,7 @@
 import org.nongnu.libvob.*;
 import org.nongnu.libvob.impl.*;
 import org.nongnu.libvob.gl.*;
+
 import java.util.*;
 
 /** This is an internal base class for GLVobCoorder.
@@ -56,6 +57,38 @@
 	ninds = 1;
 	childs.clear();
     }
+    
+    public int getIndSize(int type)
+    {
+	switch(type) {
+	case 0:
+	case 1:
+	case 2:
+	case 3: return 3;
+	case 4: return 5;
+	case 5:
+	case 6: return 4;
+	case 7:
+	case 8:
+	case 9: return 3;
+	case 10: return 4;
+	case 11: 
+	case 12: 
+	case 13: 
+	case 14: 
+	case 15: 
+	case 16: return 3;
+	case 17: 
+	case 18: return 4;
+	case 19: return 3;
+	case 20: return 3;
+	case 21: return 4;
+	case 22: return 3;
+	default:
+	    throw new IllegalArgumentException("No type known for type: "+type);
+	}
+    }
+    
 
     public void activate(int cs) {
 	inds[cs] |= GL.CSFLAG_ACTIVE;
diff -rN -u libvob-old/org/nongnu/libvob/impl/lwjgl/LWJGL_Screen.java libvob-new/org/nongnu/libvob/impl/lwjgl/LWJGL_Screen.java
--- libvob-old/org/nongnu/libvob/impl/lwjgl/LWJGL_Screen.java	2006-02-07 23:05:22.275583422 +0200
+++ libvob-new/org/nongnu/libvob/impl/lwjgl/LWJGL_Screen.java	2006-02-07 22:10:35.000000000 +0200
@@ -14,7 +14,7 @@
 import org.nongnu.libvob.GraphicsAPI;
 import org.nongnu.libvob.gl.GL;
 import org.nongnu.libvob.gl.GLVobCoorder;
-import org.nongnu.libvob.gl.impl.lwjgl.LwjglCoorder;
+import org.nongnu.libvob.gl.impl.lwjgl.LwjglRenderer;
 import org.nongnu.libvob.impl.DefaultVobMatcher;
 import org.nongnu.libvob.impl.gl.GLVobMap;
 
@@ -55,7 +55,7 @@
     public void renderStill(VobScene vs, float lod) {
 	p("render still");
 
-	LwjglCoorder.getInstance().render(vs.map, null, (GLVobCoorder)vs.coords, null, 0, true, true);
+	LwjglRenderer.getInstance().render((LWJGL_VobMap)vs.map, null, (GLVobCoorder)vs.coords, null, 0, vs.getSize());
     }
 
     public void renderAnim(VobScene prev, VobScene next, float fract, float lod,
@@ -79,9 +79,9 @@
 
 	createInterpList(sc, osc, towardsOther);
 
-	LwjglCoorder.getInstance().render(sc.map, interplist, 
+	LwjglRenderer.getInstance().render((LWJGL_VobMap)sc.map, interplist, 
 			(GLVobCoorder) sc.coords, (GLVobCoorder)osc.coords, 
-			fract, true, showFinal);
+			fract, prev.getSize());
 
     }
 
diff -rN -u libvob-old/org/nongnu/libvob/impl/lwjgl/LWJGL_VobMap.java libvob-new/org/nongnu/libvob/impl/lwjgl/LWJGL_VobMap.java
--- libvob-old/org/nongnu/libvob/impl/lwjgl/LWJGL_VobMap.java	2006-02-07 23:05:22.273583723 +0200
+++ libvob-new/org/nongnu/libvob/impl/lwjgl/LWJGL_VobMap.java	2006-02-07 22:10:35.000000000 +0200
@@ -1,9 +1,10 @@
 /*   
-GLVobMap.java
+LWJGL_VobMap.java
  *    
  *    Copyright (c) 2000-2001, Ted Nelson and Tuomas Lukka
  *                  2003, Tuomas J. Lukka
  *                  2004, Matti J. Katila
+ *                  2006, Matti J. Katila
  *
  *    This file is part of Gzz.
  *    
@@ -35,7 +36,7 @@
 
 public class LWJGL_VobMap implements VobMap {
     public static boolean dbg = false;
-    private static void p(String s) { System.out.println("GLVobMap:: "+s); }
+    private static void p(String s) { System.out.println("LWJGL_VobMap:: "+s); }
 
     LWJGL_Screen screen;
     VobScene vs;
@@ -46,17 +47,20 @@
 	list = new int[20000];
 	cs = new int[20000];
 	vobs = new Vob[20000];
+	index2vob = new Vob[20000];
 	clear();
     }
 
     public void setVS(VobScene vs) { this.vs = vs; }
 
-    int[] list;
+    public int[] list;
     int curs;
     int[] cs;
-    Object[] vobs;
+    public Object[] vobs, index2vob;
     int nvobs;
 
+    public int getSize() { return curs; }
+    
     public void clear() {
 	for(int i=0; i<curs; i++)
 	    list[i] = 0;
@@ -86,6 +90,7 @@
 	// Now, stash it away.
 	cs[nvobs] = scs[0];
 	vobs[nvobs++] = vob;
+	index2vob[curs] = vob;
 	list[curs++] = (GL.RENDERABLEN | ind);
 	list[curs++] = scs.length;
 	for(int i=0; i<scs.length; i++) 
@@ -100,6 +105,7 @@
 	// Now, stash it away.
 	cs[nvobs] = coordsys1;
 	vobs[nvobs++] = vob;
+	index2vob[curs] = vob;
 	list[curs++] = (GL.RENDERABLE3 | ind);
 	list[curs++] = coordsys1;
 	list[curs++] = coordsys2;
@@ -114,6 +120,7 @@
 	// Now, stash it away.
 	cs[nvobs] = coordsys1;
 	vobs[nvobs++] = vob;
+	index2vob[curs] = vob;
 	list[curs++] = (GL.RENDERABLE2 | ind);
 	list[curs++] = coordsys1;
 	list[curs++] = coordsys2;
@@ -127,6 +134,7 @@
 	// Now, stash it away.
 	cs[nvobs] = coordsys1;
 	vobs[nvobs++] = vob;
+	index2vob[curs] = vob;
 	list[curs++] = (GL.RENDERABLE1 | ind);
 	list[curs++] = coordsys1;
     }
@@ -137,8 +145,10 @@
 	if(ind == 0) return;
 	// Now, stash it away.
 	vobs[nvobs++] = vob;
+	index2vob[curs] = vob;
 	list[curs++] = (GL.RENDERABLE0 | ind);
     }
+    
     public void dump() {
 	p("GLVobMap");
 	for(int i=0; i<nvobs; i++) {




More information about the Fencommits mailing list