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


Java ColoringAttributes类代码示例

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


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

示例1: RepresentationTin

import javax.media.j3d.ColoringAttributes; //导入依赖的package包/类
public RepresentationTin(ITriangulatedSurface tin, Color[] colorShade,
    int method) {
  super();
  this.nbClasses = colorShade.length;
  Box3D b = new Box3D(tin.coord());
  this.zMin = b.getLLDP().getZ();
  this.zMax = b.getURDP().getZ();
  this.colorShade = toColor3f(colorShade);
  this.method = METHOD_LINEAR;
  this.tin = tin;
  GeometryInfo geoInfo = fromOrientableSToTriangleArray();

  Appearance app = new Appearance();

  ColoringAttributes at = new ColoringAttributes();
  at.setShadeModel(ColoringAttributes.NICEST);

  app.setColoringAttributes(at);

  this.bGRep.addChild(new Shape3D(geoInfo.getGeometryArray(), app));

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

示例2: 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

示例3: 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

示例4: makeAppearance

import javax.media.j3d.ColoringAttributes; //导入依赖的package包/类
private Appearance makeAppearance( Material material, Color4f color, boolean transparent )
{
	Appearance appearance = new Appearance();
	appearance .setMaterial( material );
	appearance .setCapability( Appearance .ALLOW_MATERIAL_READ );
	appearance .setCapability( Appearance .ALLOW_MATERIAL_WRITE );
	material .setLightingEnable( true );
    Color3f justColor = new Color3f( color .x, color.y, color.z );
	appearance .setColoringAttributes( new ColoringAttributes( justColor, ColoringAttributes .SHADE_FLAT ) );
	if ( transparent || color.w < 1.0f ) {
		TransparencyAttributes ta = new TransparencyAttributes();
		ta .setTransparencyMode( TransparencyAttributes .BLENDED );
		float alpha = transparent? ( PREVIEW_TRANSPARENCY * color.w ) : color.w;
		ta .setTransparency( PREVIEW_TRANSPARENCY );
		appearance .setTransparencyAttributes( ta );
	}		
	return appearance;
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:19,代码来源:Appearances.java

示例5: DebugVector

import javax.media.j3d.ColoringAttributes; //导入依赖的package包/类
public DebugVector( Point3f location , Vector3f extent , Color3f color )
{
	ColoringAttributes ca = new ColoringAttributes( );
	ca.setCapability( ColoringAttributes.ALLOW_COLOR_WRITE );
	RenderingAttributes ra = new RenderingAttributes( );
	ra.setCapability( RenderingAttributes.ALLOW_VISIBLE_WRITE );
	TransparencyAttributes ta = new TransparencyAttributes( );
	ta.setTransparency( 0.3f );
	Appearance app = new Appearance( );
	app.setColoringAttributes( ca );
	app.setCapability( Appearance.ALLOW_COLORING_ATTRIBUTES_READ );
	app.setRenderingAttributes( ra );
	app.setCapability( Appearance.ALLOW_RENDERING_ATTRIBUTES_READ );
	shape.setAppearance( app );
	shape.setCapability( Shape3D.ALLOW_APPEARANCE_READ );
	shape.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE );
	
	setVector( location , extent );
	setColor( color );
	
	addChild( shape );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:23,代码来源:DebugVector.java

示例6: 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

示例7: 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

示例8: createBackgroundNode

import javax.media.j3d.ColoringAttributes; //导入依赖的package包/类
/**
 * Returns a new background node.  
 */
private Node createBackgroundNode(boolean listenToHomeUpdates, final boolean waitForLoading)
{
	final Appearance backgroundAppearance = new Appearance();
	ColoringAttributes backgroundColoringAttributes = new ColoringAttributes();
	backgroundAppearance.setColoringAttributes(backgroundColoringAttributes);
	// Allow background color and texture to change
	backgroundAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
	backgroundAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
	backgroundColoringAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
	
	Geometry halfSphereGeometry = createHalfSphereGeometry(true);
	final Shape3D halfSphere = new Shape3D(halfSphereGeometry, backgroundAppearance);
	BranchGroup backgroundBranch = new BranchGroup();
	backgroundBranch.addChild(halfSphere);
	backgroundBranch.addChild(new Shape3D(createHalfSphereGeometry(false)));
	
	final Background background = new Background(backgroundBranch);
	updateBackgroundColorAndTexture(backgroundAppearance, this.home, waitForLoading);
	background.setImageScaleMode(Background.SCALE_FIT_ALL);
	background.setApplicationBounds(new BoundingBox(new Point3d(-1E7, -1E7, -1E7), new Point3d(1E7, 1E7, 1E7)));
	
	if (listenToHomeUpdates)
	{
		// Add a listener on sky color and texture properties change 
		this.skyColorListener = new PropertyChangeListener()
		{
			public void propertyChange(PropertyChangeEvent ev)
			{
				updateBackgroundColorAndTexture(backgroundAppearance, home, waitForLoading);
			}
		};
		this.home.getEnvironment().addPropertyChangeListener(HomeEnvironment.Property.SKY_COLOR,
				this.skyColorListener);
		this.home.getEnvironment().addPropertyChangeListener(HomeEnvironment.Property.SKY_TEXTURE,
				this.skyColorListener);
	}
	return background;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:42,代码来源:HomeComponent3D.java

示例9: 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

示例10: 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

示例11: SlicePlaneRenderer

import javax.media.j3d.ColoringAttributes; //导入依赖的package包/类
public SlicePlaneRenderer(View view, Context context, Volume vol)
{
	super(view, context, vol);
	volRefPtAttr = (CoordAttr) context.getAttr("Vol Ref Pt");

	root = new BranchGroup();

	// subclasses add the slice geometry to root

	borderSwitch = new Switch(Switch.CHILD_ALL);
	borderSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);

	RenderingAttributes ra = new RenderingAttributes();
	ra.setDepthBufferEnable(true);
	ColoringAttributes bclr = new ColoringAttributes(0.4f, 0.4f, 0.4f,
			ColoringAttributes.SHADE_FLAT);
	Appearance ba = new Appearance();
	ba.setColoringAttributes(bclr);
	ba.setRenderingAttributes(ra);

	borderShape = new Shape3D(null, ba);
	borderShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);

	borderSwitch.addChild(borderShape);

	root.addChild(borderSwitch);

	root.setCapability(BranchGroup.ALLOW_DETACH);
	root.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:31,代码来源:SlicePlaneRenderer.java

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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