Using BillboardSets with Mogre

o0hamish0o

09-01-2009 14:49:18

Hi,

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#?

Thanks,
-Hamish

Beauty

10-01-2009 04:33:58

I looked in the wiki, found something and then I created a new page with some informations about:
http://www.ogre3d.org/wiki/index.php/Billboard

There are rectangle classes. Look here:
http://www.ogre3d.org/wiki/index.php/MO ... ET_classes
By the way - there are no pointers in C#.

Maybe it helps.

o0hamish0o

13-01-2009 22:12:34

Hi,

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;
bb1Node.AttachObject(bbset);


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

-Hamish