Homebrew OBJ file loader with Citro3D?

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Reaction score
1,211
Trophies
2
Age
24
XP
2,441
Country
United States
Is there a way we can load OBJ files in Citro3D C homebrew without having to type in each coordinate or is there a converter that converts OBJ files in C headers?
 
I'm not aware of a OBJ->C converter that would work, but you can load OBJ files from SD or romfs. You can pull Model.cpp/Model.h from https://github.com/machinamentum/ModelViewer/blob/master/source/Model.cpp. That has an OBJ loader, but it'll only work if the OBJ being loaded is triangulated (has exactly 3 vertices for each face; there's a checkbox in Blender's exporter that will automatically do this for you). You'll have to do a small amount of work to convert the OpenGL-based rendering code to Citro3D, but the basic idea is there in order to do that (I dont have a code sample unfortunately as I havent yet used Citro3D).

Also keep in mind that if you're going to feed a vertex buffer to Citro3D, you probably will have to move the vertex data out of main memory and into the linear heap first.
 

Site & Scene News

Popular threads in this forum