Package javax.media.j3d

Examples of javax.media.j3d.Material


    float shininessSphere = 20.0f;

    Appearance sphereApp = new Appearance();

    sphereApp.setMaterial(new Material(ambientColourSphere,emissiveColourSphere,
                           diffuseColourSphere,specularColourSphere,shininessSphere));

    ColoringAttributes ca = new ColoringAttributes();
    ca.setShadeModel(ColoringAttributes.SHADE_FLAT);
    sphereApp.setColoringAttributes(ca);
View Full Code Here


     *  This has the side effect of setting the protected variable
     *  _changesAllowedNow so that derived classes can check it.
     *  @exception IllegalActionException If a parameter cannot be evaluated.
     */
    protected void _createAppearance() throws IllegalActionException {
        _material = new Material();
        _appearance = new Appearance();

        boolean allowChanges = ((BooleanToken) allowRuntimeChanges.getToken())
                .booleanValue();

View Full Code Here

    final ColoringAttributes colorAttr = new ColoringAttributes();
    colorAttr.setColor(orange);
    colorAttr.setShadeModel(ColoringAttributes.NICEST);
    appear.setColoringAttributes(colorAttr);

    final Material material = new Material();
    material.setAmbientColor(orange);
    material.setDiffuseColor(orange);
    material.setSpecularColor(orange);
    material.setEmissiveColor(orange);
    appear.setMaterial(material);

    final Box box = new Box();
    box.setAppearance(appear);
View Full Code Here

        polyAttr.setPolygonMode(PolygonAttributes.POLYGON_LINE); //POLYGON_FILL);

        // appearance
    app = new Appearance();
   
    Material mat = new Material();
    mat.setLightingEnable(true);
    mat.setDiffuseColor(1.0f, 1.0f, 1.0f);
   
    app.setPolygonAttributes(polyAttr);
    app.setTextureUnitState(textureUnitState);
    app.setMaterial(mat);
   
View Full Code Here

//        renderTextures();

  // appearance
    app = new Appearance();
   
    Material mat = new Material();
    mat.setLightingEnable(true);
    mat.setDiffuseColor(1.0f, 1.0f, 1.0f);
   
    app.setPolygonAttributes(polyAttr);
    app.setTextureUnitState(textureUnitState);
    app.setMaterial(mat);
   
View Full Code Here

    Color3f white = new Color3f(1.0f, 1.0f, 0.6f);
    Color3f gray  = new Color3f(.2f, .2f, .2f);
    Color3f red = new Color3f(1.0f, 0, 0);
    Color3f yellow = new Color3f(1,1,0);
   
    Material objMaterial = new Material(objColor, black,
        objColor, white, 100.0f);
    Material blackMaterial = new Material(objColor, black,
        black, objColor, 10.0f);
    Material whiteMaterial = new Material(white, white,
        white, white, 100.0f);
    Material grayMaterial = new Material(gray, black,
        gray, gray, 100.0f);

    Material redMaterial = new Material(red, black,
        red, red, 100.0f);
    Material yellowMaterial = new Material(yellow, black,
        yellow, yellow, 100);

    look.setMaterial(new Material(objColor, black,
        objColor, white, 100.0f));
    Appearance blackLook = new Appearance();
    blackLook.setMaterial(blackMaterial);

    Appearance whiteLook = new Appearance();
View Full Code Here

    Color3f black = new Color3f(0,0,0);
    Color3f white = new Color3f(1,1,1);
    Color3f gray  = new Color3f(.2f, .2f, .2f);
    Color3f red = new Color3f(1, 0, 0);
    Color3f yellow = new Color3f(0,1,1);
    Material lightGrayMaterial = new Material(lightGray, black,
        lightGray, white, 100.0f);
    Material blackMaterial = new Material(lightGray, black,
        black, lightGray, 10.0f);
    Material whiteMaterial = new Material(white, white,
        white, white, 100.0f);
    Material grayMaterial = new Material(gray, black,
        gray, gray, 100.0f);
    Material redMaterial = new Material(red, black,
        red, red, 100.0f);
    Material yellowMaterial = new Material(yellow, black,
        yellow, yellow, 100.0f);

    final Appearance lightGrayLook = new Appearance();
    lightGrayLook.setMaterial(lightGrayMaterial);
    Appearance blackLook = new Appearance();
View Full Code Here

/*     */
/*     */   void assignMaterial(String matName, Shape3D shape)
/*     */   {
/* 119 */     ObjectFileMaterial p = null;
/*     */
/* 123 */     Material m = new Material();
/* 124 */     p = (ObjectFileMaterial)this.materials.get(matName);
/* 125 */     Appearance a = new Appearance();
/*     */
/* 127 */     if (p != null)
/*     */     {
/* 129 */       if (p.Ka != null) m.setAmbientColor(p.Ka);
/* 130 */       if (p.Kd != null) m.setDiffuseColor(p.Kd);
/*     */
/* 133 */       if ((p.Ks != null) && (p.illum != 1)) m.setSpecularColor(p.Ks);
/* 134 */       else if (p.illum == 1) m.setSpecularColor(0.0F, 0.0F, 0.0F);
/*     */
/* 136 */       if (p.illum >= 1) m.setLightingEnable(true);
/* 137 */       else if (p.illum == 0) m.setLightingEnable(false);
/*     */
/* 139 */       if (p.Ns != -1.0F) m.setShininess(p.Ns);
/*     */
/* 141 */       if (p.t != null) {
/* 142 */         a.setTexture(p.t);
/*     */
/* 144 */         if ((((GeometryArray)shape.getGeometry()).getVertexFormat() & 0x20) == 0)
View Full Code Here

/* 219 */     Color3f aColor = new Color3f(0.1F, 0.1F, 0.1F);
/* 220 */     Color3f eColor = new Color3f(0.0F, 0.0F, 0.0F);
/* 221 */     Color3f dColor = new Color3f(0.6F, 0.6F, 0.6F);
/* 222 */     Color3f sColor = new Color3f(1.0F, 1.0F, 1.0F);
/*     */
/* 224 */     Material m = new Material(aColor, eColor, dColor, sColor, 100.0F);
/* 225 */     Appearance a = new Appearance();
/* 226 */     m.setLightingEnable(true);
/* 227 */     a.setMaterial(m);
/* 228 */     setAppearance(a);
/*     */   }
View Full Code Here

/* 243 */           debugOutputLn(2, "passed in normalCoords, length = " + shape.normalCoords.length);
/*     */         }
/*     */
/* 246 */         debugOutputLn(8, "created fan array");
/*     */
/* 249 */         Material material = new Material(surf.getColor(), surf.getEmissiveColor(), surf.getDiffuseColor(), surf.getSpecularColor(), surf.getShininess());
/*     */
/* 254 */         material.setLightingEnable(true);
/* 255 */         appearance.setMaterial(material);
/* 256 */         if (surf.getTransparency() != 0.0F) {
/* 257 */           TransparencyAttributes ta = new TransparencyAttributes();
/* 258 */           ta.setTransparency(surf.getTransparency());
/* 259 */           ta.setTransparencyMode(2);
View Full Code Here

TOP

Related Classes of javax.media.j3d.Material

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.