RenderKit / embree

Embree ray tracing kernels repository.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new geometry buffer components size

opened this issue · comments

Hi,

The doc says that the lib expects a 32 bit unsigned number for the geometry indices function, but glTF format has it as a 16-bit ushort.

So, could the following code be made valid?

 auto *indices = std::bit_cast <uint16_t *> ( rtcSetNewGeometryBuffer( geom,
                                                                  RTC_BUFFER_TYPE_INDEX,
                                                                  0,
                                                                  RTC_FORMAT_USHORT3,
                                                                  3 * sizeof( uint16_t ),
                                                                  indices_buffer_from_glb_file.size() ) );

otherwise that would mean that a -boring- first pass to convert elements is needed.

Thanks

You need to convert the index buffer to uint32 as Embree does not support ushort3 as index format.

ok,

std::transform( begin( el.indices ), end( el.indices ), indices, []( u16 val ){

        u32 v = val;

        return v;

} );

will do then.
thanks!