当前位置: 首页>>代码示例>>Java>>正文


Java TransformGroup类代码示例

本文整理汇总了Java中javax.media.j3d.TransformGroup的典型用法代码示例。如果您正苦于以下问题:Java TransformGroup类的具体用法?Java TransformGroup怎么用?Java TransformGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransformGroup类属于javax.media.j3d包,在下文中一共展示了TransformGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildScene

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
@Override
void buildScene(TransformGroup transformGroup) {
    transformGroup.addChild(getColorBackground(new Color(.905f, .905f, 0.95f)));
    Appearance appearance = new Appearance();
    Material mat = new Material();
    mat.setAmbientColor(0.5f, 0.5f, 0.5f);
    mat.setDiffuseColor(1.0f, 1.0f, 1.0f);
    mat.setEmissiveColor(0.0f, 0.0f, 0.0f);
    mat.setSpecularColor(1.0f, 1.0f, 1.0f);
    mat.setShininess(80.0f);
    appearance.setMaterial(mat);

    TransparencyAttributes ta = new TransparencyAttributes();
    ta.setTransparency(0.5f);
    ta.setTransparencyMode(TransparencyAttributes.BLENDED);
    appearance.setTransparencyAttributes(ta);

    transformGroup.addChild(new Box(0.6f, 0.5f, 0.4f, appearance));

    transformGroup.addChild(getPointLight(new Color(1.0f, 1.0f, 1.0f), new Point3f(2.0f, 2.0f, 2.0f)));
    transformGroup.addChild(getAmbientLight(new Color(0.1f, 0.1f, 0.1f)));
    transformGroup.setTransform(getTransform(new Vector3f(0.3f, 0.3f, 0.3f), 0.75, -1, Math.PI / 4.0d));
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:24,代码来源:LightningExample.java

示例2: createCompass

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
public static Group createCompass() {
  Appearance ap = Compass.generateAppearance(Color.pink, 0.5, true);
  Cone c = new Cone(1f, 5f, ap);

  Transform3D tf = new Transform3D();
  tf.rotX(Math.PI / 2);

  Transform3D tf1 = new Transform3D();
  tf1.setTranslation(new Vector3d(10, 15, -40));

  TransformGroup tg = new TransformGroup(tf);
  tg.addChild(c);

  TransformGroup tg2 = new TransformGroup(tf1);
  tg2.addChild(tg);

  return tg2;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:19,代码来源:Compass.java

示例3: updateViewPlatformTransform

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
/**
 * Updates <code>viewPlatformTransform</code> transform from <code>camera</code> angles and location.
 */
private void updateViewPlatformTransform(TransformGroup viewPlatformTransform, Camera camera,
		boolean updateWithAnimation)
{
	if (updateWithAnimation)
	{
		// Get the camera interpolator
		CameraInterpolator cameraInterpolator = (CameraInterpolator) viewPlatformTransform
				.getChild(viewPlatformTransform.numChildren() - 1);
		cameraInterpolator.moveCamera(camera);
	}
	else
	{
		Transform3D transform = new Transform3D();
		updateViewPlatformTransform(transform, camera.getX(), camera.getY(), camera.getZ(), camera.getYaw(),
				camera.getPitch());
		viewPlatformTransform.setTransform(transform);
	}
	clearPrintedImageCache();
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:23,代码来源:HomeComponent3D.java

示例4: updateViewPlatformTransform

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
/**
 * Updates the given view platform transformation from yaw angle, pitch angle and scale. 
 */
private void updateViewPlatformTransform(TransformGroup viewPlatformTransform, float viewYaw, float viewPitch,
		float viewScale)
{
	// Default distance used to view a 2 unit wide scene
	double nominalDistanceToCenter = 1.4 / Math.tan(Math.PI / 8);
	// We don't use a TransformGroup in scene tree to be able to share the same scene 
	// in the different views displayed by OrientationPreviewComponent class 
	Transform3D translation = new Transform3D();
	translation.setTranslation(new Vector3d(0, 0, nominalDistanceToCenter));
	Transform3D pitchRotation = new Transform3D();
	pitchRotation.rotX(viewPitch);
	Transform3D yawRotation = new Transform3D();
	yawRotation.rotY(viewYaw);
	Transform3D scale = new Transform3D();
	scale.setScale(viewScale);
	
	pitchRotation.mul(translation);
	yawRotation.mul(pitchRotation);
	scale.mul(yawRotation);
	viewPlatformTransform.setTransform(scale);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:25,代码来源:ModelPreviewComponent.java

示例5: testOBJWriter

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
/**
 * Simple test of OBJWriter class with Java 3D objects.
 */
public void testOBJWriter() throws IOException {
  // 1. Open the OBJ file "Test.obj"
  OBJWriter writer = new OBJWriter("[email protected]#.obj", "Test", 3);
  assertTrue("[email protected]#.obj not created", new File("[email protected]#.obj").exists());
  
  // 2. Write a box at center 
  writer.writeNode(new Box());
  
  // Write a sphere centered at (2, 0, 2) 
  Transform3D translation = new Transform3D();
  translation.setTranslation(new Vector3f(2f, 0, 2f));
  TransformGroup translationGroup = new TransformGroup(translation);
  
  translationGroup.addChild(new Sphere());
  writer.writeNode(translationGroup);
  
  // 3. Close file
  writer.close();
  assertTrue("[email protected]#.mtl not created", new File("[email protected]#.mtl").exists());
  
  if (!new File("[email protected]#.obj").delete()
      || !new File("[email protected]#.mtl").delete()) {
    fail("Couldn't delete test files");
  }
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:29,代码来源:OBJWriterTest.java

示例6: setLighting

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
private void setLighting(TransformGroup objMove) {
    // Set up the ambient light
    Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f);
    AmbientLight ambientLightNode = new AmbientLight(ambientColor);
    ambientLightNode.setInfluencingBounds(boundingSphere);
    objMove.addChild(ambientLightNode);

    // Set up the directional lights
    Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f);
    Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f);

    //light1Direction.scale(scale * 10.0f);
    Color3f light2Color = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f light2Direction = new Vector3f(-1.0f, -1.0f, -1.0f);
    //light2Direction.scale(scale * 10.0f);

    DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
    light1.setInfluencingBounds(boundingSphere);
    objMove.addChild(light1);

    DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction);
    light2.setInfluencingBounds(boundingSphere);
    objMove.addChild(light2);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:25,代码来源:VRLDensityVisualization.java

示例7: makeSpin

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
private RotationInterpolator makeSpin(TransformGroup spinner) {
    //Alpha alpha = new Alpha(1, Alpha.DECREASING_ENABLE, 0, 10000, 5000, 0, 1000, 5000, 0, 1000);
    Alpha alpha = new Alpha(1, 3000);//new Alpha(-1, 10000) set speed here
    alpha.setAlphaAtOneDuration(3000);
    alpha.setIncreasingAlphaRampDuration(500);
    alpha.setMode(Alpha.INCREASING_ENABLE);

    rotator = new RotationInterpolator(alpha, spinner);
    double rot = Math.toRadians(90);
    Transform3D rotate1 = new Transform3D();
    rotate1.rotX(rot);
    rotate1.setTranslation(new Vector3f(0.3f, 0.3f, 0.0f));
    rotator.setTransformAxis(rotate1);
    rotator.setSchedulingBounds(bounds);
    return rotator;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:17,代码来源:NeuGenVisualization.java

示例8: setLightingRecon

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
private void setLightingRecon(TransformGroup objMove) {
    // Set up the ambient light
    Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f);
    AmbientLight ambientLightNode = new AmbientLight(ambientColor);
    ambientLightNode.setInfluencingBounds(bounds);
    objMove.addChild(ambientLightNode);

    // Set up the directional lights
    Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f);
    Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f);

    //light1Direction.scale(scale * 10.0f);
    Color3f light2Color = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f light2Direction = new Vector3f(-1.0f, -1.0f, -1.0f);
    //light2Direction.scale(scale * 10.0f);

    DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
    light1.setInfluencingBounds(bounds);
    objMove.addChild(light1);

    DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction);
    light2.setInfluencingBounds(bounds);
    objMove.addChild(light2);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:25,代码来源:NeuGenVisualization.java

示例9: setLightingNet

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
private void setLightingNet(TransformGroup objMove) {
    // Set up the ambient light
    Color3f ambientColor = Utils3D.lightBlue1;
    AmbientLight ambientLightNode = new AmbientLight(ambientColor);
    ambientLightNode.setInfluencingBounds(bounds);
    objMove.addChild(ambientLightNode);
    // Set up the directional lights
    Color3f light1Color = Utils3D.brown;
    Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f);
    light1Direction.scale(scale * 10.0f);
    //Color3f light2Color = Utils3D.brown;
    //Vector3f light2Direction = new Vector3f(-1.0f, -1.0f, -1.0f);
    //light2Direction.scale(scale * 10.0f);
    DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
    light1.setInfluencingBounds(bounds);
    objMove.addChild(light1);
    //DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction);
    //light2.setInfluencingBounds(bounds);
    //objMove.addChild(light2);

    //objMove.addChild(lgt1);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:23,代码来源:NeuGenVisualization.java

示例10: addNeurons

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
private void addNeurons(TransformGroup objRoot) {
    net = ngView.getNet();
    ngView.outPrintln("Number of neurons: " + net.getNeuronList().size());
    addSomata(objRoot);
    addSynapse(objRoot);

    switch (visMethod) {
        case LINES: {
            logger.info("visualize neuron with lines");
            addAxons(objRoot);
            addDendrites(objRoot);
            addUndefinedSections(objRoot);
            break;
        }
        case SOLID: {
            logger.info("visualize solid axons");
            addAxonsCyl(objRoot);
            addDendritesCyl(objRoot);
            addUndefinedSectionsCyl(objRoot);
            break;
        }
    }

    ngView.outPrintln(" processing network geometry\n");
    task.setMyProgress(0.8f);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:27,代码来源:NeuGenVisualization.java

示例11: 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);
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:23,代码来源:WorldViewer.java

示例12: addNode

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
/**
 * Fuegt eine Node ein
 * 
 * @param node
 *            Die Node
 * @param x
 *            X-Koordinate
 * @param y
 *            Y-Koordinate
 * @param z
 *            Z-Achse absolut; positiv ist vom Boden Richtung Bot +
 *            Betrachter, negativ vom Boden weg vom Betrachter
 * @param bg
 *            BranchGropu, in die das Objekt rein soll
 */
public void addNode(Node node, float x, float y, float z, BranchGroup bg) {
	Transform3D translate = new Transform3D();

	translate.set(new Vector3d(x, y, z));

	TransformGroup tg = new TransformGroup(translate);
	tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	tg.addChild(node);
	
	TransformGroup tgObject = new TransformGroup();
	tgObject.addChild(tg);
	tgObject.setCapability(Node.ENABLE_PICK_REPORTING);
	tgObject.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	tgObject.setPickable(true);
	bg.addChild(tgObject);
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:32,代码来源:Parcours.java

示例13: setParcours

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
/**
 * Erzeugt einen Szenegraphen mit Boden und Grenzen der Roboterwelt
 * @param parc Der Parcours
 */
private void setParcours(Parcours parc) {
	parcours = parc;
	// Hindernisse werden an die richtige Position geschoben

	// Zuerst werden sie gemeinsam so verschoben, dass ihre Unterkante genau
	// buendig mit der Unterkante des Bodens ist:
	Transform3D translate = new Transform3D();
	translate.set(new Vector3d(0d, 0d, 0.2d - PLAYGROUND_THICKNESS));
	TransformGroup obstTG = new TransformGroup(translate);
	obstTG.setCapability(Node.ENABLE_PICK_REPORTING);
	obstTG.setPickable(true);
	obstBG.addChild(obstTG);

    obstTG.addChild(parc.getObstBG());
    lightBG.addChild(parc.getLightBG());
    bpsBG.addChild(parc.getBpsBG());
    terrainBG.addChild(parc.getTerrainBG());

    obstBG.setCapability(Node.ENABLE_PICK_REPORTING);
    obstBG.setCapability(Node.ALLOW_PICKABLE_READ);
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:26,代码来源:World.java

示例14: manifestationSwitched

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
@Override
public void manifestationSwitched( RenderedManifestation from, RenderedManifestation to )
{
    BranchGroup target = (BranchGroup) from .getGraphicsObject();
    if ( target == null ) {
        return;
    }
    TransformGroup tg = (TransformGroup) target .getChild( 0 );
    Shape3D poly = (Shape3D) tg .getChild( 0 );
    poly .setUserData( to );
    if ( this .isSticky )
    {
        to .setGraphicsObject( target );
        from .setGraphicsObject( null );
    }
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:17,代码来源:Java3dSceneGraph.java

示例15: refreshPolygonOutlines

import javax.media.j3d.TransformGroup; //导入依赖的package包/类
private void refreshPolygonOutlines() {
	Collection<BranchGroup> bgs = new ArrayList<>();
       for ( int i = 0; i < mScene .numChildren(); i++ ) {
           BranchGroup bg = (BranchGroup) mScene .getChild( i );
           bgs .add( bg );
       }
       for (BranchGroup branchGroup : bgs) {
           TransformGroup tg = (TransformGroup) branchGroup .getChild( 0 );
       	Shape3D solidPoly = (Shape3D) tg .getChild( 0 );
       	RenderedManifestation rm = (RenderedManifestation) solidPoly .getUserData();
       	if ( rm != null ) {
       		this .manifestationRemoved( rm );
       		this .manifestationAdded( rm );
       	}
	}
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:17,代码来源:Java3dSceneGraph.java


注:本文中的javax.media.j3d.TransformGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。