ParticleSystem: Added support for GLES2 and upper (GL_QUADS -> GL_TRIANGLES)
This commit is contained in:
parent
6ae1139630
commit
f00b7180cb
@ -394,29 +394,41 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
|||||||
case osgParticle::Particle::HEXAGON:
|
case osgParticle::Particle::HEXAGON:
|
||||||
case osgParticle::Particle::QUAD:
|
case osgParticle::Particle::QUAD:
|
||||||
{
|
{
|
||||||
vertices.push_back(xpos-p1-p2);
|
osg::Vec3 c0(xpos-p1-p2);
|
||||||
colors.push_back(color);
|
osg::Vec2 t0(s_coord, t_coord);
|
||||||
texcoords.push_back(osg::Vec2(s_coord, t_coord));
|
osg::Vec3 c1(xpos+p1-p2);
|
||||||
|
osg::Vec2 t1(s_coord+s_tile, t_coord);
|
||||||
|
osg::Vec3 c2(xpos+p1+p2);
|
||||||
|
osg::Vec2 t2(s_coord+s_tile, t_coord+t_tile);
|
||||||
|
osg::Vec3 c3(xpos-p1+p2);
|
||||||
|
osg::Vec2 t3(s_coord, t_coord+t_tile);
|
||||||
|
|
||||||
vertices.push_back(xpos+p1-p2);
|
// first triangle
|
||||||
colors.push_back(color);
|
vertices.push_back(c0);
|
||||||
texcoords.push_back(osg::Vec2(s_coord+s_tile, t_coord));
|
vertices.push_back(c1);
|
||||||
|
vertices.push_back(c2);
|
||||||
|
texcoords.push_back(t0);
|
||||||
|
texcoords.push_back(t1);
|
||||||
|
texcoords.push_back(t2);
|
||||||
|
|
||||||
vertices.push_back(xpos+p1+p2);
|
// second triangle
|
||||||
colors.push_back(color);
|
vertices.push_back(c2);
|
||||||
texcoords.push_back(osg::Vec2(s_coord+s_tile, t_coord+t_tile));
|
vertices.push_back(c3);
|
||||||
|
vertices.push_back(c0);
|
||||||
|
texcoords.push_back(t2);
|
||||||
|
texcoords.push_back(t3);
|
||||||
|
texcoords.push_back(t0);
|
||||||
|
|
||||||
vertices.push_back(xpos-p1+p2);
|
for (int j = 0; j < 6; ++j)
|
||||||
colors.push_back(color);
|
colors.push_back(color);
|
||||||
texcoords.push_back(osg::Vec2(s_coord, t_coord+t_tile));
|
|
||||||
|
|
||||||
if (!primitives.empty() && primitives.back().first==GL_QUADS)
|
if (!primitives.empty() && primitives.back().first==GL_TRIANGLES)
|
||||||
{
|
{
|
||||||
primitives.back().second+=4;
|
primitives.back().second+=6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
primitives.push_back(ArrayData::ModeCount(GL_QUADS,4));
|
primitives.push_back(ArrayData::ModeCount(GL_TRIANGLES,6));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user