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

📄 westwall.java

📁 一个java 3D程序的源代码
💻 JAVA
字号:
public class westWall extends solidObject{

	public vector start;
	public vector iDirection, jDirection, kDirection;
	public vector[] specularCentre;

	public westWall(double x, double y, double z){
		start = new vector(x,y,z);
		iDirection = new vector(1,0,0);
		jDirection = new vector(0,1,0);
		kDirection = new vector(0,0,1);

		this.start = start;
		makeBoundary();
		super.visible = super.testVisibility();
		super.tempCentre = new vector(0,0,0);
		super.findCentre();
		makePolygons();
		sortedPolygons = true;

	}

	public void makeBoundary(){
		boundary = new polygon3D[6];
		vector[] a = new vector[]{put(-0.1, 20, 0), put(-0.1, 20, 70), put(-0.1, 0, 70), put(-0.1, 0, 0)};
		boundary[0] = new polygon3D(a, null, null, null, null);
		vector[] b = new vector[]{put(-0.1, 20, 0), put(-0.1, 20, 70), put(-0.1, 0, 70), put(-0.1, 0, 0)};
		boundary[1] = new polygon3D(b, null, null, null, null);
		vector[] c = new vector[]{put(-0.1, 20, 0), put(-0.1, 20, 70), put(-0.1, 0, 70), put(-0.10, 0, 0)};
		boundary[2] = new polygon3D(c, null, null, null, null);
		vector[] d = new vector[]{put(-0.1, 20, 0), put(-0.1, 20, 70), put(-0.1, 0, 70), put(-0.1, 0, 0)};
		boundary[3] = new polygon3D(d, null, null, null, null);
		vector[] e = new vector[]{put(-0.1, 20, 0), put(-0.1, 20, 70), put(-0.1, 0, 70), put(-0.1, 0, 0)};
		boundary[4] = new polygon3D(e, null, null, null, null);
		vector[] f = new vector[]{put(-0.1, 20, 0), put(-0.1, 20, 70), put(-0.1, 0, 70), put(-0.1, 0, 0)};
		boundary[5] = new polygon3D(f, null, null, null, null);
	}

	public void makePolygons(){
		polygons = new polygon3D[3];
		vector[] t;

		t = new vector[]{put(0, 20, 0), put(0, 20, 70), put(0, 0, 70), put(0, 0, 0)};
		polygons[2] = new polygon3D(t, t[0],  t[1], t[3], gallery.textures[2]);
		polygons[2].scaleX = 10;

		t = new vector[]{put(0, 1, 0), put(0, 1, 70), put(0.3, 1, 70), put(0.3, 1, 0)};
		polygons[1] = new polygon3D(t, t[0],  t[1], t[3], gallery.textures[3]);
		polygons[1].scaleX = 10;

		t = new vector[]{put(0.3, 1, 0), put(0.3, 1, 70), put(0.3, 0, 70), put(0.3, 0, 0)};
		polygons[0] = new polygon3D(t, t[0],  t[1], t[3], gallery.textures[3]);
		polygons[0].scaleX = 10;

	}

	public vector put(double i, double j, double k){
		vector temp = new vector(0,0,0);
		temp.set(start);
		temp.add(iDirection, i);
		temp.add(jDirection, j);
		temp.add(kDirection, k);
		return temp;
	}

}

⌨️ 快捷键说明

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