📄 colouredtiles.java
字号:
// ColouredTiles.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th
// ColouredTiles creates a coloured quad array of tiles.
// No lighting since no normals or Material used
import javax.media.j3d.*;
import javax.vecmath.*;
import java.util.ArrayList;
public class ColouredTiles extends Shape3D
{
private QuadArray plane;
public ColouredTiles(ArrayList coords, Color3f col)
{
plane = new QuadArray(coords.size(),
GeometryArray.COORDINATES | GeometryArray.COLOR_3 );
createGeometry(coords, col);
createAppearance();
}
private void createGeometry(ArrayList coords, Color3f col)
{
int numPoints = coords.size();
Point3f[] points = new Point3f[numPoints];
coords.toArray( points );
plane.setCoordinates(0, points);
Color3f cols[] = new Color3f[numPoints];
for(int i=0; i < numPoints; i++)
cols[i] = col;
plane.setColors(0, cols);
setGeometry(plane);
} // end of createGeometry()
private void createAppearance()
{
Appearance app = new Appearance();
PolygonAttributes pa = new PolygonAttributes();
pa.setCullFace(PolygonAttributes.CULL_NONE);
// so can see the ColouredTiles from both sides
app.setPolygonAttributes(pa);
setAppearance(app);
} // end of createAppearance()
} // end of ColouredTiles class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -