Using BillboardSets with Mogre


09-01-2009 14:49:18


Does anyone have a good example on how to use BillboardSets with Mogre?

Specifically, I'm having a problem creating and passing a FloatRect* into SetTextureCoords as in:

(assume sceneMgr is valid)
BillboardSet bbset = sceneMgr.CreateBillboardSet("bbSet", 4);
bbset.SetTextureCoords(textCoords, (ushort)4);

How do I create textCoords as a FloatRect* in C#?



10-01-2009 04:33:58

I looked in the wiki, found something and then I created a new page with some informations about:

There are rectangle classes. Look here: ... ET_classes
By the way - there are no pointers in C#.

Maybe it helps.


13-01-2009 22:12:34


Thanks for putting the page together.

I ended up doing this:
BillboardSet bbset = sceneMgr.CreateBillboardSet("bb1", 4);

FloatRect[] textureCoords = {
new FloatRect(0.0f, 0.0f, 0.5f, 0.5f),
new FloatRect(0.5f, 0.0f, 1.0f, 0.5f),
new FloatRect(0.0f, 0.5f, 0.5f, 1.0f),
new FloatRect(0.5f, 0.5f, 1.0f, 1.0f)

unsafe {
fixed (FloatRect* frPtr = textureCoords) {
bbset.SetTextureCoords(frPtr, 4);

bb1Node = sceneMgr.RootSceneNode.CreateChildSceneNode("bb1");

Billboard bb1 = bbset.CreateBillboard(Vector3.ZERO);
bb1.TexcoordIndex = 2;

Marking the code as unsafe was the only way I could see to use a pointer.