Skip to content
Snippets Groups Projects
Commit 6c3a82cd authored by Ansgar Philippsen's avatar Ansgar Philippsen Committed by Marco Biasini
Browse files

fixed broken linewidth for primlist

parent 74417bef
No related branches found
No related tags found
No related merge requests found
p=gfx.PrimList("p")
p.AddLine(geom.Vec3(0,0,0),geom.Vec3(5,0,0))
p.AddLine(geom.Vec3(0,0,0),geom.Vec3(0,5,0))
p.AddLine(geom.Vec3(0,0,0),geom.Vec3(0,0,5))
p.SetColor(gfx.YELLOW)
scene.Add(p)
p.SetLineWidth(5)
p.SetAALines(True)
...@@ -143,6 +143,16 @@ geom::Vec3 PrimList::GetCenter() const ...@@ -143,6 +143,16 @@ geom::Vec3 PrimList::GetCenter() const
return cen; return cen;
} }
void PrimList::SetLineWidth(float w)
{
GfxObj::SetLineWidth(w);
va_.SetLineWidth(line_width_);
simple_va_.SetLineWidth(line_width_);
for(std::vector<IndexedVertexArray>::iterator it=vas_.begin();it!=vas_.end();++it) {
it->SetLineWidth(line_width_);
}
}
void PrimList::OnRenderModeChange() void PrimList::OnRenderModeChange()
{ {
// noop // noop
...@@ -323,6 +333,7 @@ void PrimList::prep_simple_va() ...@@ -323,6 +333,7 @@ void PrimList::prep_simple_va()
simple_va_.SetTwoSided(true); simple_va_.SetTwoSided(true);
simple_va_.SetAALines(GetAALines()); simple_va_.SetAALines(GetAALines());
simple_va_.SetOpacity(GetOpacity()); simple_va_.SetOpacity(GetOpacity());
simple_va_.SetLineWidth(line_width_);
for(SpherePrimList::const_iterator it=points_.begin();it!=points_.end();++it) { for(SpherePrimList::const_iterator it=points_.begin();it!=points_.end();++it) {
simple_va_.Add(it->position,geom::Vec3(),it->color); simple_va_.Add(it->position,geom::Vec3(),it->color);
...@@ -342,6 +353,7 @@ void PrimList::prep_va() ...@@ -342,6 +353,7 @@ void PrimList::prep_va()
va_.SetCullFace(true); va_.SetCullFace(true);
va_.SetColorMaterial(true); va_.SetColorMaterial(true);
va_.SetMode(0x4); va_.SetMode(0x4);
va_.SetLineWidth(line_width_);
for(SpherePrimList::const_iterator it=spheres_.begin();it!=spheres_.end();++it) { for(SpherePrimList::const_iterator it=spheres_.begin();it!=spheres_.end();++it) {
va_.AddSphere(SpherePrim(it->position, it->radius, it->color), va_.AddSphere(SpherePrim(it->position, it->radius, it->color),
......
...@@ -74,6 +74,7 @@ class DLLEXPORT_OST_GFX PrimList: public GfxObj ...@@ -74,6 +74,7 @@ class DLLEXPORT_OST_GFX PrimList: public GfxObj
virtual void OnRenderModeChange(); virtual void OnRenderModeChange();
virtual void SetLineWidth(float w);
/// \brief clear all prims /// \brief clear all prims
void Clear(); void Clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment