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


Java ColoringAttributes.setColor方法代码示例

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


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

示例1: Segment3D

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
public Segment3D() {
        super();
        Appearance ap = new Appearance();
        ColoringAttributes ca = new ColoringAttributes();
        ca.setColor(Utils3D.grey);
        ap.setColoringAttributes(ca);
        /*TransparencyAttributes myTA = new TransparencyAttributes();
        myTA.setTransparency(0.7f);
        myTA.setTransparencyMode(TransparencyAttributes.FASTEST);
        ap.setTransparencyAttributes(myTA);*/
//		render the Box as a wire frame
/*PolygonAttributes polyAttrbutes = new PolygonAttributes();
        polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
        polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
        ap.setPolygonAttributes(polyAttrbutes);*/
        setAppearance(ap);
    }
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:18,代码来源:Segment3D.java

示例2: Triangle3dCreator

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
/**
 * Creates a new instance of Triangle3dCreator color the color of the
 * triangle
 */
public Triangle3dCreator(Color3f color) {
    this.triangleColor = color;
    this.triangleAppearance = new Appearance();

    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(triangleColor);
    this.triangleAppearance.setColoringAttributes(ca);

    TransparencyAttributes ta = new TransparencyAttributes();
    ta.setTransparency(0.5f);
    this.triangleAppearance.setTransparencyAttributes(ta);

    this.triangleContainer = new Shape3D();
    triangleContainer.removeGeometry(0);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:20,代码来源:Triangle3dCreator.java

示例3: maskAppearance

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
public static Appearance maskAppearance( )
{
	final Appearance app = new Appearance( );
	
	final TransparencyAttributes ta = new TransparencyAttributes( );
	ta.setTransparencyMode( TransparencyAttributes.BLENDED );
	ta.setSrcBlendFunction( TransparencyAttributes.BLEND_ZERO );
	ta.setDstBlendFunction( TransparencyAttributes.BLEND_ONE );
	app.setTransparencyAttributes( ta );
	
	final ColoringAttributes ca = new ColoringAttributes( );
	ca.setColor( new Color3f( 0 , 0 , 0 ) );
	app.setColoringAttributes( ca );
	
	final RenderingAttributes ra = new RenderingAttributes( );
	ra.setDepthBufferWriteEnable( true );
	app.setRenderingAttributes( ra );
	
	return app;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:21,代码来源:J3DUtils.java

示例4: setSelected

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
@Override
public void setSelected(boolean isSelected) {
  this.selected = isSelected;

  List<Shape3D> shapes = this.getShapes();
  int nbElem = shapes.size();

  for (int i = 0; i < nbElem; i++) {
    Appearance ap = shapes.get(i).getAppearance();

    if (isSelected) {

      ColoringAttributes ca = new ColoringAttributes();
      ca.setColor(new Color3f(ConstantRepresentation.selectionColor));
      ap.setColoringAttributes(ca);
      ap.setTexture(null);
      ap.setTextureAttributes(null);
    } else {

      ap.setTextureAttributes(new TextureAttributes());
      ap.setTexture(this.texture);

      shapes.get(i).getAppearance().setColoringAttributes(null);
      shapes.get(i).setAppearance(ap);
    }

  }

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

示例5: create3D

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
private void create3D() {
	super.create3D(true);
	// construct sensor body - a line for each individual sensor ray.
	Point3d[] coords = new Point3d[nbSensors * 2];
	for (int i = 0; i < nbSensors; i++) {
		Point3d start = new Point3d(positions[i]);
		coords[i * 2] = start;
		Point3d end = new Point3d(start);
		Point3d direction = new Point3d(directions[i]);
		if (((flags & FLAG_SHOW_FULL_SENSOR_RAY) == 0) && (type != TYPE_BUMPER))
			direction.scale(0.05f); // just a small ray
		end.add(direction);
		coords[i * 2 + 1] = end;

	}
	LineArray line = new LineArray(coords.length, GeometryArray.COORDINATES);
	line.setCoordinates(0, coords);

	Appearance appear = new Appearance();
	Material material = new Material();

	ColoringAttributes ca = new ColoringAttributes();
	ca.setColor(color);

	appear.setColoringAttributes(ca);
	appear.setMaterial(material);
	Shape3D shape = new Shape3D(line, appear);
	shape.setCollidable(false);
	shape.setPickable(false);
	addChild(shape);

}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:33,代码来源:RangeSensorBelt.java

示例6: addLight

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

示例7: CorticalColumn

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
public CorticalColumn(float scale) {
    super();
    this.scale = scale;
    Region.Param.ColumnParam par = Region.Param.getInstance().getColumnParam();
    lengthX = par.getLength() * scale;
    widthY = par.getWidth() * scale;
    layer1 = par.getLayer1() * scale;
    layer23 = par.getLayer23() * scale;
    layer4 = par.getLayer4() * scale;
    layer5A = par.getLayer5A() * scale;
    layer5B = par.getLayer5B() * scale;
    layer6 = par.getLayer6() * scale;
    heightZ = par.getHeight() * scale;

    Appearance ap = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(Utils3D.grey);
    ap.setColoringAttributes(ca);
    TransparencyAttributes myTA = new TransparencyAttributes();
    myTA.setTransparency(0.7f);
    myTA.setTransparencyMode(TransparencyAttributes.NICEST);
    ap.setTransparencyAttributes(myTA);
    //render the Box as a wire frame
    PolygonAttributes polyAttrbutes = new PolygonAttributes();
    polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
    polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
    ap.setPolygonAttributes(polyAttrbutes);
    setAppearance(ap);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:30,代码来源:CorticalColumn.java

示例8: addScaleBarToSceneGraph

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
/**
 * add a 100 µm scale bar to the BranchGroup
 *
 * @param scene
 *                the BranchGroup
 */
public static void addScaleBarToSceneGraph(TransformGroup scene, Point3f scaleBarPos, float scale) {
    if (scaleBarPos == null) {
        scaleBarPos = new Point3f();
    }

    float barPos = -150.0f * scale;
    float hight = 100.0f * scale;
    //logger.info("scaleBarPos: " + scaleBarPos.toString());
    LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    //la.setCoordinate(0, new Point3f(scaleBarPos.x + 0.7f, scaleBarPos.y + 0.0f, scaleBarPos.z + 0.9f));
    //la.setCoordinate(1, new Point3f(scaleBarPos.x + 0.7f, scaleBarPos.y + 0.0f, scaleBarPos.z + 1.0f));
    la.setCoordinate(0, new Point3f(barPos, scaleBarPos.y, scaleBarPos.z));
    la.setCoordinate(1, new Point3f(barPos, scaleBarPos.y, scaleBarPos.z + hight));
    for (int i = 0; i < 2; ++i) {
        la.setColor(i, grey);
    }
    scene.addChild(new Shape3D(la));
    Text3D text3d = new Text3D(new Font3D(new Font("plain", java.awt.Font.PLAIN, 1), new FontExtrusion()), "100 µm");
    text3d.setAlignment(Text3D.ALIGN_LAST);
    Shape3D text3dShape3d = new Shape3D(text3d);
    Appearance appearance = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(grey);
    appearance.setColoringAttributes(ca);
    text3dShape3d.setAppearance(appearance);

    TransformGroup tg = new TransformGroup();
    Transform3D t3d = new Transform3D();
    t3d.rotX(Math.PI / 2);
    float textScale = 30f * scale;
    //t3d.setScale(0.025);
    t3d.setScale(textScale);
    t3d.setTranslation(new Vector3f((barPos + (barPos/10.0f)), scaleBarPos.y, scaleBarPos.z + hight/2.0f));
    tg.setTransform(t3d);
    tg.addChild(text3dShape3d);
    scene.addChild(tg);
    // scene.addChild(text3dShape3d);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:45,代码来源:Utils3D.java

示例9: addText3D

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
public static void addText3D(TransformGroup bg, String text, Vector3f vPos, float scale, Color3f color) {
    Text3D text3d = new Text3D(new Font3D(new Font("plain", java.awt.Font.PLAIN, 1), new FontExtrusion()), text);
    Shape3D text3dShape3d = new Shape3D(text3d); 
    Appearance appearance = new Appearance();

    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(color);
    appearance.setColoringAttributes(ca);

    TransparencyAttributes myTA = new TransparencyAttributes();
    myTA.setTransparency(0.3f);
    myTA.setTransparencyMode(TransparencyAttributes.NICEST);
    appearance.setTransparencyAttributes(myTA);

    text3dShape3d.setAppearance(appearance);

    TransformGroup tg = new TransformGroup();
    Transform3D t3d = new Transform3D();

    t3d.rotX(Math.PI / 2);
    t3d.setTranslation(vPos);
    t3d.setScale(scale * 15.0f);

    tg.setTransform(t3d);
    tg.addChild(text3dShape3d);
    bg.addChild(tg);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:28,代码来源:Utils3D.java

示例10: RegionCA1

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
public RegionCA1(float scale) {
    super();
    this.scale = scale;
    Region.Param.CA1Param regPar = Region.Param.getInstance().getCa1Param();
    lengthX = regPar.getLength() * scale;
    widthY = regPar.getWidth() * scale;
    stratumOriens = regPar.getStratumOriens() * scale;
    stratumPyramidale = regPar.getStratumPyramidale() * scale;
    stratumRadiatum = regPar.getStratumRadiatum() * scale;
    stratumLacunosum = regPar.getStratumLacunosum() * scale;
    heightZ = regPar.getHeight() * scale;

    Appearance ap = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(Utils3D.grey);
    ap.setColoringAttributes(ca);
    TransparencyAttributes myTA = new TransparencyAttributes();
    myTA.setTransparency(0.7f);
    myTA.setTransparencyMode(TransparencyAttributes.FASTEST);
    ap.setTransparencyAttributes(myTA);
    //render the Box as a wire frame
    PolygonAttributes polyAttrbutes = new PolygonAttributes();
    polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
    polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
    ap.setPolygonAttributes(polyAttrbutes);
    setAppearance(ap);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:28,代码来源:RegionCA1.java

示例11: Line3dCreator

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
/**
 * Creates a new instance of Line3dCreator color the color of the line
 */
public Line3dCreator(Color3f color) {
    this.lineColor = color;
    this.lineAppearance = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(lineColor);
    this.lineAppearance.setColoringAttributes(ca);
    this.lineContainer = new Shape3D();
    this.lineContainer.removeGeometry(0);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:13,代码来源:Line3dCreator.java

示例12: createWireFrameAppearance

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private static Appearance createWireFrameAppearance() {
    Appearance materialAppear = new Appearance();
    PolygonAttributes polyAttrib = new PolygonAttributes();
    polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE);
    materialAppear.setPolygonAttributes(polyAttrib);
    ColoringAttributes redColoring = new ColoringAttributes();
    redColoring.setColor(ColorUtil.red);
    materialAppear.setColoringAttributes(redColoring);
    return materialAppear;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:12,代码来源:AppearanceCreator.java

示例13: addCoordinateSphereAxesToSceneGraph

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
/**
 * Function to add a white sphere and axes at the origin of the
 * coordinate system for better orientation. The z-axis is in black.
 */
public static void addCoordinateSphereAxesToSceneGraph(BranchGroup scene, float radius) {
    float rad = (radius <= 0.0f) ? 0.1f : radius;
    Appearance ap = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(white);
    ap.setColoringAttributes(ca);
    scene.addChild(new Sphere(rad, ap));

    LineArray la1 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la1.setCoordinate(0, new Point3f());
    la1.setCoordinate(1, new Point3f(5.0f * rad, 0.0f, 0.0f));
    for (int i = 0; i < 2; ++i) {
        la1.setColor(i, white);
    }
    scene.addChild(new Shape3D(la1));
    LineArray la2 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la2.setCoordinate(0, new Point3f());
    la2.setCoordinate(1, new Point3f(0.0f, 5.0f * rad, 0.0f));
    for (int i = 0; i < 2; ++i) {
        la2.setColor(i, white);
    }
    scene.addChild(new Shape3D(la2));
    LineArray la3 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la3.setCoordinate(0, new Point3f());
    la3.setCoordinate(1, new Point3f(0.0f, 0.0f, 5.0f * rad));
    for (int i = 0; i < 2; ++i) {
        la3.setColor(i, black);
    }
    scene.addChild(new Shape3D(la3));
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:35,代码来源:ColorUtil.java

示例14: create3D

import javax.media.j3d.ColoringAttributes; //导入方法依赖的package包/类
private void create3D() {
  super.create3D(true);
  // construct sensor body - a line for each individual sensor ray.
  Point3d[] coords = new Point3d[nbSensors * 2];
  for (int i = 0; i < nbSensors; i++) {
    Point3d start = new Point3d(positions[i]);
    coords[i * 2] = start;
    Point3d end = new Point3d(start);
    Point3d direction = new Point3d(directions[i]);
    if (((flags & FLAG_SHOW_FULL_SENSOR_RAY) == 0) && (type != TYPE_BUMPER))
      direction.scale(0.05f); // just a small ray
    end.add(direction);
    coords[i * 2 + 1] = end;

  }
  LineArray line = new LineArray(coords.length, GeometryArray.COORDINATES);
  line.setCoordinates(0, coords);

  Appearance appear = new Appearance();
  Material material = new Material();

  ColoringAttributes ca = new ColoringAttributes();
  ca.setColor(color);

  appear.setColoringAttributes(ca);
  appear.setMaterial(material);
  Shape3D shape = new Shape3D(line, appear);
  shape.setCollidable(false);
  shape.setPickable(false);
  addChild(shape);

}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:33,代码来源:RangeSensorBelt.java

示例15: addLight

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


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