A collection of fixes and additions


24-02-2008 17:34:19

I've integrated the plugin into my project. There's some blogging about it here and some screen shots here.. There are some issues with colouring and lightning, but overall it looks good. In the process I patched the code a bit. Here's a diff file of my changes: forest20080223.diff. It's done against the cvs version as of 2008-02-23.

The changes I've made is:

  1. moved it to a PagedGeometry namespace to prevent it from collidiing with application classes
    fixed ogre library header include directives
    properly cast PixelBox::data when deleting
    handle meshes with invalid materials in BatchedGeometry
    separate the grass generating functionality to the placement functinality in GrassLayer. This is done by providing a base class, GrassLayerBase, and a default subclass, GrassLayer. The GrassLayerBase only handles grass creation and provides abstract methods for determining grass placement, which are then implemented by GrassLayer, or any other subclass. This allows for developers to easier provide their own placement schemes, while reusing the grass creation functionality in GrassLayerBase. As a result, the GrassLoader class has been extended with a class template parameter, for example GrassLoader<GrassLayer>
    added a preprocessor directive to ImpostorPage, IMPOSTOR_FILE_SAVE, which if set to 1 will not use images saved to the disc for the impostor texture
    make ImpostorPage better handle entities by disabling max render distance, detaching from existing scene nodes and making sure it is visible

    All functionality is intact, but there are two API changes. One is that the namespace has changed, and the other is that you must specify the GrassLayer class when creating a GrassLoader (GrassLoader<GrassLayer>)

    Overall I'm very pleased with the whole plugin, and how easy it is to extend it.


25-02-2008 03:45:33

Thanks :). I'll review this and merge it with the main version tomorrow if I can.


25-02-2008 17:22:05

Argh.. I just can't seem to get patch files to work. I downloaded patch.exe for windows and typed "patch -p0 < forest20080223.diff", but it doesn't work. I think the patch file uses different directory structures so it doesn't work. For example the patch tries to access "/cvsroot/ogre/ogreaddons/forests/examples/source/Example1.cpp" where for me it's "C:/Programming/Ogre Projects/ogreaddons/forests/examples/source/Example1.cpp".

I guess I'll try to manually change the directories in the patch now.

Edit: Nevermind - I just got it to patch. I had to change the directories from "/cvsroot/ogre/ogreaddons/forests/*" to "*". Semi-absolute paths are so annoying :)


25-02-2008 18:19:58

Ok, your changes are now merged with the official version. Thanks again for the patch :).


25-02-2008 18:32:29


In my app all trees are individual entities, which up close needs to be selectable and editable. Thus they need to be rendered as normal entities close up. Currently I use a combination of a DummyPage (which just doesn't render anything) together with setting max render distance on the entities. Thus up to a certain distance the entities will be rendered themselves, while the dummy page will make sure that no imposters are rendered. And then at a certain distance the entities won't be rendered but the imposters will take over.
The problem with this is however that the imposters and entities will overlap, since the imposters are rendered in batch, so there's no exact distance where they become active.
Thus I plan to create an EntityPage, which will just render the entities attached to it. Should be quite useful.


25-02-2008 20:30:40

Thus I plan to create an EntityPage, which will just render the entities attached to it. Should be quite useful.
Definitely. I was having trouble with the old EntityPage mainly because it was very hard to find a way to quickly load many entities, mainly because attaching/detaching scene nodes is very slow, and it's hard to implement a fade-in/fade-out technique. If you find a way to overcome this (or if it's no longer a problem for some reason), then that would definitely be quite useful.


25-02-2008 20:56:52

Ah, there was an EntityPage previously? Do you remember when it was removed from cvs? Might be useful for ideas.


25-02-2008 22:06:36

I'm not sure when they were removed, but you can get them from the CVS browser here:
http://ogre.cvs.sourceforge.net/ogre/og ... 0&view=log
http://ogre.cvs.sourceforge.net/ogre/og ... 0&view=log


02-05-2008 10:03:42

I see that you in revision 2426 reverted my changes to GrassLoader. Was that by mistake or on purpose?


03-05-2008 15:59:25

I originally reverted the changes when I was debugging the grass system memory leak, but then later decided to keep the old method. I don't think a pluggable system for grass distribution methods is useful enough to justify the added complexity - if you want to make a special distribution method, you can easily modify GrassLoader yourself - all the loaders are really templates anyway; they're meant to be modified to suit your application if you need.


03-05-2008 18:06:15

Ok, thanks for clearing that up.