hi there.
I'm trying to navigate a world with JMF. I want to use keyboard to naviagte a world
with an object with movie-textured 3D cube.
the 3D cube was successfully textured with mov file, and the world is created as
usual, but i cannot navigate the world. need help.
this program is a modification of JMF solution demo on Java Media Framework homepage.
everythig except scene graph creation is exactly same as the demo.
---------------------------------------------------------------------------------------------------------
private BranchGroup createSceneGraph(SimpleUniverse su) {
BranchGroup objRoot = new BranchGroup();
objRoot.addChild(createLand()); // bg creation
TransformGroup objScale = new TransformGroup();
// Transform3D t3d = new Transform3D();
// t3d.setScale(0.5);
// objScale.setTransform(t3d);
objRoot.addChild(objScale);
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.setCapability( TransformGroup.ALLOW_TRANSFORM_READ );
objTrans.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
objScale.addChild(objTrans);
// Create appearance object for textured obj
app = new Appearance();
tex = createTexture();
app.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
tex.setCapability(Texture.ALLOW_IMAGE_WRITE);
app.setTexture(tex);
TextureAttributes texAttr = new TextureAttributes();
texAttr.setTextureMode(TextureAttributes.MODULATE);
app.setTextureAttributes(texAttr);
Box textureCube = new Box(0.08f, 0.08f, 0.08f,Box.GENERATE_TEXTURE_COORDS,
app);
objTrans.addChild(textureCube);
BoundingSphere bounds = new BoundingSphere(new BoundingSphere());//new
Point3d(0.0,0.0,0.0), 100.0);
// Create textured cube and add it to the scene graph.
// Mouse behavior
MouseRotate r_beh = new MouseRotate(objTrans);
objTrans.addChild(r_beh);
r_beh.setSchedulingBounds(bounds);
MouseZoom z_beh = new MouseZoom(objTrans);
objTrans.addChild(z_beh);
z_beh.setSchedulingBounds(bounds);
MouseTranslate t_beh = new MouseTranslate(objTrans);
objTrans.addChild(t_beh);
t_beh.setSchedulingBounds(bounds);
// // Create Keyboard handler
TransformGroup vpTrans = null;
Vector3f translate = new Vector3f();
Transform3D T3D = new Transform3D();
vpTrans = su.getViewingPlatform().getViewPlatformTransform();
translate.set(new Point3f(0.0f, 0.3f, 0.0f));
T3D.setTranslation(translate);
vpTrans.setTransform(T3D);
KeyNavigatorBehavior key = new KeyNavigatorBehavior(vpTrans);
key.setSchedulingBounds(new BoundingSphere(new Point3d(),1000.0));
objRoot.addChild(key);
// Have Java 3D perform optimizations on this scene graph.
objRoot.compile();
return objRoot;
}
===============================
Virtual Reality Lab.
EE Dept. Hanyang University
Seoul, Korea
http://mr.hanyang.ac.kr
-------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".