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


Java Color3f类代码示例

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


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

示例1: buildScene

import javax.vecmath.Color3f; //导入依赖的package包/类
@Override
void buildScene(TransformGroup transformGroup) {
    Background background = new Background(new Color3f(.905f, .905f, 0.95f));
    background.setApplicationBounds(BOUNDS);
    transformGroup.addChild(background);

    Appearance appearance = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(1.0f, 0.0f, 1.0f);
    ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD);
    appearance.setColoringAttributes(ca);
    transformGroup.addChild(new Box(0.6f, 0.5f, 0.4f, appearance));

    Transform3D transform3D = new Transform3D();
    transform3D.setTranslation(new Vector3f(0.3f, 0.3f, 0.3f));
    transform3D.setScale(0.75);
    Transform3D t = new Transform3D();
    t.rotY(Math.PI / 4.0d);
    transform3D.mul(t);
    transformGroup.setTransform(transform3D);
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:22,代码来源:ColoredBoxExample.java

示例2: J3dTest

import javax.vecmath.Color3f; //导入依赖的package包/类
public J3dTest(){  
  // 创建一个虚拟空间  
    SimpleUniverse universe = new SimpleUniverse();  
    // 创建一个用来包含对象的数据结构  
    BranchGroup group = new BranchGroup();  
     
    // 创建一个球并把它加入到group中  
    Sphere sphere = new Sphere(0.5f); // 小球的半径为0.5米  
    group.addChild(sphere);  
     
    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(4.0f, -7.0f, -12.0f);  
    // 设置光线的方向  
    DirectionalLight light1= new DirectionalLight(light1Color, light1Direction);  
    // 指定颜色和方向,产生单向光源  
    light1.setInfluencingBounds(bounds);  
    // 把光线的作用范围加入光源中  
    group.addChild(light1);  
    // 将光源加入group组,安放观察点  
    universe.getViewingPlatform().setNominalViewingTransform();  
    // 把group加入到虚拟空间中  
    universe.addBranchGraph(group);  
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:27,代码来源:J3dTest.java

示例3: init

import javax.vecmath.Color3f; //导入依赖的package包/类
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
    KeyBinding selectOption = new KeyBinding("key.wigctrl.selectoption", Keyboard.KEY_LMENU, "key.wigctrl.category");
    ClientRegistry.registerKeyBinding(selectOption);

    ToolPage terraform = new ToolPage(Keyboard.KEY_V, "wigpage.terraform.name", new Color3f(0.2f, 1.0f, 0.2f));
    Pages.add(terraform);

    terraform.addTool(new Tool("test", new ResourceLocation("wig:test"), null, null));

    MinecraftForge.EVENT_BUS.register(new BarSelectInputHandler());
    MinecraftForge.EVENT_BUS.register(new PageRenderHandler());
    MinecraftForge.EVENT_BUS.register(new SingleBarInputHandler());
    MinecraftForge.EVENT_BUS.register(new ToolNameRenderHandler());
    MinecraftForge.EVENT_BUS.register(new SingleToolInputHandler());

    proxy.initTexAtlas();
}
 
开发者ID:CannibalVox,项目名称:wig,代码行数:20,代码来源:WigMod.java

示例4: lightScene

import javax.vecmath.Color3f; //导入依赖的package包/类
private void lightScene()
/* One ambient light, 2 directional lights */
{
	Color3f white = new Color3f(1.0f, 1.0f, 1.0f);

	// Set up the ambient light
	AmbientLight ambientLightNode = new AmbientLight(white);
	ambientLightNode.setInfluencingBounds(bounds);
	sceneBG.addChild(ambientLightNode);

	// Set up the directional lights
	Vector3f light1Direction = new Vector3f(-1.0f, -1.0f, -1.0f);
	// left, down, backwards
	Vector3f light2Direction = new Vector3f(1.0f, -1.0f, 1.0f);
	// right, down, forwards

	DirectionalLight light1 = new DirectionalLight(white, light1Direction);
	light1.setInfluencingBounds(bounds);
	sceneBG.addChild(light1);

	DirectionalLight light2 = new DirectionalLight(white, light2Direction);
	light2.setInfluencingBounds(bounds);
	sceneBG.addChild(light2);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:25,代码来源:Points3DPanel.java

示例5: setColor

import javax.vecmath.Color3f; //导入依赖的package包/类
/** Set the object color */
@Override
public void setColor(Color3f color) {
	Material mat = appearance.getMaterial();
	Color3f ambient = new Color3f(color);
	ambient.scale(0.3f);
	mat.setAmbientColor(ambient);
	color.clampMax(0.8f);
	mat.setDiffuseColor(color);
	// No specular color
	Color3f specular = new Color3f(0, 0, 0);
	mat.setSpecularColor(specular);

	mat.setShininess(1f);

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

示例6: create3D

import javax.vecmath.Color3f; //导入依赖的package包/类
void create3D(float size) {
	super.create3D(true);
	// lamp body
	onColor = new Color3f(0.1f, 1f, 1f);
	offColor = new Color3f(0.3f, 0.3f, 0.3f);
	blinkColor = new Color3f(1f, 0.3f, 0.3f);
	Appearance appear = new Appearance();
	material = new Material();
	material.setAmbientColor(offColor);
	material.setDiffuseColor(offColor);
	material.setCapability(Material.ALLOW_COMPONENT_WRITE);
	material.setSpecularColor(offColor);
	material.setColorTarget(Material.DIFFUSE);
	appear.setMaterial(material);
	Node node = new com.sun.j3d.utils.geometry.Cylinder(size, size, appear);
	node.setCollidable(false);
	node.setPickable(false);
	addChild(node);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:20,代码来源:LampActuator.java

示例7: create3D

import javax.vecmath.Color3f; //导入依赖的package包/类
/** Create the 3d object */
protected void create3D(EnvironmentDescription wd, Color3f color) {
	// create the box using a primitive
	super.create3D();
	Material mat = new Material();
	appearance.setMaterial(mat);

	int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;
	flags |= Primitive.ENABLE_APPEARANCE_MODIFY;
	// com.sun.j3d.utils.geometry.Box box =new
	// com.sun.j3d.utils.geometry.Box(sx,sy,sz,flags,appearance,0);
	// bug in j3d api doc . must give half values.
	com.sun.j3d.utils.geometry.Box box = new com.sun.j3d.utils.geometry.Box(sx / 2, sy / 2, sz / 2, flags, appearance, 0);
	// Enable sensor detection
	box.setPickable(true);

	// define the boundsfFor collision detection
	BoundingBox bounds = new BoundingBox();
	bounds.setUpper(sx / 2, sy / 2, sz / 2);
	bounds.setLower(-sx / 2, -sy / 2, -sz / 2);
	setBounds(bounds);

	setColor(color);
	addChild(box);

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

示例8: BumpersDemo

import javax.vecmath.Color3f; //导入依赖的package包/类
public BumpersDemo() {
	setWorldSize(12);

	boxColor = new Color3f(0.6f, 0.5f, .3f);

	add(new Box(new Vector3d(-5, 0, 0), new Vector3f(0.1f, 1, 10), this));
	add(new Box(new Vector3d(0, 0, -5), new Vector3f(10, 1, 0.1f), this));
	add(new Box(new Vector3d(5, 0, 0), new Vector3f(0.1f, 1, 10), this));
	add(new Box(new Vector3d(0, 0, 5), new Vector3f(10, 1, 0.1f), this));
	add(new Box(new Vector3d(2, 0, 2), new Vector3f(2, 1, 3), this));
	add(new Box(new Vector3d(-2, 0, -2), new Vector3f(3, 1, 2), this));

	add(new Robot(new Vector3d(4, 0, 4), "bump1"));
	add(new Robot(new Vector3d(4, 0, -4), "bump2"));
	add(new Robot(new Vector3d(-4, 0, 4), "bump3"));
	add(new Robot(new Vector3d(-4, 0, -4), "bump4"));

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

示例9: PickCherriesDemo

import javax.vecmath.Color3f; //导入依赖的package包/类
public PickCherriesDemo() {
	showAxis(false);
	setWorldSize(12);
	boxColor = new Color3f(0.6f, 0.5f, .3f);
	// add the four walls
	add(new Box(new Vector3d(-5, 0, 0), new Vector3f(0.1f, 1, 10), this, new Color3f(.8f, 0.2f, 0.2f)));
	add(new Box(new Vector3d(0, 0, -5), new Vector3f(10, 1, 0.1f), this, new Color3f(0.2f, 0.8f, 0.2f)));
	add(new Box(new Vector3d(5, 0, 0), new Vector3f(0.1f, 1, 10), this, new Color3f(0f, 0.2f, 0.8f)));
	add(new Box(new Vector3d(0, 0, 5), new Vector3f(10, 1, 0.1f), this, new Color3f(0.2f, 0.2f, 0.8f)));

	// add the robot
	add(new Robot(new Vector3d(0, 0, 0), "R1"));

	// add cherries randomly .
	for (int n = 0; n < 30; n++) {
		double x = (Math.random() * 10 - 5);
		double z = (Math.random() * 10 - 5);
		add(new CherryAgent(new Vector3d(x, 0, z), "cherry", 0.15f));
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:21,代码来源:PickCherriesDemo.java

示例10: setLighting

import javax.vecmath.Color3f; //导入依赖的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

示例11: setLightingRecon

import javax.vecmath.Color3f; //导入依赖的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

示例12: setLightingNet

import javax.vecmath.Color3f; //导入依赖的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

示例13: Triangle3dCreator

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

        // ca werden nicht benoetigt
        // ColoringAttributes ca = new ColoringAttributes();
        // ca.setColor(triangleColor);
        // this.triangleAppearance.setColoringAttributes(ca);

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

//		Material material = new Material();
//		material.setAmbientColor(color);
//		material.setShininess(0.5f);
//		material.setLightingEnable(true);
//		this.triangleAppearance.setMaterial(material);

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

示例14: Triangle3dCreator

import javax.vecmath.Color3f; //导入依赖的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

示例15: myBackground

import javax.vecmath.Color3f; //导入依赖的package包/类
/** Creates new myBackground */
public myBackground(BoundingSphere bounds)
{
  // Set up the background
  //Color3f bgColor = new Color3f(0.9f, 0.9f, 0.9f);
  Color3f bgColor = new Color3f(0.5f, 0.75f, 1f); //0.1f, 0.15f, 0.3f);
  
  /*
  String FileName = "clouds.gif";
  BufferedImage im = null;
try {
im = ImageIO.read(new File("./FlightObjects/Textures/"+FileName).toURL());
} catch (IOException e) {System.out.println(e);}//MalformedURLException mue) {mue.printStackTrace;}
  ImageComponent2D Imagee = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, im);
  //setImage(Imagee);
  */
  
  setColor(bgColor);
  setApplicationBounds(bounds);
}
 
开发者ID:007Style,项目名称:whiskeyDEM,代码行数:21,代码来源:myBackground.java


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