Basic question for importers, answered, now with sample importer
Hi folks,
I'm just getting rolling with the DAZ Studio SDK so this is probably some basic misconception I've got going.
I'm building an importer and trying to implement my read function. As I understand it I need to read my stuff, build my mesh, and somehow drop it into that DzShape object.
I see references on these boards to a DzFacetMesh which seems to be where you build a generic mesh, and it looks to be everything I'd expect it to be. However as I poke around DzShape, I can't for the life of me understand how you'd hook those up (e.g. I see a getGeometry, but no corresponding setGeometry).
Sadly the samples don't have a basic importer and the only things that reference DzShape are a custom shape and some stuff that pull existing attributes.
Any suggestions?
Thanks,
Comments
Okay. I'm a little farther along, but still not there yet.
The object I was looking for was a DzFacetShape. It derives from shape and lets you assign a DzFacetMesh to it. So my read looks something like the code below.
However, I can't see it in the scene. If I have it selected and hover over, some of the mesh is visible, but fades back to the bounding box when I'm done. The mesh I can see on hover over is what I'm expecting so I think the geometry is right.
It seems like it might be some missing material settings or something.
Any suggestions?
Thanks,
Got it!
Hi folks,
Since there isn't an importer sample in the SDK, here's mine.
Of course Ground Control is doing a lot of the heavy lifting behind the scenes to actually read the file and build the mesh, but this should give you a place to start in terms of which objects/apis to call to get something on the screen. Figuring out which UV thingy actually sets the UVs and what it was expecting took me a couple of hours of tweak, compile, test, rinse, and repeat.
Just a few words of warning. This is a work in progress. I'm probably not cleaning up everything correctly here yet. I need to sit down and see which APIs just take over the newly allocated memory and which do deep copies (e.g. does vMesh freak out if I destroy uvList). I also should use the native maps instead of calloc for a couple of the arrays. Finally, not sure I'm building the mesh in the fastest way. addFacet seems pokey, but can't find a way to allocate the number of facets up front and then value them (like I can do with vertices).
header
code
Regards,