Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ImageData::Ptr ImageLoader::loadTga(const std::string &filename) {
- ImageData::Ptr data_ = std::make_shared<ImageData>();
- {
- TGA *info;
- TGAData *data;
- char * tmp = const_cast<char *>(filename.c_str());
- data = reinterpret_cast<TGAData*>(malloc(sizeof(TGAData)));
- if(!data) {
- TGA_ERROR((TGA*)NULL, TGA_OOM);
- return 0;
- }
- info = TGAOpen(tmp,"r");
- data->flags = TGA_IMAGE_ID | TGA_IMAGE_DATA | TGA_RGB;
- TGAReadImage(info,data);
- data_->size.width = info->hdr.width;
- data_->size.height = info->hdr.height;
- //data_->channel = 3;
- TGAClose(info);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement