From: <mbj...@us...> - 2010-01-08 01:09:26
|
Revision: 4414 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4414&view=rev Author: mbjornstk Date: 2010-01-08 01:09:14 +0000 (Fri, 08 Jan 2010) Log Message: ----------- Make marks fade to transparent (not 100% sure), instead of white ghost. Pretty much an exercise in guessing if things are premul or not, and what has to be pure black or can be a more real dark grey. Maybe needs more changes. Modified Paths: -------------- main/trunk/src/graphics/skid_marks.cpp main/trunk/src/graphics/skid_marks.hpp Modified: main/trunk/src/graphics/skid_marks.cpp =================================================================== --- main/trunk/src/graphics/skid_marks.cpp 2010-01-08 00:57:21 UTC (rev 4413) +++ main/trunk/src/graphics/skid_marks.cpp 2010-01-08 01:09:14 UTC (rev 4414) @@ -26,6 +26,9 @@ float SkidMarks::m_avoid_z_fighting = 0.0f; const int SkidMarks::m_start_alpha = 128; +const int SkidMarks::m_start_grey = 32; +//const int start_premul = SkidMarks::m_start_grey * SkidMarks::m_start_alpha / 256; compiler whines about private later +const int start_premul = 32 * 128 / 256; /** Initialises empty skid marks. */ SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart) @@ -33,7 +36,8 @@ m_width = width; m_material = new video::SMaterial(); m_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; - m_material->AmbientColor = video::SColor(128, 16, 16, 16); + m_material->AmbientColor = video::SColor(128, 0, 0, 0); // or should be start_premul? +// m_material->DiffuseColor = video::SColor(SkidMarks::m_start_alpha, start_premul, start_premul, start_premul); compiler whines about private m_material->DiffuseColor = video::SColor(128, 16, 16, 16); m_material->Shininess = 0; m_skid_marking = false; @@ -270,16 +274,17 @@ { m_fade_out += f; // Changing the alpha value is quite expensive, so it's only done - // about 10 times till 0 is reached. + // about 10 times till 0 is reached. if(m_fade_out*10>SkidMarks::m_start_alpha) { video::SColor &c=Material.DiffuseColor; int a=c.getAlpha(); a -= a<m_fade_out ? a : (int)m_fade_out; - c.setAlpha(a); + int premul_grey = a * SkidMarks::m_start_grey / 255; + c.set(a, premul_grey, premul_grey, premul_grey); for(unsigned int i=0; i<Vertices.size(); i++) { - Vertices[i].Color.setAlpha(a); + Vertices[i].Color.set(a, premul_grey, premul_grey, premul_grey); } m_fade_out = 0.0f; } Modified: main/trunk/src/graphics/skid_marks.hpp =================================================================== --- main/trunk/src/graphics/skid_marks.hpp 2010-01-08 00:57:21 UTC (rev 4413) +++ main/trunk/src/graphics/skid_marks.hpp 2010-01-08 01:09:14 UTC (rev 4414) @@ -44,6 +44,8 @@ int m_current; /** Initial alpha value. */ static const int m_start_alpha; + /** Initial grey value, same for the 3 channels. */ + static const int m_start_grey; /** Material to use for the skid marks. */ video::SMaterial *m_material; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-01-28 04:38:02
|
Revision: 4549 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4549&view=rev Author: hikerstk Date: 2010-01-28 04:37:56 +0000 (Thu, 28 Jan 2010) Log Message: ----------- Added support for lightmaps, but this is completely untested atm. Modified Paths: -------------- main/trunk/src/graphics/material.cpp main/trunk/src/graphics/material.hpp Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2010-01-27 22:57:14 UTC (rev 4548) +++ main/trunk/src/graphics/material.cpp 2010-01-28 04:37:56 UTC (rev 4549) @@ -49,6 +49,7 @@ b=false; node->get("clampV", &b); if(b) m_clamp_tex +=VCLAMP; node->get("transparency", &m_transparency ); + node->get("lightmap", &m_lightmap ); node->get("alpha", &m_alpha_blending ); node->get("light", &m_lighting ); node->get("sphere", &m_sphere_map ); @@ -97,6 +98,7 @@ m_index = index; m_clamp_tex = 0; m_transparency = false; + m_lightmap = false; m_alpha_blending = false; m_lighting = true; m_sphere_map = false; @@ -135,9 +137,11 @@ else if (m_alpha_blending) m->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; - if (m_sphere_map) + else if (m_sphere_map) m->MaterialType = video::EMT_SPHERE_MAP; - + else if (m_lightmap) + m->MaterialType = video::EMT_LIGHTMAP; + if (!m_lighting) { //m->setFlag( video::EMF_LIGHTING, false ); Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-01-27 22:57:14 UTC (rev 4548) +++ main/trunk/src/graphics/material.hpp 2010-01-28 04:37:56 UTC (rev 4549) @@ -45,6 +45,8 @@ bool m_sphere_map; bool m_transparency; bool m_alpha_blending; + /** True if lightmapping is enabled for this material. */ + bool m_lightmap; float m_friction; /** How much the top speed is reduced per second. */ float m_slowdown; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-01-31 20:51:40
|
Revision: 4591 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4591&view=rev Author: auria Date: 2010-01-31 20:51:34 +0000 (Sun, 31 Jan 2010) Log Message: ----------- Implemented U/V clamp support for materials Modified Paths: -------------- main/trunk/src/graphics/material.cpp main/trunk/src/graphics/material.hpp Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2010-01-31 20:39:07 UTC (rev 4590) +++ main/trunk/src/graphics/material.cpp 2010-01-31 20:51:34 UTC (rev 4591) @@ -48,7 +48,7 @@ node->get("clampU", &b); if(b) m_clamp_tex +=UCLAMP; b=false; node->get("clampV", &b); if(b) m_clamp_tex +=VCLAMP; - node->get("transparency", &m_transparency ); + node->get("transparency", &m_alpha_testing ); node->get("lightmap", &m_lightmap ); node->get("alpha", &m_alpha_blending ); node->get("light", &m_lighting ); @@ -97,7 +97,7 @@ { m_index = index; m_clamp_tex = 0; - m_transparency = false; + m_alpha_testing = false; m_lightmap = false; m_alpha_blending = false; m_lighting = true; @@ -127,7 +127,7 @@ */ void Material::setMaterialProperties(video::SMaterial *m) const { - if (m_transparency) + if (m_alpha_testing) // Note: if EMT_TRANSPARENT_ALPHA_CHANNEL is used, you have to use // scene_manager->getParameters()->setAttribute( // scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); and enable @@ -137,18 +137,42 @@ else if (m_alpha_blending) m->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; - else if (m_sphere_map) - m->MaterialType = video::EMT_SPHERE_MAP; - else if (m_lightmap) - m->MaterialType = video::EMT_LIGHTMAP; + if (m_sphere_map) m->MaterialType = video::EMT_SPHERE_MAP; + + if (m_lightmap) m->MaterialType = video::EMT_LIGHTMAP; if (!m_lighting) { //m->setFlag( video::EMF_LIGHTING, false ); - m->AmbientColor = video::SColor(255, 255, 255, 255); - m->DiffuseColor = video::SColor(255, 255, 255, 255); + m->AmbientColor = video::SColor(255, 255, 255, 255); + m->DiffuseColor = video::SColor(255, 255, 255, 255); m->EmissiveColor = video::SColor(255, 255, 255, 255); m->SpecularColor = video::SColor(255, 255, 255, 255); } + if (m_clamp_tex & UCLAMP) + { + // m->setFlag(); + // n1->getMaterial(0).TextureLayer[0].TextureWrap = video::ETC_CLAMP; + /** + //! Texture is clamped to the last pixel + ETC_CLAMP, + //! Texture is clamped to the edge pixel + ETC_CLAMP_TO_EDGE, + //! Texture is clamped to the border pixel (if exists) + ETC_CLAMP_TO_BORDER, + */ + for (unsigned int n=0; n<video::MATERIAL_MAX_TEXTURES; n++) + { + m->TextureLayer[n].TextureWrapU = video::ETC_CLAMP_TO_EDGE; + } + } + if (m_clamp_tex & VCLAMP) + { + for (unsigned int n=0; n<video::MATERIAL_MAX_TEXTURES; n++) + { + m->TextureLayer[n].TextureWrapV = video::ETC_CLAMP_TO_EDGE; + } + } + // FIXME: more parameters need to be set! } // setMaterialProperties Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-01-31 20:39:07 UTC (rev 4590) +++ main/trunk/src/graphics/material.hpp 2010-01-31 20:51:34 UTC (rev 4591) @@ -43,7 +43,7 @@ int m_clamp_tex; bool m_lighting; bool m_sphere_map; - bool m_transparency; + bool m_alpha_testing; bool m_alpha_blending; /** True if lightmapping is enabled for this material. */ bool m_lightmap; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-03 21:47:43
|
Revision: 4626 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4626&view=rev Author: auria Date: 2010-02-03 21:47:36 +0000 (Wed, 03 Feb 2010) Log Message: ----------- Fixed resolution switching closing STK. Includes a totally ugly workaround a irrlicht behaviour I don't understand Modified Paths: -------------- main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-02-03 01:57:12 UTC (rev 4625) +++ main/trunk/src/graphics/irr_driver.cpp 2010-02-03 21:47:36 UTC (rev 4626) @@ -53,6 +53,7 @@ IrrDriver::IrrDriver() { + m_res_switching = false; file_manager->dropFileSystem(); initDevice(); } // IrrDriver @@ -191,7 +192,7 @@ //m_video_driver->enableMaterial2D(); #endif - // set cursor viasible by default (what's the default is not tooclearly documented, + // set cursor visible by default (what's the default is not too clearly documented, // so let's decide ourselves...) m_device->getCursorControl()->setVisible(true); m_pointer_shown = true; @@ -268,6 +269,8 @@ //----------------------------------------------------------------------------- void IrrDriver::changeResolution() { + m_res_switching = true; + // show black before resolution switch so we don't see OpenGL's buffer garbage during switch m_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140)); m_device->getVideoDriver()->draw2DRectangle( SColor(255, 0, 0, 0), @@ -298,10 +301,9 @@ attachment_manager -> loadModels(); // Re-init GUI engine - IrrlichtDevice* device = irr_driver->getDevice(); - video::IVideoDriver* driver = device->getVideoDriver(); - GUIEngine::init(device, driver, StateManager::get()); + GUIEngine::init(m_device, m_video_driver, StateManager::get()); GUIEngine::reshowCurrentScreen(); + } // changeResolution // ---------------------------------------------------------------------------- @@ -764,7 +766,9 @@ { if (!m_device->run()) { - main_loop->abort(); + // FIXME: I have NO idea why, after performing resolution switch, the irrlicht device asks once to be deleted + if (m_res_switching) m_res_switching = false; + else main_loop->abort(); } const bool inRace = race_manager->raceIsActive(); Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-02-03 01:57:12 UTC (rev 4625) +++ main/trunk/src/graphics/irr_driver.hpp 2010-02-03 21:47:36 UTC (rev 4626) @@ -51,6 +51,10 @@ /** Irrlicht race font. */ irr::gui::IGUIFont *m_race_font; + /** Flag set during resolution switching, so that the game doesn't think it needs + * to exit because no frame is open */ + bool m_res_switching; + void setAllMaterialFlags(scene::IAnimatedMesh *mesh) const; std::vector<VideoMode> m_modes; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-24 22:10:33
|
Revision: 4830 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4830&view=rev Author: auria Date: 2010-02-24 22:10:27 +0000 (Wed, 24 Feb 2010) Log Message: ----------- Lowered dependencies of Star (now accepts any scene node, no more uselessly requires an animated mesh) Modified Paths: -------------- main/trunk/src/graphics/stars.cpp main/trunk/src/graphics/stars.hpp Modified: main/trunk/src/graphics/stars.cpp =================================================================== --- main/trunk/src/graphics/stars.cpp 2010-02-24 22:08:41 UTC (rev 4829) +++ main/trunk/src/graphics/stars.cpp 2010-02-24 22:10:27 UTC (rev 4830) @@ -29,7 +29,7 @@ const float RADIUS = 0.7f; const float STAR_SIZE = 0.4f; -Stars::Stars(scene::IAnimatedMeshSceneNode* parentKart) +Stars::Stars(scene::ISceneNode* parentKart) { m_parent_kart_node = parentKart; m_enabled = false; Modified: main/trunk/src/graphics/stars.hpp =================================================================== --- main/trunk/src/graphics/stars.hpp 2010-02-24 22:08:41 UTC (rev 4829) +++ main/trunk/src/graphics/stars.hpp 2010-02-24 22:10:27 UTC (rev 4830) @@ -45,7 +45,7 @@ float m_remaining_time; public: - Stars (scene::IAnimatedMeshSceneNode* parentKart); + Stars (scene::ISceneNode* parentKart); ~Stars (); void showFor(float time); void reset(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-24 23:08:04
|
Revision: 4831 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4831&view=rev Author: auria Date: 2010-02-24 22:11:06 +0000 (Wed, 24 Feb 2010) Log Message: ----------- Lowered dependencies of Shadow (now accepts any scene node, no more uselessly requires an animated mesh) Modified Paths: -------------- main/trunk/src/graphics/shadow.cpp main/trunk/src/graphics/shadow.hpp Modified: main/trunk/src/graphics/shadow.cpp =================================================================== --- main/trunk/src/graphics/shadow.cpp 2010-02-24 22:10:27 UTC (rev 4830) +++ main/trunk/src/graphics/shadow.cpp 2010-02-24 22:11:06 UTC (rev 4831) @@ -23,7 +23,7 @@ #include "graphics/irr_driver.hpp" -Shadow::Shadow(video::ITexture *texture, scene::IAnimatedMeshSceneNode *node) +Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node) { video::SMaterial m; m.setTexture(0, texture); Modified: main/trunk/src/graphics/shadow.hpp =================================================================== --- main/trunk/src/graphics/shadow.hpp 2010-02-24 22:10:27 UTC (rev 4830) +++ main/trunk/src/graphics/shadow.hpp 2010-02-24 22:11:06 UTC (rev 4831) @@ -40,7 +40,7 @@ scene::ISceneNode *m_parent_kart_node; public: Shadow(video::ITexture *texture, - scene::IAnimatedMeshSceneNode *node); + scene::ISceneNode *node); ~Shadow(); void enableShadow(); void disableShadow(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-03-23 11:30:39
|
Revision: 5049 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5049&view=rev Author: hikerstk Date: 2010-03-23 11:30:33 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Fixed smoke and water splash (incorrect coordinate systems). Modified Paths: -------------- main/trunk/src/graphics/smoke.cpp main/trunk/src/graphics/water_splash.cpp Modified: main/trunk/src/graphics/smoke.cpp =================================================================== --- main/trunk/src/graphics/smoke.cpp 2010-03-23 10:41:46 UTC (rev 5048) +++ main/trunk/src/graphics/smoke.cpp 2010-03-23 11:30:33 UTC (rev 5049) @@ -78,16 +78,16 @@ Vec3 c=wi.m_raycastInfo.m_contactPointWS; // FIXME: the X position is not yet always accurate. - m_node->setPosition(core::vector3df(c.getX()+ m_particle_size*0.25f * (left?+1:-1), - c.getZ()+m_particle_size*0.25f, - c.getY())); + m_node->setPosition(core::vector3df(c.getX()+m_particle_size*0.25f * (left?+1:-1), + c.getY(), + c.getZ()+m_particle_size*0.25f)); // There seems to be no way to randomise the velocity for particles, // so we have to do this manually, by changing the default velocity. // Irrlicht expects velocity (called 'direction') in m/ms!! Vec3 dir(cos(DEGREE_TO_RAD*(rand()%180))*0.002f, - sin(DEGREE_TO_RAD*(rand()%180))*0.002f, - sin(DEGREE_TO_RAD*(rand()%100))*0.002f); + sin(DEGREE_TO_RAD*(rand()%100))*0.002f, + sin(DEGREE_TO_RAD*(rand()%180))*0.002f); m_emitter->setDirection(dir.toIrrVector()); } // update Modified: main/trunk/src/graphics/water_splash.cpp =================================================================== --- main/trunk/src/graphics/water_splash.cpp 2010-03-23 10:41:46 UTC (rev 5048) +++ main/trunk/src/graphics/water_splash.cpp 2010-03-23 11:30:33 UTC (rev 5049) @@ -89,8 +89,8 @@ // FIXME: the X position is not yet always accurate. m_node->setPosition(core::vector3df(c.getX()+ m_particle_size*0.25f * (left?+1:-1), - c.getZ()+m_particle_size*0.25f, - c.getY())); + c.getY(), + c.getZ()+m_particle_size*0.25f)); // There seems to be no way to randomise the velocity for particles, // so we have to do this manually, by changing the default velocity. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-03-24 10:29:48
|
Revision: 5055 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5055&view=rev Author: hikerstk Date: 2010-03-24 10:29:41 +0000 (Wed, 24 Mar 2010) Log Message: ----------- Added setting to disable backface culling. Modified Paths: -------------- main/trunk/src/graphics/material.cpp main/trunk/src/graphics/material.hpp Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2010-03-24 10:25:08 UTC (rev 5054) +++ main/trunk/src/graphics/material.cpp 2010-03-24 10:29:41 UTC (rev 5055) @@ -2,6 +2,7 @@ // // SuperTuxKart - a fun racing game with go-kart // Copyright (C) 2004 Steve Baker <sjb...@ai...> +// 2010 Steve Baker, Joerg Henrichs // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -62,6 +63,7 @@ node->get("max-speed", &m_max_speed_fraction); node->get("slowdown", &m_slowdown ); node->get("anisotropic", &m_anisotropic ); + node->get("backface-culling", &m_backface_culling ); std::string s(""); node->get("graphical-effect", &s ); if(s=="water") @@ -105,6 +107,7 @@ m_alpha_blending = false; m_lighting = true; m_anisotropic = false; + m_backface_culling = true; m_sphere_map = false; m_friction = 1.0f; m_ignore = false; @@ -199,5 +202,8 @@ } #endif - // FIXME: more parameters need to be set! + + if(!m_backface_culling) + m->setFlag(video::EMF_BACK_FACE_CULLING, false); + } // setMaterialProperties Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-03-24 10:25:08 UTC (rev 5054) +++ main/trunk/src/graphics/material.hpp 2010-03-24 10:29:41 UTC (rev 5055) @@ -46,6 +46,9 @@ bool m_sphere_map; bool m_alpha_testing; bool m_alpha_blending; + + /** True if backface culliing should be enabled. */ + bool m_backface_culling; /** Whether to use anisotropic filtering for this texture */ bool m_anisotropic; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-04-16 00:32:38
|
Revision: 5206 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5206&view=rev Author: auria Date: 2010-04-16 00:32:31 +0000 (Fri, 16 Apr 2010) Log Message: ----------- Irrdriver no more has a method to receive events from irrlicht. anyway it did nothing with them so that was just uselessly confusing. Modified Paths: -------------- main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-04-16 00:24:25 UTC (rev 5205) +++ main/trunk/src/graphics/irr_driver.cpp 2010-04-16 00:32:31 UTC (rev 5206) @@ -149,8 +149,7 @@ bits, //bits per pixel UserConfigParams::m_fullscreen, false, // stencil buffers - false, // vsync - this // event receiver + false // vsync ); if(m_device) break; } // for bits=24, 16 @@ -858,38 +857,7 @@ } // update // ---------------------------------------------------------------------------- -// Irrlicht Event handler. -bool IrrDriver::OnEvent(const irr::SEvent &event) -{ - switch (event.EventType) - { - case irr::EET_KEY_INPUT_EVENT: { - printf("key input event\n"); - break; - } // keyboard - case irr::EET_GUI_EVENT: { - return false; } - case irr::EET_MOUSE_INPUT_EVENT: { - return false; } - case irr::EET_LOG_TEXT_EVENT: - { - // Ignore 'normal' messages - if(event.LogEvent.Level>0) - { - printf("Level %d: %s\n", - event.LogEvent.Level,event.LogEvent.Text); - } - return true; - } - default: - printf("Event: %d -> ",event.EventType); - return false; - } // switch - return false; -} // OnEvent -// ---------------------------------------------------------------------------- - #if 0 #pragma mark - #pragma mark RTT Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-04-16 00:24:25 UTC (rev 5205) +++ main/trunk/src/graphics/irr_driver.hpp 2010-04-16 00:32:31 UTC (rev 5206) @@ -37,7 +37,7 @@ int width, height; }; -class IrrDriver : public IEventReceiver +class IrrDriver { private: /** The irrlicht device. */ @@ -89,7 +89,6 @@ /** Returns the gui environment, used to add widgets to a screen. */ gui::IGUIEnvironment *getGUI() const { return m_gui_env; } //irr::gui::IGUIFont *getRaceFont() const { return m_race_font; } - bool OnEvent(const irr::SEvent &event); void setAmbientLight(const video::SColor &light); video::ITexture *getTexture(const std::string &filename); scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-04-20 23:46:00
|
Revision: 5221 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5221&view=rev Author: auria Date: 2010-04-20 23:45:54 +0000 (Tue, 20 Apr 2010) Log Message: ----------- Install a temporary event handler in the irrlicht device, until EventHandler is ready to take upon to task, to shut up irrlicht's chatty logging Modified Paths: -------------- main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-04-20 19:11:48 UTC (rev 5220) +++ main/trunk/src/graphics/irr_driver.cpp 2010-04-20 23:45:54 UTC (rev 5221) @@ -149,7 +149,8 @@ bits, //bits per pixel UserConfigParams::m_fullscreen, false, // stencil buffers - false // vsync + false, // vsync + this // event receiver ); if(m_device) break; } // for bits=24, 16 @@ -857,7 +858,32 @@ } // update // ---------------------------------------------------------------------------- +// Irrlicht Event handler. +bool IrrDriver::OnEvent(const irr::SEvent &event) +{ + //TODO: ideally we wouldn't use this object to STFU irrlicht's chatty debugging, we'd + // just create the EventHandler earlier so it can act upon it + switch (event.EventType) + { + case irr::EET_LOG_TEXT_EVENT: + { + // Ignore 'normal' messages + if (event.LogEvent.Level>0) + { + printf("Level %d: %s\n", + event.LogEvent.Level,event.LogEvent.Text); + } + return true; + } + default: + return false; + } // switch + + return false; +} // OnEvent +// ---------------------------------------------------------------------------- + #if 0 #pragma mark - #pragma mark RTT Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-04-20 19:11:48 UTC (rev 5220) +++ main/trunk/src/graphics/irr_driver.hpp 2010-04-20 23:45:54 UTC (rev 5221) @@ -37,7 +37,7 @@ int width, height; }; -class IrrDriver +class IrrDriver : public IEventReceiver { private: /** The irrlicht device. */ @@ -89,6 +89,12 @@ /** Returns the gui environment, used to add widgets to a screen. */ gui::IGUIEnvironment *getGUI() const { return m_gui_env; } //irr::gui::IGUIFont *getRaceFont() const { return m_race_font; } + + /** this is not really used to process events, it's only used to shut down irrLicht's + * chatty logging until the event handler is ready to take the task + */ + bool OnEvent(const irr::SEvent &event); + void setAmbientLight(const video::SColor &light); video::ITexture *getTexture(const std::string &filename); scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-07-05 00:11:04
|
Revision: 5634 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5634&view=rev Author: hikerstk Date: 2010-07-05 00:10:58 +0000 (Mon, 05 Jul 2010) Log Message: ----------- Fixed crash in end camera - hopefully the last problem. Modified Paths: -------------- main/trunk/src/graphics/camera.cpp main/trunk/src/graphics/camera.hpp Modified: main/trunk/src/graphics/camera.cpp =================================================================== --- main/trunk/src/graphics/camera.cpp 2010-07-04 23:42:35 UTC (rev 5633) +++ main/trunk/src/graphics/camera.cpp 2010-07-05 00:10:58 UTC (rev 5634) @@ -399,7 +399,11 @@ */ void Camera::handleEndCamera(float dt) { - switch(m_end_cameras[m_current_end_camera].m_type) + EndCameraInformation::EndCameraType info + = m_end_cameras.size()==0 ? EndCameraInformation::EC_AHEAD_OF_KART + : m_end_cameras[m_current_end_camera].m_type; + + switch(info) { case EndCameraInformation::EC_STATIC_FOLLOW_KART: { Modified: main/trunk/src/graphics/camera.hpp =================================================================== --- main/trunk/src/graphics/camera.hpp 2010-07-04 23:42:35 UTC (rev 5633) +++ main/trunk/src/graphics/camera.hpp 2010-07-05 00:10:58 UTC (rev 5634) @@ -106,9 +106,9 @@ EC_AHEAD_OF_KART A camera that flies ahead of the kart always pointing at the kart. */ - enum {EC_STATIC_FOLLOW_KART, - EC_AHEAD_OF_KART} - m_type; + typedef enum {EC_STATIC_FOLLOW_KART, + EC_AHEAD_OF_KART} EndCameraType; + EndCameraType m_type; /** Position of the end camera. */ Vec3 m_position; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2012-01-10 23:41:14
|
Revision: 10639 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=10639&view=rev Author: auria Date: 2012-01-10 23:41:08 +0000 (Tue, 10 Jan 2012) Log Message: ----------- Just increasing my commit count, nothing to see folks Modified Paths: -------------- main/trunk/src/graphics/lod_node.cpp main/trunk/src/graphics/material.cpp Modified: main/trunk/src/graphics/lod_node.cpp =================================================================== --- main/trunk/src/graphics/lod_node.cpp 2012-01-10 23:40:14 UTC (rev 10638) +++ main/trunk/src/graphics/lod_node.cpp 2012-01-10 23:41:08 UTC (rev 10639) @@ -90,9 +90,7 @@ m_nodes[0]->getType() == scene::ESNT_ANIMATED_MESH)) { if (m_previous_visibility == WAS_HIDDEN && shown) - { - printf("== Show '%s' ==\n", m_group_name.c_str()); - + { scene::IMesh* mesh; if (m_nodes[0]->getType() == scene::ESNT_MESH) @@ -121,9 +119,7 @@ } } else if (m_previous_visibility == WAS_SHOWN && !shown) - { - printf("== Hide '%s' ==\n", m_group_name.c_str()); - + { scene::IMesh* mesh; if (m_nodes[0]->getType() == scene::ESNT_MESH) Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2012-01-10 23:40:14 UTC (rev 10638) +++ main/trunk/src/graphics/material.cpp 2012-01-10 23:41:08 UTC (rev 10639) @@ -1023,7 +1023,6 @@ /** Callback from LOD nodes to create some effects */ void Material::onMadeVisible(scene::IMeshBuffer* who) { - printf("onMadeVisible %s\n", m_texname.c_str()); if (m_bubble_provider.find(who) != m_bubble_provider.end()) { m_bubble_provider[who]->onMadeVisible(); @@ -1035,7 +1034,6 @@ /** Callback from LOD nodes to create some effects */ void Material::onHidden(scene::IMeshBuffer* who) { - printf("onHidden %s\n", m_texname.c_str()); if (m_bubble_provider.find(who) != m_bubble_provider.end()) { m_bubble_provider[who]->onHidden(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2013-03-01 05:42:45
|
Revision: 12537 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=12537&view=rev Author: hikerstk Date: 2013-03-01 05:42:38 +0000 (Fri, 01 Mar 2013) Log Message: ----------- Removed remaining hardcoded shader directories. Modified Paths: -------------- main/trunk/src/graphics/hardware_skinning.cpp main/trunk/src/graphics/material.cpp Modified: main/trunk/src/graphics/hardware_skinning.cpp =================================================================== --- main/trunk/src/graphics/hardware_skinning.cpp 2013-03-01 05:33:36 UTC (rev 12536) +++ main/trunk/src/graphics/hardware_skinning.cpp 2013-03-01 05:42:38 UTC (rev 12537) @@ -15,8 +15,11 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "graphics/irr_driver.hpp" #include "graphics/hardware_skinning.hpp" + +#include "graphics/irr_driver.hpp" +#include "io/file_manager.hpp" + #include <IAnimatedMeshSceneNode.h> #include <IAnimatedMesh.h> #include <ISkinnedMesh.h> @@ -36,16 +39,11 @@ // Compile the shaders and associate the callback s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - "../data/shaders/skinning.vert", "main", video::EVST_VS_2_0, - "", "main", video::EPST_PS_2_0, - callback, video::EMT_SOLID); - - /*s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - "../data/shaders/skinning.vert", "main", video::EVST_VS_2_0, - "../data/shaders/skinning.frag", "main", video::EPST_PS_2_0, - callback, video::EMT_SOLID); - */ - + (file_manager->getShaderDir()+"skinning.vert").c_str(), + "main", video::EVST_VS_2_0, "", + "main", video::EPST_PS_2_0, + callback, video::EMT_SOLID); + // Drop callback->drop(); Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2013-03-01 05:33:36 UTC (rev 12536) +++ main/trunk/src/graphics/material.cpp 2013-03-01 05:42:38 UTC (rev 12537) @@ -912,16 +912,11 @@ IGPUProgrammingServices* gpu = irr_driver->getVideoDriver()->getGPUProgrammingServices(); s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - (file_manager->getDataDir() + - "shaders/spheremap.vert").c_str(), - "main", - video::EVST_VS_2_0, - (file_manager->getDataDir() + - "shaders/spheremap.frag").c_str(), - "main", - video::EPST_PS_2_0, - m_shaders[SPHERE_MAP], - video::EMT_SOLID_2_LAYER ); + (file_manager->getShaderDir() + "spheremap.vert").c_str(), + "main", video::EVST_VS_2_0, + (file_manager->getShaderDir() + "spheremap.frag").c_str(), + "main", video::EPST_PS_2_0, + m_shaders[SPHERE_MAP], video::EMT_SOLID_2_LAYER ); m->MaterialType = (E_MATERIAL_TYPE)material_type; } else @@ -1020,21 +1015,20 @@ } } - const char* vertex_shader = "shaders/normalmap.vert"; - const char* pixel_shader = "shaders/normalmap.frag"; + const char* vertex_shader = "normalmap.vert"; + const char* pixel_shader = "normalmap.frag"; // Material and shaders IGPUProgrammingServices* gpu = video_driver->getGPUProgrammingServices(); s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - (file_manager->getDataDir() + vertex_shader).c_str(), - "main", - video::EVST_VS_2_0, - (file_manager->getDataDir() + pixel_shader).c_str(), - "main", - video::EPST_PS_2_0, - m_shaders[with_lightmap ? NORMAL_MAP_WITH_LIGHTMAP : NORMAL_MAP], - video::EMT_SOLID_2_LAYER ); + (file_manager->getShaderDir() + vertex_shader).c_str(), + "main", video::EVST_VS_2_0, + (file_manager->getShaderDir() + pixel_shader).c_str(), + "main", video::EPST_PS_2_0, + m_shaders[with_lightmap ? NORMAL_MAP_WITH_LIGHTMAP + : NORMAL_MAP], + video::EMT_SOLID_2_LAYER ); m->MaterialType = (E_MATERIAL_TYPE)material_type; m->Lighting = false; m->ZWriteEnable = true; @@ -1092,16 +1086,11 @@ IGPUProgrammingServices* gpu = irr_driver->getVideoDriver()->getGPUProgrammingServices(); s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - (file_manager->getDataDir() + - "shaders/splatting.vert").c_str(), - "main", - video::EVST_VS_2_0, - (file_manager->getDataDir() + - "shaders/splatting.frag").c_str(), - "main", - video::EPST_PS_2_0, - m_shaders[SPLATTING], - video::EMT_SOLID_2_LAYER ); + (file_manager->getShaderDir() + "splatting.vert").c_str(), + "main",video::EVST_VS_2_0, + (file_manager->getShaderDir() + "splatting.frag").c_str(), + "main",video::EPST_PS_2_0, + m_shaders[SPLATTING], video::EMT_SOLID_2_LAYER ); m->MaterialType = (E_MATERIAL_TYPE)material_type; } @@ -1120,17 +1109,13 @@ // Material and shaders IGPUProgrammingServices* gpu = video_driver->getGPUProgrammingServices(); s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - (file_manager->getDataDir() + "shaders/bubble.vert").c_str(), - "main", - video::EVST_VS_2_0, - (file_manager->getDataDir() + "shaders/bubble.frag").c_str(), - "main", - video::EPST_PS_2_0, - m_bubble_provider[mb], - (m_alpha_blending ? - video::EMT_TRANSPARENT_ALPHA_CHANNEL : - video::EMT_SOLID) - ); + (file_manager->getShaderDir() + "bubble.vert").c_str(), + "main", video::EVST_VS_2_0, + (file_manager->getShaderDir() + "bubble.frag").c_str(), + "main", video::EPST_PS_2_0, + m_bubble_provider[mb], + (m_alpha_blending ? video::EMT_TRANSPARENT_ALPHA_CHANNEL + : video::EMT_SOLID) ); m->MaterialType = (E_MATERIAL_TYPE)material_type; // alpha blending and bubble shading can work together so when both are enabled @@ -1160,8 +1145,8 @@ m->setTexture(2, irr_driver->getTexture(file_manager->getTextureFile("waternormals2.jpg"))); bool fog = World::getWorld()->getTrack()->isFogEnabled(); - const char* vertex_shader = (fog ? "shaders/water_fog.vert" : "shaders/water.vert"); - const char* pixel_shader = (fog ? "shaders/water_fog.frag" : "shaders/water.frag"); + const char* vertex_shader = (fog ? "water_fog.vert" : "water.vert"); + const char* pixel_shader = (fog ? "water_fog.frag" : "water.frag"); ((WaterShaderProvider*)m_shaders[WATER_SHADER])->enableFog(fog); @@ -1169,14 +1154,12 @@ IGPUProgrammingServices* gpu = irr_driver->getVideoDriver()->getGPUProgrammingServices(); s32 material_type = gpu->addHighLevelShaderMaterialFromFiles( - (file_manager->getDataDir() + vertex_shader).c_str(), - "main", - video::EVST_VS_2_0, - (file_manager->getDataDir() + pixel_shader).c_str(), - "main", - video::EPST_PS_2_0, - m_shaders[WATER_SHADER], - video::EMT_SOLID_2_LAYER ); + (file_manager->getShaderDir() + vertex_shader).c_str(), + "main", video::EVST_VS_2_0, + (file_manager->getShaderDir() + pixel_shader ).c_str(), + "main", video::EPST_PS_2_0, + m_shaders[WATER_SHADER], + video::EMT_SOLID_2_LAYER ); m->MaterialType = (E_MATERIAL_TYPE)material_type; } modes++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vin...@us...> - 2014-01-01 19:52:35
|
Revision: 14876 http://sourceforge.net/p/supertuxkart/code/14876 Author: vincentlj Date: 2014-01-01 19:52:32 +0000 (Wed, 01 Jan 2014) Log Message: ----------- GPUParticles: Add an parameter to turn alpha additive particle on/off. Modified Paths: -------------- main/trunk/src/graphics/gpuparticles.cpp main/trunk/src/graphics/gpuparticles.h main/trunk/src/graphics/material.hpp main/trunk/src/graphics/particle_emitter.cpp Modified: main/trunk/src/graphics/gpuparticles.cpp =================================================================== --- main/trunk/src/graphics/gpuparticles.cpp 2014-01-01 19:13:57 UTC (rev 14875) +++ main/trunk/src/graphics/gpuparticles.cpp 2014-01-01 19:52:32 UTC (rev 14876) @@ -230,7 +230,7 @@ ISceneNode* parent, scene::ISceneManager* mgr, s32 id, const core::vector3df& position, const core::vector3df& rotation, - const core::vector3df& scale) : CParticleSystemSceneNode(createDefaultEmitter, parent, mgr, id, position, rotation, scale) { + const core::vector3df& scale) : CParticleSystemSceneNode(createDefaultEmitter, parent, mgr, id, position, rotation, scale), m_alpha_additive(false) { static const GLfloat quad_vertex[] = { -.5, -.5, 0., 0., .5, -.5, 1., 0., @@ -244,6 +244,8 @@ glBindBuffer(GL_ARRAY_BUFFER, 0); } +void ParticleSystemProxy::setAlphaAdditive(bool val) { m_alpha_additive = val; } + void ParticleSystemProxy::generateParticlesFromPointEmitter(scene::IParticlePointEmitter *emitter) { float *particles = new float[COMPONENTCOUNT * count], *initialvalue = new float[COMPONENTCOUNT * count]; @@ -485,7 +487,10 @@ glEnable(GL_BLEND); core::matrix4 projm = irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION); core::matrix4 viewm = irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if (m_alpha_additive) + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + else + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glUseProgram(RenderProgram); glEnableVertexAttribArray(attrib_pos); glEnableVertexAttribArray(attrib_lf); Modified: main/trunk/src/graphics/gpuparticles.h =================================================================== --- main/trunk/src/graphics/gpuparticles.h 2014-01-01 19:13:57 UTC (rev 14875) +++ main/trunk/src/graphics/gpuparticles.h 2014-01-01 19:52:32 UTC (rev 14876) @@ -31,6 +31,7 @@ protected: GLuint quad_vertex_buffer; GLuint tfb_buffers[2], initial_values_buffer; + bool m_alpha_additive; GLuint SimulationProgram; GLuint attrib_position, attrib_velocity, attrib_lifetime, attrib_initial_position, attrib_initial_velocity, attrib_initial_lifetime, attrib_size, attrib_initial_size; @@ -62,6 +63,7 @@ virtual void setEmitter(scene::IParticleEmitter* emitter); virtual void render(); + void setAlphaAdditive(bool); }; class PointEmitter : public GPUParticle Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2014-01-01 19:13:57 UTC (rev 14875) +++ main/trunk/src/graphics/material.hpp 2014-01-01 19:52:32 UTC (rev 14876) @@ -335,6 +335,9 @@ void onMadeVisible(scene::IMeshBuffer* who); void onHidden(scene::IMeshBuffer* who); void isInitiallyHidden(scene::IMeshBuffer* who); + /** For particle system : specify if the particle should be additively blended + */ + bool isAlphaAdditive() const { return !m_alpha_blending; } } ; Modified: main/trunk/src/graphics/particle_emitter.cpp =================================================================== --- main/trunk/src/graphics/particle_emitter.cpp 2014-01-01 19:13:57 UTC (rev 14875) +++ main/trunk/src/graphics/particle_emitter.cpp 2014-01-01 19:52:32 UTC (rev 14876) @@ -371,6 +371,7 @@ else { m_node = ParticleSystemProxy::addParticleNode(); + static_cast<ParticleSystemProxy *>(m_node)->setAlphaAdditive(type->getMaterial()->isAlphaAdditive()); } if (m_parent != NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2014-01-07 02:12:21
|
Revision: 14957 http://sourceforge.net/p/supertuxkart/code/14957 Author: auria Date: 2014-01-07 02:12:17 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Use light absolute position for culling, the relative position was incorrectly used Modified Paths: -------------- main/trunk/src/graphics/light.cpp main/trunk/src/graphics/light.hpp main/trunk/src/graphics/render.cpp Modified: main/trunk/src/graphics/light.cpp =================================================================== --- main/trunk/src/graphics/light.cpp 2014-01-07 02:04:31 UTC (rev 14956) +++ main/trunk/src/graphics/light.cpp 2014-01-07 02:12:17 UTC (rev 14957) @@ -42,6 +42,10 @@ m_color[0] = r; m_color[1] = g; m_color[2] = b; + +#ifdef __LIGHT_NODE_VISUALISATION__ + m_viz_added = false; +#endif } LightNode::~LightNode() @@ -94,4 +98,13 @@ void LightNode::OnRegisterSceneNode() { // This node is only drawn manually. + +#ifdef __LIGHT_NODE_VISUALISATION__ + if (!m_viz_added) + { + scene::IMeshSceneNode* viz = irr_driver->addSphere(0.5f, video::SColor(255, m_color[0]*255, m_color[1]*255, m_color[2]*255)); + viz->setPosition(this->getAbsolutePosition()); + m_viz_added = true; + } +#endif } Modified: main/trunk/src/graphics/light.hpp =================================================================== --- main/trunk/src/graphics/light.hpp 2014-01-07 02:04:31 UTC (rev 14956) +++ main/trunk/src/graphics/light.hpp 2014-01-07 02:12:17 UTC (rev 14957) @@ -30,9 +30,15 @@ namespace scene { class IMesh; } } +//#define __LIGHT_NODE_VISUALISATION__ + // The actual node class LightNode: public scene::ISceneNode { +#ifdef __LIGHT_NODE_VISUALISATION__ + bool m_viz_added; +#endif + public: LightNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float energy, float r, float g, float b); virtual ~LightNode(); Modified: main/trunk/src/graphics/render.cpp =================================================================== --- main/trunk/src/graphics/render.cpp 2014-01-07 02:04:31 UTC (rev 14956) +++ main/trunk/src/graphics/render.cpp 2014-01-07 02:12:17 UTC (rev 14957) @@ -706,7 +706,7 @@ m_lights[i]->render(); continue; } - const core::vector3df &lightpos = (m_lights[i]->getPosition() - campos); + const core::vector3df &lightpos = (m_lights[i]->getAbsolutePosition() - campos); unsigned idx = (unsigned)(lightpos.getLength() / 10); if (idx > 14) continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vin...@us...> - 2014-01-13 16:40:36
|
Revision: 15049 http://sourceforge.net/p/supertuxkart/code/15049 Author: vincentlj Date: 2014-01-13 16:40:31 +0000 (Mon, 13 Jan 2014) Log Message: ----------- Found another instance of PassThrough Shader usage. Modified Paths: -------------- main/trunk/src/graphics/post_processing.cpp main/trunk/src/graphics/post_processing.hpp main/trunk/src/graphics/render.cpp Modified: main/trunk/src/graphics/post_processing.cpp =================================================================== --- main/trunk/src/graphics/post_processing.cpp 2014-01-13 16:05:46 UTC (rev 15048) +++ main/trunk/src/graphics/post_processing.cpp 2014-01-13 16:40:31 UTC (rev 15049) @@ -731,8 +731,7 @@ glEnable(GL_DEPTH_TEST); } -static -void renderPassThrough(ITexture *tex) +void PostProcessing::renderPassThrough(ITexture *tex) { if (!PassThroughShader::Program) PassThroughShader::init(); Modified: main/trunk/src/graphics/post_processing.hpp =================================================================== --- main/trunk/src/graphics/post_processing.hpp 2014-01-13 16:05:46 UTC (rev 15048) +++ main/trunk/src/graphics/post_processing.hpp 2014-01-13 16:40:31 UTC (rev 15049) @@ -84,6 +84,9 @@ /** Blur the in texture */ void renderGaussian6Blur(video::ITexture *in, video::ITexture *temprtt, float inv_width, float inv_height); + /** Render tex. Used for blit/texture resize */ + void renderPassThrough(video::ITexture *tex); + /** Render the post-processed scene */ void render(); Modified: main/trunk/src/graphics/render.cpp =================================================================== --- main/trunk/src/graphics/render.cpp 2014-01-13 16:05:46 UTC (rev 15048) +++ main/trunk/src/graphics/render.cpp 2014-01-13 16:40:31 UTC (rev 15049) @@ -639,14 +639,12 @@ minimat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; // To half - minimat.setTexture(0, m_rtts->getRTT(RTT_TMP1)); m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_HALF1), false, false); - m_post_processing->drawQuad(cam, minimat); + m_post_processing->renderPassThrough(m_rtts->getRTT(RTT_TMP1)); // To quarter - minimat.setTexture(0, m_rtts->getRTT(RTT_HALF1)); m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_QUARTER1), false, false); - m_post_processing->drawQuad(cam, minimat); + m_post_processing->renderPassThrough(m_rtts->getRTT(RTT_HALF1)); // Blur it m_post_processing->renderGaussian6Blur(m_rtts->getRTT(RTT_QUARTER1), m_rtts->getRTT(RTT_QUARTER2), 4.f / UserConfigParams::m_width, 4.f / UserConfigParams::m_height); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vin...@us...> - 2014-01-13 16:54:51
|
Revision: 15050 http://sourceforge.net/p/supertuxkart/code/15050 Author: vincentlj Date: 2014-01-13 16:54:48 +0000 (Mon, 13 Jan 2014) Log Message: ----------- Use direct call for some gaussian3blur invokation. Modified Paths: -------------- main/trunk/src/graphics/post_processing.cpp main/trunk/src/graphics/post_processing.hpp main/trunk/src/graphics/render.cpp Modified: main/trunk/src/graphics/post_processing.cpp =================================================================== --- main/trunk/src/graphics/post_processing.cpp 2014-01-13 16:40:31 UTC (rev 15049) +++ main/trunk/src/graphics/post_processing.cpp 2014-01-13 16:54:48 UTC (rev 15050) @@ -455,6 +455,35 @@ } } +namespace Gaussian3HBlurShader +{ + GLuint Program = 0; + GLuint attrib_position, attrib_texcoord; + GLuint uniform_tex, uniform_pixel; + + GLuint vao = 0; + + void init() + { + initGL(); + Program = LoadProgram(file_manager->getAsset("shaders/screenquad.vert").c_str(), file_manager->getAsset("shaders/gaussian3h.frag").c_str()); + attrib_position = glGetAttribLocation(Program, "Position"); + attrib_texcoord = glGetAttribLocation(Program, "Texcoord"); + uniform_tex = glGetUniformLocation(Program, "tex"); + uniform_pixel = glGetUniformLocation(Program, "pixel"); + if (!quad_vbo) + initQuadVBO(); + glGenVertexArrays(1, &vao); + glBindVertexArray(vao); + glBindBuffer(GL_ARRAY_BUFFER, quad_vbo); + glEnableVertexAttribArray(attrib_position); + glEnableVertexAttribArray(attrib_texcoord); + glVertexAttribPointer(attrib_position, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0); + glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid*)(2 * sizeof(float))); + glBindVertexArray(0); + } +} + namespace Gaussian6VBlurShader { GLuint Program = 0; @@ -484,6 +513,35 @@ } } +namespace Gaussian3VBlurShader +{ + GLuint Program = 0; + GLuint attrib_position, attrib_texcoord; + GLuint uniform_tex, uniform_pixel; + + GLuint vao = 0; + + void init() + { + initGL(); + Program = LoadProgram(file_manager->getAsset("shaders/screenquad.vert").c_str(), file_manager->getAsset("shaders/gaussian3v.frag").c_str()); + attrib_position = glGetAttribLocation(Program, "Position"); + attrib_texcoord = glGetAttribLocation(Program, "Texcoord"); + uniform_tex = glGetUniformLocation(Program, "tex"); + uniform_pixel = glGetUniformLocation(Program, "pixel"); + if (!quad_vbo) + initQuadVBO(); + glGenVertexArrays(1, &vao); + glBindVertexArray(vao); + glBindBuffer(GL_ARRAY_BUFFER, quad_vbo); + glEnableVertexAttribArray(attrib_position); + glEnableVertexAttribArray(attrib_texcoord); + glVertexAttribPointer(attrib_position, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0); + glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid*)(2 * sizeof(float))); + glBindVertexArray(0); + } +} + namespace PassThroughShader { GLuint Program = 0; @@ -691,6 +749,47 @@ glDisable(GL_BLEND); } + +void PostProcessing::renderGaussian3Blur(video::ITexture *in, video::ITexture *temprtt, float inv_width, float inv_height) +{ + glDisable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + { + if (!Gaussian3VBlurShader::Program) + Gaussian3VBlurShader::init(); + irr_driver->getVideoDriver()->setRenderTarget(temprtt, false, false); + glUseProgram(Gaussian3VBlurShader::Program); + glBindVertexArray(Gaussian3VBlurShader::vao); + + glUniform2f(Gaussian3VBlurShader::uniform_pixel, inv_width, inv_height); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(in)->getOpenGLTextureName()); + glUniform1i(Gaussian3VBlurShader::uniform_tex, 0); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + } + { + if (!Gaussian3HBlurShader::Program) + Gaussian3HBlurShader::init(); + irr_driver->getVideoDriver()->setRenderTarget(in, false, false); + glUseProgram(Gaussian3HBlurShader::Program); + glBindVertexArray(Gaussian3HBlurShader::vao); + + glUniform2f(Gaussian3HBlurShader::uniform_pixel, inv_width, inv_height); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(temprtt)->getOpenGLTextureName()); + glUniform1i(Gaussian3HBlurShader::uniform_tex, 0); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + } + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glEnable(GL_DEPTH_TEST); +} + void PostProcessing::renderGaussian6Blur(video::ITexture *in, video::ITexture *temprtt, float inv_width, float inv_height) { glDisable(GL_BLEND); @@ -955,22 +1054,8 @@ drawQuad(cam, m_material); // Blur - { - gacb->setResolution(UserConfigParams::m_width / 4, - UserConfigParams::m_height / 4); - m_material.MaterialType = irr_driver->getShader(ES_GAUSSIAN3V); - m_material.setTexture(0, irr_driver->getRTT(RTT_QUARTER1)); - drv->setRenderTarget(irr_driver->getRTT(RTT_QUARTER2), true, false); + renderGaussian3Blur(irr_driver->getRTT(RTT_QUARTER1), irr_driver->getRTT(RTT_QUARTER2), 4. / UserConfigParams::m_width, 4.f / UserConfigParams::m_height); - drawQuad(cam, m_material); - - m_material.MaterialType = irr_driver->getShader(ES_GAUSSIAN3H); - m_material.setTexture(0, irr_driver->getRTT(RTT_QUARTER2)); - drv->setRenderTarget(irr_driver->getRTT(RTT_QUARTER1), false, false); - - drawQuad(cam, m_material); - } - // Calculate the sun's position in texcoords const core::vector3df pos = sun->getPosition(); float ndc[4]; Modified: main/trunk/src/graphics/post_processing.hpp =================================================================== --- main/trunk/src/graphics/post_processing.hpp 2014-01-13 16:40:31 UTC (rev 15049) +++ main/trunk/src/graphics/post_processing.hpp 2014-01-13 16:54:48 UTC (rev 15050) @@ -82,6 +82,7 @@ void renderLightbBlend(video::ITexture *diffuse, video::ITexture *specular, video::ITexture *ao, video::ITexture *specmap, bool debug); /** Blur the in texture */ + void renderGaussian3Blur(video::ITexture *in, video::ITexture *temprtt, float inv_width, float inv_height); void renderGaussian6Blur(video::ITexture *in, video::ITexture *temprtt, float inv_width, float inv_height); /** Render tex. Used for blit/texture resize */ Modified: main/trunk/src/graphics/render.cpp =================================================================== --- main/trunk/src/graphics/render.cpp 2014-01-13 16:40:31 UTC (rev 15049) +++ main/trunk/src/graphics/render.cpp 2014-01-13 16:54:48 UTC (rev 15050) @@ -755,8 +755,6 @@ m_post_processing->renderPointlight(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH) , accumulatedLightPos, accumulatedLightColor, accumulatedLightEnergy); // Handle SSAO SMaterial m_material; - GaussianBlurProvider * const gacb = (GaussianBlurProvider *) irr_driver-> - getCallback(ES_GAUSSIAN3H); m_material.ZWriteEnable = false; m_material.MaterialType = irr_driver->getShader(ES_SSAO); @@ -768,19 +766,9 @@ m_post_processing->drawQuad(cam, m_material); // Blur it to reduce noise. - if(UserConfigParams::m_ssao == 1) { - gacb->setResolution(UserConfigParams::m_width / 4, - UserConfigParams::m_height / 4); - m_material.MaterialType = irr_driver->getShader(ES_GAUSSIAN3V); - m_material.setTexture(0, irr_driver->getRTT(RTT_SSAO)); - m_video_driver->setRenderTarget(irr_driver->getRTT(RTT_QUARTER4), true, false); - m_post_processing->drawQuad(cam, m_material); - - m_material.MaterialType = irr_driver->getShader(ES_GAUSSIAN3H); - m_material.setTexture(0, irr_driver->getRTT(RTT_QUARTER4)); - m_video_driver->setRenderTarget(irr_driver->getRTT(RTT_SSAO), false, false); - m_post_processing->drawQuad(cam, m_material); - } else if (UserConfigParams::m_ssao == 2) + if(UserConfigParams::m_ssao == 1) + m_post_processing->renderGaussian3Blur(irr_driver->getRTT(RTT_SSAO), irr_driver->getRTT(RTT_QUARTER4), 4.f / UserConfigParams::m_width, 4.f / UserConfigParams::m_height); + else if (UserConfigParams::m_ssao == 2) m_post_processing->renderGaussian6Blur(irr_driver->getRTT(RTT_SSAO), irr_driver->getRTT(RTT_TMP4), 1.f / UserConfigParams::m_width, 1.f / UserConfigParams::m_height); m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_COLOR), false, false); @@ -837,20 +825,8 @@ minimat.TextureLayer[0].TextureWrapU = minimat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; - ((GaussianBlurProvider *) m_shaders->m_callbacks[ES_GAUSSIAN3H])->setResolution( - UserConfigParams::m_width, - UserConfigParams::m_height); + m_post_processing->renderGaussian3Blur(m_rtts->getRTT(RTT_DISPLACE), m_rtts->getRTT(RTT_TMP2), 1.f / UserConfigParams::m_width, 1.f / UserConfigParams::m_height); - minimat.MaterialType = m_shaders->getShader(ES_GAUSSIAN3H); - minimat.setTexture(0, m_rtts->getRTT(RTT_DISPLACE)); - m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_TMP2), true, false); - m_post_processing->drawQuad(cam, minimat); - - minimat.MaterialType = m_shaders->getShader(ES_GAUSSIAN3V); - minimat.setTexture(0, m_rtts->getRTT(RTT_TMP2)); - m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_DISPLACE), true, false); - m_post_processing->drawQuad(cam, minimat); - glDisable(GL_STENCIL_TEST); m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_COLOR), false, false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-07-05 23:03:26
|
Revision: 5651 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5651&view=rev Author: hikerstk Date: 2010-07-05 23:03:19 +0000 (Mon, 05 Jul 2010) Log Message: ----------- Fixed minor memory leak. Modified Paths: -------------- main/trunk/src/graphics/material_manager.cpp main/trunk/src/graphics/material_manager.hpp Modified: main/trunk/src/graphics/material_manager.cpp =================================================================== --- main/trunk/src/graphics/material_manager.cpp 2010-07-05 23:02:09 UTC (rev 5650) +++ main/trunk/src/graphics/material_manager.cpp 2010-07-05 23:03:19 UTC (rev 5651) @@ -42,7 +42,19 @@ } //----------------------------------------------------------------------------- +/** Frees all allocated data structures. + */ +MaterialManager::~MaterialManager() +{ + for(unsigned int i=0; i<m_materials.size(); i++) + { + delete m_materials[i]; + } + m_materials.clear(); +} // ~MaterialManager +//----------------------------------------------------------------------------- + void MaterialManager::setAllFlatMaterialFlags(scene::IMeshBuffer *mb) const { video::SMaterial& material = mb->getMaterial(); Modified: main/trunk/src/graphics/material_manager.hpp =================================================================== --- main/trunk/src/graphics/material_manager.hpp 2010-07-05 23:02:09 UTC (rev 5650) +++ main/trunk/src/graphics/material_manager.hpp 2010-07-05 23:03:19 UTC (rev 5651) @@ -41,7 +41,8 @@ std::vector<Material*> m_materials; public: - MaterialManager(); + MaterialManager(); + ~MaterialManager(); void loadMaterial (); void reInit (); void setAllMaterialFlags(video::ITexture* t, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-07-11 13:26:32
|
Revision: 5678 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5678&view=rev Author: hikerstk Date: 2010-07-11 13:26:26 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Simplified skid structure by removing pointer to mesh (which is not needed at all). Modified Paths: -------------- main/trunk/src/graphics/skid_marks.cpp main/trunk/src/graphics/skid_marks.hpp Modified: main/trunk/src/graphics/skid_marks.cpp =================================================================== --- main/trunk/src/graphics/skid_marks.cpp 2010-07-11 13:14:09 UTC (rev 5677) +++ main/trunk/src/graphics/skid_marks.cpp 2010-07-11 13:26:26 UTC (rev 5678) @@ -59,17 +59,12 @@ for(unsigned int i=0; i<m_nodes.size(); i++) { irr_driver->removeNode(m_nodes[i]); - // No need to call irr_driver->removeMesh, since this only - // removes the mesh from the mesh cache (if it exists in it), - // and this ('manual') mesh was never added to the cash. - m_meshes[i]->drop(); m_left[i]->drop(); m_right[i]->drop(); } m_left.clear(); m_right.clear(); m_nodes.clear(); - m_meshes.clear(); m_skid_marking = false; m_current = -1; } // reset @@ -130,10 +125,10 @@ raycast_right.m_contactPointWS); // Adjust the boundary box of the mesh to include the // adjusted aabb of its buffers. - core::aabbox3df aabb=m_meshes[m_current]->getBoundingBox(); + core::aabbox3df aabb=m_nodes[m_current]->getMesh()->getBoundingBox(); aabb.addInternalBox(m_left[m_current]->getAABB()); aabb.addInternalBox(m_right[m_current]->getAABB()); - m_meshes[m_current]->setBoundingBox(aabb); + m_nodes[m_current]->getMesh()->setBoundingBox(aabb); return; } @@ -182,8 +177,11 @@ m_material, m_avoid_z_fighting); new_mesh->addMeshBuffer(smq_right); - scene::ISceneNode *new_node = irr_driver->addMesh(new_mesh); - + scene::IMeshSceneNode *new_node = irr_driver->addMesh(new_mesh); + // We don't keep a reference to the mesh here, so we have to decrement + // the reference count (which is set to 1 when doing "new SMesh()". + // The scene node will keep the mesh alive. + new_mesh->drop(); m_current++; if(m_current>=stk_config->m_max_skidmarks) m_current = 0; @@ -191,7 +189,6 @@ { m_left. push_back (smq_left ); m_right.push_back (smq_right); - m_meshes.push_back(new_mesh); m_nodes.push_back (new_node); } else @@ -199,13 +196,11 @@ irr_driver->removeNode(m_nodes[m_current]); // Not necessary to delete m_nodes: removeNode // deletes the node since its refcount reaches zero. - delete m_meshes[m_current]; delete m_left [m_current]; delete m_right [m_current]; m_left [m_current] = smq_left; m_right [m_current] = smq_right; - m_meshes[m_current] = new_mesh; m_nodes [m_current] = new_node; } Modified: main/trunk/src/graphics/skid_marks.hpp =================================================================== --- main/trunk/src/graphics/skid_marks.hpp 2010-07-11 13:14:09 UTC (rev 5677) +++ main/trunk/src/graphics/skid_marks.hpp 2010-07-11 13:26:26 UTC (rev 5678) @@ -76,11 +76,8 @@ /** Two skidmark objects for the left and right wheel. */ std::vector<SkidMarkQuads *> m_left, m_right; - /** The meshes - each mesh containing two mesh buffers (left/right). */ - std::vector<scene::IMesh *> m_meshes; - /** The nodes where each left/right pair is attached to. */ - std::vector<scene::ISceneNode *> m_nodes; + std::vector<scene::IMeshSceneNode *> m_nodes; /** Shared static so that consecutive skidmarks are at a slightly * different height. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-09-09 00:31:05
|
Revision: 5933 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5933&view=rev Author: hikerstk Date: 2010-09-09 00:30:58 +0000 (Thu, 09 Sep 2010) Log Message: ----------- More NoCopy - embarrassingly left out in previous commit :( Modified Paths: -------------- main/trunk/src/graphics/camera.hpp main/trunk/src/graphics/explosion.hpp main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp main/trunk/src/graphics/material.hpp main/trunk/src/graphics/material_manager.hpp main/trunk/src/graphics/moving_texture.hpp main/trunk/src/graphics/nitro.hpp main/trunk/src/graphics/shadow.hpp main/trunk/src/graphics/skid_marks.hpp main/trunk/src/graphics/slip_stream.hpp main/trunk/src/graphics/stars.hpp main/trunk/src/graphics/water_splash.hpp Modified: main/trunk/src/graphics/camera.hpp =================================================================== --- main/trunk/src/graphics/camera.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/camera.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -28,6 +28,7 @@ using namespace irr; #include "io/xml_node.hpp" +#include "utils/no_copy.hpp" #include "utils/vec3.hpp" class Kart; @@ -36,7 +37,7 @@ * \brief Handles the game camera * \ingroup graphicsp" */ -class Camera +class Camera : public NoCopy { public: enum Mode { Modified: main/trunk/src/graphics/explosion.hpp =================================================================== --- main/trunk/src/graphics/explosion.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/explosion.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef HEADER_EXPLOSION_HPP #define HEADER_EXPLOSION_HPP +#include "utils/no_copy.hpp" + #include "irrlicht.h" using namespace irr; @@ -29,7 +31,7 @@ /** * \ingroup graphics */ -class Explosion +class Explosion : public NoCopy { private: SFXBase* m_explode_sound; Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/irr_driver.cpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -178,6 +178,7 @@ file_manager->setDevice(m_device); m_device->setWindowCaption(L"SuperTuxKart"); m_scene_manager = m_device->getSceneManager(); + // Force creation of mipmaps even if the mipmaps flag in a b3d file // does not set the 'enable mipmap' flag. m_scene_manager->getParameters()->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true); @@ -480,9 +481,10 @@ * since the node is not optimised. * \param mesh The mesh to add. */ -scene::IMeshSceneNode *IrrDriver::addMesh(scene::IMesh *mesh) +scene::IMeshSceneNode *IrrDriver::addMesh(scene::IMesh *mesh, + scene::ISceneNode *parent) { - return m_scene_manager->addMeshSceneNode(mesh); + return m_scene_manager->addMeshSceneNode(mesh, parent); } // addMesh // ---------------------------------------------------------------------------- Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/irr_driver.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -27,6 +27,7 @@ #include <string> #include <vector> +#include "utils/no_copy.hpp" #include "utils/ptr_vector.hpp" #include "utils/vec3.hpp" @@ -45,7 +46,7 @@ * \brief class that creates the irrLicht device and offers higher-level ways to manage the 3D scene * \ingroup graphics */ -class IrrDriver : public IEventReceiver +class IrrDriver : public IEventReceiver, public NoCopy { private: /** The irrlicht device. */ @@ -111,7 +112,8 @@ scene::ISceneNode *addWaterNode(scene::IMesh *mesh, float wave_height, float wave_speed, float wave_length); scene::IMeshSceneNode*addOctTree(scene::IMesh *mesh); - scene::IMeshSceneNode*addMesh(scene::IMesh *mesh); + scene::IMeshSceneNode*addMesh(scene::IMesh *mesh, + scene::ISceneNode *parent=NULL); scene::ISceneNode *addBillboard(const core::dimension2d< f32 > size, video::ITexture *texture, scene::ISceneNode* parent=NULL); scene::IParticleSystemSceneNode Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/material.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef HEADER_MATERIAL_HPP #define HEADER_MATERIAL_HPP +#include "utils/no_copy.hpp" + #include <string> #include "irrlicht.h" @@ -31,7 +33,7 @@ /** * \ingroup graphics */ -class Material +class Material : public NoCopy { public: enum GraphicalEffect {GE_NONE, GE_SMOKE, GE_WATER}; Modified: main/trunk/src/graphics/material_manager.hpp =================================================================== --- main/trunk/src/graphics/material_manager.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/material_manager.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef HEADER_MATERIAL_MANAGER_HPP #define HEADER_MATERIAL_MANAGER_HPP +#include "utils/no_copy.hpp" + #include "irrlicht.h" using namespace irr; @@ -32,7 +34,7 @@ /** * \ingroup graphics */ -class MaterialManager +class MaterialManager : public NoCopy { private: Modified: main/trunk/src/graphics/moving_texture.hpp =================================================================== --- main/trunk/src/graphics/moving_texture.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/moving_texture.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef MOVING_TEXTURE_HPP #define MOVING_TEXTURE_HPP +#include "utils/no_copy.hpp" + #include <string> #include "irrlicht.h" using namespace irr; @@ -30,7 +32,7 @@ * \brief Handles animated textures (textures that move) * \ingroup graphics */ -class MovingTexture +class MovingTexture : public NoCopy { private: /** Translation increment per second. */ Modified: main/trunk/src/graphics/nitro.hpp =================================================================== --- main/trunk/src/graphics/nitro.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/nitro.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef HEADER_NITRO_HPP #define HEADER_NITRO_HPP +#include "utils/no_copy.hpp" + #include "irrlicht.h" using namespace irr; @@ -29,7 +31,7 @@ * \brief Handles nitro particle effects * \ingroup graphics */ -class Nitro +class Nitro : public NoCopy { private: /** The kart to which this nitro belongs. */ Modified: main/trunk/src/graphics/shadow.hpp =================================================================== --- main/trunk/src/graphics/shadow.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/shadow.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef HEADER_SHADOW_HPP #define HEADER_SHADOW_HPP +#include "utils/no_copy.hpp" + #include <string> #include "irrlicht.h" @@ -31,7 +33,7 @@ * be added later. * \ingroup graphics */ -class Shadow +class Shadow : public NoCopy { private: /** The scene node for the shadow. */ Modified: main/trunk/src/graphics/skid_marks.hpp =================================================================== --- main/trunk/src/graphics/skid_marks.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/skid_marks.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -25,6 +25,7 @@ #include "irrlicht.h" using namespace irr; +#include "utils/no_copy.hpp" #include "utils/vec3.hpp" class Kart; @@ -32,7 +33,7 @@ /** \brief This class is responsible for drawing skid marks for a kart. * \ingroup graphics */ -class SkidMarks +class SkidMarks : public NoCopy { private: /** Reference to the kart to which these skidmarks belong. */ @@ -51,7 +52,7 @@ /** Material to use for the skid marks. */ video::SMaterial *m_material; - class SkidMarkQuads : public scene::SMeshBuffer + class SkidMarkQuads : public scene::SMeshBuffer, public NoCopy { /** Used to move skid marks at the same location slightly on * top of each other to avoid a 'wobbling' effect when sometines Modified: main/trunk/src/graphics/slip_stream.hpp =================================================================== --- main/trunk/src/graphics/slip_stream.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/slip_stream.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -24,6 +24,8 @@ using namespace irr; #include "graphics/moving_texture.hpp" +#include "utils/no_copy.hpp" + class Kart; /** Modified: main/trunk/src/graphics/stars.hpp =================================================================== --- main/trunk/src/graphics/stars.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/stars.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -17,6 +17,8 @@ #ifndef HEADER_STARS_HPP #define HEADER_STARS_HPP +#include "utils/no_copy.hpp" + #include <vector> #include "irrlicht.h" @@ -26,7 +28,7 @@ * \brief This class is used to display rotating stars around a kart's head. * \ingroup graphics */ -class Stars +class Stars : public NoCopy { private: Modified: main/trunk/src/graphics/water_splash.hpp =================================================================== --- main/trunk/src/graphics/water_splash.hpp 2010-09-09 00:29:28 UTC (rev 5932) +++ main/trunk/src/graphics/water_splash.hpp 2010-09-09 00:30:58 UTC (rev 5933) @@ -20,6 +20,8 @@ #ifndef HEADER_WATER_SPLASH_HPP #define HEADER_WATER_SPLASH_HPP +#include "utils/no_copy.hpp" + #include "irrlicht.h" using namespace irr; @@ -29,7 +31,7 @@ * \brief Handles a water-splash particle effect * \ingroup graphics */ -class WaterSplash +class WaterSplash : public NoCopy { private: /** The kart to which this smoke belongs. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-11-10 16:53:51
|
Revision: 6492 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6492&view=rev Author: auria Date: 2010-11-10 16:53:45 +0000 (Wed, 10 Nov 2010) Log Message: ----------- Removed unused code Modified Paths: -------------- main/trunk/src/graphics/material_manager.cpp main/trunk/src/graphics/material_manager.hpp Modified: main/trunk/src/graphics/material_manager.cpp =================================================================== --- main/trunk/src/graphics/material_manager.cpp 2010-11-09 23:52:31 UTC (rev 6491) +++ main/trunk/src/graphics/material_manager.cpp 2010-11-10 16:53:45 UTC (rev 6492) @@ -54,30 +54,6 @@ } // ~MaterialManager //----------------------------------------------------------------------------- - -void MaterialManager::setAllFlatMaterialFlags(scene::IMeshBuffer *mb) const -{ - video::SMaterial& material = mb->getMaterial(); - - //printf("=== I've got a flat material here! (%i, %i, %i) ==\n", - // material.AmbientColor.getRed(), material.AmbientColor.getGreen(), material.AmbientColor.getBlue()); - if (material.AmbientColor.getAlpha() < 255) - { - //printf("---> AND IT's TRANSLUSCENT!!\n"); - - //m->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; - material.MaterialType = video::EMT_SOLID; - material.ZWriteEnable = false; - material.setFlag(video::EMF_ZWRITE_ENABLE, false); - material.ColorMaterial = video::ECM_DIFFUSE_AND_AMBIENT; - //material.setFlag(video::EMF_BACK_FACE_CULLING, false); - //material.Wireframe=true; - } - -// material.Shininess = 0.6f; -} - -//----------------------------------------------------------------------------- /** Searches for the material in the given texture, and calls a function * in the material to set the irrlicht material flags. * \param t Pointer to the texture. Modified: main/trunk/src/graphics/material_manager.hpp =================================================================== --- main/trunk/src/graphics/material_manager.hpp 2010-11-09 23:52:31 UTC (rev 6491) +++ main/trunk/src/graphics/material_manager.hpp 2010-11-10 16:53:45 UTC (rev 6492) @@ -51,7 +51,6 @@ scene::IMeshBuffer *mb) const; void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const; - void setAllFlatMaterialFlags(scene::IMeshBuffer *mb) const; int addEntity (Material *m); Material *getMaterial (const std::string& t, bool is_full_path=false, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-11-23 23:23:46
|
Revision: 6707 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6707&view=rev Author: hikerstk Date: 2010-11-23 23:23:40 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Fixed resolution changing on linux: previously the resolution was changed (and the old window/device deleted) while the old device was still actively delivering events, so deleting caused a crash. Now changing the resolution is only setting a flag, and the resolution change will be applied during the next update, i.e. while the device is not busy anymore. Modified Paths: -------------- main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-11-23 22:18:30 UTC (rev 6706) +++ main/trunk/src/graphics/irr_driver.cpp 2010-11-23 23:23:40 UTC (rev 6707) @@ -52,8 +52,8 @@ IrrDriver::IrrDriver() { - m_res_switching = false; - m_device = NULL; + m_resolution_changing = RES_CHANGE_NONE; + m_device = NULL; file_manager->dropFileSystem(); initDevice(); } // IrrDriver @@ -317,19 +317,22 @@ UserConfigParams::m_height = h; UserConfigParams::m_fullscreen = fullscreen; - doApplyResSettings(); - - new ConfirmResolutionDialog(); -} + // Setting this flag will trigger a call to applyResolutionSetting() + // in the next update call. This avoids the problem that changeResolution + // is actually called from the gui, i.e. the event loop, i.e. while the + // old device is active - so we can't delete this device (which we must + // do in applyResolutionSettings + m_resolution_changing = RES_CHANGE_YES; +} // changeResolution //----------------------------------------------------------------------------- -void IrrDriver::doApplyResSettings() +void IrrDriver::applyResolutionSettings() { - m_res_switching = true; - - // show black before resolution switch so we don't see OpenGL's buffer garbage during switch - m_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140)); + // show black before resolution switch so we don't see OpenGL's buffer + // garbage during switch + m_device->getVideoDriver()->beginScene(true, true, + video::SColor(255,100,101,140)); m_device->getVideoDriver()->draw2DRectangle( SColor(255, 0, 0, 0), core::rect<s32>(0, 0, UserConfigParams::m_prev_width, @@ -407,8 +410,17 @@ UserConfigParams::m_width = UserConfigParams::m_prev_width; UserConfigParams::m_height = UserConfigParams::m_prev_height; UserConfigParams::m_fullscreen = UserConfigParams::m_prev_fullscreen; - - doApplyResSettings(); + + // This will trigger calling applyResolutionSettings in update(). This is + // necessary to avoid that the old screen is deleted, while it is + // still active (i.e. sending out events which triggered the change + // of resolution // Setting this flag will trigger a call to applyResolutionSetting() + // in the next update call. This avoids the problem that changeResolution + // is actually called from the gui, i.e. the event loop, i.e. while the + // old device is active - so we can't delete this device (which we must + // do in applyResolutionSettings) + m_resolution_changing=RES_CHANGE_CANCEL; + } // cancelResChange // ---------------------------------------------------------------------------- @@ -420,15 +432,15 @@ { io::IAttributes * attr = m_scene_manager->getParameters(); printf("[%ls], FPS:%3d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)\n", - m_video_driver->getName(), - m_video_driver->getFPS (), - (f32) m_video_driver->getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f ), - attr->getAttributeAsInt ( "culled" ), - attr->getAttributeAsInt ( "calls" ), - attr->getAttributeAsInt ( "drawn_solid" ), - attr->getAttributeAsInt ( "drawn_transparent" ), - attr->getAttributeAsInt ( "drawn_transparent_effect" ) - ); + m_video_driver->getName(), + m_video_driver->getFPS (), + (f32) m_video_driver->getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f ), + attr->getAttributeAsInt ( "culled" ), + attr->getAttributeAsInt ( "calls" ), + attr->getAttributeAsInt ( "drawn_solid" ), + attr->getAttributeAsInt ( "drawn_transparent" ), + attr->getAttributeAsInt ( "drawn_transparent_effect" ) + ); } // printRenderStats @@ -818,16 +830,22 @@ */ void IrrDriver::update(float dt) { - if (!m_device->run()) + // If the resolution should be switched, do it now. This will delete the + // old device and create a new one. + if (m_resolution_changing!=RES_CHANGE_NONE) { - // FIXME: I have NO idea why, after performing resolution switch, the irrlicht device asks once to be deleted - if (m_res_switching) m_res_switching = false; - else main_loop->abort(); + applyResolutionSettings(); + if(m_resolution_changing==RES_CHANGE_YES) + new ConfirmResolutionDialog(); + m_resolution_changing = RES_CHANGE_NONE; } - else if (m_res_switching) + + + if (!m_device->run()) { - m_res_switching = false; + main_loop->abort(); } + World *world = World::getWorld(); Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-11-23 22:18:30 UTC (rev 6706) +++ main/trunk/src/graphics/irr_driver.hpp 2010-11-23 23:23:40 UTC (rev 6707) @@ -60,9 +60,13 @@ /** Irrlicht race font. */ irr::gui::IGUIFont *m_race_font; - /** Flag set during resolution switching, so that the game doesn't think it needs - * to exit because no frame is open */ - bool m_res_switching; + /** Flag to indicate if a resolution change is pending (which will be + * acted upon in the next update). None means no change, yes means + * change to new resolution and trigger confirmation dialog. + * Cancel indicates a change of the resolution (back to the original + * one), but no confirmation dialog. */ + enum {RES_CHANGE_NONE, RES_CHANGE_YES, + RES_CHANGE_CANCEL} m_resolution_changing; void setAllMaterialFlags(scene::IAnimatedMesh *mesh) const; std::vector<VideoMode> m_modes; @@ -74,7 +78,7 @@ bool m_pointer_shown; /** Internal method that applies the resolution in user settings. */ - void doApplyResSettings(); + void applyResolutionSettings(); public: IrrDriver(); @@ -136,7 +140,7 @@ /** Call to change resolution */ void changeResolution(const int w, const int h, const bool fullscreen); - /** Call this to roll back to the previous resolution if a resolution switch attempt goes bad */ + /** Call this to roll back to the previous resolution if a resolution switch attempt goes bad */ void cancelResChange(); void showPointer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-11-26 01:02:40
|
Revision: 6735 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6735&view=rev Author: auria Date: 2010-11-26 01:02:33 +0000 (Fri, 26 Nov 2010) Log Message: ----------- Applied patch by samuncle to support disabling backface culling, thanks! (even though I helped quite a bit ;) Modified Paths: -------------- main/trunk/src/graphics/material.cpp main/trunk/src/graphics/material.hpp Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2010-11-26 00:23:19 UTC (rev 6734) +++ main/trunk/src/graphics/material.cpp 2010-11-26 01:02:33 UTC (rev 6735) @@ -63,6 +63,7 @@ node->get("max-speed", &m_max_speed_fraction); node->get("slowdown-time", &m_slowdown_time ); node->get("anisotropic", &m_anisotropic ); + node->get("noculling", &m_disable_cull ); node->get("backface-culling", &m_backface_culling ); std::string s(""); node->get("graphical-effect", &s ); @@ -269,6 +270,7 @@ m->SpecularColor = video::SColor(255, 255, 255, 255); } + // anisotropic if (m_anisotropic && UserConfigParams::m_anisotropic) { m->setFlag(video::EMF_ANISOTROPIC_FILTER, true); @@ -278,6 +280,14 @@ m->setFlag(video::EMF_TRILINEAR_FILTER, true); } + // noculling + if (m_disable_cull) + { + m->setFlag( irr::video::EMF_BACK_FACE_CULLING , false ); + } + + + if ( (m_clamp_tex & UCLAMP) != 0) { // m->setFlag(); Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-11-26 00:23:19 UTC (rev 6734) +++ main/trunk/src/graphics/material.hpp 2010-11-26 01:02:33 UTC (rev 6735) @@ -62,6 +62,9 @@ /** Whether to use anisotropic filtering for this texture */ bool m_anisotropic; + /** Disable the culling **/ + bool m_disable_cull; + /** True if lightmapping is enabled for this material. */ bool m_lightmap; float m_friction; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-11-29 11:31:13
|
Revision: 6769 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6769&view=rev Author: hikerstk Date: 2010-11-29 11:31:07 +0000 (Mon, 29 Nov 2010) Log Message: ----------- Reverted commit that added backface culling ... which was already supported (also the patch did not initialise memory). Modified Paths: -------------- main/trunk/src/graphics/material.cpp main/trunk/src/graphics/material.hpp Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2010-11-29 11:03:22 UTC (rev 6768) +++ main/trunk/src/graphics/material.cpp 2010-11-29 11:31:07 UTC (rev 6769) @@ -63,7 +63,6 @@ node->get("max-speed", &m_max_speed_fraction); node->get("slowdown-time", &m_slowdown_time ); node->get("anisotropic", &m_anisotropic ); - node->get("noculling", &m_disable_cull ); node->get("backface-culling", &m_backface_culling ); std::string s(""); node->get("graphical-effect", &s ); @@ -278,16 +277,8 @@ else if (UserConfigParams::m_trilinear) { m->setFlag(video::EMF_TRILINEAR_FILTER, true); - } + } - // noculling - if (m_disable_cull) - { - m->setFlag( irr::video::EMF_BACK_FACE_CULLING , false ); - } - - - if ( (m_clamp_tex & UCLAMP) != 0) { // m->setFlag(); Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-11-29 11:03:22 UTC (rev 6768) +++ main/trunk/src/graphics/material.hpp 2010-11-29 11:31:07 UTC (rev 6769) @@ -62,9 +62,6 @@ /** Whether to use anisotropic filtering for this texture */ bool m_anisotropic; - /** Disable the culling **/ - bool m_disable_cull; - /** True if lightmapping is enabled for this material. */ bool m_lightmap; float m_friction; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-12-08 02:04:06
|
Revision: 6888 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6888&view=rev Author: auria Date: 2010-12-08 02:04:00 +0000 (Wed, 08 Dec 2010) Log Message: ----------- Fixed little glitch that could cause explosions to be cut before they had time to fade out Modified Paths: -------------- main/trunk/src/graphics/explosion.cpp main/trunk/src/graphics/explosion.hpp Modified: main/trunk/src/graphics/explosion.cpp =================================================================== --- main/trunk/src/graphics/explosion.cpp 2010-12-08 01:54:48 UTC (rev 6887) +++ main/trunk/src/graphics/explosion.cpp 2010-12-08 02:04:00 UTC (rev 6888) @@ -27,7 +27,6 @@ #include "items/projectile_manager.hpp" #include "utils/vec3.hpp" -const float explosion_time = 1.5f; const float burst_time = 0.1f; Explosion::Explosion(const Vec3& coord, const char* explosion_sound) Modified: main/trunk/src/graphics/explosion.hpp =================================================================== --- main/trunk/src/graphics/explosion.hpp 2010-12-08 01:54:48 UTC (rev 6887) +++ main/trunk/src/graphics/explosion.hpp 2010-12-08 02:04:00 UTC (rev 6888) @@ -28,6 +28,8 @@ class Vec3; class SFXBase; +const float explosion_time = 1.5f; + /** * \ingroup graphics */ @@ -44,7 +46,7 @@ void init (const Vec3& coord); void update (float delta_t); int inUse (); - bool hasEnded () { return m_remaining_time<0.0f; } + bool hasEnded () { return m_remaining_time < -explosion_time; } } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |