aboutsummaryrefslogtreecommitdiff
path: root/util
Commit message (Expand)AuthorAge
* Don't add line number to comment when running updatepo.shest312015-09-02
* Add fgettext_ne as keyword to updatepo.shest312015-08-25
* Update toolchain_mingw64.cmakeRui2015-07-18
* Add LibGMPest312015-05-11
* Replaced libjpeg dependency on apt-get, it should be libjpeg-dev instead of l...Megaf2015-05-11
* Make Git version detection use VERSION_STRING instead of tagsShadowNinja2015-05-05
* Clean up and tweak build systemShadowNinja2015-03-27
* Rename --do-unittests to --run-unittests as @Zeno- and @sfan5 requestedLoic Blot2015-02-24
* Unit tests must be done at integration process.Loic Blot2015-02-21
* Add LevelDB and redis to Travis Linux buildssfan52015-02-16
* Reduce gettext wide/narrow and string/char* conversionsShadowNinja2015-02-05
* Add wstrgettext to list of translation update keywordsShadowNinja2015-02-05
* Add SQLite3 libraries to buildbotsfan52015-01-08
* Fix buildbot (was broken by 04a1a446cf845a0db80d39fd0e42771aa07e4492)sfan52015-01-06
* Add util/bump_version.shKahrl2014-12-30
* Update MinGW toolchain downloads used by travissfan52014-12-23
* Build for win32 & win64 on Travis toosfan52014-12-06
* Update the cURL the buildbot uses to 7.38.0sfan52014-10-19
* updatepo.sh: Find all filesDiego Martínez2014-09-30
* Add ZLIBWAPI_DLL and LEVELDB_DLL CMake options Remove legacy MINGWM10_DLL CMa...sfan52014-07-29
* Move master server to seperate repositoryShadowNinja2014-06-30
* Masterserver: Fix compiling servers.jstproller2014-06-30
* Masterserver: Fix undefined playersproller2014-06-28
* Update buildbot scripts and add 64-bit buildbotsfan52014-06-18
* Fix null string escapeproller2014-02-24
* Send long announce as POST, show OS in useragentproller2014-01-07
* Rename names -> can_see_far_names in announceproller2013-12-03
* Remove link to #, add unlimited_player_transfer_distance to announceproller2013-12-03
* Masterserver uptime fixproller2013-11-05
* Fix masterserver README.mdIlya Zhuravlev2013-11-04
* Masterserver fixesproller2013-11-04
* Masterserver show privs and js autoloadproller2013-11-04
* Add a "More..." link when the serverlist is filteredShadowNinja2013-11-03
* Only show servers with at least master.min_clients clientsShadowNinja2013-11-03
* Use a doT.js template for the serverlistShadowNinja2013-11-03
* Masterserver totals fixproller2013-10-18
* Masterserver updateproller2013-10-18
* Add translation for main menusapier2013-08-17
* Fix stored XSS vulnerability in the serverlistSfan52013-08-07
* Master server script improvementproller2013-08-05
* Masterserver bugfixproller2013-08-04
* More info in serverlistproller2013-08-03
* Masterserver mods fixproller2013-07-13
* Better masterserver htmlproller2013-07-13
* Masterserver mods announse, ipv6, better curl errorsproller2013-07-13
* Add texture bumpmapping feature.RealBadAngel2013-07-04
* Remove common from CMakeLists.txt, README.txt, lua-api.txt and buildwin.shPilzAdam2013-05-18
* Fix masterserver javascript: adjustable output idproller2013-04-11
* Fix backward compatibility for server uptime in master server web pageproller2013-03-30
* Masterserver: report gameid, uptime, cosmetic fixes on server web pageproller2013-03-30
an>(IsVisible) { //SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT); SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID); } ISceneNode::OnRegisterSceneNode(); } #define MYROUND(x) (x > 0.0 ? (int)x : (int)x - 1) void Clouds::render() { video::IVideoDriver* driver = SceneManager->getVideoDriver(); /*if(SceneManager->getSceneNodeRenderPass() != scene::ESNRP_TRANSPARENT) return;*/ if(SceneManager->getSceneNodeRenderPass() != scene::ESNRP_SOLID) return; ScopeProfiler sp(g_profiler, "Rendering of clouds, avg", SPT_AVG); int num_faces_to_draw = 1; if(g_settings->getBool("enable_3d_clouds")) num_faces_to_draw = 6; driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); driver->setMaterial(m_material); /* Clouds move from X+ towards X- */ const s16 cloud_radius_i = 12; const float cloud_size = BS*48; const v2f cloud_speed(-BS*2, 0); // Position of cloud noise origin in world coordinates v2f world_cloud_origin_pos_f = m_time*cloud_speed; // Position of cloud noise origin from the camera v2f cloud_origin_from_camera_f = world_cloud_origin_pos_f - m_camera_pos; // The center point of drawing in the noise v2f center_of_drawing_in_noise_f = -cloud_origin_from_camera_f; // The integer center point of drawing in the noise v2s16 center_of_drawing_in_noise_i( MYROUND(center_of_drawing_in_noise_f.X / cloud_size), MYROUND(center_of_drawing_in_noise_f.Y / cloud_size) ); // The world position of the integer center point of drawing in the noise v2f world_center_of_drawing_in_noise_f = v2f( center_of_drawing_in_noise_i.X * cloud_size, center_of_drawing_in_noise_i.Y * cloud_size ) + world_cloud_origin_pos_f; for(s16 zi=-cloud_radius_i; zi<cloud_radius_i; zi++) for(s16 xi=-cloud_radius_i; xi<cloud_radius_i; xi++) { v2s16 p_in_noise_i( xi+center_of_drawing_in_noise_i.X, zi+center_of_drawing_in_noise_i.Y ); /*if((p_in_noise_i.X + p_in_noise_i.Y)%2==0) continue;*/ /*if((p_in_noise_i.X/2 + p_in_noise_i.Y/2)%2==0) continue;*/ v2f p0 = v2f(xi,zi)*cloud_size + world_center_of_drawing_in_noise_f; double noise = noise2d_perlin_abs( (float)p_in_noise_i.X*cloud_size/BS/200, (float)p_in_noise_i.Y*cloud_size/BS/200, m_seed, 3, 0.4); if(noise < 0.95) continue; float b = m_brightness; video::SColor c_top(128,b*240,b*240,b*255); video::SColor c_side_1(128,b*230,b*230,b*255); video::SColor c_side_2(128,b*220,b*220,b*245); video::SColor c_bottom(128,b*205,b*205,b*230); video::S3DVertex v[4] = { video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 1), video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 1), video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 0), video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 0) }; f32 rx = cloud_size; f32 ry = 8*BS; f32 rz = cloud_size; for(int i=0; i<num_faces_to_draw; i++) { switch(i) { case 0: // top v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; v[2].Pos.X= rx; v[2].Pos.Y= ry; v[2].Pos.Z= rz; v[3].Pos.X= rx; v[3].Pos.Y= ry, v[3].Pos.Z=-rz; break; case 1: // back for(int j=0;j<4;j++) v[j].Color=c_side_1; v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz; v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; break; case 2: //right for(int j=0;j<4;j++) v[j].Color=c_side_2; v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z=-rz; v[1].Pos.X= rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; v[2].Pos.X= rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz; v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; break; case 3: // front for(int j=0;j<4;j++) v[j].Color=c_side_1; v[0].Pos.X= rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz; v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z= rz; v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z= rz; v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz; break; case 4: // left for(int j=0;j<4;j++) v[j].Color=c_side_2; v[0].Pos.X=-rx; v[0].Pos.Y= ry; v[0].Pos.Z= rz; v[1].Pos.X=-rx; v[1].Pos.Y= ry; v[1].Pos.Z=-rz; v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; v[3].Pos.X=-rx; v[3].Pos.Y=-ry, v[3].Pos.Z= rz; break; case 5: // bottom for(int j=0;j<4;j++) v[j].Color=c_bottom; v[0].Pos.X= rx; v[0].Pos.Y=-ry; v[0].Pos.Z= rz; v[1].Pos.X=-rx; v[1].Pos.Y=-ry; v[1].Pos.Z= rz; v[2].Pos.X=-rx; v[2].Pos.Y=-ry; v[2].Pos.Z=-rz; v[3].Pos.X= rx; v[3].Pos.Y=-ry, v[3].Pos.Z=-rz; break; } v3f pos = v3f(p0.X,m_cloud_y,p0.Y); for(u16 i=0; i<4; i++) v[i].Pos += pos; u16 indices[] = {0,1,2,2,3,0}; driver->drawVertexPrimitiveList(v, 4, indices, 2, video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT); } } } void Clouds::step(float dtime) { m_time += dtime; } void Clouds::update(v2f camera_p, float brightness) { m_camera_pos = camera_p; m_brightness = brightness; }