32 |
import org.nongnu.libvob.buoy.*; |
import org.nongnu.libvob.buoy.*; |
33 |
|
|
34 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
35 |
|
import java.awt.Color; |
36 |
import java.awt.event.MouseEvent; |
import java.awt.event.MouseEvent; |
37 |
|
|
38 |
/** A BuoyViewNodeType showing areas of 2D planes rendered through |
/** A BuoyViewNodeType showing areas of 2D planes rendered through |
41 |
public class NodeType2D implements BuoyViewNodeType { |
public class NodeType2D implements BuoyViewNodeType { |
42 |
public static boolean dbg = false; |
public static boolean dbg = false; |
43 |
private static void pa(String s) { System.out.println(s); } |
private static void pa(String s) { System.out.println(s); } |
44 |
|
|
45 |
|
public static int effigy = 0; |
46 |
|
|
47 |
protected View2D view; |
protected View2D view; |
48 |
|
|
63 |
|
|
64 |
public int renderBuoy(VobScene vs, int into, Object linkId, |
public int renderBuoy(VobScene vs, int into, Object linkId, |
65 |
Object anchor, Object cachedSize) { |
Object anchor, Object cachedSize) { |
66 |
|
if(effigy != 0) { |
67 |
|
Vob eff = org.nongnu.libvob.gl.GLRen.createQuad(effigy-1); |
68 |
|
vs.map.put( eff, into); |
69 |
|
//vs.map.put(new org.nongnu.libvob.vobs.RectBgVob( |
70 |
|
// Color.green, true, Color.black), into); |
71 |
|
return into; |
72 |
|
} |
73 |
Pair p = (Pair)anchor; |
Pair p = (Pair)anchor; |
74 |
Object plane = p.first; |
Object plane = p.first; |
75 |
Rectangle rect = (Rectangle)p.second; |
Rectangle rect = (Rectangle)p.second; |
82 |
float scale = w / rect.width; |
float scale = w / rect.width; |
83 |
if(scale < h / rect.height) scale = h / rect.height; |
if(scale < h / rect.height) scale = h / rect.height; |
84 |
|
|
85 |
int box2paper = vs.coords.orthoBox(0, 0, rect.x, rect.y, |
/// int box2paper = vs.coords.orthoBox(0, 0, rect.x, rect.y, |
86 |
scale, scale, |
/// 1/scale, 1/scale, |
87 |
|
/// w, h); |
88 |
|
int box2paper = vs.coords.orthoBox(0, 0, 0, 0, |
89 |
|
1, 1, |
90 |
w, h); |
w, h); |
91 |
vs.matcher.add(into, box2paper, "BUOYPAP"); |
vs.matcher.add(into, box2paper, "BUOYPAP"); |
92 |
|
|
93 |
view.render(vs, plane, into, into, box2paper); |
view.render(vs, plane, into, into, box2paper); |
94 |
|
|
95 |
return vs.coords.translate(into, w/2f, h/2f); |
return vs.coords.translate(into, w/2f, h/2f); |
96 |
} |
} |
97 |
|
|