OBJ file loader with Citro3D?

Discussion in '3DS - Homebrew Development and Emulators' started by kprovost7314, Oct 10, 2016.

  1. kprovost7314
    OP

    kprovost7314 GBAtemp's Official Bara Master

    Member
    1,730
    943
    Dec 24, 2014
    United States
    In that bara manga ( ͡° ͜ʖ ͡°)
    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?
     
  2. machinamentum

    machinamentum GBAtemp Regular

    Member
    163
    450
    Jul 5, 2015
    United States
    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.
     
    Voxel and Minnow like this.
  3. kprovost7314
    OP

    kprovost7314 GBAtemp's Official Bara Master

    Member
    1,730
    943
    Dec 24, 2014
    United States
    In that bara manga ( ͡° ͜ʖ ͡°)
    ok....