aboutsummaryrefslogtreecommitdiff
Commit message (Expand)AuthorAge
* Fix typo: vector.check() ought to be vector.check(v)Lars Müller2022-04-24
* Use mod names/titles instead of technical names (#12192)olive2022-04-24
* Builtin: Allow to revoke unknown privilegesSmallJoker2022-04-24
* Fix some debug info showing despite being disabled in the UI (#12205)Lars Müller2022-04-21
* Update docs to reference CSS Color Module Level 3Lars Müller2022-04-21
* Fix '[combine' when EVDF_TEXTURE_NPOT is disabled. (#12187)paradust72022-04-16
* Send chat error when attemping to /set a secure setting (#12193)olive2022-04-16
* upright_sprite: Fix walk animation in first person (#12194)SmallJoker2022-04-15
* Implement shadow offsets for the new SM distortion function (#12191)x20482022-04-14
* Fix item entity Z-fightingLars Mueller2022-04-10
* Remove unneeded ObjectRef setter return values (#12179)Lars Müller2022-04-10
* Don't test overflow behavior for VoxelArea extentsShadowNinja2022-04-08
* Remove generate-texture-normals.shShadowNinja2022-04-08
* Fix typo and update settings filesShadowNinja2022-04-08
* Fix spaces generated by settings file generatorShadowNinja2022-04-08
* Use CMake's -B, --build, and --install optionsShadowNinja2022-04-08
* Fix OOB read in trim("")ShadowNinja2022-04-08
* Remove duplicate test for trimShadowNinja2022-04-08
* Update directory name sanitizationShadowNinja2022-04-08
* Add tests for sanitizeDirNameShadowNinja2022-04-08
* Add additional reserved directory namesShadowNinja2022-04-08
* Auto-detect level of parallelismShadowNinja2022-04-08
* Remove duplication in config.hShadowNinja2022-04-08
* Spacing fixesShadowNinja2022-04-08
* Treat empty XDG_CACHE_HOME same as unsetShadowNinja2022-04-08
* Use build directory for buildsShadowNinja2022-04-08
* Fix compiler warningsShadowNinja2022-04-08
* Remove reference to a removed file in devtest (followup to #12157)Dmitry Kostenko2022-04-07
* Remove obsolete commented code (follow up to #12166)Dmitry Kostenko2022-04-07
* Adjust shadowmap distortion to use entire SM texture (#12166)x20482022-04-07
* Disentangle map implementations (#12148)Jude Melton-Houghton2022-04-07
* Enable shadows by default in devtest (#12157)x20482022-04-07
* Compile Lua as C++ (#11683)Jude Melton-Houghton2022-04-07
* Fix -mwindows flag not being applied anymoresfan52022-04-03
* Add depth sorting for node faces (#11696)x20482022-04-02
* Increase the ratio between shadow range and viewing rangeDmitry Kostenko2022-04-02
* Avoid negation of comparison operator (luacheck warning)Dmitry Kostenko2022-04-01
* Limit shadow map to the viewing range (#12158)x20482022-03-31
* Tune shadow perspective distortion (#12146)x20482022-03-31
* Store vector metatable in registryJude Melton-Houghton2022-03-29
* Optimize swapping nodes with equivalent lightingJude Melton-Houghton2022-03-29
* Fix the documentation of InvRef:get_lists() and clean up code (#12150)DS2022-03-29
* Add API to control shadow intensity from the game/mod (#11944)x20482022-03-26
* Improve lua vector helper class doumentation (#12090)DS2022-03-19
* Fix memory leak in EmergeManagerDaroc Alden2022-03-14
* Fix footsteps for players whose collision box min y != 0 (#12110)Gregor Parzefall2022-03-14
* Fix undefined behavior in TileLayer (#12125)Daroc Alden2022-03-11
* Remove direct OpenGL(ES) dependencysfan52022-03-09
* Use Irrlicht bindings for GL callsfan52022-03-09
* Fix memory leak from SpatialAreaStore (#12120)Daroc Alden2022-03-09
l opt">(x0y1,x1y1,tx); return linearInterpolation(u,v,ty); } double triLinearInterpolation( double v000, double v100, double v010, double v110, double v001, double v101, double v011, double v111, double x, double y, double z) { /*double tx = easeCurve(x); double ty = easeCurve(y); double tz = easeCurve(z);*/ double tx = x; double ty = y; double tz = z; return( v000*(1-tx)*(1-ty)*(1-tz) + v100*tx*(1-ty)*(1-tz) + v010*(1-tx)*ty*(1-tz) + v110*tx*ty*(1-tz) + v001*(1-tx)*(1-ty)*tz + v101*tx*(1-ty)*tz + v011*(1-tx)*ty*tz + v111*tx*ty*tz ); } double noise2d(int x, int y, int seed) { int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y + NOISE_MAGIC_SEED * seed) & 0x7fffffff; n = (n>>13)^n; n = (n * (n*n*60493+19990303) + 1376312589) & 0x7fffffff; return 1.0 - (double)n/1073741824; } double noise3d(int x, int y, int z, int seed) { int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y + NOISE_MAGIC_Z * z + NOISE_MAGIC_SEED * seed) & 0x7fffffff; n = (n>>13)^n; n = (n * (n*n*60493+19990303) + 1376312589) & 0x7fffffff; return 1.0 - (double)n/1073741824; } #if 0 double noise2d_gradient(double x, double y, int seed) { // Calculate the integer coordinates int x0 = (x > 0.0 ? (int)x : (int)x - 1); int y0 = (y > 0.0 ? (int)y : (int)y - 1); // Calculate the remaining part of the coordinates double xl = x - (double)x0; double yl = y - (double)y0; // Calculate random cosine lookup table indices for the integer corners. // They are looked up as unit vector gradients from the lookup table. int n00 = (int)((noise2d(x0, y0, seed)+1)*8); int n10 = (int)((noise2d(x0+1, y0, seed)+1)*8); int n01 = (int)((noise2d(x0, y0+1, seed)+1)*8); int n11 = (int)((noise2d(x0+1, y0+1, seed)+1)*8); // Make a dot product for the gradients and the positions, to get the values double s = dotProduct(cos_lookup[n00], cos_lookup[(n00+12)%16], xl, yl); double u = dotProduct(-cos_lookup[n10], cos_lookup[(n10+12)%16], 1.-xl, yl); double v = dotProduct(cos_lookup[n01], -cos_lookup[(n01+12)%16], xl, 1.-yl); double w = dotProduct(-cos_lookup[n11], -cos_lookup[(n11+12)%16], 1.-xl, 1.-yl); // Interpolate between the values return biLinearInterpolation(s,u,v,w,xl,yl); } #endif #if 1 double noise2d_gradient(double x, double y, int seed) { // Calculate the integer coordinates int x0 = (x > 0.0 ? (int)x : (int)x - 1); int y0 = (y > 0.0 ? (int)y : (int)y - 1); // Calculate the remaining part of the coordinates double xl = x - (double)x0; double yl = y - (double)y0; // Get values for corners of cube double v00 = noise2d(x0, y0, seed); double v10 = noise2d(x0+1, y0, seed); double v01 = noise2d(x0, y0+1, seed); double v11 = noise2d(x0+1, y0+1, seed); // Interpolate return biLinearInterpolation(v00,v10,v01,v11,xl,yl); } #endif double noise3d_gradient(double x, double y, double z, int seed) { // Calculate the integer coordinates int x0 = (x > 0.0 ? (int)x : (int)x - 1); int y0 = (y > 0.0 ? (int)y : (int)y - 1); int z0 = (z > 0.0 ? (int)z : (int)z - 1); // Calculate the remaining part of the coordinates double xl = x - (double)x0; double yl = y - (double)y0; double zl = z - (double)z0; // Get values for corners of cube double v000 = noise3d(x0, y0, z0, seed); double v100 = noise3d(x0+1, y0, z0, seed); double v010 = noise3d(x0, y0+1, z0, seed); double v110 = noise3d(x0+1, y0+1, z0, seed); double v001 = noise3d(x0, y0, z0+1, seed); double v101 = noise3d(x0+1, y0, z0+1, seed); double v011 = noise3d(x0, y0+1, z0+1, seed); double v111 = noise3d(x0+1, y0+1, z0+1, seed); // Interpolate return triLinearInterpolation(v000,v100,v010,v110,v001,v101,v011,v111,xl,yl,zl); } double noise2d_perlin(double x, double y, int seed, int octaves, double persistence) { double a = 0; double f = 1.0; double g = 1.0; for(int i=0; i<octaves; i++) { a += g * noise2d_gradient(x*f, y*f, seed+i); f *= 2.0; g *= persistence; } return a; } double noise2d_perlin_abs(double x, double y, int seed, int octaves, double persistence) { double a = 0; double f = 1.0; double g = 1.0; for(int i=0; i<octaves; i++) { a += g * fabs(noise2d_gradient(x*f, y*f, seed+i)); f *= 2.0; g *= persistence; } return a; } double noise3d_perlin(double x, double y, double z, int seed, int octaves, double persistence) { double a = 0; double f = 1.0; double g = 1.0; for(int i=0; i<octaves; i++) { a += g * noise3d_gradient(x*f, y*f, z*f, seed+i); f *= 2.0; g *= persistence; } return a; } double noise3d_perlin_abs(double x, double y, double z, int seed, int octaves, double persistence) { double a = 0; double f = 1.0; double g = 1.0; for(int i=0; i<octaves; i++) { a += g * fabs(noise3d_gradient(x*f, y*f, z*f, seed+i)); f *= 2.0; g *= persistence; } return a; }