12345678910111213141516171819202122232425262728293031323334353637 |
- #include "GenerationTemplate.h"
- GenerationTemplate::GenerationTemplate(float propability, int minSurfaceDist, int maxSurfaceDist, Framework::Vec3<int> minPosOffset, Framework::Vec3<int> maxSize)
- : ReferenceCounter(),
- propability(propability),
- minSurfaceDist(minSurfaceDist),
- maxSurfaceDist(maxSurfaceDist),
- minPosOffset(minPosOffset),
- maxSize(maxSize)
- {}
- bool GenerationTemplate::canEffect(Framework::Vec3<int> location, Framework::Vec3<int> affectedLocation) const
- {
- Framework::Vec3<int> localPos = affectedLocation - (location + minPosOffset);
- return localPos.x >= 0 && localPos.y >= 0 && localPos.z >= 0 && localPos.x < maxSize.x&& localPos.y < maxSize.y&& localPos.z < maxSize.z;
- }
- bool GenerationTemplate::isGenerationPossable(Framework::Vec3<int> location, int distToSurface) const
- {
- return distToSurface >= minSurfaceDist && distToSurface <= maxSurfaceDist;
- }
- float GenerationTemplate::getPropability() const
- {
- return propability;
- }
- Framework::Vec3<int> GenerationTemplate::getMinAffectedOffset() const
- {
- return minPosOffset;
- }
- Framework::Vec3<int> GenerationTemplate::getMaxAffectedOffset() const
- {
- return minPosOffset + maxSize;
- }
|