Example #1
0
void constructMesh(MeshSegment*& meshSeg, const char* fileName, const char* fileType)
{
	if (strcmp(fileType, "ply") == 0 || strcmp(fileType, "off") == 0 || strcmp(fileType, "obj") == 0){
		readTrimesh(meshSeg, fileName);
	}
	srand(time(NULL));
}
Example #2
0
static void readObject(const uint8_t* ptr, a3dsDataT* a3ds) {
    chunkT* chunk = (chunkT*)ptr;
    ptr = chunk->data;

    assert(chunk->id == 0x4000);

    a3dsObjectDataT* obj_data = calloc(1, sizeof(a3dsObjectDataT));
    arrayAdd(a3ds->objects, &obj_data);

    obj_data->name = (string*)ptr;

    ptr += strlen(obj_data->name)+1;

    void* chunk_end = (uint8_t*)chunk + chunk->length;
    while (ptr < chunk_end) {
        chunk = (chunkT*)ptr;

        if (chunk->id == 0x4100) readTrimesh(ptr, obj_data);

        ptr = (uint8_t*)chunk + chunk->length;
    }
}