guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.8k stars 223 forks source link

Closes inmmediatly on open .vxl #265

Closed ByCGS1999 closed 1 year ago

ByCGS1999 commented 2 years ago

I've been trying to open a .vxl file but every time i open it the software crashes and closes.

The voxel file is this. (Its compressed otherwise github wont take it) TheColosseum.zip

Any idea or fix?

guillaumechereau commented 2 years ago

I just tried and it crashes indeed. I'll have a look.

guillaumechereau commented 2 years ago

By the way: how did you generate the file?

guillaumechereau commented 2 years ago

Ok it crashes because apparently the file is not compliant to the Ace of Spade version 1, as described here: https://silverspaceship.com/aosmap/aos_file_format.html.

Are there several vxl format versions?

ByCGS1999 commented 2 years ago

Theoricly all the AOS vxl formats are the same. Generated by Voxlap but not sure at all. Edit: Also its extracted from the Jagex version. That may be the problem

guillaumechereau commented 2 years ago

What are the dimensions of the model? Do you have a screenshot of it?

On Thu, Dec 16, 2021 at 23:36 CGS1999 @.***> wrote:

Theoricly all the AOS vxl formats are the same. Generated by Voxlap but not sure at all

— Reply to this email directly, view it on GitHub https://github.com/guillaumechereau/goxel/issues/265#issuecomment-995930108, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2JH2XRJZLCGH5AT4CDFDURIBPBANCNFSM5KDHL54Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- Sent from my iPad.

ByCGS1999 commented 2 years ago

X: 512 Y: 128 Z: 512

mgerhardy commented 2 years ago

https://github.com/PetrifiedLasagna/AoS-OS/blob/master/engine/voxlap5.h - looks like the model exceeds the max allowed boundaries.

but this version allows higher resolutions: https://github.com/Ericson2314/Voxlap/blob/no-asm/include/voxlap5.h

mgerhardy commented 2 years ago

I know also found models with x:512, y:256, z:512 - but I still haven't found a way to check which dimensions a model has. I'm currently just trying one after another - which is ... bad, but still: https://github.com/mgerhardy/vengi/commit/9e4520c012e157cbd238190df8e7272d0059bda1

mgerhardy commented 2 years ago

I think i've found a proper way to detect the sizes


    struct Header {
        uint8_t len = 0;
        uint8_t colorStartIdx = 0;
        uint8_t colorEndIdx = 0;
        uint8_t airStartIdx = 0;
    };

glm::ivec3 AoSVXLFormat::dimensions(io::SeekableReadStream &stream) const {
    int64_t initial = stream.pos();

    glm::ivec3 size(0);

    while (stream.remaining() >= (int64_t)sizeof(Header)) {
        Header header;
        stream.readUInt8(header.len);
        stream.readUInt8(header.colorStartIdx);
        stream.readUInt8(header.colorEndIdx);
        stream.readUInt8(header.airStartIdx);
        if (header.colorEndIdx + 1 > size.y) {
            size.y = header.colorEndIdx + 1;
        }
        const int64_t spanBytes = header.len > 0 ? header.len * (int)sizeof(uint32_t) : core_max(0, (header.colorEndIdx + 2 - header.colorStartIdx)) * (int)sizeof(uint32_t);
        core_assert_msg(spanBytes >= 0, "spanbytes: %i, stream pos: %i", (int)spanBytes, (int)stream.pos());
        stream.skip(spanBytes);
    }
    size.y = 1 << (int)glm::ceil(glm::log2((float)size.y));
    size.x = size.z = 512;

    stream.seek(initial);
    return size;
}
mgerhardy commented 2 years ago

full version here: https://github.com/mgerhardy/vengi/blob/master/src/modules/voxelformat/AoSVXLFormat.cpp

guillaumechereau commented 2 years ago

OK, I just made a commit that should to make it work, at least for import.

Screen Shot 2022-08-12 at 6 47 13 AM
pegvin commented 2 years ago

@guillaumechereau you should have a look at xtreme8000's libvxl.

guillaumechereau commented 2 years ago

I didn't see he made a branch for that.

@xtreme8000, would you mind making a PR to goxel to add yourself to the CLA? so that I could check and merge your code? I need that to distribute goxel on iOS App Store.

bztsrc commented 2 years ago

I didn't see he made a branch for that.

@guillaumechereau I've actually already fixed this issue and also implemented libvxl integration in Goxel many many months ago. https://github.com/guillaumechereau/goxel/issues/32#issuecomment-1120258958

Cheers, bzt

guillaumechereau commented 2 years ago

@bztsrc: due to the fact that I have a iOS version of goxel, I usually avoid looking at any PR or patches from people who have not added their names to the list of CLA. Maybe at some point I will switch the project to MIT or something similar that would make commercial distribution easier.

bztsrc commented 2 years ago

@guillaumechereau: you should stop talking because with every sentence you're just getting deeper in your own lies.

I usually avoid looking at any PR or patches from people who have not added their names to the list of CLA.

Which I did of course, I've attached my CLA to my pull request. https://github.com/guillaumechereau/goxel/pull/189/commits/19ece9036c12fecde9650a6ccdca3617ea87260f#diff-5327a4e42b46c849bf4bc8cac36af5a1be9a008a9cd8f2f8966ab742f0df766b

Cheers, bzt

guillaumechereau commented 2 years ago

Ah sorry I missed that. OK I'll check the code. But if the bug is fixed I guess that's enough for now.