Example #1
0
    def genHeightMap(self):
        '''Generate our heightmap'''
        self.sb.showMessage('Generating heightmap...')

        # create our heightmap
        heightObject = HeightMap(self.mapSize, self.roughness, self.isIsland)
        found = False
        # method = 3 #testing
        while not found:  # loop until we have something workable
            heightObject.run(self.getAlgorithm())
            #break #testing
            if self.avgLandmass and heightObject.landMassPercent() < 0.15:
                self.statusBar().showMessage('Too little land mass')
            elif self.avgLandmass and heightObject.landMassPercent() > 0.85:
                self.statusBar().showMessage('Too much land mass')
            elif self.avgElevation and heightObject.averageElevation() < 0.2:
                self.statusBar().showMessage('Average elevation is too low')
            elif self.avgElevation and heightObject.averageElevation() > 0.8:
                self.statusBar().showMessage('Average elevation is too high')
            elif self.hasMountains and not heightObject.hasMountains():
                self.statusBar().showMessage('Not enough mountains')
            else:
                found = True

        self.elevation = heightObject.heightmap
        del heightObject
        self.viewHeightMap()
        self.statusBar().showMessage('Successfully generated a heightmap!')
Example #2
0
 def genDrainageMap(self):
     '''Generate a fractal drainage map'''
     self.sb.showMessage('Generating drainage...')
     drainObject = HeightMap(self.mapSize)
     drainObject.run(HM_DSA)
     self.drainage = drainObject.heightmap
     del drainObject
     self.viewDrainageMap()
     self.statusBar().showMessage('Successfully generated drainage!')
Example #3
0
    def genHeightMap(self):
        '''Generate our heightmap'''
        self.sb.showMessage('Generating heightmap...')

        # grab our values from config
        roughness = self.dNewWorld.sbRoughness.value()
        method = self.getAlgorithm()

        # create our heightmap
        heightObject = HeightMap(self.mapSize, roughness)
        found = False
        # method = 3 #testing
        while not found:  # loop until we have something workable
            heightObject.run(method)
            # break #testing
            if self.dNewWorld.cbAvgLandmass.isChecked(
            ) and heightObject.landMassPercent() < 0.15:
                self.statusBar().showMessage('Too little land mass')
            elif self.dNewWorld.cbAvgLandmass.isChecked(
            ) and heightObject.landMassPercent() > 0.85:
                self.statusBar().showMessage('Too much land mass')
            elif self.dNewWorld.cbAvgElevation.isChecked(
            ) and heightObject.averageElevation() < 0.2:
                self.statusBar().showMessage('Average elevation is too low')
            elif self.dNewWorld.cbAvgElevation.isChecked(
            ) and heightObject.averageElevation() > 0.8:
                self.statusBar().showMessage('Average elevation is too high')
            elif self.dNewWorld.cbMountains.isChecked(
            ) and heightObject.hasNoMountains():
                self.statusBar().showMessage('Not enough mountains')
            else:
                found = True

        self.elevation = heightObject.heightmap
        del heightObject
        self.viewHeightMap()
        self.statusBar().showMessage('Successfully generated a heightmap!')