1 module sbylib.wrapper.assimp.assimp;
2 
3 public import sbylib.wrapper.assimp.constants : DefaultLogStream;
4 import bindbc.assimp;
5 
6 class Assimp {
7 
8 static:
9 
10     private bool initialized = false;
11 
12     void initialize() {
13         if (initialized) return;
14         initialized = true;
15 
16         version(BindAssimp_Static) {}
17         else {
18             loadAssimp("libassimp.so.5");
19         }
20     }
21 
22     uint[3] getVersion() {
23         return [aiGetVersionMajor(), aiGetVersionMinor(), aiGetVersionRevision()];
24     }
25 
26     string getLegalString() {
27         import std.conv : to;
28 
29         return aiGetLegalString().to!string;
30     }
31 
32     uint getCompileFlags() {
33         return aiGetCompileFlags();
34     }
35 
36     auto getPredefinedLogStream(DefaultLogStream name) 
37         in (name == DefaultLogStream.Stdout || name == DefaultLogStream.Stderr)
38     {
39         return aiGetPredefinedLogStream(name, null);
40     }
41 
42     aiLogStream getPredefinedLogStream(string path) {
43         import std..string : toStringz;
44 
45         return aiGetPredefinedLogStream(DefaultLogStream.File, path.toStringz);
46     }
47 
48     void attachLogStream(aiLogStream stream) {
49         aiAttachLogStream(&stream);
50     }
51 
52     void detachLogStream(aiLogStream stream) {
53         aiDetachLogStream(&stream);
54     }
55 
56     void detachAllLogStreams() {
57         aiDetachAllLogStreams();
58     }
59 
60     bool verboseLogging(bool b) {
61         aiEnableVerboseLogging(b);
62         return b;
63     }
64 
65     string getErrorString() {
66         import std.conv : to;
67 
68         return aiGetErrorString().to!string;
69     }
70 
71     bool isExtensionSupported(string str) {
72         import std..string : toStringz;
73 
74         return cast(bool)aiIsExtensionSupported(str.toStringz);
75     }
76 }