Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Cube.java
- // Easel
- //
- // Created by Philip Rhodes on 7/26/05.
- // Copyright 2005 __MyCompanyName__. All rights reserved.
- //
- /** The Cube class represents a cube. */
- public class Cube extends Shape {
- /** Construct a cube that is initially sitting on the xy
- * plane with one vertex at 0,0,0 and the other at 1,1,1 in object space.
- * Its dimensions are then scaled by the size parameter given to the
- * constructor.
- */
- public Cube(float size){
- super(8, 12);
- setScales(size, size, size);
- int vi = 0;
- //int ti = 0;
- for(int x=0;x<=1;x++)
- {
- for(int y=0;y<=1;y++)
- {
- //float temp[] = new float[3];
- for(int z=0;z<=1;z++)
- {
- //temp[0] = (float)x;
- //temp[1] = (float)y;
- //temp[2] = (float)z;
- this.setVertex(vi++,(float)x,(float)y,(float)z);
- }
- }
- }
- /*
- for(j=0;j<vertices.length;j++)
- {
- if(j%3==0 || j)
- {
- //this would be the first vertex
- }
- }
- */
- setTriangle(0,0,4,6);
- setTriangle(1,0,2,6);
- setTriangle(2,0,1,3);
- setTriangle(3,0,2,3);
- setTriangle(4,0,4,5);
- setTriangle(5,0,1,5);
- setTriangle(6,7,6,4);
- setTriangle(7,7,5,4);
- setTriangle(8,7,6,2);
- setTriangle(9,7,3,2);
- setTriangle(10,7,5,1);
- setTriangle(11,7,3,1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement