aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
Commit message (Expand)AuthorAge
* Fix errors/warnings reported by valgrindsfan52014-07-06
* Unite nodes shaders.RealBadAngel2014-06-15
* Shaders rework.RealBadAngel2013-12-03
* Cavegen: Respect is_ground_content MapNode setting; fix some code formatting ...kwolekr2013-11-29
* Add support for different drowning damage and allow drowning in other nodetypesBlockMen2013-08-06
* Leveled nodebox backward compatibilityproller2013-08-02
* Weather supportproller2013-07-27
* Bump protocol versionPilzAdam2013-07-20
* Add liquid_range to nodedefPilzAdam2013-07-20
* Change ContentFeatures array to a vectorKahrl2013-07-14
* Leveled nodeboxproller2013-07-13
* Remove texture atlas / AtlasPointer, rename getTextureRaw to getTextureKahrl2013-07-02
* Add drowningPilzAdam2013-06-19
* Add new drawtype GLASSLIKE_FRAMEDRealBadAngel2013-04-24
* Add option to use texture alpha channelkwolekr2013-04-23
* unkn own block -> unkn own nodekhonkhortisan2013-04-05
* Fix MapgenV6::generateCaves possible division by 0 and misc. cosmetic fixeskwolekr2013-03-30
* Optimize CNodeDefManager::getIdskwolekr2013-03-30
* Move rightclickable to the proper placePilzAdam2013-03-23
* Include backface_culling flag in serialization format for TileDefsJürgen Doser2013-03-23
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Disable placement prediction for nodes that use on_rightclickJeija2013-02-19
* Disable backface culling for drawtype plantlike and only draw 2 faces instead...Jürgen Doser2013-02-10
* The new mapgen, noise functions, et al.kwolekr2013-01-21
* Fix tile MaterialType to make sense and make lava surface be shader'd lower l...Perttu Ahola2012-12-02
* Support serialization of protocol 13 ContentFeaturesPerttu Ahola2012-11-29
* Proper versioning of new network-serialized stuffPerttu Ahola2012-11-26
* Update ContentFeatures serialization format now as PROTOCOL_VERSION was changedPerttu Ahola2012-11-25
* Fix more things I forgot for attached players. Such players will now properly...MirceaKitsune2012-11-25
* Fix some remaining issues with attachments, now they work. Tested with object...MirceaKitsune2012-11-25
* Fix unnecessary network protocol incompatibility in ContentFeaturesPerttu Ahola2012-11-08
* Add liquid_renewable property.Ilya Zhuravlev2012-09-07
* Fix black display inside opaque waterMatthew I2012-08-31
* Fix map deserialization and remove old serialization codePerttu Ahola2012-07-23
* Increment protocol versionPerttu Ahola2012-06-17
* Custom boxy nodes (stairs, slabs) and collision changesKahrl2012-06-17
* Properly and efficiently use split utility headersPerttu Ahola2012-06-17
* Node texture animationPerttu Ahola2012-06-16
* Node placement client-side predictionPerttu Ahola2012-06-10
* Add after_destruct and cache the existence of on_construct, on_destruct and a...Perttu Ahola2012-06-05
* Switch the license to be LGPLv2/later, with small parts still remaining as GP...Perttu Ahola2012-06-05
* WIP node metadata, node timersKahrl2012-06-03
* Allow group:groupname in ABM definition and implement minetest.hash_node_posi...Perttu Ahola2012-03-31
* Some serialization version stuffPerttu Ahola2012-03-25
* Add sound.digPerttu Ahola2012-03-24
* Add sounds, tune thingsPerttu Ahola2012-03-24
* Add event manager and use it to trigger soundsPerttu Ahola2012-03-24
* Unknown nodes can be dugPerttu Ahola2012-03-19
* MapBlockMesh, mesh animation system, urgent mesh updates, athmospheric light,...Kahrl2012-03-15
l opt">= -0x7fffffff - 1; const static s32 RANDOM_MAX = 0x7fffffff; const static u32 RANDOM_RANGE = 0xffffffff; PcgRandom(u64 state=0x853c49e6748fea9bULL, u64 seq=0xda3e39cb94b95bdbULL); void seed(u64 state, u64 seq=0xda3e39cb94b95bdbULL); u32 next(); u32 range(u32 bound); s32 range(s32 min, s32 max); void bytes(void *out, size_t len); s32 randNormalDist(s32 min, s32 max, int num_trials=6); private: u64 m_state; u64 m_inc; }; #define NOISE_FLAG_DEFAULTS 0x01 #define NOISE_FLAG_EASED 0x02 #define NOISE_FLAG_ABSVALUE 0x04 //// TODO(hmmmm): implement these! #define NOISE_FLAG_POINTBUFFER 0x08 #define NOISE_FLAG_SIMPLEX 0x10 struct NoiseParams { float offset = 0.0f; float scale = 1.0f; v3f spread = v3f(250, 250, 250); s32 seed = 12345; u16 octaves = 3; float persist = 0.6f; float lacunarity = 2.0f; u32 flags = NOISE_FLAG_DEFAULTS; NoiseParams() = default; NoiseParams(float offset_, float scale_, const v3f &spread_, s32 seed_, u16 octaves_, float persist_, float lacunarity_, u32 flags_=NOISE_FLAG_DEFAULTS) { offset = offset_; scale = scale_; spread = spread_; seed = seed_; octaves = octaves_; persist = persist_; lacunarity = lacunarity_; flags = flags_; } }; class Noise { public: NoiseParams np; s32 seed; u32 sx; u32 sy; u32 sz; float *noise_buf = nullptr; float *gradient_buf = nullptr; float *persist_buf = nullptr; float *result = nullptr; Noise(const NoiseParams *np, s32 seed, u32 sx, u32 sy, u32 sz=1); ~Noise(); void setSize(u32 sx, u32 sy, u32 sz=1); void setSpreadFactor(v3f spread); void setOctaves(int octaves); void gradientMap2D( float x, float y, float step_x, float step_y, s32 seed); void gradientMap3D( float x, float y, float z, float step_x, float step_y, float step_z, s32 seed); float *perlinMap2D(float x, float y, float *persistence_map=NULL); float *perlinMap3D(float x, float y, float z, float *persistence_map=NULL); inline float *perlinMap2D_PO(float x, float xoff, float y, float yoff, float *persistence_map=NULL) { return perlinMap2D( x + xoff * np.spread.X, y + yoff * np.spread.Y, persistence_map); } inline float *perlinMap3D_PO(float x, float xoff, float y, float yoff, float z, float zoff, float *persistence_map=NULL) { return perlinMap3D( x + xoff * np.spread.X, y + yoff * np.spread.Y, z + zoff * np.spread.Z, persistence_map); } private: void allocBuffers(); void resizeNoiseBuf(bool is3d); void updateResults(float g, float *gmap, const float *persistence_map, size_t bufsize); }; float NoisePerlin2D(const NoiseParams *np, float x, float y, s32 seed); float NoisePerlin3D(const NoiseParams *np, float x, float y, float z, s32 seed); inline float NoisePerlin2D_PO(NoiseParams *np, float x, float xoff, float y, float yoff, s32 seed) { return NoisePerlin2D(np, x + xoff * np->spread.X, y + yoff * np->spread.Y, seed); } inline float NoisePerlin3D_PO(NoiseParams *np, float x, float xoff, float y, float yoff, float z, float zoff, s32 seed) { return NoisePerlin3D(np, x + xoff * np->spread.X, y + yoff * np->spread.Y, z + zoff * np->spread.Z, seed); } // Return value: -1 ... 1 float noise2d(int x, int y, s32 seed); float noise3d(int x, int y, int z, s32 seed); float noise2d_gradient(float x, float y, s32 seed, bool eased=true); float noise3d_gradient(float x, float y, float z, s32 seed, bool eased=false); float noise2d_perlin(float x, float y, s32 seed, int octaves, float persistence, bool eased=true); inline float easeCurve(float t) { return t * t * t * (t * (6.f * t - 15.f) + 10.f); } float contour(float v);