27 |
package org.fenfire.view; |
package org.fenfire.view; |
28 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
29 |
import org.nongnu.libvob.gl.*; |
import org.nongnu.libvob.gl.*; |
30 |
|
import org.fenfire.functional.Function; |
31 |
|
|
32 |
/** A paper background for View2D. |
/** A paper background for View2D. |
33 |
* For the render call, make sure the plane object |
* For the render call, make sure the plane object |
40 |
public static boolean dbg = false; |
public static boolean dbg = false; |
41 |
private static void pa(String s) { System.out.println("PaperView2D::"+s); } |
private static void pa(String s) { System.out.println("PaperView2D::"+s); } |
42 |
|
|
|
public PaperMill paperMill; |
|
43 |
public float dicefactor = 1; |
public float dicefactor = 1; |
44 |
public int flags = 0; |
public int flags = 0; |
45 |
|
|
46 |
public float paperScaling = .5f; |
public float paperScaling = .5f; |
47 |
|
|
48 |
|
private Function paperMill; |
49 |
|
|
50 |
// implement |
// implement |
51 |
public void chgFast(VobScene vs, |
public void chgFast(VobScene vs, |
52 |
Object plane, |
Object plane, |
62 |
} |
} |
63 |
protected View2D child; |
protected View2D child; |
64 |
|
|
65 |
public PaperView2D() { |
/** Create a new PaperView2D. |
66 |
this(null); |
* @param paperMill A function; input: the plane object, output: |
67 |
|
* a org.nongnu.libvob.gl.Paper object. |
68 |
|
*/ |
69 |
|
public PaperView2D(Function paperMill) { |
70 |
|
this(paperMill, null); |
71 |
} |
} |
72 |
public PaperView2D(View2D child) { |
/** Create a new PaperView2D. |
73 |
|
* @param paperMill A function; input: the plane object, output: |
74 |
|
* a org.nongnu.libvob.gl.Paper object. |
75 |
|
* @param child The view to render inside this. |
76 |
|
* XXX View2DList should take care of this already. |
77 |
|
*/ |
78 |
|
public PaperView2D(Function paperMill, View2D child) { |
79 |
|
this.paperMill = paperMill; |
80 |
this.child = child; |
this.child = child; |
81 |
} |
} |
82 |
|
|
95 |
) |
) |
96 |
{ |
{ |
97 |
if (dbg) pa("begin render"); |
if (dbg) pa("begin render"); |
|
if(paperMill == null) |
|
|
paperMill = PaperMill.getInstance(); |
|
98 |
|
|
99 |
int seed = plane.hashCode(); |
Paper p = (Paper)paperMill.f(plane) ; |
|
|
|
|
Paper p = paperMill.getOptimizedPaper(seed) ; |
|
100 |
|
|
101 |
org.nongnu.libvob.Vob v = GLRen.createEasyPaperQuad(p, dicefactor, flags); |
org.nongnu.libvob.Vob v = GLRen.createEasyPaperQuad(p, dicefactor, flags); |
102 |
int magnified = box2paper; |
int magnified = box2paper; |