EliteAsian123 / noa-plus-plugins

Noa Engine... With Plugins!
MIT License
2 stars 1 forks source link

heres the 3d cave code #5

Open levlups opened 5 years ago

levlups commented 5 years ago

js code ,,,,,,,

case "simplex3d":
        for (var x1 = 0; x1 < data.shape[0]; ++x1) {
            for (var z1 = 0; z1 < data.shape[2]; ++z1) {

                for (var y1 = 0; y1 < data.shape[1]; ++y1) {
                    var random = this.simplexNoise.noise3D((x1 + x) / 50,(y1 + y) / 50*10, (z1 + z) / 50);
            var random2 = Math.floor(this.simplexNoise.noise2D((x1 + x) / 100, (z1 + z) / 100) * 10);

                                if ( random<0.1) {

                                                if (y1 + y === random2 + 1) {
                                        data.set(x1, y1, z1, blockIDs[0]);
                                    } else if (y1 + y < random2 + 1 && y1 + y > random2 - 5) {
                                        data.set(x1, y1, z1, blockIDs[1]);
                                    } else if (y1 + y <= random2 - 5) {
                                        data.set(x1, y1, z1, blockIDs[2]);
                                    }   

                            }   

                }

            }
        }
    break;

end of code ,,,,,

levlups commented 5 years ago

its weird how when we use simplex noise , no more holes no more deffects on the land ...?????