本文整理汇总了C++中Boundary::process方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::process方法的具体用法?C++ Boundary::process怎么用?C++ Boundary::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boundary
的用法示例。
在下文中一共展示了Boundary::process方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processTerrain
float ProceduralTerrainAppearance::processTerrain(Layer* layer, float x, float y, float& baseValue, float affectorTransformValue, int affectorType) {
Vector<Boundary*>* boundaries = layer->getBoundaries();
Vector<AffectorProceduralRule*>* affectors = layer->getAffectors();
Vector<FilterProceduralRule*>* filters = layer->getFilters();
float transformValue = 0;
bool hasBoundaries = false;
FilterRectangle rect;
rect.minX = FLT_MAX, rect.maxX = FLT_MIN, rect.minY = FLT_MAX, rect.maxY = FLT_MIN;
for (int i = 0; i < boundaries->size(); ++i) {
Boundary* boundary = boundaries->get(i);
if (!boundary->isEnabled()) {
continue;
} else
hasBoundaries = true;
float result = boundary->process(x, y);
if (result != 0.0) {
if (boundary->getMinX() < rect.minX)
rect.minX = boundary->getMinX();
if (boundary->getMaxX() > rect.maxX)
rect.maxX = boundary->getMaxX();
if (boundary->getMinY() < rect.minY)
rect.minY = boundary->getMinY();
if (boundary->getMaxY() > rect.maxY)
rect.maxY = boundary->getMaxY();
}
int featheringType = boundary->getFeatheringType();
result = calculateFeathering(result, featheringType);
if (result > transformValue)
transformValue = result;
if (transformValue >= 1) {
break;
}
}
if (!hasBoundaries)
transformValue = 1.0;
if (layer->invertBoundaries())
transformValue = 1.0 - transformValue;
if (transformValue != 0) {
for (int i = 0; i < filters->size(); ++i) {
FilterProceduralRule* filter = filters->get(i);
if (!filter->isEnabled())
continue;
/*if (!(filter->getFilterType() & affectorType))
continue;*/
float result = filter->process(x, y, transformValue, baseValue, terrainGenerator, &rect);
int featheringType = filter->getFeatheringType();
result = calculateFeathering(result, featheringType);
if (transformValue > result)
transformValue = result;
if (transformValue == 0)
break;
}
if (layer->invertFilters())
transformValue = 1.0 - transformValue;
if (transformValue != 0) {
for (int i = 0; i < affectors->size(); ++i) {
AffectorProceduralRule* affector = affectors->get(i);
/*if (!affector->isEnabled()) filtered in height affectors vector
continue;*/
if (affector->isEnabled() && (affector->getAffectorType() & affectorType))
affector->process(x, y, transformValue * affectorTransformValue, baseValue, terrainGenerator);
}
Vector<Layer*>* children = layer->getChildren();
for (int i = 0; i < children->size(); ++i) {
Layer* layer = children->get(i);
if (layer->isEnabled()) {
processTerrain(layer, x, y, baseValue, affectorTransformValue * transformValue, affectorType);
}
//.........这里部分代码省略.........