📄 pool.java
字号:
public class pool extends solidObject{
public vector start;
public vector iDirection, jDirection, kDirection;
public vector[] specularCentre;
public pool(double x, double y, double z){
start = new vector(x,y,z);
iDirection = new vector(1,0,0);
jDirection = new vector(0,1.25,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, 0, 0), put(0, 3, 0), put(12, 3, 0), put(12, 0, 0)};
boundary[0] = new polygon3D(a, null, null, null, null);
vector[] b = new vector[]{put(12, 0, 0), put(12, 3, 0), put(12, 3, 12), put(12, 0, 12) };
boundary[1] = new polygon3D(b, null, null, null, null);
vector[] c = new vector[]{put(12, 0, 12), put(12, 3, 12), put(0, 3, 12), put(0, 0, 12)};
boundary[2] = new polygon3D(c, null, null, null, null);
vector[] d = new vector[]{put(0, 0, 12), put(0, 3, 12), put(0, 3, 0), put(0, 0, 0)};
boundary[3] = new polygon3D(d, null, null, null, null);
vector[] e = new vector[]{put(0,3,0), put(0,3,12), put(12,3,12), put(12, 3, 0)};
boundary[4] = new polygon3D(e, null, null, null, null);
vector[] f = new vector[]{put(0,0,0), put(12,0,0), put(12,0,12), put(0, 0, 12)};
boundary[5] = new polygon3D(f, null, null, null, null);
}
public void makePolygons(){
polygons = new polygon3D[15];
vector[] t;
t = new vector[]{put(0, 0, 0), put(0, 3, 0), put(12, 3, 0), put(12, 0, 0)};
polygons[0] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[0].scaleY = 3;
t = new vector[]{put(12, 0, 0), put(12, 3, 0), put(12, 3, 12), put(12, 0, 12) };
polygons[1] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[1].scaleY = 3;
t = new vector[]{put(12, 0, 12), put(12, 3, 12), put(0, 3, 12), put(0, 0, 12)};
polygons[2] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[2].scaleY = 3;
t = new vector[]{put(0, 0, 12), put(0, 3, 12), put(0, 3, 0), put(0, 0, 0)};
polygons[3] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[3].scaleY = 3;
t = new vector[]{put(0, 3, 0), put(0, 3, 0.5), put(12, 3, 0.5), put(12, 3, 0)};
polygons[4] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[4].scaleY = 3;
polygons[4].scaleX = 0.2;
t = new vector[]{put(0, 3, 11.5), put(0, 3, 12), put(12, 3, 12), put(12, 3, 11.5)};
polygons[5] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[5].scaleY = 3;
polygons[5].scaleX = 0.2;
t = new vector[]{put(0, 3, 0.5), put(0, 3, 11.5), put(0.5, 3, 11.5), put(0.5, 3, 0.5)};
polygons[6] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[6].scaleX = 3;
polygons[6].scaleY = 0.2;
t = new vector[]{put(11.5, 3, 0.5), put(11.5, 3, 11.5), put(12, 3, 11.5), put(12, 3, 0.5)};
polygons[7] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[7].scaleX = 3;
polygons[7].scaleY = 0.2;
t = new vector[]{put(0.5, 0.5, 0.5), put(0.5, 0.5, 11.5), put(11.5, 0.5, 11.5), put(11.5, 0.5, 0.5)};
polygons[9] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[17]);
t = new vector[]{put(0.5, 2.25, 0.5), put(0.5, 2.25, 11.5), put(11.5, 2.25, 11.5), put(11.5, 2.25, 0.5)};
polygons[8] = new polygon3D(t, t[0], t[1], t[3], gameData.wave);
polygons[8].waterSurface = true;
modelBuilder.world.addTransparentPolygon(polygons[8]);
polygons[8].scaleX =25;
polygons[8].scaleY = 3;
t = new vector[]{put(11.5, 2.25, 0.5), put(11.5, 2.25, 11.5), put(0.5, 2.25, 11.5), put(0.5, 2.25, 0.5)};
polygons[10] = new polygon3D(t, t[0], t[1], t[3], gameData.wave);
polygons[10].waterSurface = true;
modelBuilder.world.addTransparentPolygon(polygons[10]);
polygons[10].scaleX = 25;
polygons[10].scaleY = 3;
t = new vector[]{put(0.5, 0.5, 11.5), put(0.5, 3, 11.5), put(11.5, 3, 11.5), put(11.5, 0.5, 11.5)};
polygons[11] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[11].scaleY = 6;
t = new vector[]{put(11.5, 0.5, 11.5), put(11.5, 3, 11.5), put(11.5, 3, 0.5), put(11.5, 0.5, 0.5)};
polygons[12] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[12].scaleY = 3;
t = new vector[]{put(0.5, 0.5, 0.5), put(0.5, 3, 0.5), put(0.5, 3, 11.5), put(0.5, 0.5, 11.5)};
polygons[13] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[13].scaleY = 3;
t = new vector[]{put(11.5, 0.5, 0.5), put(11.5, 3, 0.5), put(0.5, 3, 0.5), put(0.5, 0.5, 0.5)};
polygons[14] = new polygon3D(t, t[0], t[1], t[3], gallery.textures[16]);
polygons[14].scaleY = 3;
}
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 + -