Je propose ce post pour les questions sur la 3D.
J'ai essayé de faire un cube mais les faces ne s'affichent pas bien



Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 
public class Cube extends CustomNode {
    public var origin: Point3D = Point3D{}
    public-init var size: Number = 150;
    init {
        children = [
            for(n in [0..1]) [
                Rectangle {
                    fill: Color.LIGHTGRAY
                    stroke: Color.BLACK
                    strokeWidth: 2
                    translateZ: size*n
                    width: size height: size
                }
                Rectangle {
                    rotationAxis: Point3D {
                        x:0 y:10 z:0
                    }
                    rotate: 90
                    fill: Color.LIGHTGREEN
                    stroke: Color.BLACK
                    strokeWidth: 2
                    translateX: (size*(n-.5))
                    translateZ: size/2
                    width: size height: size
                }
                Rectangle {
                    rotationAxis: Point3D {
                        x:1 y:0 z:0
                    }
                    rotate: 90
                    fill: Color.LIGHTSKYBLUE
                    stroke: Color.BLACK
                    strokeWidth: 2
                    translateY: size*(n-.5)
                    translateZ: size/2
                    width: size height: size
                }
            ]
        ]
    }
}
function run() {
    def feats = ConditionalFeature.values();
    for(f in feats) {
        println("feature {f}=>{Platform.isSupported(f)}");
    }
    def cube = Cube {
        size: 100
        opacity: 1
        rotationAxis: Point3D{z: 1}
    }
     def grp = Group {
 
        rotationAxis: Point3D{x: 1 y: 1}
        rotate: 60
        translateZ: 100
        translateX: 100
        translateY: 100
        content: cube
    }
    Timeline {
        repeatCount: Timeline.INDEFINITE
        keyFrames: [at(2s){ cube.rotate => 360}]
    }.playFromStart();
 
    Stage {
	title : "3D Cube"
	onClose: function () {  }
	scene: Scene {
            width: 300
            height: 300
            fill: Color.TRANSPARENT
            camera: PerspectiveCamera {
                fieldOfView: 200
            }
            content: [
                grp
            ]
       }
   }
}