Fixed vegetation definition, due to layers refactoring in master
This commit is contained in:
parent
8cf2881a73
commit
01992a0019
6 changed files with 13 additions and 12 deletions
|
@ -3,8 +3,8 @@
|
|||
#include "VegetationLayerDefinition.h"
|
||||
#include "VegetationModelDefinition.h"
|
||||
|
||||
static DefinitionNode *_layer_constructor(Layers *parent) {
|
||||
return new VegetationLayerDefinition(parent);
|
||||
static DefinitionNode *_layer_constructor(Layers *parent, const std::string &name) {
|
||||
return new VegetationLayerDefinition(parent, name);
|
||||
}
|
||||
|
||||
VegetationDefinition::VegetationDefinition(DefinitionNode *parent) : Layers(parent, "vegetation", _layer_constructor) {
|
||||
|
@ -12,7 +12,7 @@ VegetationDefinition::VegetationDefinition(DefinitionNode *parent) : Layers(pare
|
|||
|
||||
double VegetationDefinition::getMaxHeight() const {
|
||||
double max_height = 0.0;
|
||||
int n = count();
|
||||
int n = getLayerCount();
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
double layer_height = getVegetationLayer(i)->getMaxHeight();
|
||||
|
@ -25,13 +25,13 @@ double VegetationDefinition::getMaxHeight() const {
|
|||
}
|
||||
|
||||
void VegetationDefinition::applyPreset(VegetationPreset preset) {
|
||||
VegetationLayerDefinition *layer;
|
||||
VegetationLayerDefinition layer(this, "temp");
|
||||
|
||||
clear();
|
||||
|
||||
if (preset == VEGETATION_PRESET_TEMPERATE) {
|
||||
layer = getVegetationLayer(addLayer());
|
||||
layer->applyPreset(VegetationLayerDefinition::VEGETATION_BASIC_TREES);
|
||||
layer->setName("Basic tree");
|
||||
layer.applyPreset(VegetationLayerDefinition::VEGETATION_BASIC_TREES);
|
||||
layer.setName("Basic tree");
|
||||
addLayer(layer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#include "VegetationModelDefinition.h"
|
||||
#include "VegetationPresenceDefinition.h"
|
||||
|
||||
VegetationLayerDefinition::VegetationLayerDefinition(DefinitionNode *parent) : DefinitionNode(parent, "layer") {
|
||||
VegetationLayerDefinition::VegetationLayerDefinition(DefinitionNode *parent, const std::string &name)
|
||||
: DefinitionNode(parent, name, "vegetationlayer") {
|
||||
model = new VegetationModelDefinition(this);
|
||||
presence = new VegetationPresenceDefinition(this);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace definition {
|
|||
*/
|
||||
class DEFINITIONSHARED_EXPORT VegetationLayerDefinition : public DefinitionNode {
|
||||
public:
|
||||
VegetationLayerDefinition(DefinitionNode *parent);
|
||||
VegetationLayerDefinition(DefinitionNode *parent, const std::string &name);
|
||||
|
||||
inline const VegetationPresenceDefinition *getPresence() const {
|
||||
return presence;
|
||||
|
|
|
@ -103,7 +103,7 @@ RayCastingResult VegetationRenderer::getBoundResult(const SpaceSegment &segment,
|
|||
}
|
||||
|
||||
// Iterate all layers and instances
|
||||
int n = vegetation->count();
|
||||
int n = vegetation->getLayerCount();
|
||||
for (int i = 0; i < n; i++) {
|
||||
VegetationLayerDefinition *layer = vegetation->getVegetationLayer(i);
|
||||
|
||||
|
|
Loading…
Reference in a new issue