60 |
} |
} |
61 |
|
|
62 |
public int renderBuoy(VobScene vs, int into, Object linkId, |
public int renderBuoy(VobScene vs, int into, Object linkId, |
63 |
Object anchor, Object cachedSize) { |
Object a, Object cachedSize) { |
64 |
if (dbg) pa("start renderBuoy"); |
if (dbg) pa("start renderBuoy"); |
65 |
if(effigy != 0) { |
if(effigy != 0) { |
66 |
Vob eff = org.nongnu.libvob.gl.GLRen.createQuad(effigy-1, 0,0); |
Vob eff = org.nongnu.libvob.gl.GLRen.createQuad(effigy-1, 0,0); |
67 |
vs.map.put( eff, into); |
vs.map.put( eff, into); |
68 |
return into; |
return into; |
69 |
} |
} |
70 |
Triple t = (Triple)anchor; |
View2D.Anchor anchor = (View2D.Anchor)a; |
|
Object plane = t.first; |
|
71 |
|
|
|
Rectangle rect = (Rectangle)t.second; |
|
|
Object node = t.third; // may be null if this |
|
|
// is not a noded View2D |
|
|
|
|
72 |
float[] tmp = new float[2]; |
float[] tmp = new float[2]; |
73 |
vs.coords.getSqSize(into, tmp); |
vs.coords.getSqSize(into, tmp); |
74 |
float w = tmp[0], h = tmp[1]; |
float w = tmp[0], h = tmp[1]; |
75 |
if (dbg) pa("rect "+rect+" coords "+w+","+h); |
if (dbg) pa("rect "+anchor+" coords "+w+","+h); |
76 |
|
|
77 |
float scale = w / rect.width; |
float scale = w / anchor.w; |
78 |
if(scale < h / rect.height) scale = h / rect.height; |
if(scale < h / anchor.h) scale = h / anchor.h; |
79 |
|
|
80 |
int box2paper = vs.coords.orthoBox(0, 0, rect.x, rect.y, |
int box2paper = vs.coords.orthoBox(0, 0, anchor.x, anchor.y, |
81 |
1/scale, 1/scale, |
1/scale, 1/scale, |
82 |
w, h); |
w, h); |
83 |
// int box2paper = vs.coords.orthoBox(0, 0, 0, 0, |
// int box2paper = vs.coords.orthoBox(0, 0, 0, 0, |
85 |
// w, h); |
// w, h); |
86 |
vs.matcher.add(into, box2paper, "BOX2PAPER"); |
vs.matcher.add(into, box2paper, "BOX2PAPER"); |
87 |
|
|
88 |
view2d.render(vs, plane, into, into, box2paper); |
view2d.render(vs, anchor.plane, into, into, box2paper); |
89 |
|
|
90 |
if (dbg) pa("start renderBuoy..DONE"); |
if (dbg) pa("start renderBuoy..DONE"); |
91 |
|
|
92 |
|
// anchor.node may be null if this |
93 |
|
// is not a noded View2D |
94 |
|
|
95 |
int box = node==null ? into : vs.matcher.getCS(into, new Pair(plane, node)); |
int box = anchor.node==null |
96 |
|
? into |
97 |
|
: vs.matcher.getCS(into, |
98 |
|
new Pair(anchor.plane, anchor.node)); |
99 |
return vs.coords.unitSq(box); |
return vs.coords.unitSq(box); |
100 |
} |
} |
101 |
} |
} |