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


Java Transform3D.set方法代码示例

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


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

示例1: addNode

import javax.media.j3d.Transform3D; //导入方法依赖的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

示例2: setParcours

import javax.media.j3d.Transform3D; //导入方法依赖的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

示例3: addLight

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Add a light to the 3d world. Used only in the creation phase.
 */
Light addLight(Vector3d pos, Color3f color) {
	BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), worldSize * 2);

	TransformGroup tg = new TransformGroup();
	Transform3D t3d = new Transform3D();
	t3d.set(pos);
	tg.setTransform(t3d);
	PointLight light = new PointLight();
	light.setAttenuation(0.5f, 0, 0);
	// light.setAttenuation(0f,.08f,0);
	// light.setAttenuation(1.2f,0,0);
	// note : light pos not affected by transform (but bound is).
	light.setPosition((float) pos.x, (float) pos.y, (float) pos.z);
	light.setInfluencingBounds(bounds);
	sceneTrans.addChild(light);
	// light geometry
	ColoringAttributes ca = new ColoringAttributes();
	ca.setColor(color);
	Appearance appL1 = new Appearance();
	appL1.setColoringAttributes(ca);
	Primitive s = new Sphere(0.4f, appL1);
	s.setCollidable(true);
	tg.addChild(s);
	sceneTrans.addChild(tg);
	return light;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:30,代码来源:World.java

示例4: updateRotation

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public void updateRotation()
{
	double xRot = xSlide.getValue() / (double) (steps);
	double yRot = ySlide.getValue() / (double) (steps);
	double zRot = zSlide.getValue() / (double) (steps);
	double wRot = wManualSlide.getValue() / (double) (steps);

	wRot *= 3.14;
	// System.out.println(steps);
	// System.out.println(xSlide.getValue() + " - " + xRot);
	// System.out.println(ySlide.getValue() + " - " + yRot);
	// System.out.println(zSlide.getValue() + " - " + zRot);
	// System.out.println(wManualSlide.getValue() + " - " + wRot);

	Transform3D tra = new Transform3D();
	AxisAngle4d rotation = new AxisAngle4d();
	rotation.setX(xRot);
	rotation.setY(yRot);
	rotation.setZ(zRot);
	rotation.setAngle(wRot);

	tra.set(rotation);

	Quat4d dat = new Quat4d();
	tra.get(dat);
	// System.out.println("\nSetting Values\n" + dat.x);
	// System.out.println(dat.y);
	// System.out.println(dat.z);
	// System.out.println(dat.w);
	panel.getRender().getRotationAttr().set(tra);
	panel.getRender().restoreXform();

}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:34,代码来源:RotationControlPanel.java

示例5: getCubeAsBox

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public TransformGroup getCubeAsBox(float x, float y, float z) {
    Transform3D translate = new Transform3D();
    translate.set(new Vector3f(x + 0.5f * cubeLength, y + 0.5f * cubeWidth, z + 0.5f * cubeHeight));
    TransformGroup translateBox = new TransformGroup(translate);

    Box cube = new Box(0.5f * cubeLength, 0.5f * cubeWidth, 0.5f * cubeHeight, cubeAppearance);
    translateBox.addChild(cube);
    return translateBox;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:10,代码来源:Cube3dCreator.java

示例6: addLight

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Add a light to the 3d world. Used only in the creation phase.
 */
Light addLight(Vector3d pos, Color3f color) {
  BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), worldSize * 2);

  TransformGroup tg = new TransformGroup();
  Transform3D t3d = new Transform3D();
  t3d.set(pos);
  tg.setTransform(t3d);
  PointLight light = new PointLight();
  light.setAttenuation(0.5f, 0, 0);
  // light.setAttenuation(0f,.08f,0);
  // light.setAttenuation(1.2f,0,0);
  // note : light pos not affected by transform (but bound is).
  light.setPosition((float) pos.x, (float) pos.y, (float) pos.z);
  light.setInfluencingBounds(bounds);
  sceneTrans.addChild(light);
  // light geometry
  ColoringAttributes ca = new ColoringAttributes();
  ca.setColor(color);
  Appearance appL1 = new Appearance();
  appL1.setColoringAttributes(ca);
  Primitive s = new Sphere(0.4f, appL1);
  s.setCollidable(true);
  tg.addChild(s);
  sceneTrans.addChild(tg);
  return light;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:30,代码来源:World.java

示例7: addSphere

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * ����sceneBG�ɒlj�
 */
private void addSphere() {
    Color3f black = new Color3f(0.0f, 0.0f, 0.0f); // ��
    Color3f red = new Color3f(1.0f, 0.0f, 0.0f); // ��
    Color3f specular = new Color3f(0.9f, 0.9f, 0.9f); // �قڔ�

    // ���̍ގ��iMaterial�j
    Material blueMat = new Material(red, black, red, specular, 25.0f);
    blueMat.setLightingEnable(true);

    // ���̌����ځiAppearance�j
    Appearance blueApp = new Appearance();
    blueApp.setMaterial(blueMat);

    // ���̈ړ�
    Transform3D t3d = new Transform3D();
    t3d.set(new Vector3f(0, 0, 0));  // ���_�ֈړ�����T3D

    // �ړ����]�p�̃m�[�h��TG�iT3D���Z�b�g���Ďg���j
    TransformGroup tg = new TransformGroup(t3d);
    // �����쐬
    Sphere sphere = new Sphere(2.0f, Sphere.GENERATE_NORMALS, 100, blueApp);
    tg.addChild(sphere);  // �ړ��pTG�ɋ���ڑ�����I

    // sceneBG�ɋ����܂�TG��lj�
    sceneBG.addChild(tg);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:30,代码来源:MainPanel.java

示例8: shear

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Transform from the origin and unit x, y, and z axes to a new origin and x, y, and z axes. If newX, newY, and newZ are not perpendicular, shearing will
 * result. If newX, newY, and newZ are not unitary, scaling will result.
 * 
 * @param newOrigin
 *            the new origin point.
 * @param newX
 *            the new x axis.
 * @param newY
 *            the new y axis.
 * @param newZ
 *            the new z axis.
 * @param result
 *            the Transform3D to set such that (ignoring floating-point inaccuracy):
 *            <ul>
 *            <li> <code>result.transform( new Point3d( 0, 0, 0 ) )</code> equals <code>newOrigin</code>,</li>
 *            <li> <code>result.transform( new Vector3d( 1, 0, 0 ) )</code> equals <code>newX</code>,</li>
 *            <li> <code>result.transform( new Vector3d( 0, 1, 0 ) )</code> equals <code>newY</code>, and</li>
 *            <li> <code>result.transform( new Vector3d( 0, 0, 1 ) )</code> equals <code>newZ</code>.</li>
 *            </ul>
 * @return <code>result</code>
 * 
 * @throws IllegalArgumentException
 *             if <code>newX</code>, <code>newY</code>, or <code>newZ</code> is zero
 */
public Transform3D shear( Point3f newOrigin , Vector3f newX , Vector3f newY , Vector3f newZ , Transform3D result )
{
	if( newX.equals( ZEROF ) || newY.equals( ZEROF ) || newZ.equals( ZEROF ) )
	{
		throw new IllegalArgumentException( "newX, newY, and newZ must be nonzero" );
	}
	
	m[ 0 ] = newX.x;
	m[ 1 ] = newY.x;
	m[ 2 ] = newZ.x;
	m[ 3 ] = newOrigin.x;
	m[ 4 ] = newX.y;
	m[ 5 ] = newY.y;
	m[ 6 ] = newZ.y;
	m[ 7 ] = newOrigin.y;
	m[ 8 ] = newX.z;
	m[ 9 ] = newY.z;
	m[ 10 ] = newZ.z;
	m[ 11 ] = newOrigin.z;
	m[ 12 ] = 0;
	m[ 13 ] = 0;
	m[ 14 ] = 0;
	m[ 15 ] = 1;
	result.set( m );
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:52,代码来源:TransformComputer3f.java

示例9: orient

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Creates a transform that orients an object from one coordinate reference frame to another.<br>
 * <br>
 * 
 * @param oldOrigin
 *            the origin of the old reference frame.
 * @param oldX
 *            the x axis of the old reference frame (whatever direction you want; it doesn't have to be (1, 0, 0))
 * @param newOrigin
 *            the origin of the new reference frame.
 * @param newX
 *            the x axis of the new reference frame.
 * @param result
 *            the Transform3D to set such that (ignoring floating point inaccuracy):
 *            <ul>
 *            <li> <code>result.transform( oldOrigin )</code> will equal <code>newOrigin</code></li>
 *            <li> <code>result.transform( oldX )</code> will equal <code>newX</code></li>
 *            <li> <code>result.transform( n )</code> will equal <code>n</code></li> for any vector <code>n</code> perpendicular to <code>oldX</code> and
 *            <code>newX</code>.
 *            </ul>
 * @return <code>result</code>
 * 
 * @throws IllegalArgumentException
 *             if <code>oldX</code> or <code>newX</code> is zero.
 * 
 * @see #orient(Point3f, Vector3f, Vector3f, Point3f, Vector3f, Vector3f, Transform3D)
 */
public Transform3D orient( Point3f oldOrigin , Vector3f oldX , Point3f newOrigin , Vector3f newX , Transform3D result )
{
	v1.normalize( oldX );
	v4.normalize( newX );
	// pick y normal to place of rotation for oldY and newY
	v2.cross( v1 , v4 );
	v5.set( v2 );
	if( v2.equals( ZEROF ) )
	{
		// no rotation necessary; just translate
		Arrays.fill( m , 0 );
		m[ 0 ] = 1;
		m[ 3 ] = newOrigin.x - oldOrigin.x;
		m[ 5 ] = 1;
		m[ 7 ] = newOrigin.y - oldOrigin.y;
		m[ 10 ] = 1;
		m[ 11 ] = newOrigin.z - oldOrigin.z;
		m[ 15 ] = 1;
		result.set( m );
	}
	else
	{
		// compute oldZ and newZ
		v3.cross( v1 , v2 );
		v6.cross( v4 , v5 );
		shear( oldOrigin , v1 , v2 , v3 , newOrigin , v4 , v5 , v6 , result );
	}
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:57,代码来源:TransformComputer3f.java

示例10: shear

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Transform from the origin and unit x, y, and z axes to a new origin and x, y, and z axes. If newX, newY, and newZ are not perpendicular, shearing will
 * result. If newX, newY, and newZ are not unitary, scaling will result.
 * 
 * @param newOrigin
 *            the new origin point.
 * @param newX
 *            the new x axis.
 * @param newY
 *            the new y axis.
 * @param newZ
 *            the new z axis.
 * @param result
 *            the Transform3D to set such that (ignoring floating-point inaccuracy):
 *            <ul>
 *            <li> <code>result.transform( new Point3d( 0, 0, 0 ) )</code> equals <code>newOrigin</code>,</li>
 *            <li> <code>result.transform( new Vector3d( 1, 0, 0 ) )</code> equals <code>newX</code>,</li>
 *            <li> <code>result.transform( new Vector3d( 0, 1, 0 ) )</code> equals <code>newY</code>, and</li>
 *            <li> <code>result.transform( new Vector3d( 0, 0, 1 ) )</code> equals <code>newZ</code>.</li>
 *            </ul>
 * @return <code>result</code>
 * 
 * @throws IllegalArgumentException
 *             if <code>newX</code>, <code>newY</code>, or <code>newZ</code> is zero
 */
public Transform3D shear( Point3d newOrigin , Vector3d newX , Vector3d newY , Vector3d newZ , Transform3D result )
{
	if( newX.equals( ZEROD ) || newY.equals( ZEROD ) || newZ.equals( ZEROD ) )
	{
		throw new IllegalArgumentException( "newX, newY, and newZ must be nonzero" );
	}
	
	m[ 0 ] = newX.x;
	m[ 1 ] = newY.x;
	m[ 2 ] = newZ.x;
	m[ 3 ] = newOrigin.x;
	m[ 4 ] = newX.y;
	m[ 5 ] = newY.y;
	m[ 6 ] = newZ.y;
	m[ 7 ] = newOrigin.y;
	m[ 8 ] = newX.z;
	m[ 9 ] = newY.z;
	m[ 10 ] = newZ.z;
	m[ 11 ] = newOrigin.z;
	m[ 12 ] = 0;
	m[ 13 ] = 0;
	m[ 14 ] = 0;
	m[ 15 ] = 1;
	result.set( m );
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:52,代码来源:TransformComputer3d.java

示例11: orient

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Creates a transform that orients an object from one coordinate reference frame to another.<br>
 * <br>
 * 
 * @param oldOrigin
 *            the origin of the old reference frame.
 * @param oldX
 *            the x axis of the old reference frame (whatever direction you want; it doesn't have to be (1, 0, 0))
 * @param newOrigin
 *            the origin of the new reference frame.
 * @param newX
 *            the x axis of the new reference frame.
 * @param result
 *            the Transform3D to set such that (ignoring floating point inaccuracy):
 *            <ul>
 *            <li> <code>result.transform( oldOrigin )</code> will equal <code>newOrigin</code></li>
 *            <li> <code>result.transform( oldX )</code> will equal <code>newX</code></li>
 *            <li> <code>result.transform( n )</code> will equal <code>n</code></li> for any vector <code>n</code> perpendicular to <code>oldX</code> and
 *            <code>newX</code>.
 *            </ul>
 * @return <code>result</code>
 * 
 * @throws IllegalArgumentException
 *             if <code>oldX</code> or <code>newX</code> is zero.
 * 
 * @see #orient(Point3f, Vector3f, Vector3f, Point3f, Vector3f, Vector3f, Transform3D)
 */
public Transform3D orient( Point3d oldOrigin , Vector3d oldX , Point3d newOrigin , Vector3d newX , Transform3D result )
{
	v1.normalize( oldX );
	v4.normalize( newX );
	// pick y normal to place of rotation for oldY and newY
	v2.cross( v1 , v4 );
	v5.set( v2 );
	if( v2.equals( ZEROD ) )
	{
		// no rotation necessary; just translate
		Arrays.fill( m , 0 );
		m[ 0 ] = 1;
		m[ 3 ] = newOrigin.x - oldOrigin.x;
		m[ 5 ] = 1;
		m[ 7 ] = newOrigin.y - oldOrigin.y;
		m[ 10 ] = 1;
		m[ 11 ] = newOrigin.z - oldOrigin.z;
		m[ 15 ] = 1;
		result.set( m );
	}
	else
	{
		// compute oldZ and newZ
		v3.cross( v1 , v2 );
		v6.cross( v4 , v5 );
		shear( oldOrigin , v1 , v2 , v3 , newOrigin , v4 , v5 , v6 , result );
	}
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:57,代码来源:TransformComputer3d.java

示例12: geometryWithColor

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * 
 * Permet de créer une géométrie Java3D à partir d'une apparence
 * 
 * @param ap
 * @return
 */
private ArrayList<TransformGroup> geometryWithColor(Appearance ap) {
  // On récupère la géométrie sous forme de points
  IGeometry geom = this.feat.getGeom();

  if (geom instanceof GM_MultiPoint) {

    // On peut àventuellement vouloir ajouter des traitements

  } else if (geom instanceof GM_Point) {

    // On peut àventuellement vouloir ajouter des traitements
  } else {
    Object0d.logger.warn(Messages.getString("Representation.GeomUnk"));
    return null;
  }

  IDirectPositionList lDP = geom.coord();

  int nbPoints = lDP.size();

  PointArray pA = new PointArray(nbPoints, GeometryArray.COORDINATES
      | GeometryArray.COLOR_3);

  ArrayList<TransformGroup> lTG = new ArrayList<TransformGroup>(nbPoints);
  Object0d.logger.debug(nbPoints);
  pA.setCapability(GeometryArray.ALLOW_COLOR_READ);
  pA.setCapability(GeometryArray.ALLOW_COLOR_WRITE);

  for (int i = 0; i < nbPoints; i++) {

    // On crée la sphère et on lui applique l'apparence choisie
    Sphere s = new Sphere(Object0d.RADIUS, ap);

    s.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    IDirectPosition pTemp = lDP.get(i);

    // On place le centre de la sphère aux bonnes coordonnées
    Transform3D translate = new Transform3D();
    translate.set(new Vector3f((float) pTemp.getX(), (float) pTemp.getY(),
        (float) pTemp.getZ()));

    TransformGroup TG1 = new TransformGroup(translate);
    TG1.addChild(s);

    lTG.add(TG1);
    // On complète la liste des sphères
    this.lShape.add(s);

  }

  return lTG;

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:67,代码来源:Object0d.java

示例13: geometryWithOutColor

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Génère une représentation avec une couleur pour chaque sphère
 * 
 * @param ap
 * @return
 */
private ArrayList<TransformGroup> geometryWithOutColor(Appearance ap) {
  // On décompose sous forme de points la géométrie
  IGeometry geom = this.feat.getGeom();
  if (geom instanceof GM_MultiPoint) {

    // On peut àventuellement vouloir ajouter des traitements

  } else if (geom instanceof GM_Point) {
    // On peut àventuellement vouloir ajouter des traitements

  } else {
    Object0d.logger.warn(Messages.getString("Representation.GeomUnk"));
    return null;
  }
  IDirectPositionList lDP = geom.coord();

  int nbPoints = lDP.size();

  PointArray pA = new PointArray(nbPoints, GeometryArray.COORDINATES
      | GeometryArray.COLOR_3);

  ArrayList<TransformGroup> lTG = new ArrayList<TransformGroup>(nbPoints);

  pA.setCapability(GeometryArray.ALLOW_COLOR_READ);
  pA.setCapability(GeometryArray.ALLOW_COLOR_WRITE);

  for (int i = 0; i < nbPoints; i++) {

    Sphere s = new Sphere(Object0d.RADIUS, ap);

    // on ajoute une couleur aléatoire
    ColoringAttributes CA = new ColoringAttributes(new Color3f(
        (float) Math.random(), (float) Math.random(), (float) Math.random()),
        ColoringAttributes.SHADE_GOURAUD);
    ap.setColoringAttributes(CA);

    s.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    IDirectPosition pTemp = lDP.get(i);

    // On place le sphère aux bonnes coordonnées
    Transform3D translate = new Transform3D();
    translate.set(new Vector3f((float) pTemp.getX(), (float) pTemp.getY(),
        (float) pTemp.getZ()));

    TransformGroup TG1 = new TransformGroup(translate);
    TG1.addChild(s);

    lTG.add(TG1);
    this.lShape.add(s);

  }

  return lTG;

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:68,代码来源:Object0d.java

示例14: initBGSel

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Permet de créer un BranchGroup contenant une sphère Elle servira à indiquer
 * si un objet est selectionné
 */
private void initBGSel() {
  // On initialise la selection
  // On récupère la sphère englobante de l'objet
  BoundingSphere bs = new BoundingSphere(this.bGRep.getBounds());
  Point3d pt = new Point3d();
  bs.getCenter(pt);
  // On place le sphère aux bonnes coordonnées
  Transform3D translate = new Transform3D();
  translate.set(new Vector3f((float) pt.getX(), (float) pt.getY(), (float) pt
      .getZ()));

  // Création de l'apparence
  Appearance apparenceFinale = new Appearance();

  // Autorisations pour l'apparence
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);

  // Création des attributs du polygone
  PolygonAttributes pa = new PolygonAttributes();

  pa.setCullFace(PolygonAttributes.CULL_NONE);
  pa.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);

  // Indique que l'on est en mode surfacique
  pa.setPolygonMode(PolygonAttributes.POLYGON_FILL);

  pa.setCullFace(PolygonAttributes.CULL_BACK);

  pa.setBackFaceNormalFlip(false);

  Color3f couleur3F = new Color3f(ConstantRepresentation.selectionColor);
  // Création du material (gestion des couleurs et de l'affichage)
  Material material = new Material();
  material.setAmbientColor(couleur3F.x / 2, couleur3F.y / 2, couleur3F.z / 2);
  material.setDiffuseColor(couleur3F);
  material.setSpecularColor(new Color3f(1.0f, 1.0f, 1.0f));
  material.setShininess(128);
  apparenceFinale.setMaterial(material);

  // On applique l'apparence à la sphère
  Sphere sphere = new Sphere((float) bs.getRadius(), apparenceFinale);

  TransparencyAttributes t_attr = new TransparencyAttributes(
      TransparencyAttributes.BLENDED, (float) 0.5,
      TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLENDED);
  apparenceFinale.setTransparencyAttributes(t_attr);

  TransformGroup TG1 = new TransformGroup(translate);
  TG1.addChild(sphere);

  this.bgSel = new BranchGroup();
  this.bgSel.setCapability(BranchGroup.ALLOW_DETACH);
  this.bgSel.addChild(TG1);

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:65,代码来源:Default3DRep.java

示例15: getRotationTransform

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Obtain rotation transform.
 */
public void getRotationTransform(Transform3D t) {
	t.set(rotation);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:7,代码来源:BaseObject.java


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