Subversion Repositories distributed

Rev

Rev 44 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 44 Rev 47
Line 12... Line 12...
12
public class Kubus {
12
public class Kubus {
13
        protected Box centerbox;
13
        protected Box centerbox;
14
       
14
       
15
        private static final float Size_Faktor = 0.5f;
15
        private static final float Size_Faktor = 0.5f;
16
        private static final float Abstand_Faktor = 0.5f;
16
        private static final float Abstand_Faktor = 0.5f;
17
        private static final float Max_Iter = 6; // Ab 7 wird's eklig!
17
        private static final float Max_Iter = 5; // Ab 7 wird's eklig!
18
       
18
       
19
        public Kubus(Node rootNode, float size, float abstand, float x, float y, float z, LockDirectoryEnum e, int iter) {
19
        public Kubus(Node rootNode, float size, float abstand, float x, float y, float z, LockDirectoryEnum e, int iter) {
20
                if (iter > Max_Iter) return;
20
                if (iter > Max_Iter) return;
21
               
21
               
22
                Box centerbox = new Box("Center-Box", new Vector3f(x, y, z), size, size, size);
22
                Box centerbox = new Box("Center-Box", new Vector3f(x-size/2, y-size/2, z-size/2), new Vector3f(x+size/2, y+size/2, z+size/2));
23
               
23
               
24
                Node rn = getRoomNode(centerbox, iter);
24
                Node rn = getRoomNode(centerbox, iter);
25
                rootNode.attachChild(rn);
25
                rootNode.attachChild(rn);
26
               
26
               
27
                // WIESO geht es nur mit abstand??? Es sollte abstand*1 sein!
-
 
28
                float abstand2 = 0.5f*size + abstand + 0.5f*size*Size_Faktor;
27
                float abstand2 = 0.5f*size + abstand + 0.5f*size*Size_Faktor;
29
//              System.out.println(iter);
-
 
30
//              System.out.println(size);
-
 
31
//              System.out.println((0.5f*size) + " + " + abstand + " + " + ( 0.5f*size*Size_Faktor));
-
 
32
//              
-
 
33
//              System.out.println(x-abstand2);
-
 
34
               
28
               
35
                if (e != LockDirectoryEnum.LOCK_X_NEG)
29
                if (e != LockDirectoryEnum.LOCK_X_NEG)
36
                        new Kubus(rn, size*Size_Faktor, abstand*Abstand_Faktor, x-abstand2, y, z, LockDirectoryEnum.LOCK_X_POS, iter+1);
30
                        new Kubus(rn, size*Size_Faktor, abstand*Abstand_Faktor, x-abstand2, y, z, LockDirectoryEnum.LOCK_X_POS, iter+1);
37
                if (e != LockDirectoryEnum.LOCK_X_POS)
31
                if (e != LockDirectoryEnum.LOCK_X_POS)
38
                        new Kubus(rn, size*Size_Faktor, abstand*Abstand_Faktor, x+abstand2, y, z, LockDirectoryEnum.LOCK_X_NEG, iter+1);
32
                        new Kubus(rn, size*Size_Faktor, abstand*Abstand_Faktor, x+abstand2, y, z, LockDirectoryEnum.LOCK_X_NEG, iter+1);
Line 63... Line 57...
63
        Color x = ColorUtilities.HSLtoRGB(1.0f/iter, 1.0f, 0.5f);
57
        Color x = ColorUtilities.HSLtoRGB(1.0f/iter, 1.0f, 0.5f);
64
        float r = (float)x.getRed()/255;
58
        float r = (float)x.getRed()/255;
65
        float g = (float)x.getGreen()/255;
59
        float g = (float)x.getGreen()/255;
66
        float b = (float)x.getBlue()/255;
60
        float b = (float)x.getBlue()/255;
67
       
61
       
68
        materialState.setDiffuse(new ColorRGBA(r, g, b, opacityAmount)); // TODO
62
        materialState.setDiffuse(new ColorRGBA(r, g, b, opacityAmount));
69
        materialState.setSpecular(new ColorRGBA(1.0f, 1.0f, 1.0f, opacityAmount));
63
        materialState.setSpecular(new ColorRGBA(1.0f, 1.0f, 1.0f, opacityAmount));
70
        materialState.setShininess(128.0f);
64
        materialState.setShininess(128.0f);
71
        materialState.setEmissive(new ColorRGBA(0.0f, 0.0f, 0.0f, opacityAmount));
65
        materialState.setEmissive(new ColorRGBA(0.0f, 0.0f, 0.0f, opacityAmount));
72
        materialState.setEnabled(true);
66
        materialState.setEnabled(true);
73
 
67