cleaned all trailing white space from source files.
[sdk] / samples / 3D / hello3D / hello3D.ec
1 import "ecere"
2
3 class MyApp : GuiApplication
4 {
5    driver = "OpenGL";
6 };
7
8 Camera camera
9 {
10    fixed,
11    position = Vector3D { 0, 0, -300 },
12    orientation = Euler { 0, 0, 0 },
13    fov = 53;
14 };
15
16 Light light
17 {
18    diffuse = lightCoral;
19    orientation = Euler { pitch = 10, yaw = 30 };
20 };
21
22 class Hello3D : Window
23 {
24    text = "Hello, 3D";
25    background = black;
26    borderStyle = sizable;
27    hasMaximize = true;
28    hasMinimize = true;
29    hasClose = true;
30    size = { 640, 480 };
31
32    Cube cube { };
33
34    bool OnLoadGraphics()
35    {
36       cube.Create(displaySystem);
37       cube.transform.scaling = { 100, 100, 100 };
38       cube.transform.orientation = Euler { 50, 30, 50 };
39       cube.UpdateTransform();
40       return true;
41    }
42
43    void OnResize(int w, int h)
44    {
45       camera.Setup(w, h, null);
46       camera.Update();
47    }
48
49    void OnRedraw(Surface surface)
50    {
51       surface.Clear(depthBuffer);
52       display.SetLight(0, light);
53       display.SetCamera(surface, camera);
54       display.DrawObject(cube);
55       display.SetCamera(surface, null);
56    }
57 }
58
59 Hello3D hello3D {};