Package javax.vecmath

Examples of javax.vecmath.Color3f


    void set(Color3f c) {
        set(c.get());
    }

    Color3f get() {
        return new Color3f(_color);
    }
View Full Code Here


        Shape3D co= new Shape3D(Geometries.cone(arrowRadius, arrowLength, divisions,true,l-arrowLength));
        group.addChild(co);
        Shape3D bco= new Shape3D(Geometries.disc(arrowRadius, divisions,false,l-arrowLength));
        group.addChild(bco);

        Color3f aColor  = new Color3f(0.1f, 0.1f, 0.1f);
        Color3f eColor  = new Color3f(0.0f, 0.0f, 0.0f);
        Color3f sColor  = new Color3f(1.0f, 1.0f, 1.0f);

        Appearance cya=new Appearance();
        cya.setColoringAttributes(new ColoringAttributes(new Color3f(color),ColoringAttributes.SHADE_GOURAUD));
        Material cym = new Material(aColor, eColor, new Color3f(color), sColor, 100.0f);
        cym.setLightingEnable(true);
        cya.setMaterial(cym);
        cy.setAppearance(cya);
        bcy.setAppearance(cya);

        Appearance coa=new Appearance();
        coa.setColoringAttributes(new ColoringAttributes(new Color3f(arrowColor),ColoringAttributes.SHADE_GOURAUD));
        Material com = new Material(aColor, eColor, new Color3f(arrowColor), sColor, 100.0f);
        com.setLightingEnable(true);
        coa.setMaterial(com);
        co.setAppearance(coa);
        bco.setAppearance(coa);
    }
View Full Code Here

            DiscDialog.Result n=d.getResult();
            if(n!=null){
                GroupNode gn=(GroupNode)getNode();
       
                Shape3D sd= new Shape3D(Geometries.disc(n.radius, n.divisions,n.up,0.));
                Color3f aColor  = new Color3f(0.1f, 0.1f, 0.1f);
                Color3f eColor  = new Color3f(0.0f, 0.0f, 0.0f);
                Color3f sColor  = new Color3f(1.0f, 1.0f, 1.0f);

                Appearance cya=new Appearance();
                cya.setColoringAttributes(new ColoringAttributes(new Color3f(Color.WHITE),ColoringAttributes.SHADE_GOURAUD));
                cya.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
                Material cym = new Material(aColor, eColor, new Color3f(Color.WHITE), sColor, 100.0f);
                cym.setLightingEnable(true);
                cya.setMaterial(cym);
                sd.setAppearance(cya);

                gn.addChild(sd);
View Full Code Here

       
        void apply(double[] v){
            GroupNode gn=(GroupNode)getNode();
           
            Shape3D sd= new Shape3D(Geometries.polygon(v));
            Color3f aColor  = new Color3f(0.1f, 0.1f, 0.1f);
            Color3f eColor  = new Color3f(0.0f, 0.0f, 0.0f);
            Color3f sColor  = new Color3f(1.0f, 1.0f, 1.0f);

            Appearance cya=new Appearance();
            cya.setColoringAttributes(new ColoringAttributes(new Color3f(Color.WHITE),ColoringAttributes.SHADE_GOURAUD));
            cya.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
            Material cym = new Material(aColor, eColor, new Color3f(Color.WHITE), sColor, 100.0f);
            cym.setLightingEnable(true);
            cya.setMaterial(cym);
            sd.setAppearance(cya);

            gn.addChild(sd);
View Full Code Here

        return _object.getMaterial();
    }
   
    @Override
    public Color3f getPropertyValue() {
        Color3f res=new Color3f();
        if(_propertyName.equals(AmbientColor)){
            _object.getMaterial().getAmbientColor(res);
        }
        else if(_propertyName.equals(DiffuseColor)){
            _object.getMaterial().getDiffuseColor(res);
View Full Code Here

            super(object, LightColor);
        }

        @Override
        public Color3f getPropertyValue() {
            Color3f res=new Color3f();
            _object.getColor(res);
            return res;
        }
View Full Code Here

      } else {
        throw new IncorrectFormatException("Expected material name at line " + tokenizer.lineno());
      }
    } else if ("Ka".equals(tokenizer.sval)) {
      // Read ambient color Ka r g b
      Color3f ambiantColor = new Color3f(parseNumber(tokenizer),
          parseNumber(tokenizer), parseNumber(tokenizer));
      if (currentAppearance != null) {
        Material material = getMaterial(currentAppearance);
        material.setAmbientColor(ambiantColor);
      }
    } else if ("Kd".equals(tokenizer.sval)) {
      // Read diffuse or emissive color Kd r g b
      Color3f diffuseColor = new Color3f(parseNumber(tokenizer),
          parseNumber(tokenizer), parseNumber(tokenizer));
      if (currentAppearance != null) {
        OBJMaterial material = getMaterial(currentAppearance);
        material.setDiffuseColor(diffuseColor);
        currentAppearance.setColoringAttributes(
            new ColoringAttributes(diffuseColor, ColoringAttributes.SHADE_GOURAUD));
      }
    } else if ("Ks".equals(tokenizer.sval)) {
      // Read specular color Ks r g b
      Color3f specularColor = new Color3f(parseNumber(tokenizer),
          parseNumber(tokenizer), parseNumber(tokenizer));
      if (currentAppearance != null) {
        OBJMaterial material = getMaterial(currentAppearance);
        if (!material.isIlluminationModelSet()
            || material.getIlluminationModel() >= 2) {
View Full Code Here

  private void update(boolean waitTextureLoadingEnd) {
    Home home = (Home)getUserData();
    Shape3D groundShape = (Shape3D)getChild(0);
    int currentGeometriesCount = groundShape.numGeometries();
   
    Color3f groundColor = new Color3f(new Color(home.getEnvironment().getGroundColor()));
    final Appearance groundAppearance = groundShape.getAppearance();
    groundAppearance.getColoringAttributes().setColor(groundColor);
    HomeTexture groundTexture = home.getEnvironment().getGroundTexture();
    if (groundTexture != null) {
      final TextureManager imageManager = TextureManager.getInstance();
View Full Code Here

  /**
   * Updates<code>backgroundAppearance</code> color and texture from <code>home</code> sky color and texture.
   */
  private void updateBackgroundColorAndTexture(final Appearance backgroundAppearance, Home home,
                                               boolean waitForLoading) {
    Color3f skyColor = new Color3f(new Color(home.getEnvironment().getSkyColor()));
    backgroundAppearance.getColoringAttributes().setColor(skyColor);
    HomeTexture skyTexture = home.getEnvironment().getSkyTexture();
    if (skyTexture != null) {
      TextureManager textureManager = TextureManager.getInstance();
      if (waitForLoading) {
View Full Code Here

  /**
   * Returns the lights of the scene.
   */
  private Light [] createLights(boolean listenToHomeUpdates) {
    final Light [] lights = {
        new DirectionalLight(new Color3f(1, 1, 1), new Vector3f(1.5f, -0.8f, -1)),        
        new DirectionalLight(new Color3f(1, 1, 1), new Vector3f(-1.5f, -0.8f, -1)),
        new DirectionalLight(new Color3f(1, 1, 1), new Vector3f(0, -0.8f, 1)),
        new DirectionalLight(new Color3f(0.7f, 0.7f, 0.7f), new Vector3f(0, 1f, 0)),
        new AmbientLight(new Color3f(0.2f, 0.2f, 0.2f))};
    for (int i = 0; i < lights.length - 1; i++) {
      // Allow directional lights color to change
      lights [i].setCapability(DirectionalLight.ALLOW_COLOR_WRITE);
      // Store default color in user data
      Color3f defaultColor = new Color3f();
      lights [i].getColor(defaultColor);
      lights [i].setUserData(defaultColor);
      updateLightColor(lights [i]);
    }
   
View Full Code Here

TOP

Related Classes of javax.vecmath.Color3f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.