Ejemplo n.º 1
0
		/// <summary>
		/// Creates a new random number generator of type Type
		/// </summary>
		/// <param name="Type">Generator type</param>
		public CudaRandHost(GeneratorType Type)
		{
			_generator = new CurandGenerator();
			_status = CudaRandNativeMethods.curandCreateGeneratorHost(ref _generator, Type);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandCreateGeneratorHost", _status));
			if (_status != CurandStatus.Success) throw new CudaRandException(_status);
		}
Ejemplo n.º 2
0
    public void init(Hashtable attributeHash, GeneratorType type, Hashtable characterHash, int time)
    {
        this.type = type;
        this.attributeHash = attributeHash;
        this.radius = (int)(this.attributeHash["AOERadius"]);
        this.hpMax = time;
        this.hp = this.hpMax;
        this.characterHash = characterHash;
        if(this.type == GeneratorType.LifeGenerator)
        {
            this.per = (int)((Effect)this.attributeHash["hp"]).num;
            startAddCharaterHp();
        }
        else if(this.type == GeneratorType.ShieldGenerator)
        {
            this.per = (int)((Effect)this.attributeHash["def_PHY"]).num;

        }
        if (null != lightRange){
            lightRange.transform.localScale *= this.radius/100;
        }

        hpBar.initBar(this.hpMax);

        startAutoConsumeTime();

        // startRotationImage();

        this.isEnabled = true;
    }
Ejemplo n.º 3
0
 public IChunkGenerator GetNewGenerator(GeneratorType type, long seed)
 {
     switch(type)
     {
         case GeneratorType.Custom: return new CustomChunkGenerator(_World, seed);
         default: return new CustomChunkGenerator(_World, seed);
     }
 }
 /// <summary>
 /// Creates random generator of given type.
 /// </summary>
 /// <param name="generator">
 /// Generator type.
 /// </param>
 /// <returns>
 /// Random numbers generator.
 /// </returns>
 /// <exception cref="ArgumentException">
 /// Thrown if generator type is unknown.
 /// </exception>
 public static IGenerator Create(GeneratorType generator)
 {
     switch (generator)
     {
         case GeneratorType.SimpleGenerator:
             return new SimpleGenerator();
         default:
             throw new ArgumentException("This type of generator does not registered in system", "generator");
     }
 }
Ejemplo n.º 5
0
        public generator_params(GeneratorType iGeneratorType, double fGeneratorParamFirst, double fGeneratorParamSecond)
        {
            InitializeComponent();

            Z_comboBox.SelectedIndex = (int)iGeneratorType;
            //Z_param1_label.Text = "a";
            //Z_param2_label.Text = "b";
            Z_param1_textBox.Text = fGeneratorParamFirst.ToString();
            Z_param2_textBox.Text = fGeneratorParamSecond.ToString();

            fGeneratorParamFirst_BASE = fGeneratorParamFirst;
            fGeneratorParamSecond_BASE = fGeneratorParamSecond;
        }
Ejemplo n.º 6
0
 public GeneratorData(GeneratorJsonData data, GeneratorType type)
 {
     this.Id              = data.id;
     this.Name            = data.name;
     this.BaseCost        = data.baseCost;
     this.IncrementFactor = data.incrementFactor;
     this.BaseGeneration  = data.baseGeneration;
     this.TimeToGenerate  = data.timeToGenerate;
     //this.CoinPrice = data.coinPrice;
     this.EnhancePrice          = data.enhancePrice;
     this.ProfitIncrementFactor = data.profitIncrementFactor;
     this.ManagerIconId         = data.managerIcon;
     this.Type = type;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Generates a maze and returns it as two-dimensional array
        /// </summary>
        /// <param name="xSize">Width = X-size * 2 + 1</param>
        /// <param name="ySize">Height = Y-size * 2 + 1</param>
        /// <param name="generatorType">Type of generator. Possible variants: Latest, Random, LatestAndRandom,
        /// LatestOverRandom, RandomOverLatest, Oldest, OldestAndNewest, OldestAndRandom</param>
        /// <param name="cavernRate">Cavern frequency. How much caverns will be on map. It's making maze non-perfect. </param>
        /// <param name="startCellX">CreateWorld cell for mazegen algorithm X. Null for Random.</param>
        /// <param name="startCellY">CreateWorld cell for mazegen algorithm Y. Null for Random.</param>
        /// <returns></returns>
        public MazeGenParams(ushort xSize      = 5, ushort ySize       = 5, GeneratorType generatorType = GeneratorType.LatestOverRandom,
                             ushort cavernRate = 30, ushort?startCellX = null, ushort?startCellY        = null)
        {
            if (xSize > MazeConfig.MazeMaxSize)
            {
                xSize = MazeConfig.MazeMaxSize;
            }
            if (ySize > MazeConfig.MazeMaxSize)
            {
                ySize = MazeConfig.MazeMaxSize;
            }

            if (xSize < MazeConfig.MazeMinSize)
            {
                xSize = MazeConfig.MazeMinSize;
            }
            if (ySize < MazeConfig.MazeMinSize)
            {
                ySize = MazeConfig.MazeMinSize;
            }

            XSize = xSize;
            YSize = ySize;

            GeneratorType = generatorType;

            if (cavernRate > MazeConfig.MazeMaxCavernRate)
            {
                cavernRate = MazeConfig.MazeMaxCavernRate;
            }

            if (cavernRate < MazeConfig.MazeMinCavernRate)
            {
                cavernRate = MazeConfig.MazeMinCavernRate;
            }

            CavernRate = cavernRate;

            StartCellX = startCellX;
            StartCellY = startCellY;

            // formula: (x * y - 2) ^ 0.67
            var maxP = Convert.ToUInt16(Math.Pow(XSize * YSize - 1, 2 / 3f));

            if (maxP > byte.MaxValue)
            {
                maxP = byte.MaxValue;
            }
            MaxPlayers = (byte)maxP;
        }
Ejemplo n.º 8
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_userData = br.ReadUInt64();
     m_lazyRecomputeDisplacementThreshold = br.ReadSingle();
     m_type = (GeneratorType)br.ReadByte();
     m_forceGenerateOntoPpu = br.ReadByte();
     br.ReadUInt16();
     m_materialId = br.ReadInt32();
     br.ReadUInt32();
     m_cachedSilhouettes = des.ReadClassPointer <hkaiConvexSilhouetteSet>(br);
     m_transform         = new hkQTransform();
     m_transform.Read(des, br);
 }
Ejemplo n.º 9
0
    public static string description(this GeneratorType type)
    {
        switch (type)
        {
        case GeneratorType.ATOMIC: return("Генератор на атомар-\nном принципе");

        case GeneratorType.PLASMA: return("Генератор на плаз-\nменном принципе");

        case GeneratorType.MULTYPHASE: return("Генератор на мульти-\nфазном принципе");

        case GeneratorType.TUNNEL: return("Генератор на туне-\nльном принципе");

        default: return("Неизвестный тип генератора");
        }
    }
Ejemplo n.º 10
0
    public static int cost(this GeneratorType type)
    {
        switch (type)
        {
        case GeneratorType.ATOMIC: return(100);

        case GeneratorType.PLASMA: return(200);

        case GeneratorType.MULTYPHASE: return(300);

        case GeneratorType.TUNNEL: return(400);

        default: return(0);
        }
    }
Ejemplo n.º 11
0
    public static float volume(this GeneratorType type)
    {
        switch (type)
        {
        case GeneratorType.ATOMIC: return(1);

        case GeneratorType.PLASMA: return(1);

        case GeneratorType.MULTYPHASE: return(1);

        case GeneratorType.TUNNEL: return(1);

        default: return(0);
        }
    }
Ejemplo n.º 12
0
    public static string name(this GeneratorType type)
    {
        switch (type)
        {
        case GeneratorType.ATOMIC: return("Атомарный генератор");

        case GeneratorType.PLASMA: return("Плазменный генератор");

        case GeneratorType.MULTYPHASE: return("Мультифазный генератор");

        case GeneratorType.TUNNEL: return("Тунельный генератор");

        default: return("Неизвестный тип генератора");
        }
    }
Ejemplo n.º 13
0
 public T Generate <T>(GeneratorType generatorType, int max)
 {
     if (max == 0)
     {
         new ArgumentNullException("max cannot be zero");
     }
     if (generatorType == GeneratorType.Integer)
     {
         return((T)(object)new Integers.Randomizer(random).Generate(0, max));
     }
     else
     {
         return((T)(object)new Strings.Randomizer(random).Generate(Strings.RandomizerType.Alphabetic, max));
     }
 }
Ejemplo n.º 14
0
        public EditHtmlTemplate(GeneratorType type, string moduleName, string moduleUIName)
        {
            this.Type         = type;
            this.moduleName   = moduleName;
            this.moduleUIName = moduleUIName;

            string attrValueTitle = type.Type.GetAttributeValue((TitleAttribute ta) => ta.Title);

            this.title = $"{attrValueTitle}";

            var properties = type.Type.GetProperties();

            editableProperties   = properties.Where(pi => pi.CustomAttributes.Any(ca => ca.AttributeType == typeof(DisplayAttribute))).ToArray();
            collectionProperties = properties.Where(pi => IsCollection(pi.PropertyType)).ToArray();
        }
Ejemplo n.º 15
0
        public ListHtmlTemplate(GeneratorType type, string moduleName, string moduleUIName)
        {
            this.type         = type;
            this.moduleName   = moduleName;
            this.moduleUIName = moduleUIName;

            string attrValueTitle = type.Type.GetAttributeValue((TitleAttribute ta) => ta.Title);

            this.title = attrValueTitle;

            searchProperty = getNamedArgument <DisplayAttribute>(type.Type.GetProperties().FirstOrDefault(pi => pi.CustomAttributes.Any(ca => ca.AttributeType == typeof(SearchPropertyAttribute))));


            listableProperties = type.Type.GetProperties().Where(pi => pi.CustomAttributes.Any(ca => ca.AttributeType == typeof(DisplayAttribute))).ToArray();
        }
Ejemplo n.º 16
0
    public static Sprite getGeneratorSprite(GeneratorType type)
    {
        switch (type)
        {
        case GeneratorType.ATOMIC: return(generators[0]);

        case GeneratorType.PLASMA: return(generators[1]);

        case GeneratorType.MULTYPHASE: return(generators[2]);

        case GeneratorType.TUNNEL: return(generators[3]);

        default: Debug.Log("Unknown generator type: " + type); return(null);
        }
    }
Ejemplo n.º 17
0
    public static TerrainGenerator makeTG(ScriptableObject opt, GeneratorType type)
    {
        if (type == GeneratorType.Bounds)
        {
            return(new BoundsGen(opt as BoundsGenOpt));
        }
        else if (type == GeneratorType.GeomRidge)
        {
            return(new GeomRidgeGen(opt as GeomRidgeGenOpt));
        }
        else if (type == GeneratorType.Normalise)
        {
            return(new Normalise());
        }
        else if (type == GeneratorType.Ridge)
        {
            return(new RidgeGenerator(opt as RidgeGenOpt));
        }
        else if (type == GeneratorType.SmoothGeometric)
        {
            return(new SmoothGeometric(opt as SmoothGeomOpt));
        }
        else if (type == GeneratorType.YTransform)
        {
            return(new YTransformGen(opt as YTransformOpt));
        }
        else if (type == GeneratorType.MultiplyConform)
        {
            return(new MultiplyConform(opt as MultiplyConformOpt));
        }
        else if (type == GeneratorType.AddConform)
        {
            return(new AddConform(opt as AddConformOpt));
        }
        else if (type == GeneratorType.SmoothStretch)
        {
            return(new SmoothStretchGen(opt as SmoothStrechOpt));
        }
        else if (type == GeneratorType.RidgeStretch)
        {
            return(new RidgeStretchGen(opt as RidgeStretchOpt));
        }


        Debug.Log("something has gone very wrong");
        throw new System.Exception("unknown generator type");
        //return null;
    }
Ejemplo n.º 18
0
    public static NodeBase createNewGenerate(GeneratorType t)
    {
        NodeBase rlt = null;

        if (t == GeneratorType.Const_Value)
        {
            rlt = new NodeConst();
        }
        else if (t == GeneratorType.Noise)
        {
            rlt = new NodePerlin();
        }
        rlt.initInput();
        rlt.guid = Guid.NewGuid().ToString();
        return(rlt);
    }
Ejemplo n.º 19
0
        private ITeamGenerator SelectGeneratorByGeneratorType(GeneratorType type)
        {
            ITeamGenerator generator = null;

            switch (type)
            {
            case GeneratorType.Random:
                generator = new TeamGenerator();
                break;

            case GeneratorType.Manual:
            case GeneratorType.None:
                break;
            }
            return(generator);
        }
Ejemplo n.º 20
0
        public static string GenerateRndString(int uzunluk = 4, GeneratorType generatorType = GeneratorType.AllowAll)
        {
            Random        Rnd           = new Random();
            StringBuilder stringBuilder = new StringBuilder();

            int totalwritten = 0;

            while (totalwritten < uzunluk)
            {
                int skey = Rnd.Next(48, 122);
                if (skey == 94 || skey == 96)
                {
                    skey++;
                }
                if (!char.IsLetterOrDigit((char)skey))
                {
                    continue;
                }
                if (generatorType != GeneratorType.AllowAll)
                {
                    if ((generatorType & GeneratorType.AllowNumeric) == 0)
                    {
                        if (char.IsDigit((char)skey))
                        {
                            continue;
                        }
                    }
                    if ((generatorType & GeneratorType.AllowUpperCaseChar) == 0)
                    {
                        if (char.IsUpper((char)skey))
                        {
                            continue;
                        }
                    }
                    if ((generatorType & GeneratorType.AllowLowerCaseChar) == 0)
                    {
                        if (char.IsLower((char)skey))
                        {
                            continue;
                        }
                    }
                }
                stringBuilder.Append(((char)skey));
                totalwritten++;
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 21
0
        public void AddGenerator(GeneratorType Type)
        {
            if ((Type & GeneratorType.Alpha) != 0)
            {
                Generators.Add(GenerateAlpha);
            }

            if ((Type & GeneratorType.Numeric) != 0)
            {
                Generators.Add(GenerateNumber);
            }

            if ((Type & GeneratorType.Symbols) != 0)
            {
                Generators.Add(GenerateSymbol);
            }
        }
Ejemplo n.º 22
0
        public static IIDGenerator Create(GeneratorType type)
        {
            IIDGenerator generator = null;

            switch (type)
            {
            case GeneratorType.GUID:
                generator = new GUIDGenerator();
                break;

            case GeneratorType.SnowFlak:
                generator = new SnowFlakGenerator();
                break;
            }

            return(generator);
        }
        public DynamicMethodDefinition(MethodBase method, Func <AssemblyName, ModuleDefinition> moduleGen = null)
        {
            string type = Environment.GetEnvironmentVariable("MONOMOD_DMD_TYPE");

            if (!string.IsNullOrEmpty(type))
            {
                try {
                    // TryGet is unavailable.
                    Generator = (GeneratorType)Enum.Parse(typeof(GeneratorType), type, true);
                } catch {
                }
            }
            Debug = Environment.GetEnvironmentVariable("MONOMOD_DMD_DEBUG") == "1";

            Method = method ?? throw new ArgumentNullException(nameof(method));
            Reload(moduleGen);
        }
Ejemplo n.º 24
0
        private static AbstractGenerator.AbstractGenerator GetGenerator(GeneratorType generatorType)
        {
            switch (generatorType)
            {
            case GeneratorType.JMeter:
                return(new JMeterGenerator.JMeterGenerator());

            case GeneratorType.OpenSTA:
                return(new OpenSTAGenerator());

            case GeneratorType.Testing:
                return(new TestingGenerator.TestingGenerator());

            default:
                throw new NotImplementedException("GeneratorType is not implemented: " + generatorType);
            }
        }
Ejemplo n.º 25
0
 public void initWindow(int id, DeleteFunc funDel, SelectFunc funSel)
 {
     winID     = id;
     funDelete = funDel;
     funSelect = funSel;
     rect      = new Rect(0, 0, 128, 128 + 16);
     rect.Set(pos.x, pos.y, rect.width, rect.height);
     tex = new Texture2D(1, 1);
     tex.SetPixel(0, 0, new Color(1, 1, 1));
     generateType       = node.value.getGeneratorType();
     unaryOperatorType  = node.value.getUnaryOperatorType();
     binaryOperatorType = node.value.getBinaryOperatorType();
     //ternaryOperatorType = node.value.getTernaryOperatorType();
     texPort = new Texture2D(1, 1);
     texPort.SetPixel(0, 0, new Color(1, 1, 1));
     texPort.Apply();
 }
Ejemplo n.º 26
0
        public float SetEmissionFactor(GeneratorType generatorType)
        {
            switch (generatorType)
            {
            case GeneratorType.Coal:
                return(0.30f);

            case GeneratorType.Oil:
                return(0.25f);

            case GeneratorType.Gas:
                return(0.25f);

            default:                                    //Wind, Solar, Hydro
                return(0f);
            }
        }
Ejemplo n.º 27
0
        private IFakeGenerator getGenerator(GeneratorType type)
        {
            string typeString = type.ToString();

            if (generators.ContainsKey(typeString))
            {
                return(generators[typeString]);
            }

            Type systemType = Type.GetType(String.Format("{0}.{1}{2}", "DotNetFaker.Generators", typeString, "Generator"));

            IFakeGenerator generator = (IFakeGenerator)Activator.CreateInstance(systemType);

            generator.Random = random;
            generators.Add(typeString, generator);

            return(generators[typeString]);
        }
Ejemplo n.º 28
0
        public void Test_Generator_Is_Created()
        {
            // Arrange
            DateTime dtJustBefore = DateTime.Now; System.Threading.Thread.Sleep(100);

            // Act
            GeneratorType generator = DocumentHelpers.GetDefaultGenerator();

            // Pre-Assert Arrange
            System.Threading.Thread.Sleep(100); DateTime dtJustAfter = DateTime.Now;

            // Assert
            Assert.IsNotNull(generator);
            Assert.IsTrue((generator.timestamp > dtJustBefore) && (generator.timestamp < dtJustAfter));
            Assert.IsFalse(string.IsNullOrEmpty(generator.product_name));
            Assert.IsFalse(string.IsNullOrEmpty(generator.product_version));
            Assert.IsTrue(generator.schema_version >= (decimal)5.6);
        }
Ejemplo n.º 29
0
        public List <T> GenerateList <T>(GeneratorType generatorType, int max)
        {
            List <T> ts = new List <T>();

            if (max == 0)
            {
                new ArgumentNullException("max cannot be zero");
            }
            if (generatorType == GeneratorType.Integer)
            {
                ts.Add((T)(object)new Integers.Randomizer(random).Generate());
            }
            else
            {
                ts.Add((T)(object)new Strings.Randomizer(random).Generate());
            }
            return(ts);
        }
Ejemplo n.º 30
0
    int randInRange(int a, int b, GeneratorType generatorType)
    {
        float val = 0;
        switch(generatorType)
        {
        case GeneratorType.degree:
            val = randInRangeDegree ();
            break;
        case GeneratorType.normal:
            val = randInRangeNormal ();
            break;
        case GeneratorType.perlin:
            perlinNoise ();
            break;
        }

        return (int)Mathf.Round ((b - a) * val) + a;
    }
Ejemplo n.º 31
0
        public Maze Generate(int x, int y, GeneratorType generatorType)
        {
            var dimension = new Dimension((ushort)x, (ushort)y);

            switch (generatorType)
            {
            case GeneratorType.RecursiveSplit:
                return(new RecursiveSplitMazeGenerator(this.rand, dimension).Generate());

            case GeneratorType.Random:
                return(new RandomMazeGenerator(this.rand).Generate(dimension));

            default:
                break;
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 32
0
 public void Append(IEnumerable <GeneratorData> generators, GeneratorType type)
 {
     if (IsLoaded)
     {
         foreach (var gen in generators)
         {
             //GeneratorData newData = new GeneratorData(jsonData, type);
             if (!Generators.ContainsKey(gen.Id))
             {
                 Generators.Add(gen.Id, gen);
             }
             else
             {
                 throw new UnityException($"Repository already contains generator => {gen.Id}");
             }
         }
     }
 }
Ejemplo n.º 33
0
    public static GeneratorData createGeneratorData()
    {
        GeneratorType type = GeneratorType.ATOMIC;

        switch (UnityEngine.Random.Range(0, Enum.GetNames(typeof(GeneratorType)).Length))
        {
        case 0: type = GeneratorType.ATOMIC; break;

        case 1: type = GeneratorType.PLASMA; break;

        case 2: type = GeneratorType.MULTYPHASE; break;

        case 3: type = GeneratorType.TUNNEL; break;

        default: Debug.Log("Unmapped value for generator"); break;
        }
        return(createGeneratorData(type));
    }
Ejemplo n.º 34
0
        public static IHelloWorldGenerator GetHelloWorldGeneratorInstance(GeneratorType type, IMessagePrinter printer)
        {
            IHelloWorldGenerator generator = null;

            switch (type)
            {
            case GeneratorType.Console:
            {
                generator = new HelloWorldGeneratorConsole(printer);
                break;
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
            return(generator);
        }
Ejemplo n.º 35
0
    public void ChangeFeedDisplay(GeneratorType _newFeedType)
    {
        ResetFeed();
        whichItemsToPull = _newFeedType;

        switch (whichItemsToPull)
        {
        case GeneratorType.CHALLENGE_FEED:
            PullAllChallenges();
            FillChallengeFeed();
            break;

        case GeneratorType.COMPLETED_FEED:
            PullCompleted();
            FillChallengeFeed();
            break;

        case GeneratorType.UPCOMING_FEED:
            PullUpcoming();
            FillChallengeFeed();
            break;

        case GeneratorType.REWARD_PAGE:
            PullRewards();
            FillRewardFeed();
            break;

        case GeneratorType.FEEDBACK_PAGE:
            PullFeedback();
            FillFeedbackFeed();
            break;

        case GeneratorType.CHALLENGER_UPCOMING:
            PullChallengerUpcoming();
            FillChallengerFeed();
            break;

        case GeneratorType.CHALLENGER_COMPLETED:
            PullChallengerCompleted();
            FillChallengeFeed();
            break;
        }
    }
Ejemplo n.º 36
0
        private void Init(Entity entity, XmlNode node)
        {
            this.entity = entity;
            if (node != null)
            {
                type        = Parse(Utils.Xml.GetAttrValue(node, "type"));
                startWith   = Utils.Xml.GetAttrValue(node, "startWith", startWith);
                increment   = Utils.Xml.GetAttrValue(node, "startWith", increment);
                hasMaxValue = Utils.Xml.IsAttrExists(node, "maxValue");
                maxValue    = Utils.Xml.GetAttrValue(node, "maxValue", maxValue);
                persistence = new Persistence(this, node);
            }
            else
            {
                persistence = new Persistence(this, entity.Persistence);
            }

            SetMinMax();
        }
Ejemplo n.º 37
0
 public GeneratorManager(GeneratorType type)
 {
     //这里根据传入的类型进行动态构建
     switch (type)
     {
         case GeneratorType.Pdf:
             {
                 generator = new PdfGenerator();
                 break;
             }
         case GeneratorType.Excel:
             {
                 generator = new ExcelGenerator();
                 break;
             }
         default:
             break;
     }
 }
Ejemplo n.º 38
0
        public static IList<string[]> Generate(GeneratorType type, IList<NodeFeature> features)
        {
            IGenerate generator;
            switch (type)
            {
                case GeneratorType.HeaderGenerator:
                    generator = new HeaderGenerator();
                    break;

                case GeneratorType.CodeBehindGenerator:
                    generator = new CodeBehindGenerator();
                    break;

                case GeneratorType.StepDefinitionGenerator:
                    generator = new StepDefinitionGenerator();
                    break;

                default:
                    throw new NotImplementedException();
            }
            return generator.Generate(new MSCppUnitTestLanguageConfig(), features);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Функция создания генератора заданого типа
        /// возвращает интефейс этого генератора
        /// </summary>
        /// <param name="generatorType"></param>
        /// <param name="fA"></param>
        /// <param name="fB"></param>
        /// <returns></returns>
        public static IGen CreateGenerator(GeneratorType generatorType, double fA, double fB)
        {
            switch (generatorType)
            {
                case GeneratorType.Uniform:
                    return new UniformGen(fA, fB);

                case GeneratorType.Normal:
                    return new NormalGen(fA, fB);

                case GeneratorType.Rayleigh:
                    return new RayleighGen(fA);

                case GeneratorType.Gamma:
                    return new GammaGen(fA, fB);

                case GeneratorType.Exponential:
                    return new ExponentialGen(fA);

                default:
                    return new UniformGen(0, 1);
            }
        }
Ejemplo n.º 40
0
 // -------------------------------------------------------------------------------------------------------- UTILITIES
 private void convertIntVarsToEnums()
 {
     switch (erosionTypeInt) {
         case 0:
         erosionType = ErosionType.Thermal;
         break;
         case 1:
         erosionType = ErosionType.Hydraulic;
         break;
         case 2:
         erosionType = ErosionType.Tidal;
         break;
         case 3:
         erosionType = ErosionType.Wind;
         break;
         case 4:
         erosionType = ErosionType.Glacial;
         break;
     }
     switch (hydraulicTypeInt) {
         case 0:
         hydraulicType = HydraulicType.Fast;
         break;
         case 1:
         hydraulicType = HydraulicType.Full;
         break;
         case 2:
         hydraulicType = HydraulicType.Velocity;
         break;
     }
     switch (generatorTypeInt) {
         case 0:
         generatorType = GeneratorType.Voronoi;
         break;
         case 1:
         generatorType = GeneratorType.DiamondSquare;
         break;
         case 2:
         generatorType = GeneratorType.Perlin;
         break;
         case 3:
         generatorType = GeneratorType.Smooth;
         break;
         case 4:
         generatorType = GeneratorType.Normalise;
         break;
     }
     switch (voronoiTypeInt) {
         case 0:
         voronoiType = VoronoiType.Linear;
         break;
         case 1:
         voronoiType = VoronoiType.Sine;
         break;
         case 2:
         voronoiType = VoronoiType.Tangent;
         break;
     }
     switch (neighbourhoodInt) {
         case 0:
         neighbourhood = Neighbourhood.Moore;
         break;
         case 1:
         neighbourhood = Neighbourhood.VonNeumann;
         break;
     }
 }
Ejemplo n.º 41
0
 public void VoronoiGenerator(FeatureType featureType, int cells, float features, float scale, float blend)
 {
     generatorTypeInt = 0;
     generatorType = GeneratorType.Voronoi;
     switch (featureType) {
         case FeatureType.Mountains:
         voronoiTypeInt = 0;
         voronoiType = VoronoiType.Linear;
         break;
         case FeatureType.Hills:
         voronoiTypeInt = 1;
         voronoiType = VoronoiType.Sine;
         break;
         case FeatureType.Plateaus:
         voronoiTypeInt = 2;
         voronoiType = VoronoiType.Tangent;
         break;
     }
     voronoiCells = cells;
     voronoiFeatures = features;
     voronoiScale = scale;
     voronoiBlend = blend;
     GeneratorProgressDelegate generatorProgressDelegate = new GeneratorProgressDelegate(dummyGeneratorProgress);
     generateTerrain(generatorProgressDelegate);
 }
Ejemplo n.º 42
0
        //функция установки параметров генератора
        private bool SetGeneratorParameters(ref GeneratorType iGeneratorType, ref double fGeneratorParamFirst, ref double fGeneratorParamSecond)
        {
            bool bSetResult = false;
            //iGeneratorType = 0;
            //fGeneratorParamFirst = 0.0;
            //fGeneratorParamSecond = 0.0;

            using (generator_params generatorForm = new generator_params(iGeneratorType, fGeneratorParamFirst, fGeneratorParamSecond))
            {
                if (DialogResult.OK == generatorForm.ShowDialog())
                {
                    iGeneratorType = (GeneratorType)generatorForm.Z_comboBox.SelectedIndex;
                    fGeneratorParamFirst = generatorForm.fGeneratorParamFirst;
                    fGeneratorParamSecond = generatorForm.fGeneratorParamSecond;
                    bSetResult = true;
                }
            }

            return bSetResult;
        }
Ejemplo n.º 43
0
 public void FractalGenerator(float fractalDelta, float blend)
 {
     generatorTypeInt = 1;
     generatorType = GeneratorType.DiamondSquare;
     diamondSquareDelta = fractalDelta;
     diamondSquareBlend = blend;
     GeneratorProgressDelegate generatorProgressDelegate = new GeneratorProgressDelegate(dummyGeneratorProgress);
     generateTerrain(generatorProgressDelegate);
 }
Ejemplo n.º 44
0
 public void NormaliseTerrain(float minHeight, float maxHeight, float blend)
 {
     generatorTypeInt = 4;
     generatorType = GeneratorType.Normalise;
     normaliseMin = minHeight;
     normaliseMax = maxHeight;
     normaliseBlend = blend;
     GeneratorProgressDelegate generatorProgressDelegate = new GeneratorProgressDelegate(dummyGeneratorProgress);
     generateTerrain(generatorProgressDelegate);
 }
Ejemplo n.º 45
0
 public IdAttribute(GeneratorType type)
 {
     GeneratorType = type;
 }
Ejemplo n.º 46
0
 public static extern CurandStatus curandCreateGeneratorHost(ref CurandGenerator generator, GeneratorType rng_type);
Ejemplo n.º 47
0
 public void SmoothTerrain(int iterations, float blend)
 {
     generatorTypeInt = 3;
     generatorType = GeneratorType.Smooth;
     smoothIterations = iterations;
     smoothBlend = blend;
     GeneratorProgressDelegate generatorProgressDelegate = new GeneratorProgressDelegate(dummyGeneratorProgress);
     generateTerrain(generatorProgressDelegate);
 }
Ejemplo n.º 48
0
 public void setVoronoiPreset(voronoiPresetData preset)
 {
     generatorTypeInt = 0;
     generatorType = GeneratorType.Voronoi;
     voronoiTypeInt = (int) preset.voronoiType;
     voronoiType = preset.voronoiType;
     voronoiCells = preset.voronoiCells;
     voronoiFeatures = preset.voronoiFeatures;
     voronoiScale = preset.voronoiScale;
     voronoiBlend = preset.voronoiBlend;
 }
Ejemplo n.º 49
0
 public void setPerlinPreset(perlinPresetData preset)
 {
     generatorTypeInt = 2;
     generatorType = GeneratorType.Perlin;
     perlinFrequency = preset.perlinFrequency;
     perlinAmplitude = preset.perlinAmplitude;
     perlinOctaves = preset.perlinOctaves;
     perlinBlend = preset.perlinBlend;
 }
Ejemplo n.º 50
0
 public void setFractalPreset(fractalPresetData preset)
 {
     generatorTypeInt = 1;
     generatorType = GeneratorType.DiamondSquare;
     diamondSquareDelta = preset.diamondSquareDelta;
     diamondSquareBlend = preset.diamondSquareBlend;
 }
Ejemplo n.º 51
0
 public void PerlinGenerator(int frequency, float amplitude, int octaves, float blend)
 {
     generatorTypeInt = 2;
     generatorType = GeneratorType.Perlin;
     perlinFrequency = frequency;
     perlinAmplitude = amplitude;
     perlinOctaves = octaves;
     perlinBlend = blend;
     GeneratorProgressDelegate generatorProgressDelegate = new GeneratorProgressDelegate(dummyGeneratorProgress);
     generateTerrain(generatorProgressDelegate);
 }