List of usage examples for javax.media.j3d Texture BASE_LEVEL_LINEAR
int BASE_LEVEL_LINEAR
To view the source code for javax.media.j3d Texture BASE_LEVEL_LINEAR.
Click Source Link
From source file:BooksDemo.java
private Appearance createTexture(String fileName) { Image sourceImage = UIHelper.readImage(fileName); if (sourceImage == null) System.out.println("Image could not be loaded from " + fileName); TextureLoader loader = new TextureLoader(sourceImage, this); ImageComponent2D image = loader.getImage(); if (image == null) System.out.println("Texture could not be loaded from " + fileName); Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight()); texture.setImage(0, image);/* ww w .ja v a 2 s . c om*/ texture.setEnable(true); texture.setMagFilter(Texture.BASE_LEVEL_LINEAR); texture.setMinFilter(Texture.BASE_LEVEL_LINEAR); Appearance appearance = new Appearance(); PolygonAttributes polyAttributes = new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0f); appearance.setPolygonAttributes(polyAttributes); appearance.setTexture(texture); TextureAttributes textureAttributes = new TextureAttributes(); appearance.setTextureAttributes(textureAttributes); return appearance; }
From source file:TexBug.java
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); Object source = e.getSource(); if (action == texEnableString) { texEnable = texEnableCheckBox.isSelected(); System.out.println("texture.setEnable(" + texEnable + ")"); texture.setEnable(texEnable);/*from w ww . j a va 2 s .c om*/ } else if (action == texBoundarySWrapString) { texBoundaryModeS = Texture.WRAP; setTexture(); } else if (action == texBoundarySClampString) { texBoundaryModeS = Texture.CLAMP; setTexture(); } else if (action == texBoundaryTWrapString) { texBoundaryModeT = Texture.WRAP; setTexture(); } else if (action == texBoundaryTClampString) { texBoundaryModeT = Texture.CLAMP; setTexture(); } else if (action == texMinFilterBasePointString) { texMinFilter = Texture.BASE_LEVEL_POINT; setTexture(); } else if (action == texMinFilterBaseLinearString) { texMinFilter = Texture.BASE_LEVEL_LINEAR; setTexture(); } else if (action == texMinFilterMultiPointString) { texMinFilter = Texture.MULTI_LEVEL_POINT; setTexture(); } else if (action == texMinFilterMultiLinearString) { texMinFilter = Texture.MULTI_LEVEL_LINEAR; setTexture(); } else if (action == texMinFilterFastestString) { texMinFilter = Texture.FASTEST; setTexture(); } else if (action == texMinFilterNicestString) { texMinFilter = Texture.NICEST; setTexture(); } else if (action == texMagFilterBasePointString) { texMagFilter = Texture.BASE_LEVEL_POINT; setTexture(); } else if (action == texMagFilterBaseLinearString) { texMagFilter = Texture.BASE_LEVEL_LINEAR; setTexture(); } else if (action == texMagFilterNicestString) { texMagFilter = Texture.NICEST; setTexture(); } else if (action == texMagFilterFastestString) { texMagFilter = Texture.FASTEST; setTexture(); } else if (action == texMipMapBaseString) { texMipMapMode = Texture.BASE_LEVEL; setTexture(); } else if (action == texMipMapMultiString) { texMipMapMode = Texture.MULTI_LEVEL_MIPMAP; setTexture(); } }
From source file:AppearanceTest.java
public void onMag_BASE_LEVEL_LINEAR() { getTexture().setMagFilter(Texture.BASE_LEVEL_LINEAR); assignToAppearance(); }
From source file:AppearanceTest.java
public void onMin_BASE_LEVEL_LINEAR() { getTexture().setMinFilter(Texture.BASE_LEVEL_LINEAR); assignToAppearance(); }
From source file:AppearanceExplorer.java
public Texture2DEditor(Appearance app, String codeBaseString, String[] texImageNames, String[] texImageFileNames, int texImageIndex, boolean texEnable, int texBoundaryModeS, int texBoundaryModeT, int texMinFilter, int texMagFilter, int texMipMapMode, Color4f texBoundaryColor) { super(BoxLayout.Y_AXIS); this.appearance = app; // TODO: make deep copies? this.imageNames = texImageNames; this.imageFileNames = texImageFileNames; this.imageIndex = texImageIndex; this.imageFile = texImageFileNames[texImageIndex]; this.codeBaseString = codeBaseString; this.enable = texEnable; this.mipMapMode = texMipMapMode; this.boundaryModeS = texBoundaryModeS; this.boundaryModeT = texBoundaryModeT; this.minFilter = texMinFilter; this.magFilter = texMagFilter; this.boundaryColor.set(texBoundaryColor); // set up the initial texture setTexture();//w w w .ja va2 s.c om JCheckBox texEnableCheckBox = new JCheckBox("Enable Texture"); texEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { enable = ((JCheckBox) e.getSource()).isSelected(); // workaround for bug // should just be able to // texture.setEnable(texEnable); // instead we have to: setTexture(); } }); // add the checkbox to the panel add(new LeftAlignComponent(texEnableCheckBox)); IntChooser imgChooser = new IntChooser("Image:", imageNames); imgChooser.setValue(imageIndex); imgChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { imageIndex = event.getValue(); imageFile = imageFileNames[imageIndex]; setTexture(); } }); add(imgChooser); // texture boundaries String[] boundaryNames = { "WRAP", "CLAMP", }; int[] boundaryValues = { Texture.WRAP, Texture.CLAMP, }; // texture boundary S IntChooser bndSChooser = new IntChooser("Boundary S Mode:", boundaryNames, boundaryValues); bndSChooser.setValue(texBoundaryModeS); bndSChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); boundaryModeS = value; setTexture(); } }); add(bndSChooser); // texture boundary T IntChooser bndTChooser = new IntChooser("Boundary T Mode:", boundaryNames, boundaryValues); bndTChooser.setValue(texBoundaryModeT); bndTChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); boundaryModeT = value; setTexture(); } }); add(bndTChooser); // texture min filter String[] minFiltNames = { "FASTEST", "NICEST", "BASE_LEVEL_POINT", "BASE_LEVEL_LINEAR", "MULTI_LEVEL_POINT", "MULTI_LEVEL_LINEAR", }; int[] minFiltValues = { Texture.FASTEST, Texture.NICEST, Texture.BASE_LEVEL_POINT, Texture.BASE_LEVEL_LINEAR, Texture.MULTI_LEVEL_POINT, Texture.MULTI_LEVEL_LINEAR, }; // min filter IntChooser minFiltChooser = new IntChooser("Min Filter:", minFiltNames, minFiltValues); minFiltChooser.setValue(minFilter); minFiltChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); minFilter = value; setTexture(); } }); add(minFiltChooser); // texture mag filter String[] magFiltNames = { "FASTEST", "NICEST", "BASE_LEVEL_POINT", "BASE_LEVEL_LINEAR", }; int[] magFiltValues = { Texture.FASTEST, Texture.NICEST, Texture.BASE_LEVEL_POINT, Texture.BASE_LEVEL_LINEAR, }; // mag filter IntChooser magFiltChooser = new IntChooser("Mag Filter:", magFiltNames, magFiltValues); magFiltChooser.setValue(magFilter); magFiltChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); magFilter = value; setTexture(); } }); add(magFiltChooser); // texture mipmap mode String[] mipMapNames = { "BASE_LEVEL", "MULTI_LEVEL_MIPMAP", }; int[] mipMapValues = { Texture.BASE_LEVEL, Texture.MULTI_LEVEL_MIPMAP, }; // mipMap mode IntChooser mipMapChooser = new IntChooser("MipMap Mode:", mipMapNames, mipMapValues); mipMapChooser.setValue(mipMapMode); mipMapChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); mipMapMode = value; setTexture(); } }); add(mipMapChooser); Color4fEditor boundaryColorEditor = new Color4fEditor("Boundary Color", boundaryColor); boundaryColorEditor.addColor4fListener(new Color4fListener() { public void colorChanged(Color4fEvent event) { event.getValue(boundaryColor); setTexture(); } }); add(boundaryColorEditor); }