Giter Club home page Giter Club logo

Comments (5)

bingo-soft avatar bingo-soft commented on July 1, 2024 1

@Brilliant-orange I faced the same problem. Unzipping generated tiles solved the issue for me.

from cesium-terrain-builder.

alan14alashti avatar alan14alashti commented on July 1, 2024

@Brilliant-orange I faced the same problem. Unzipping generated tiles solved the issue for me.
@bingo-soft
Would you mind tell us how did you do that?
I have this problem and i don't know how to unzip terrain files.
thanks.

from cesium-terrain-builder.

juedao7 avatar juedao7 commented on July 1, 2024

写.terrain时,不能用gzwrite,那样写不出正确的.terrain,而是用fwrite方式.
修正如下:在terraintile.cpp中改写

void Terrain::writeFile(const char fileName) const
{
FILE
terrainFile = fopen(fileName, "wb");

if (terrainFile == NULL) {
    throw CTBException("Failed to open file");
}

// Write the height data,float应该是4 * TILE_CELL_SIZE
//if (gzwrite(terrainFile, mHeights.data(), TILE_CELL_SIZE * 2) == 0)
if (fwrite( mHeights.data(),  sizeof(i_terrain_height),TILE_CELL_SIZE, terrainFile) == 0)
{
    fclose(terrainFile);
    throw CTBException("Failed to write height data");
}

// Write the child flags
if (fputc(mChildren,terrainFile ) == -1) {
    fclose(terrainFile);
    throw CTBException("Failed to write child flags");
}

// Write the water mask
if (fwrite(mMask,sizeof(char), mMaskLength,terrainFile ) == 0) {
    fclose(terrainFile);
    throw CTBException("Failed to write water mask");
}

fclose(terrainFile);

}
/*
void Terrain::writeFile(const char *fileName) const
{
gzFile terrainFile = gzopen(fileName, "wb");

if (terrainFile == NULL) {
    throw CTBException("Failed to open file");
}

// Write the height data,float应该是4 * TILE_CELL_SIZE
//if (gzwrite(terrainFile, mHeights.data(), TILE_CELL_SIZE * 2) == 0)
if (gzwrite(terrainFile, mHeights.data(), TILE_CELL_SIZE * sizeof(i_terrain_height)) == 0)
{
    gzclose(terrainFile);
    throw CTBException("Failed to write height data");
}

// Write the child flags
if (gzputc(terrainFile, mChildren) == -1) {
    gzclose(terrainFile);
    throw CTBException("Failed to write child flags");
}

// Write the water mask
if (gzwrite(terrainFile, mMask, mMaskLength) == 0) {
    gzclose(terrainFile);
    throw CTBException("Failed to write water mask");
}

// Try and close the file
switch (gzclose(terrainFile)) {
case Z_OK:
    break;
case Z_STREAM_ERROR:
case Z_ERRNO:
case Z_MEM_ERROR:
case Z_BUF_ERROR:
default:
    throw CTBException("Failed to close file");
}

}

from cesium-terrain-builder.

poorGiser avatar poorGiser commented on July 1, 2024

@Brilliant-orange I faced the same problem. Unzipping generated tiles solved the issue for me.
hello?how to unzip the .terrain file?

from cesium-terrain-builder.

q8f13 avatar q8f13 commented on July 1, 2024

@Brilliant-orange I faced the same problem. Unzipping generated tiles solved the issue for me.
hello?how to unzip the .terrain file?

here

from cesium-terrain-builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.