Update thunderbird to have new-engine-friendly traffic light animation

This commit is contained in:
Marianne Gagnon
2014-08-17 19:33:45 -04:00
parent 83a1acc961
commit fcb80cdb2c

View File

@@ -36,7 +36,6 @@ Vec3 Referee::m_st_start_offset = Vec3(-2, 2, 2);
Vec3 Referee::m_st_start_rotation = Vec3(0, 180, 0);
Vec3 Referee::m_st_scale = Vec3(1, 1, 1);
scene::IAnimatedMesh *Referee::m_st_referee_mesh = NULL;
video::ITexture *Referee::m_st_traffic_lights[3] = {NULL, NULL, NULL};
// ----------------------------------------------------------------------------
/** Loads the static mesh.
@@ -93,23 +92,6 @@ void Referee::init()
* RAD_TO_DEGREE;
m_st_start_rotation.setY(m_st_start_rotation.getY()+angle_to_kart);
std::vector<std::string> colors;
node->get("colors", &colors);
if(colors.size()>3)
Log::warn("referee", "Too many colors for referee defined, "
"only first three will be used.");
if(colors.size()<3)
{
Log::fatal("referee",
"Not enough colors for referee defined, aborting.");
}
for(unsigned int i=0; i<3; i++)
{
m_st_traffic_lights[i] = irr_driver->getTexture(FileManager::MODEL, colors[i]);
}
for(unsigned int i=0; i<m_st_referee_mesh->getMeshBufferCount(); i++)
{
scene::IMeshBuffer *mb = m_st_referee_mesh->getMeshBuffer(i);
@@ -119,7 +101,7 @@ void Referee::init()
std::string name=StringUtils::getBasename(t->getName()
.getInternalName().c_str());
if(name==colors[0] || name==colors[1] ||name==colors[2] )
if (name == "traffic_light.png")
{
m_st_traffic_buffer = i;
break;
@@ -232,9 +214,12 @@ void Referee::removeFromSceneGraph()
*/
void Referee::selectReadySetGo(int rsg)
{
if(m_st_traffic_buffer<0) return;
video::SMaterial &m = m_scene_node->getMesh()->getMeshBuffer(m_st_traffic_buffer)->getMaterial();
m.setTexture(0, m_st_traffic_lights[rsg]);
if (m_st_traffic_buffer < 0)
return;
video::SMaterial &m = m_scene_node->getMaterial(m_st_traffic_buffer); // m_scene_node->getMesh()->getMeshBuffer(m_st_traffic_buffer)->getMaterial();
core::matrix4* matrix = &m.getTextureMatrix(0);
matrix->setTextureTranslate(0.0f, rsg*0.333f);
// disable lighting, we need to see the traffic light even if facing away
// from the sun