diff --git a/examples/gfx/prims.py b/examples/gfx/prims.py new file mode 100644 index 0000000000000000000000000000000000000000..637f6a6b7826aba7fba6541bf5495955c62f5bf3 --- /dev/null +++ b/examples/gfx/prims.py @@ -0,0 +1,8 @@ +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) diff --git a/modules/gfx/src/prim_list.cc b/modules/gfx/src/prim_list.cc index 0c8589ea29837485a979443287b31f6be137fe74..0b06442fdc30bf8ebc9901415a0f34e368170abd 100644 --- a/modules/gfx/src/prim_list.cc +++ b/modules/gfx/src/prim_list.cc @@ -143,6 +143,16 @@ geom::Vec3 PrimList::GetCenter() const 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() { // noop @@ -323,6 +333,7 @@ void PrimList::prep_simple_va() simple_va_.SetTwoSided(true); simple_va_.SetAALines(GetAALines()); simple_va_.SetOpacity(GetOpacity()); + simple_va_.SetLineWidth(line_width_); for(SpherePrimList::const_iterator it=points_.begin();it!=points_.end();++it) { simple_va_.Add(it->position,geom::Vec3(),it->color); @@ -342,6 +353,7 @@ void PrimList::prep_va() va_.SetCullFace(true); va_.SetColorMaterial(true); va_.SetMode(0x4); + va_.SetLineWidth(line_width_); for(SpherePrimList::const_iterator it=spheres_.begin();it!=spheres_.end();++it) { va_.AddSphere(SpherePrim(it->position, it->radius, it->color), diff --git a/modules/gfx/src/prim_list.hh b/modules/gfx/src/prim_list.hh index 80eabe333a1b9264da03f015d1f423905aa36f56..1b6b979694cb503837003219fa7c910499c2a452 100644 --- a/modules/gfx/src/prim_list.hh +++ b/modules/gfx/src/prim_list.hh @@ -74,6 +74,7 @@ class DLLEXPORT_OST_GFX PrimList: public GfxObj virtual void OnRenderModeChange(); + virtual void SetLineWidth(float w); /// \brief clear all prims void Clear();