⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 texture.java

📁 一个java 3D程序的源代码
💻 JAVA
字号:
import java.awt.image.PixelGrabber;
import java.awt.*;


//only represents power of 2 textures
public class texture{
	public Image img;

	public int[] Texture;

	public int height;

	public int width;

	public int heightMask;

	public int widthMask;

	public int widthBits;

	public int heightBits;

	public PixelGrabber pg;



	public texture(Image img, int widthBits , int heightBits){
		this.img = img;

		this.widthBits = widthBits;
		this.heightBits = heightBits;

		height = (int)Math.pow(2, heightBits);
		width = (int)Math.pow(2, widthBits);

		Texture = new int[width*height];

		heightMask = height -1;
		widthMask = width - 1;

		PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, Texture, 0, width);
		try {
			pg.grabPixels();
		}catch(Exception e){}
	}

	public texture(int[] Texture, int widthBits , int heightBits){
		this.Texture = Texture;

		this.widthBits = widthBits;
		this.heightBits = heightBits;

		height = (int)Math.pow(2, heightBits);
		width = (int)Math.pow(2, widthBits);

		heightMask = height -1;
		widthMask = width - 1;

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -