|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gzz.vob.VobScene
A scene (keyframe) into which Vobs are placed.
A VobScene is somewhat like a scene graph but has some rather special features. Usually, VobScenes are not re-used between key presses: instead, the previous scene (keyframe) is saved, a new one is generated, and an interpolation between the two is generated by using the keys of the coordinate systems.
The VobScene is an aggregate of objects which perform different aspects of its function: VobCoorder keeps track of the coordinate systems defined in the VobScene, VobMap keeps track of which Vobs use which coordinate systems and VobMatcher keeps track of the keys of the coordinate systems.
For example,
// create a new coordinate system, at (100,100), with size (100,50). // In this coordinate system, the point (0,0) is mapped to (100,100) on screen // and the point (1,1) is mapped to (200,50) int cs = vs.coords.ortho(0, 0, 100, 100, 100, 50); // set key of the coordinate system. vs.matcher.add(cs, "MYVOB"); // Place a vob into it. vs.map.put(vob, cs);places a single vob into a single coordinate system. Now, when generating the next keyframe, if we do
// Lower down and narrower int cs2 = vs2.coords.ortho(0, 0, 100, 200, 50, 50); vs2.matcher.add(cs2, "MYVOB"); vs2.map.put(vob, cs2);The VobScene can be used to generate an animation from vs to vs2, smoothly animating the location and size of the vob (by animating the coordinate system). The VobScene contains shortcuts for the above code:
vs.put(vob, "MYVOB", 0, 100, 100, 100, 50); vs2.put(vob, "MYVOB", 0, 100, 200, 50, 50);has the same effect as the above code.
It is perfectly allowable to leave the keys undefined; this simply means that the coordinate systems which have no keys should not be interpolated.
Coordinate systems can be nested, and here's a difficult bit: there are actually two distinct hierarchies here: the transformations and the keys form their own, separate hierarchies.
int cs = vs.coords.ortho(0, 0, 100, 100, 100, 50); // A translation RELATIVE to cs: the origin of cs_t is at (150, 125) on screen. int cs_t = vs.coords.translate(0, .5, .5, 0); vs.matcher.add(cs, "V1"); // Sub key vs.matcher.add(cs, cs_t, "X");Now, cs_t will only be interpolated to a coordinate system whose parent is interpolated to cs, and whose key is "X". Here, both hierarchies were parallel, and indeed, usually they are. But sometimes non-parallel hierarchies are useful. For example, if we are placing images next to a map and markers on the map about where those images are, it's easier to do
void placeImage(int imageCS, int mapCS, String param) { // Place image into the image coordsys // ... int marker_cs = vs.coords.ortho(mapCS, 0, markx, marky, w, h); vs.matcher.add(imageCS, marker_cs, "MARK"); }Here, the marker transformation is a child of the map transformation, but as a keyframe object, for matching, its parent is imageCS. This allows us to use the constant key "MARK" for all the marks.
However, you'll probably see this situation pretty rarely; most often the hierarchies are indeed parallel, and for that case VobScene provides a shortcut:
int cs = vs.orthoCS(0, "V1", 0, 100, 100, 100, 50); int cs_t = vs.translateCS(cs, "X", .5, .5, 0);has the same effect as the earlier code.
Field Summary | |
VobCoorder |
coords
|
GraphicsAPI |
gfxapi
|
VobMap |
map
|
VobMatcher |
matcher
|
java.awt.Dimension |
size
|
GraphicsAPI.RenderingSurface |
window
|
Constructor Summary | |
VobScene(VobMap m,
VobCoorder c,
VobMatcher mat,
GraphicsAPI gfxapi,
GraphicsAPI.RenderingSurface window,
java.awt.Dimension size)
|
Method Summary | |
void |
activate(int cs)
Cause the given coordinate system to be considered when getCSAt() is called. |
void |
activate(java.lang.Object key)
|
int |
affineCS(int into,
java.lang.Object key,
float depth,
float cx,
float cy,
float x_x,
float x_y,
float y_x,
float y_y)
|
int |
boxCS(int into,
java.lang.Object key,
float w,
float h)
|
int |
cullCS(int into,
java.lang.Object key,
int clip)
|
int |
cullCS(int into,
java.lang.Object key,
int test,
int clip)
|
void |
dump()
|
int |
getCSAt(int parent,
float x,
float y,
float[] targetcoords)
Get the topmost activated coordsys at (x,y), whose nearest activated * direct ancestor (not determining) is parent. |
java.lang.Object |
getKeyAt(int parent,
float x,
float y,
float[] targetcoords)
|
java.awt.Dimension |
getSize()
Determines size of the area designated for the Vob s. |
int |
orthoBoxCS(int into,
java.lang.Object key,
float d,
float x,
float y,
float sx,
float sy,
float w,
float h)
|
int |
orthoCS(int into,
java.lang.Object key,
float depth,
float x,
float y,
float sx,
float sy)
|
void |
put(Vob vob)
|
void |
put(Vob vob,
int cs)
|
void |
put(Vob vob,
int cs1,
int cs2)
|
void |
put(Vob v,
int d,
int x,
int y,
int w,
int h)
|
void |
put(Vob v,
java.lang.Object key,
float d,
float x,
float y,
float w,
float h)
|
int |
rotateCS(int into,
java.lang.Object key,
float degrees)
|
int |
scaleCS(int into,
java.lang.Object key,
float sx,
float sy)
|
int |
scaleCS(int into,
java.lang.Object key,
float sx,
float sy,
float sz)
|
int |
translateCS(int into,
java.lang.Object key,
float x,
float y)
|
int |
translateCS(int into,
java.lang.Object key,
float x,
float y,
float z)
|
int |
unitSqCS(int into,
java.lang.Object key)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final VobMap map
public final VobCoorder coords
public final VobMatcher matcher
public final GraphicsAPI gfxapi
public final GraphicsAPI.RenderingSurface window
public final java.awt.Dimension size
Constructor Detail |
public VobScene(VobMap m, VobCoorder c, VobMatcher mat, GraphicsAPI gfxapi, GraphicsAPI.RenderingSurface window, java.awt.Dimension size)
Method Detail |
public final int orthoCS(int into, java.lang.Object key, float depth, float x, float y, float sx, float sy)
public final int translateCS(int into, java.lang.Object key, float x, float y)
public int translateCS(int into, java.lang.Object key, float x, float y, float z)
public int scaleCS(int into, java.lang.Object key, float sx, float sy)
public int affineCS(int into, java.lang.Object key, float depth, float cx, float cy, float x_x, float x_y, float y_x, float y_y)
public int rotateCS(int into, java.lang.Object key, float degrees)
public int scaleCS(int into, java.lang.Object key, float sx, float sy, float sz)
public int unitSqCS(int into, java.lang.Object key)
public int boxCS(int into, java.lang.Object key, float w, float h)
public int orthoBoxCS(int into, java.lang.Object key, float d, float x, float y, float sx, float sy, float w, float h)
public int cullCS(int into, java.lang.Object key, int clip)
public int cullCS(int into, java.lang.Object key, int test, int clip)
public java.awt.Dimension getSize()
Vob
s.
At least at the moment doesn't include margins.
Coordinates of the scene's
designated area run from (0,0) to (w-1, h-1).
public void put(Vob v, int d, int x, int y, int w, int h)
public void put(Vob v, java.lang.Object key, float d, float x, float y, float w, float h)
public void activate(int cs)
public void activate(java.lang.Object key)
public int getCSAt(int parent, float x, float y, float[] targetcoords)
public java.lang.Object getKeyAt(int parent, float x, float y, float[] targetcoords)
public void put(Vob vob)
public void put(Vob vob, int cs)
public void put(Vob vob, int cs1, int cs2)
public void dump()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |