Loading assimp

Dlearner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 26 03:34:21 PDT 2017


I came back to this project and realised my mistakes (Importer is 
a class for the C++ API, and we're using the C API).
So I fixed all my errors, but now I get an access violation.
As far as I can tell, it seems to be an issue with 
`aiGetMaterialTexture`.  It is meant to return an aiString with a 
filename (default value of "$texture.png"), I believe.  But I get:

aiString(13, x"67 6C 61 73 73 5F 64 69 66 2E 70 6E 67 00 FF FF FF 
... FF"c)
[shortened for brevity]

I'm meant to add this on to a directory string so I can load an 
image, but obviously this wouldn't work.

I thought it might be a problem with converting from D-strings to 
C-strings.  I sent a string to `aiImportFile` as 
`toStringz(path)`.
I tested this with some writeln debugging:

```
auto temp = path.toStringz;
writeln("toStringz: ", temp);
writeln("string: ", temp.to!string);
```

This gave:
toStringz: 4770B6
string: Models/Nanosuit/nanosuit.obj

So maybe this is a problem with using aiStrings?  I'm quite 
confused.  Sorry if this is more of an assimp question than a D 
question, but I don't know if it's me misusing D language 
features or not.


More information about the Digitalmars-d-learn mailing list