Hi All, I've got a small patch to improve the FG forests, along with some particularly bad C++ I need advice on.
The patch does the following: 1) Fixes the longstanding bug where the first set of tree definitions in a tile were used for all forests within that tile. This meant that if you have an area of deciduous forest next to some evergreen, you'd only see one type of tree or the other, depending on which was loaded first. 2) Re-introduce a feature to fade in trees by distance, so that a reduced density is visible at 2*tree-range-m, with full density at tree-range-m. As the default tree-range-m is 8km, this help stop forests "springing up" well after the rest of the tile is perfectly visible. On my machine I don't see any performance impact, despite the fact that more trees are displayed. I'd appreciate it if those with more graphics-constrained systems than my own would test this and let me know if they think the frame-rate hit is acceptable given the improvements in apparent tree coverage. I'd also be interested to hear if tree range is a performance issue in general and people would like control of it in a similar way to the 3D clouds distance slider (if anyone uses that!). The patch is available from http://www.nanjika.co.uk/flightgear/forest.diff If I have time I'll do battle with git and see if I can submit it via gitorious properly... Now, for the bad C++ :) Within the patch is the code below. The (*j)-> just looks ugly. Surely there's a better way? I'm sure those of you who write C++ more regularly than me will immediately be able to tell me where I'm going wrong! -Stuart TreeBin* treebin; SGTreeBinList::iterator j; bool found = false; for (j = randomForest.begin(); (j != randomForest.end()) && (!found); j++) { if (((*j)->texture == mat->get_tree_texture() ) && ((*j)->texture_varieties == mat->get_tree_varieties()) && ((*j)->range == mat->get_tree_range() ) && ((*j)->width == mat->get_tree_width() ) && ((*j)->height == mat->get_tree_height() ) ) { treebin = *j; found = true; } } ------------------------------------------------------------------------------ Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel