1 module sbylib.wrapper.assimp.camera;
2 
3 import bindbc.assimp.types;
4 import sbylib.wrapper.assimp.functions : toRegularString, toSbylibVector;
5 import sbylib.math : vec3;
6 
7 struct Camera {
8 
9     private const(aiCamera)* camera;
10 
11     string name() {
12         return camera.mName.toRegularString;
13     }
14 
15     vec3 position() {
16         return camera.mPosition.toSbylibVector;
17     }
18 
19     vec3 up() {
20         return camera.mUp.toSbylibVector;
21     }
22 
23     vec3 lookAt() {
24         return camera.mLookAt.toSbylibVector;
25     }
26 
27     float horizontalFOV() {
28         return camera.mHorizontalFOV;
29     }
30 
31     float clipPlaneNear() {
32         return camera.mClipPlaneNear;
33     }
34 
35     float clipPlaneFar() {
36         return camera.mClipPlaneFar;
37     }
38 
39     float aspect() {
40         return camera.mAspect;
41     }
42 
43     string toString() {
44         import std.format : format;
45         import sbylib.wrapper.assimp.functions : tree;
46 
47         string[] strs;
48         strs ~= format!"position: %s"(position);
49         strs ~= format!"up: %s"(up);
50         strs ~= format!"lookAt: %s"(lookAt);
51         strs ~= format!"horizontalFOV: %s"(horizontalFOV);
52         strs ~= format!"clipPlaneNear: %s"(clipPlaneNear);
53         strs ~= format!"clipPlaneFar: %s"(clipPlaneFar);
54         strs ~= format!"aspect: %s"(aspect);
55 
56         return tree(format!"Camera[%s]"(name), strs);
57     }
58 }