glateur
03-11-2009 11:14:54
Hi all,
this is a follow-up on my recent post, entitled 'DynamicLines - Mogre version':
http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=11503
In short: I want to render lines (2D & 3D curves). A way to do this was kindly provided by PantheR in the previous post.
However, there appears to be no easy way to set the line thickness in this scenario:
http://www.ogre3d.org/forums/viewtopic.php?t=22085
It has been suggested that line thickness could be achieved by using BillboardChains:
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=33307&p=231772&hilit=line+thickness#p231772
So this is what I set out to do. Unfortunately, I have no experience with BillboardChains, and I can't seem to find a lot of information about them. I'm stuck at the _NativePtr-bit of a BillboardChain.Element. Here's the code:
It throws an exception (can't write to protected memory) when I try to set the position of the element, so this is obviously not the way to go.
Does anyone know how to do this correctly?
How do I create a BillboardChainElement?
Do I need a BillboardSet as well?
Thanks,
g
this is a follow-up on my recent post, entitled 'DynamicLines - Mogre version':
http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=11503
In short: I want to render lines (2D & 3D curves). A way to do this was kindly provided by PantheR in the previous post.
However, there appears to be no easy way to set the line thickness in this scenario:
http://www.ogre3d.org/forums/viewtopic.php?t=22085
It has been suggested that line thickness could be achieved by using BillboardChains:
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=33307&p=231772&hilit=line+thickness#p231772
So this is what I set out to do. Unfortunately, I have no experience with BillboardChains, and I can't seem to find a lot of information about them. I'm stuck at the _NativePtr-bit of a BillboardChain.Element. Here's the code:
public MovableObject MakeLineBBC(ArrayList ALv3, string name, string matname)
{
BillboardChain rvbbc = null;
try
{
try
{
rvbbc = sceneMgr.GetBillboardChain(name);
if (rvbbc != null) sceneMgr.DestroyBillboardChain(rvbbc);
}
catch { }
rvbbc = sceneMgr.CreateBillboardChain(name);
rvbbc.MaxChainElements = (uint)ALv3.Count;
rvbbc.MaterialName = matname;
}
catch { throw new Exception("Failed to CreateBillboardChain()"); }
Vector3 cv3;
BillboardChain.Element_NativePtr bbcel;
for (int i = 0; i < ALv3.Count - 1; i++)
{
cv3 = Tools.Vector3((Vertex3)ALv3[i]);
bbcel = new BillboardChain.Element_NativePtr();
bbcel.position = cv3;
bbcel.width = 3.0f;
rvbbc.AddChainElement((uint)i, bbcel);
}
return rvbbc;
}
It throws an exception (can't write to protected memory) when I try to set the position of the element, so this is obviously not the way to go.
Does anyone know how to do this correctly?
How do I create a BillboardChainElement?
Do I need a BillboardSet as well?
Thanks,
g