From 8aeb16221aeb67a34bde07b5536434824e59a06b Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 18 Aug 2015 23:50:55 +1000 Subject: [PATCH] Fixed displaying of debug spheres in GLSL pipeline. --- src/graphics/irr_driver.cpp | 23 ++++++++++++++++++----- src/karts/controller/skidding_ai.cpp | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 74bfb6298..57899658b 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -1088,16 +1088,29 @@ scene::IMeshSceneNode *IrrDriver::addOctTree(scene::IMesh *mesh) scene::IMeshSceneNode *IrrDriver::addSphere(float radius, const video::SColor &color) { - scene::IMeshSceneNode *node = m_scene_manager->addSphereSceneNode(radius); - node->setMaterialType(video::EMT_SOLID); - scene::IMesh *mesh = node->getMesh(); + scene::IMesh *mesh = m_scene_manager->getGeometryCreator() + ->createSphereMesh(radius); + mesh->setMaterialFlag(video::EMF_COLOR_MATERIAL, true); - video::SMaterial m; + video::SMaterial &m = mesh->getMeshBuffer(0)->getMaterial(); m.AmbientColor = color; m.DiffuseColor = color; m.EmissiveColor = color; m.BackfaceCulling = false; - mesh->getMeshBuffer(0)->getMaterial() = m; + m.MaterialType = video::EMT_SOLID; + m.setTexture(0, getUnicolorTexture(video::SColor(128, 255, 105, 180))); + m.setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0))); + + if (CVS->isGLSL()) + { + STKMeshSceneNode *node = + new STKMeshSceneNode(mesh, + m_scene_manager->getRootSceneNode(), + NULL, -1, "sphere"); + return node; + } + + scene::IMeshSceneNode *node = m_scene_manager->addMeshSceneNode(mesh); return node; } // addSphere diff --git a/src/karts/controller/skidding_ai.cpp b/src/karts/controller/skidding_ai.cpp index 740197ecd..319da797b 100644 --- a/src/karts/controller/skidding_ai.cpp +++ b/src/karts/controller/skidding_ai.cpp @@ -97,7 +97,7 @@ SkiddingAI::SkiddingAI(AbstractKart *kart) m_debug_sphere[i] = irr_driver->addSphere(1.0f, col_debug); m_debug_sphere[i]->setVisible(false); m_debug_sphere[i]->setMaterialTexture(0, getUnicolorTexture(video::SColor(128, 255, 105, 180))); - m_debug_sphere[i]->setMaterialTexture(1, getUnicolorTexture(video::SColor(128, 255, 105, 180))); + m_debug_sphere[i]->setMaterialTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0))); } m_debug_sphere[m_point_selection_algorithm]->setVisible(true); m_item_sphere = irr_driver->addSphere(1.0f);