📄 quadshape2.java
字号:
import javax.media.j3d.*;
public class quadShape2 extends Shape3D {
private float vert[] = {
-.6f , .6f , .0f ,
-.6f , -.6f, .0f ,
-.3f , .6f , .0f ,
-.3f , -.6f, .0f ,
-.0f , .6f , .0f ,
-.0f , -.6f, .0f ,
.3f , .6f , .0f ,
.3f , -.6f, .0f ,
.6f , .6f , .0f ,
.6f , -.6f, .0f ,
};
private float color[] = {
1.0f,0.5f,0.0f,
1.0f,0.0f,0.5f,
1.0f,0.8f,0.0f,
5.0f,1.0f,0.0f,
0.0f,1.0f,0.5f,
0.9f,1.0f,0.0f,
0.5f,0.0f,1.0f,
0.0f,0.5f,1.0f,
1.0f,0.5f,0.0f,
1.0f,0.0f,0.5f,
};
public quadShape2() {
int[] index={ 2 , 1 , 3 , 4 , 4 , 7 , 9 , 6};
int VertexCount=8;
IndexedQuadArray quad = new IndexedQuadArray(10,
IndexedQuadArray.COORDINATES|
IndexedQuadArray.COLOR_3 , VertexCount);
quad.setCoordinates(0,vert);
quad.setColors(0,color);
quad.setCoordinateIndices(0,index);
quad.setColorIndices(0,index);
PolygonAttributes pa = new PolygonAttributes();
pa.setCullFace(PolygonAttributes.CULL_NONE);
Appearance ap = new Appearance();
ap.setPolygonAttributes(pa);
this.setGeometry(quad);
this.setAppearance(ap);
this.setGeometry(quad);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -