TriangleArray geometry=new TriangleArray( 12,TriangleArray.COORDINATES | TriangleArray.COLOR_3); // vertexCount = 3 × 4 // vertexFormat = 座標、色
Point3d p0=new Point3d( 0.0 ,-2.0*Math.sqrt(2.0)*1.0/3.0, 2.0); Point3d p1=new Point3d( Math.sqrt(3.0),-2.0*Math.sqrt(2.0)*1.0/3.0,-1.0); Point3d p2=new Point3d(-Math.sqrt(3.0),-2.0*Math.sqrt(2.0)*1.0/3.0,-1.0); Point3d p3=new Point3d( 0.0 , 2.0*Math.sqrt(2.0)*2.0/3.0, 0.0); Color3f c0=new Color3f(0.1f,1.0f,0.3f); Color3f c1=new Color3f(0.1f,1.0f,0.3f); Color3f c2=new Color3f(0.1f,1.0f,0.3f); Color3f c3=new Color3f(0.1f,1.0f,0.3f); Point3d[] vertexs={ p0,p2,p1, // 面1 p0,p1,p3, // 面2 p0,p3,p2, // 面3 p1,p2,p3}; // 面4 Color3f[] colors={ c0,c2,c1, // 面1 c0,c1,c3, // 面2 c0,c3,c2, // 面3 c1,c2,c3}; // 面4 geometry.setCoordinates(0,vertexs); // 頂点座標の設定 geometry.setColors(0,colors); // 頂点の色の設定
戻る