本文整理汇总了Java中javax.media.j3d.TransformGroup.getTransform方法的典型用法代码示例。如果您正苦于以下问题:Java TransformGroup.getTransform方法的具体用法?Java TransformGroup.getTransform怎么用?Java TransformGroup.getTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.TransformGroup
的用法示例。
在下文中一共展示了TransformGroup.getTransform方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPerspective
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Position: X/Y: zentriert, Z: so, dass der Parcours
* vollstaendig im Blick ist
* @param w Welt
*/
private void initPerspective(World w) {
double centerX = w.getWidthInM() / 2;
double centerY = w.getHeightInM() / 2;
double longerSide = Math.max(
w.getWidthInM(), w.getHeightInM());
// Winkel im Bogenmass
double field = universe.getViewer().getView().getFieldOfView();
Transform3D targetTfm = new Transform3D();
TransformGroup tg =
universe.getViewingPlatform().getViewPlatformTransform();
tg.getTransform(targetTfm);
targetTfm.setTranslation(new Vector3d(centerX, centerY,
(longerSide/2) / Math.tan(field/2)));
tg.setTransform(targetTfm);
}
示例2: initUserPosition
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* ���[�U�̎��_��������
*/
private void initUserPosition() {
ViewingPlatform vp = universe.getViewingPlatform(); // SimpleUniverse�̃f�t�H���g���擾
TransformGroup steerTG = vp.getViewPlatformTransform(); // vp��TG���擾
Transform3D t3d = new Transform3D(); // ���_�ivp�j�ړ��p��T3D
steerTG.getTransform(t3d); // ���݂̎��_���擾
// �V�������_��ݒ�
// ���[�U�̈ʒu�A������̍��W�A�������w��
// ���_�̐�͌��_
t3d.lookAt(USER_POS, new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
t3d.invert();
steerTG.setTransform(t3d); // �ύX�������_��ݒ�
}
示例3: mulTransformGroup
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Multiplies the transform at top of the transform groups stack by the
* given <code>transformMultiplier</code>.
*/
private void mulTransformGroup(Transform3D transformMultiplier)
{
TransformGroup transformGroup = (TransformGroup) this.parentGroups.peek();
Transform3D transform = new Transform3D();
transformGroup.getTransform(transform);
transform.mul(transformMultiplier);
transformGroup.setTransform(transform);
}
示例4: initUserPosition
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
private void initUserPosition()
// Set the user's initial viewpoint using lookAt()
{
ViewingPlatform vp = su.getViewingPlatform();
TransformGroup steerTG = vp.getViewPlatformTransform();
Transform3D t3d = new Transform3D();
steerTG.getTransform(t3d);
// args are: viewer posn, where looking, up direction
t3d.lookAt(USERPOSN, new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
t3d.invert();
steerTG.setTransform(t3d);
}
示例5: setViewPosition
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public void setViewPosition(Vector3f mov, int angle) {
TransformGroup tg = this.simpleUniverse.getViewingPlatform().
getViewPlatformTransform();
Transform3D t3dTrans = new Transform3D();
tg.getTransform(t3dTrans);
t3dTrans.setTranslation(mov);
tg.setTransform(t3dTrans);
Transform3D t3dRot = new Transform3D();
tg.getTransform(t3dRot);
t3dRot.setRotation(
new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(angle)));
//ViewT3D.setRotation(new AxisAngle4f(0, 0, 1, (float) Math.toRadians(45)));
tg.setTransform(t3dRot);
}
示例6: setViewPosition
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public void setViewPosition(Vector3f mov, int angle) {
TransformGroup tg = this.simpleUniverse.getViewingPlatform().getViewPlatformTransform();
Transform3D t3dTrans = new Transform3D();
tg.getTransform(t3dTrans);
t3dTrans.setTranslation(mov);
tg.setTransform(t3dTrans);
Transform3D t3dRot = new Transform3D();
tg.getTransform(t3dRot);
t3dRot.setRotation(new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(angle)));
//ViewT3D.setRotation(new AxisAngle4f(0, 0, 1, (float) Math.toRadians(45)));
tg.setTransform(t3dRot);
}
示例7: setViewPosition
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public void setViewPosition(Vector3f mov, int angle) {
TransformGroup tg = this.simpleU.getViewingPlatform().getViewPlatformTransform();
Transform3D t3dTrans = new Transform3D();
tg.getTransform(t3dTrans);
t3dTrans.setTranslation(mov);
tg.setTransform(t3dTrans);
Transform3D t3dRot = new Transform3D();
tg.getTransform(t3dRot);
//t3dRot.setTranslation(mov);
t3dRot.setRotation(new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(angle)));
//ViewT3D.setRotation(new AxisAngle4f(0, 0, 1, (float) Math.toRadians(45)));
tg.setTransform(t3dRot);
}
示例8: initUserPosition
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
private void initUserPosition()
// Set the user's initial viewpoint using lookAt()
{
ViewingPlatform vp = su.getViewingPlatform();
TransformGroup steerTG = vp.getViewPlatformTransform();
Transform3D t3d = new Transform3D();
steerTG.getTransform(t3d);
// args are: viewer posn, where looking, up direction
t3d.lookAt(USERPOSN, new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
t3d.invert();
steerTG.setTransform(t3d);
}
示例9: ObjectLoader
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public ObjectLoader() {
setLayout(new BorderLayout());
GraphicsConfiguration graphicsConfig = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(graphicsConfig);
add(canvas3D);
canvas3D.setSize(1200, 800);
canvas3D.setVisible(true);
BranchGroup scene = new BranchGroup();
ObjectFile loader = new ObjectFile(ObjectFile.LOAD_ALL);
loader.setFlags(ObjectFile.RESIZE);
Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);
BoundingSphere bounds =
new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
Vector3f light1Direction = new Vector3f(2.0f, 12.0f, -12.0f);
DirectionalLight light1
= new DirectionalLight(light1Color, light1Direction);
light1.setInfluencingBounds(bounds);
scene.addChild(light1);
Scene modelScene = null;
try {
modelScene = loader.load("Images/gargoyle.obj");
} catch (Exception e) {
}
scene.addChild(modelScene.getSceneGroup());
SimpleUniverse universe = new SimpleUniverse(canvas3D);
universe.getViewingPlatform().setNominalViewingTransform();
universe.addBranchGraph(scene);
ViewingPlatform viewPlatform = universe.getViewingPlatform();
TransformGroup viewTransform = viewPlatform.getViewPlatformTransform();
Transform3D t3d = new Transform3D();
viewTransform.getTransform(t3d);
t3d.lookAt(new Point3d(0, 0, 4), new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
t3d.invert();
viewTransform.setTransform(t3d);
}