-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathTest.java
More file actions
48 lines (38 loc) · 1.53 KB
/
Test.java
File metadata and controls
48 lines (38 loc) · 1.53 KB
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
package com.raylib;
import static com.raylib.Raylib.*;
import static com.raylib.Colors.*;
public class Test {
public static void main(String args[]) {
InitWindow(800, 450, "Hello world");
SetTargetFPS(60);
System.out.println("RLGL TEST: "+rlGetVersion());
// Camera3D camera = new Camera3D()._position(new Vector3().x(18).y(16).z(18))
// .target(new Vector3())
// .up(new Vector3().x(0).y(1).z(0))
// .fovy(45)
// .projection(0);
Camera3D camera = new Camera3D(new Vector3(18,16,18),
new Vector3(),
new Vector3().x(0).y(1).z(0),
45, 0);
Image image = new Image("heightmap.png");
TextureUnmanaged texture = new TextureUnmanaged(image);
Mesh mesh = new Mesh(GenMeshHeightmap(image, new Vector3().x(16).y(8).z(16)));
Model model = new Model(mesh);
model.materials().maps().position(0).texture(texture);
UnloadImage(image);
while(!WindowShouldClose()){
camera.Update(CAMERA_ORBITAL);
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawModel(model, new Vector3().x(-8).y(0).z(-8), 1, RED);
DrawGrid(20, 1.0f);
EndMode3D();
DrawText("Hello world", 190, 200, 20, VIOLET);
DrawFPS(20, 20);
EndDrawing();
}
CloseWindow();
}
}