Package com.sun.j3d.utils.image

Examples of com.sun.j3d.utils.image.TextureLoader


/* 273 */       if (tFile.lastIndexOf('.') != -1) {
/*     */         try
/*     */         {
/* 276 */           String suffix = tFile.substring(tFile.lastIndexOf('.') + 1).toLowerCase();
/*     */
/* 279 */           TextureLoader t = null;
/*     */
/* 281 */           if ((suffix.equals("int")) || (suffix.equals("inta")) || (suffix.equals("rgb")) || (suffix.equals("rgba")) || (suffix.equals("bw")) || (suffix.equals("sgi")))
/*     */           {
/*     */             RgbFile f;
/*     */             RgbFile f;
/* 285 */             if (this.fromUrl)
/* 286 */               f = new RgbFile(new URL(this.basePath + tFile).openStream());
/*     */             else {
/* 288 */               f = new RgbFile(new FileInputStream(this.basePath + tFile));
/*     */             }
/* 290 */             BufferedImage bi = f.getImage();
/*     */
/* 292 */             boolean luminance = (suffix.equals("int")) || (suffix.equals("inta"));
/* 293 */             boolean alpha = (suffix.equals("inta")) || (suffix.equals("rgba"));
/* 294 */             this.cur.transparent = alpha;
/*     */
/* 296 */             String s = null;
/* 297 */             if ((luminance) && (alpha)) s = "LUM8_ALPHA8";
/* 298 */             else if (luminance) s = "LUMINANCE";
/* 299 */             else if (alpha) s = "RGBA"; else {
/* 300 */               s = "RGB";
/*     */             }
/* 302 */             t = new TextureLoader(bi, s, 1);
/*     */           }
/* 305 */           else if (this.fromUrl) {
/* 306 */             t = new TextureLoader(new URL(this.basePath + tFile), "RGB", 1, null);
/*     */           }
/*     */           else {
/* 309 */             t = new TextureLoader(this.basePath + tFile, "RGB", 1, null);
/*     */           }
/*     */
/* 313 */           Texture2D texture = (Texture2D)t.getTexture();
/* 314 */           if (texture != null) this.cur.t = texture;
/*     */         }
/*     */         catch (FileNotFoundException e)
/*     */         {
/*     */         }
View Full Code Here


/* 134 */       return null;
/* 135 */     Texture2D t2d = (Texture2D)textureTable.get(this.theImage);
/* 136 */     if (t2d == null) {
/* 137 */       ImageScaler scaler = new ImageScaler((BufferedImage)this.theImage);
/* 138 */       BufferedImage scaledImage = (BufferedImage)scaler.getScaledImage();
/* 139 */       TextureLoader tl = new TextureLoader(scaledImage);
/* 140 */       t2d = (Texture2D)tl.getTexture();
/* 141 */       textureTable.put(this.theImage, t2d);
/*     */     }
/*     */
/* 144 */     return t2d;
/*     */   }
View Full Code Here

     
     
     
        Appearance groundApp = new Appearance();

        Texture textureGround = new TextureLoader("img/groundimage3.jpg", this).getTexture();
        groundApp.setTexture(textureGround);
       
        Box ground = new Box(35f,0.1f,35f, groundApp);
       
       
View Full Code Here


  private void addBackground()
  // a blue sky with clouds backdrop using a scaled texture
  {
    TextureLoader bgTexture = new TextureLoader("models/bigSky.jpg", null);
  Background back = new Background(bgTexture.getImage());
    back.setImageScaleMode(Background.SCALE_FIT_MAX);
    // back.setImageScaleMode(Background.SCALE_REPEAT);   // tiling approach
    back.setApplicationBounds( bounds );

    sceneBG.addChild( back );
View Full Code Here


  private void addBackground()
  // a blue sky with clouds backdrop using a scaled texture
  {
    TextureLoader bgTexture = new TextureLoader("models/bigSky.jpg", null);
  Background back = new Background(bgTexture.getImage());
    back.setImageScaleMode(Background.SCALE_FIT_MAX);
    // back.setImageScaleMode(Background.SCALE_REPEAT);   // tiling approach
    back.setApplicationBounds( bounds );

    sceneBG.addChild( back );
View Full Code Here

import com.sun.j3d.utils.image.TextureLoader;

public class Appearances {

    public static Appearance fromFile(String textureFileName) {
        final TextureLoader loader = new TextureLoader(textureFileName, null);
        final Texture texture = loader.getTexture();
        final Appearance appearance = new Appearance();
        final TextureAttributes ta = new TextureAttributes();
        ta.setTextureMode(TextureAttributes.COMBINE);
        appearance.setMaterial(new Material());
        appearance.setTexture(texture);
View Full Code Here

TOP

Related Classes of com.sun.j3d.utils.image.TextureLoader

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.