Example #1
4
    public EasyLCD(EasyBlocks block, double scale = 1.0)
    {
        this.block = block.GetBlock(0);
        if(this.block.Type() == "Wide LCD panel") this.wPanel = 72;

        this.screen = (IMyTextPanel)(block.GetBlock(0).Block);
        this.fontSize = block.GetProperty<Single>("FontSize");

        this.width = (int)((double)this.wPanel / this.fontSize);
        this.height = (int)((double)this.hPanel / this.fontSize);
        this.buffer = new char[this.width * this.height];
        this.clear();
        this.update();
    }
Example #2
1
 public object WithRefsWithReturn(
     ref string param1,
     ref int param2,
     ref short param3,
     ref long param4,
     ref uint param5,
     ref ushort param6,
     ref ulong param7,
     ref bool param8,
     ref double param9,
     ref decimal param10,
     ref int? param11,
     ref object param12,
     ref char param13,
     ref DateTime param14,
     ref Single param15,
     ref IntPtr param16,
     ref UInt16 param17,
     ref UInt32 param18,
     ref UInt64 param19,
     ref UIntPtr param20
     )
 {
     throw new Exception("Foo");
 }
 public static Single ToSingle(string valueToParse, Single defaultValue)
 {
     Single returnValue;
     if (!Single.TryParse(valueToParse, out returnValue))
         returnValue = defaultValue;
     return returnValue;
 }
 public Vector4(Single x, Single y, Single z, Single w)
 {
     W = w;
     X = x;
     Y = y;
     Z = z;
 }
Example #5
0
 public Trigger()
 {
     Periodical periodical = new Periodical();
     this.periodical = periodical;
     Single single = new Single();
     this.single = single;
 }
    // Update is called once per frame
    void FixedUpdate()
    {
        if (FixedDefaultEquilibriumLength)
            EquilibriumLength = (RemoteAnchor - InitialTranform - Anchor).magnitude;

        var Position = transform.TransformPoint(Anchor);
        var OtherPosition = ConnectedBody.transform.TransformPoint(RemoteAnchor);
        var CurrentLength = (OtherPosition - Position).magnitude;
        var RelaxedDistance = CurrentLength - EquilibriumLength;
        var ForceDirection = (OtherPosition - Position).normalized;
        AppliedForce = ForceDirection * RelaxedDistance * Stiffness;

        ConnectedBody.rigidbody.AddForce(-AppliedForce, ForceMode.Force);
        rigidbody.AddForce(AppliedForce, ForceMode.Force);

        if (ApplyNegativeForce)
        {
            var NextPosition = Position + rigidbody.velocity;
            var NextOtherPosition = OtherPosition + ConnectedBody.rigidbody.velocity;
            var NextLength = (NextOtherPosition - NextPosition).magnitude;
            if (((CurrentLength >= EquilibriumLength) && (NextLength < EquilibriumLength)) ||
                ((CurrentLength <= EquilibriumLength) && (NextLength > EquilibriumLength)))
            {
                rigidbody.AddForce(-rigidbody.velocity, ForceMode.Acceleration);
                ConnectedBody.rigidbody.AddForce(-ConnectedBody.rigidbody.velocity, ForceMode.Acceleration);
            }
        }
    }
 /// <summary>
 /// Constructs a Vector4 from the given Vector2 and a Z and W component.
 /// </summary>
 /// <param name="value">The vector to use as the X and Y components.</param>
 /// <param name="z">The Z component.</param>
 /// <param name="w">The W component.</param>
 public Vector4(Vector2 value, Single z, Single w)
 {
     X = value.X;
     Y = value.Y;
     Z = z;
     W = w;
 }
 /// <summary>
 /// Constructs a Vector4 from the given Vector3 and a W component.
 /// </summary>
 /// <param name="value">The vector to use as the X, Y, and Z components.</param>
 /// <param name="w">The W component.</param>
 public Vector4(Vector3 value, Single w)
 {
     X = value.X;
     Y = value.Y;
     Z = value.Z;
     W = w;
 }
Example #9
0
 public Trigger(String time)
 {
     Preconditions.checkArgument(!String.IsNullOrEmpty(time), "The time must not be empty.");
     Preconditions.checkArgument(StringUtil.IsDateTime(time), "the time is not valid");
     Single single = new Single();
     single.setTime(time);
     this.single = single;
 }
    // Update is called once per frame
    void Update()
    {
        if (GameObject.Find("Player").GetComponent<Player>().GameOver)
            return;

        GameTime += Time.deltaTime;
        Single Score = ((Single)Math.Round (GameTime, 0)) * 1000;
        GameObject.Find ("TimerHudText").GetComponent<Text> ().text = Score.ToString();
    }
Example #11
0
    public override void Initialize(Single Mass)
    {
        base.Initialize(Mass);
        Ram = transform.GetChild(0).gameObject;
        Ram.rigidbody.mass = Mass;
        Ram.GetComponent<FixedJoint>().connectedBody = ConnectedBody;

        UpdateValues();
    }
 public static void Write(this BinaryWriter writer, Single value, bool invertEndian = false)
 {
     if (invertEndian)
     {
         writer.WriteInvertedBytes(BitConverter.GetBytes(value));
     }
     else
     {
         writer.Write(value);
     }
 }
Example #13
0
 /// <summary>
 /// Discrete Fourier transform. Input array of arbitrary size.
 /// </summary>
 /// <param name="input">Input array to be transformed.</param>
 /// <returns>Output Fourier transformed array.</returns>
 public static Single[] DiscreteTransform(Single[] input)
 {
     Single[] result = new Single[input.Length];
     if (input.Length > 0)
     {
         for (int i = 0; i < input.Length; i++)
             for (int j = 0; j < input.Length; j++)
                 result[i] += input[j] * Single.RootOfUnity(input.Length, -i * j);
     }
     return result;
 }
Example #14
0
 /// <summary>
 /// Copies the contents of the vector into the given array, starting from the given index.
 /// </summary>
 /// <exception cref="ArgumentNullException">If array is null.</exception>
 /// <exception cref="RankException">If array is multidimensional.</exception>
 /// <exception cref="ArgumentOutOfRangeException">If index is greater than end of the array or index is less than zero.</exception>
 /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array
 /// or if there are not enough elements to copy.</exception>
 public void CopyTo(Single[] array, int index)
 {
     if (array == null)
         throw new ArgumentNullException("values");
     if (index < 0 || index >= array.Length)
         throw new ArgumentOutOfRangeException(SR.Format(SR.Arg_ArgumentOutOfRangeException, index));
     if ((array.Length - index) < 2)
         throw new ArgumentException(SR.Format(SR.Arg_ElementsInSourceIsGreaterThanDestination, index));
     array[index] = X;
     array[index + 1] = Y;
 }
Example #15
0
    public static void TestCtor()
    {
        Single i = new Single();
        Assert.True(i == 0);

        i = 41;
        Assert.True(i == 41);

        i = (Single)41.3;
        Assert.True(i == (Single)41.3);
    }
Example #16
0
    public void DrawText(String str, Font font, Single offsetX, Single offsetY, TextAnchor anchor)
    {
        if (str == null) return;

        var guiText = GetText();
        guiText.text = str;
        guiText.anchor = anchor;
        guiText.alignment = TextAlignment.Center;
        guiText.font = font;
        guiText.pixelOffset = new Vector2(offsetX - Screen.width * 0.5f, Screen.height * 0.5f - offsetY);
    }
Example #17
0
    public void DrawBar(Texture2D border, Texture2D fill, Single x, Single y, Single w, Single h, Single p)
    {
        Rect bgRect = new Rect(x, y, w, h);
        Rect barRect = new Rect(x + 1, y + 1, (w - 2) * p, h - 2);

        var col = new Color(0.5f, 0.5f, 0.5f, 0.5f);

        if (border != null) DrawTexture(border, bgRect, col);

        DrawTexture(fill, barRect, col);
    }
Example #18
0
    public void Initialize(Rigidbody ConnectedBody, Vector3 Anchor, Vector3 RemoteAnchor, Int32 LinksCount, Single DesiredLengthRate, Single SpringForce, Single DampingRate, Single RopeTotalMass)
    {
        this.ConnectedBody = ConnectedBody;
        this.Anchor = Anchor;
        this.RemoteAnchor = RemoteAnchor;
        this.LinksCount = LinksCount;
        this.SpringForce = SpringForce;
        this.DampingRate = DampingRate;
        this.RopeTotalMass = RopeTotalMass;
        this.DesiredLengthRate = DesiredLengthRate;

        InitializeJoints();
    }
Example #19
0
    public void ChangeBoardSize(Single s)
    {
        int newsize = Constants.BOARDSIZE + (int)s * 2;
        Debug.Log(newsize);
        mainBoard = new Board(newsize);

        Player1 = new Player(Constants.BLACKCOLOR, ref mainBoard, tglBlackAI.GetComponent<Toggle>().isOn);
        Player2 = new Player(Constants.WHITECOLOR, ref mainBoard, tglWhiteAI.GetComponent<Toggle>().isOn);

        txtBoardSize.GetComponent<Text>().text = "Board Size: " + newsize + " x " + newsize;

        CreateBoard();
    }
 public void Update()
 {
     if (active)
     {
         active = false;
         var geometry = new Quad(origin, left, up, size, color);
         var stream = new Single(geometry);
         var factory = new MeshFactory(stream);
         var filter = GetComponent<MeshFilter>();
         filter.mesh = new Mesh();
         factory.Bind(filter.mesh);
   }
 }
Example #21
0
        public void Vector2CopyToTest()
        {
            Vector2 v1 = new Vector2(2.0f, 3.0f);
            Vector2 v2 = new Vector2(4.5f, 6.5f);

            Single[] a = new Single[3];
            Single[] b = new Single[2];
            v1.CopyTo(a, 1);
            v1.CopyTo(b);
            Assert.Equal(0.0, a[0]);
            Assert.Equal(2.0, a[1]);
            Assert.Equal(3.0, a[2]);
            Assert.Equal(2.0, b[0]);
            Assert.Equal(3.0, b[1]);
        }
 public TriggerPayload(String start, String end, String time, String time_unit, int frequency, String[] point)
 {
     Preconditions.checkArgument(!String.IsNullOrEmpty(start), "The start must not be empty.");
     Preconditions.checkArgument(!String.IsNullOrEmpty(end), "The end must not be empty.");
     Preconditions.checkArgument(!String.IsNullOrEmpty(time), "The time must not be empty.");
     Preconditions.checkArgument(!String.IsNullOrEmpty(time_unit), "The time_unit must not be empty.");
     Preconditions.checkArgument(StringUtil.IsNumber(frequency.ToString()), "The frequency must be number.");
     Preconditions.checkArgument(StringUtil.IsDateTime(start), "The start is not valid.");
     Preconditions.checkArgument(StringUtil.IsDateTime(end), "The end is not valid.");
     Preconditions.checkArgument(StringUtil.IsTime(time), "The time must be the right format.");
     Preconditions.checkArgument((0 < frequency && frequency < 101), "The frequency must be less than 100.");
     Preconditions.checkArgument(StringUtil.IsTimeunit(time_unit), "The time_unit must be the right format.");
     this.single = null;
     this.periodical = new Periodical(start, end, time, time_unit, frequency, point);
 }
Example #23
0
        public void Vector3CopyToTest()
        {
            Vector3 v1 = new Vector3(2.0f, 3.0f, 3.3f);

            Single[] a = new Single[4];
            Single[] b = new Single[3];
            v1.CopyTo(a, 1);
            v1.CopyTo(b);
            Assert.Equal(0.0f, a[0]);
            Assert.Equal(2.0f, a[1]);
            Assert.Equal(3.0f, a[2]);
            Assert.Equal(3.3f, a[3]);
            Assert.Equal(2.0f, b[0]);
            Assert.Equal(3.0f, b[1]);
            Assert.Equal(3.3f, b[2]);
        }
	private void WorkOnInstanceAndLocal_1()
	{
		Single localDouble; int i, j;
                for ( i = 0; i < 100; i++ )
                {
                   int index = randomNumGen.Next(0, ValueArraySize); 
		   instanceInt_1 = ValueArray[index];
                   Thread.Sleep(index);  
                   localDouble = instanceInt_1; 
                   for ( j = 0; j < ValueArraySize; j++ )
                     if ( ValueArray[j].CompareTo(localDouble) == 0 )
                          break;
                   if (j == ValueArraySize )
                     throw new Exception("WorkOnInstanceAndLocal: Atomicity of Read/Write violated - " + localDouble);
                }	
	}
    public CleaningType addNewCType(string title, string desc, Single val)
    {
        CleaningType c = new CleaningType();

        if (title != "" && title != null && desc != "" && desc != null && val > 0)
        {
            c.name = title;
            c.cTypeValue = val;
            c.description = desc;
            db.CleaningTypes.AddObject(c);
            db.SaveChanges();
            return c;
        }
        else
            return c;
    }
Example #26
0
 /// <summary>
 /// Copies the contents of the vector into the given array, starting from the given index.
 /// </summary>
 /// <exception cref="ArgumentNullException">If array is null.</exception>
 /// <exception cref="RankException">If array is multidimensional.</exception>
 /// <exception cref="ArgumentOutOfRangeException">If index is greater than end of the array or index is less than zero.</exception>
 /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array
 /// or if there are not enough elements to copy.</exception>
 public void CopyTo(Single[] array, int index)
 {
     if (array == null)
     {
         // Match the JIT's exception type here. For perf, a NullReference is thrown instead of an ArgumentNull.
         throw new NullReferenceException(SR.Arg_NullArgumentNullRef);
     }
     if (index < 0 || index >= array.Length)
     {
         throw new ArgumentOutOfRangeException(SR.Format(SR.Arg_ArgumentOutOfRangeException, index));
     }
     if ((array.Length - index) < 2)
     {
         throw new ArgumentException(SR.Format(SR.Arg_ElementsInSourceIsGreaterThanDestination, index));
     }
     array[index] = X;
     array[index + 1] = Y;
 }
    public void Update()
    {
        TimeElapsed += Time.deltaTime;

        if (TargetUnit.IsDestroyed)
            GameObject.Destroy(gameObject);

        var age = Mathf.Clamp01(TimeElapsed / FlightDuration);
        var pos = Vector3.Lerp(StartPoint, TargetUnit.collider.bounds.center, age);

        gameObject.transform.rotation = Quaternion.LookRotation(pos - transform.position);
        gameObject.transform.position = pos;

        if (age > 0.99f)
        {
            TargetUnit.ModifyHealth(-WeaponSource.Damage, AttackingUnit, WeaponSource);
            GameObject.Destroy(gameObject);
        }
    }
    public Area addNewArea(string from, string to, Single mult)
    {
        Area tmp = new Area();

        // check if all data is correct
        if ( from != null && from != "" &&
            to != null && to!= "" &&
            mult > 0 && Convert.ToInt32(to) > Convert.ToInt32(from))
        {
            tmp.fromMin = from;
            tmp.toMax = to;
            tmp.areaVal = mult;
            db.Areas.AddObject(tmp);
        }
        else
            tmp = null;

        db.SaveChanges();

        return tmp;
    }
    public void Initialize(Rigidbody ConnectedBody, Vector3 Anchor, Vector3 RemoteAnchor, Single Stiffness, Boolean ApplyNegativeForce, Single EquilibriumLength = -1)
    {
        InitialTranform = transform.parent.localPosition + transform.localPosition;

        this.ConnectedBody = ConnectedBody;
        this.Anchor = Anchor;
        this.RemoteAnchor = RemoteAnchor;
        this.Stiffness = Stiffness;
        this.ApplyNegativeForce = ApplyNegativeForce;

        if (EquilibriumLength == -1)
        {
            this.EquilibriumLength = (RemoteAnchor - transform.parent.localPosition - transform.localPosition - Anchor).magnitude;
            this.FixedDefaultEquilibriumLength = true;
        }
        else
        {
            this.EquilibriumLength = EquilibriumLength;
            this.FixedDefaultEquilibriumLength = false;
        }
    }
    private void Update()
    {
        Timer -= Time.deltaTime;

        if (Fury.Behaviors.Manager.Instance == null || Fury.Behaviors.Manager.Instance.GameState != Fury.GameStates.Playing)
            return;

        if (Timer < 0)
        {
            Timer = 0.25f;

            var self = GetComponent<Fury.Behaviors.Unit>();

            if (self == null || self.IsDestroyed) return;
            if (self.Properties.Weapon == null) return;

            Fury.Behaviors.Unit closest = null;
            var minDist = self.Properties.Weapon.Range * 0.9f;

            foreach (var cmdr in Fury.Behaviors.Manager.Instance.Commanders)
                if (!self.IsTeamOrNeutral(cmdr))
                    foreach (var unit in cmdr.Units.Values)
                    {
                        var dist = Vector3.Distance(unit.transform.position, self.transform.position);
                        if (dist < minDist)
                        {
                            minDist = dist;
                            closest = unit;
                        }
                    }

            if (closest != null)
            {
                self.Order(closest);
            }
        }
    }
        /// <summary>
        /// Special handling for whether or not we want to cache an object that's not in LoS
        /// </summary>
        /// <param name="c_diaObject"></param>
        /// <param name="AddToCache"></param>
        /// <returns></returns>
        private static bool RefreshStepIgnoreLoS(bool AddToCache = false)
        {
            try
            {
                if (CurrentCacheObject.Type == GObjectType.Item || CurrentCacheObject.Type == GObjectType.Gold)
                {
                    return(true);
                }

                if (!DataDictionary.AlwaysRaycastWorlds.Contains(Trinity.Player.WorldID))
                {
                    // Bounty Objectives should always be on the weight list
                    if (CurrentCacheObject.IsBountyObjective)
                    {
                        return(true);
                    }

                    // Quest Monsters should get LoS white-listed
                    if (CurrentCacheObject.IsQuestMonster)
                    {
                        return(true);
                    }

                    // Always LoS Units during events
                    if (CurrentCacheObject.Type == GObjectType.Unit && Player.InActiveEvent)
                    {
                        return(true);
                    }
                }
                // Everything except items and the current target
                if (CurrentCacheObject.RActorGuid != LastTargetRactorGUID && CurrentCacheObject.Type != GObjectType.Unknown)
                {
                    if (CurrentCacheObject.Distance < 95)
                    {
                        using (new PerformanceLogger("RefreshLoS.2"))
                        {
                            // Get whether or not this RActor has ever been in a path line with AllowWalk. If it hasn't, don't add to cache and keep rechecking
                            if (!CacheData.HasBeenRayCasted.TryGetValue(CurrentCacheObject.RActorGuid, out c_HasBeenRaycastable) || DataDictionary.AlwaysRaycastWorlds.Contains(Trinity.Player.WorldID))
                            {
                                if (CurrentCacheObject.Distance >= 1f && CurrentCacheObject.Distance <= 5f)
                                {
                                    c_HasBeenRaycastable = true;
                                    if (!CacheData.HasBeenRayCasted.ContainsKey(CurrentCacheObject.RActorGuid))
                                    {
                                        CacheData.HasBeenRayCasted.Add(CurrentCacheObject.RActorGuid, c_HasBeenRaycastable);
                                    }
                                }
                                else if (Settings.Combat.Misc.UseNavMeshTargeting)
                                {
                                    Vector3 myPos = new Vector3(Player.Position.X, Player.Position.Y, Player.Position.Z + 8f);
                                    Vector3 cPos  = new Vector3(CurrentCacheObject.Position.X, CurrentCacheObject.Position.Y, CurrentCacheObject.Position.Z + 8f);
                                    cPos = MathEx.CalculatePointFrom(cPos, myPos, CurrentCacheObject.Radius + 1f);

                                    if (Single.IsNaN(cPos.X) || Single.IsNaN(cPos.Y) || Single.IsNaN(cPos.Z))
                                    {
                                        cPos = CurrentCacheObject.Position;
                                    }

                                    if (!NavHelper.CanRayCast(myPos, cPos))
                                    {
                                        AddToCache      = false;
                                        c_IgnoreSubStep = "UnableToRayCast";
                                    }
                                    else
                                    {
                                        c_HasBeenRaycastable = true;
                                        if (!CacheData.HasBeenRayCasted.ContainsKey(CurrentCacheObject.RActorGuid))
                                        {
                                            CacheData.HasBeenRayCasted.Add(CurrentCacheObject.RActorGuid, c_HasBeenRaycastable);
                                        }
                                    }
                                }
                                else
                                {
                                    if (c_ZDiff > 14f)
                                    {
                                        AddToCache      = false;
                                        c_IgnoreSubStep = "LoS.ZDiff";
                                    }
                                    else
                                    {
                                        c_HasBeenRaycastable = true;
                                        if (!CacheData.HasBeenRayCasted.ContainsKey(CurrentCacheObject.RActorGuid))
                                        {
                                            CacheData.HasBeenRayCasted.Add(CurrentCacheObject.RActorGuid, c_HasBeenRaycastable);
                                        }
                                    }
                                }
                            }
                        }
                        using (new PerformanceLogger("RefreshLoS.3"))
                        {
                            // Get whether or not this RActor has ever been in "Line of Sight" (as determined by Demonbuddy). If it hasn't, don't add to cache and keep rechecking
                            if (!CacheData.HasBeenInLoS.TryGetValue(CurrentCacheObject.RActorGuid, out c_HasBeenInLoS) || DataDictionary.AlwaysRaycastWorlds.Contains(Trinity.Player.WorldID))
                            {
                                // Ignore units not in LoS except bosses
                                if (!CurrentCacheObject.IsBoss && !c_diaObject.InLineOfSight)
                                {
                                    AddToCache      = false;
                                    c_IgnoreSubStep = "NotInLoS";
                                }
                                else
                                {
                                    c_HasBeenInLoS = true;
                                    if (!CacheData.HasBeenInLoS.ContainsKey(CurrentCacheObject.RActorGuid))
                                    {
                                        CacheData.HasBeenInLoS.Add(CurrentCacheObject.RActorGuid, c_HasBeenInLoS);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        AddToCache      = false;
                        c_IgnoreSubStep = "LoS-OutOfRange";
                    }


                    // always set true for bosses nearby
                    if (CurrentCacheObject.IsBoss || CurrentCacheObject.IsQuestMonster || CurrentCacheObject.IsBountyObjective)
                    {
                        AddToCache      = true;
                        c_IgnoreSubStep = "";
                    }
                    // always take the current target even if not in LoS
                    if (CurrentCacheObject.RActorGuid == LastTargetRactorGUID)
                    {
                        AddToCache      = true;
                        c_IgnoreSubStep = "";
                    }
                }

                // Simple whitelist for LoS
                if (DataDictionary.LineOfSightWhitelist.Contains(CurrentCacheObject.ActorSNO))
                {
                    AddToCache      = true;
                    c_IgnoreSubStep = "";
                }
                // Always pickup Infernal Keys whether or not in LoS
                if (DataDictionary.ForceToItemOverrideIds.Contains(CurrentCacheObject.ActorSNO))
                {
                    AddToCache      = true;
                    c_IgnoreSubStep = "";
                }
            }
            catch (Exception ex)
            {
                AddToCache      = true;
                c_IgnoreSubStep = "IgnoreLoSException";
                Logger.Log(TrinityLogLevel.Debug, LogCategory.CacheManagement, "{0}", ex);
            }
            return(AddToCache);
        }
Example #32
0
 public void CustomLength(Single length)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(length);
     Invoker.Method(this, "CustomLength", paramsArray);
 }
Example #33
0
		public WoodcuttingSkill(Single startingLevel) : base(startingLevel)
		{
			
		}
Example #34
0
        /// <summary>
        /// Write float to output stream.
        /// </summary>
        /// <param name="value">value to write.</param>
        public void WriteSingle(Single value)
        {
            Int32 v = BitConverter.SingleToInt32Bits(value);

            this.writer.Write(IPAddress.HostToNetworkOrder(v));
        }
 /// <summary>
 /// input is not included
 /// </summary>
 /// <param name="input"></param>
 /// <param name="windowedBuffer"></param>
 /// <param name="iteration"></param>
 /// <param name="output"></param>
 private protected override void TransformCore(ref Single input, FixedSizeQueue <Single> windowedBuffer, long iteration, ref Single output)
 {
     if (_weights == null)
     {
         output = ComputeMovingAverageUniform(windowedBuffer, input, _lag, _lastDroppedValue, ref _currentSum, ref _initUniformMovingAverage, ref _nbNanValues);
     }
     else
     {
         output = ComputeMovingAverageNonUniform(windowedBuffer, input, _weights, _lag);
     }
     _lastDroppedValue = windowedBuffer[0];
 }
Example #36
0
 public static void FF9ShadowSetOffsetWorld(Int32 uid, Single xOffset, Single zOffset)
 {
     global::Debug.LogError("Not implement FF9ShadowSetOffsetWorld");
 }
Example #37
0
 public static Single Min(Single x, Single y) => (x < y ? x : y);
Example #38
0
        /// <summary>
        /// This function computes the efficient Hankelization of the matrix sigma * u * v' using Fast Fourier Transform in in O((L + K) * log(L + K)).
        /// For details, refer to Algorithm 4 in http://arxiv.org/pdf/0911.4498.pdf.
        /// </summary>
        /// <param name="u">The u vector</param>
        /// <param name="v">The v vector</param>
        /// <param name="sigma">The scalar coefficient</param>
        /// <param name="result">The output series</param>
        /// <param name="add">Whether the hankelization result should be added to the current value in result</param>
        /// <param name="uIndex">The starting index for the u vector argument</param>
        /// <param name="vIndex">The starting index for the v vector argument</param>
        /// <param name="dstIndex">The starting index for the result</param>
        /// <param name="start">The staring index of the series to be reconstructed (by default zero)</param>
        /// <param name="end">The ending index of the series to be reconstructed (by default series length)</param>
        private void FftRankOneHankelization(Single[] u, Single[] v, Single sigma, Single[] result, bool add = false,
                                             int uIndex = 0, int vIndex = 0, int dstIndex = 0, int?start = null, int?end = null)
        {
            int s;
            int e;
            int us;
            int ue;
            int vs;
            int ve;
            int i;

            s = start ?? 0;
            e = end ?? _seriesLength - 1;

            ComputeBoundryIndices(s, e, out us, out ue, out vs, out ve);
            _ectx.Assert(0 <= ue && ue < _windowSize);
            _ectx.Assert(0 <= us && us <= ue);
            _ectx.Assert(0 <= ve && ve < _k);
            _ectx.Assert(0 <= vs && vs <= ve);

            var len = e - s + 1;

            _ectx.Assert(uIndex >= 0);
            _ectx.Assert(vIndex >= 0);
            _ectx.Assert(dstIndex >= 0);
            _ectx.Assert(Utils.Size(u) >= _windowSize + uIndex);
            _ectx.Assert(Utils.Size(v) >= _k + vIndex);
            _ectx.Assert(Utils.Size(result) >= len + dstIndex);
            _ectx.Assert(!Single.IsNaN(sigma));
            _ectx.Assert(!Single.IsInfinity(sigma));

            if (!_isSeriesFftCached)
            {
                CacheInputSeriesFft();
            }

            // Computing the FFT of u
            for (i = us; i <= ue; ++i)
            {
                _inputRe[i - us] = u[i + uIndex];
            }

            for (i = ue + 1; i < len + us; ++i)
            {
                _inputRe[i - us] = 0;
            }

            FftUtils.ComputeForwardFft(_inputRe, _allZerosIm, _outputRe, _outputIm, len);

            // Computing the FFT of v
            for (i = vs; i <= ve; ++i)
            {
                _inputRe[i - vs] = v[i + vIndex];
            }

            for (i = ve + 1; i < len + vs; ++i)
            {
                _inputRe[i - vs] = 0;
            }

            FftUtils.ComputeForwardFft(_inputRe, _allZerosIm, _inputRe, _allZerosIm, len);

            // Computing the element-by-element product in the Fourier space
            double re;
            double im;

            for (i = 0; i < len; ++i)
            {
                re = _outputRe[i];
                im = _outputIm[i];

                _outputRe[i] = _inputRe[i] * re - _allZerosIm[i] * im;
                _outputIm[i] = _inputRe[i] * im + _allZerosIm[i] * re;
            }

            // Setting _allZerosIm to 0's again
            for (i = 0; i < _seriesLength; ++i)
            {
                _allZerosIm[i] = 0;
            }

            // Computing the inverse FFT of the result
            FftUtils.ComputeBackwardFft(_outputRe, _outputIm, _outputRe, _outputIm, len);

            // Generating the output
            int a = Math.Min(ue - us + 1, ve - vs + 1);

            if (add)
            {
                for (i = 0; i < a; ++i)
                {
                    result[i + dstIndex] += RoundUpToReal(_outputRe[i], _outputIm[i], sigma / (i + 1));
                }

                for (i = a; i < len - a + 1; ++i)
                {
                    result[i + dstIndex] += RoundUpToReal(_outputRe[i], _outputIm[i], sigma / a);
                }

                for (i = len - a + 1; i < len; ++i)
                {
                    result[i + dstIndex] += RoundUpToReal(_outputRe[i], _outputIm[i], sigma / (len - i));
                }
            }
            else
            {
                for (i = 0; i < a; ++i)
                {
                    result[i + dstIndex] = RoundUpToReal(_outputRe[i], _outputIm[i], sigma / (i + 1));
                }

                for (i = a; i < len - a + 1; ++i)
                {
                    result[i + dstIndex] = RoundUpToReal(_outputRe[i], _outputIm[i], sigma / a);
                }

                for (i = len - a + 1; i < len; ++i)
                {
                    result[i + dstIndex] = RoundUpToReal(_outputRe[i], _outputIm[i], sigma / (len - i));
                }
            }
        }
Example #39
0
        /// <summary>
        /// This function computes the naive Hankelization of the matrix sigma * u * v' in O(L * K).
        /// </summary>
        /// <param name="u">The u vector</param>
        /// <param name="v">The v vector</param>
        /// <param name="sigma">The scalar coefficient</param>
        /// <param name="result">The output series</param>
        /// <param name="add">Whether the hankelization result should be added to the current value in result</param>
        /// <param name="uIndex">The starting index for the u vector argument</param>
        /// <param name="vIndex">The starting index for the v vector argument</param>
        /// <param name="dstIndex">The starting index for the result</param>
        /// <param name="start">The staring index of the series to be reconstructed (by default zero)</param>
        /// <param name="end">The ending index of the series to be reconstructed (by default series length)</param>
        private void NaiveRankOneHankelization(Single[] u, Single[] v, Single sigma, Single[] result, bool add = false,
                                               int uIndex = 0, int vIndex = 0, int dstIndex = 0, int?start = null, int?end = null)
        {
            int s;
            int e;
            int us;
            int ue;
            int vs;
            int ve;

            s = start ?? 0;
            e = end ?? _seriesLength - 1;

            ComputeBoundryIndices(s, e, out us, out ue, out vs, out ve);
            _ectx.Assert(0 <= ue && ue < _windowSize);
            _ectx.Assert(0 <= us && us <= ue);
            _ectx.Assert(0 <= ve && ve < _k);
            _ectx.Assert(0 <= vs && vs <= ve);

            var len  = e - s + 1;
            var uLen = ue - us + 1;
            var vLen = ve - vs + 1;

            _ectx.Assert(uIndex >= 0);
            _ectx.Assert(vIndex >= 0);
            _ectx.Assert(dstIndex >= 0);
            _ectx.Assert(Utils.Size(u) >= _windowSize + uIndex);
            _ectx.Assert(Utils.Size(v) >= _k + vIndex);
            _ectx.Assert(Utils.Size(result) >= len + dstIndex);
            _ectx.Assert(!Single.IsNaN(sigma));
            _ectx.Assert(!Single.IsInfinity(sigma));

            int    i;
            int    j;
            int    a;
            int    b;
            int    c;
            Single temp;

            if (!add)
            {
                for (i = 0; i < len; ++i)
                {
                    result[i + dstIndex] = 0;
                }
            }

            for (i = 0; i < len; ++i)
            {
                b    = Math.Min(uLen, i + 1) - 1;
                a    = i >= Math.Max(uLen, vLen) ? len - i : b + 1;
                c    = Math.Max(0, i - uLen + 1);
                temp = 0;
                for (j = 0; j < a; ++j)
                {
                    temp += u[us + b - j + uIndex] * v[vs + c + j + vIndex];
                }

                result[i + dstIndex] += (temp * sigma / a);
            }
        }
 public static void DrawCircle(Graphics g, Pen p, Single x, Single y, Single radius)
 {
     g.DrawEllipse(p, x - radius, y - radius, radius * 2, radius * 2);
 }
 public static void FillCircle(BaseGameModel model, Graphics g, Brush b, Single xCenterLog, Single yCenterLog, Single radiusLog, Boolean ignoreCameraPosition)
 {
     //PointF logPoint = new PointF(xCenterLog, yCenterLog);
     //PointF dispPoint = model.Camera.MapLogicalToDisplay(logPoint, ignoreCameraPosition);
     //Double scale = model.Camera.GetScale(ignoreCameraPosition);
     //Single radiusDisp = (Single)(radiusLog * scale);
     //g.FillEllipse(b, dispPoint.X - radiusDisp, dispPoint.Y - radiusDisp, radiusDisp * 2, radiusDisp * 2);
 }
Example #42
0
        private void DrawSectionPart()
        {
            try
            {
                if (m_SectionLine == null)
                {
                    return;
                }
                if (m_SurFace == null)
                {
                    return;
                }

                IGeometry pGeometry = new PolylineClass();
                object    pObject   = 1;
                m_SurFace.InterpolateShape(m_SectionLine, out pGeometry, ref pObject);
                IGroupElement pGroup = null;
                ////用于绘制三维效果
                ClsMarkDraw.AddSimpleGraphic(pGeometry, ClsMarkDraw.getRGB(71, 61, 255), 2, sPolyOutlineName, m_pMapControlDefault.Map, pGroup);
                m_pMapControlDefault.Refresh(esriViewDrawPhase.esriViewBackground, null, null);

                double dblLength;
                object StepSize = Type.Missing;;
                m_SurFace.QuerySurfaceLength(pGeometry, out dblLength, ref StepSize);
                txtSurfaceLengh.Text = dblLength.ToString();
                IPolyline pLine = pGeometry as IPolyline;
                txtPreject.Text = pLine.Length.ToString();
                txtZmax.Text    = pLine.Envelope.ZMax.ToString();
                txtZmin.Text    = pLine.Envelope.ZMin.ToString();
                IPointCollection pPointCol = pLine as IPointCollection;
                IPolyline        pPolyline2;
                IPointCollection pPointCol2 = new PolylineClass();
                int    lLOOP;
                double dblminY, dblPery, dblPerx, dblMaxY;
                dblminY = pLine.Envelope.ZMin;
                dblMaxY = pLine.Envelope.ZMax;
                if ((pLine.Envelope.ZMax - pLine.Envelope.ZMin) == 0)
                {
                    return;
                }
                if (pLine.Length == 0)
                {
                    return;
                }

                //重新绘制底图
                Image    pImage  = new Bitmap(442, 230);
                Graphics m_mouse = Graphics.FromImage(pImage);
                //m_mouse.FillRectangle(Brushes.White,0,0,460,240);
                Pen pen1 = new Pen(Color.Black, 1);

                //绘制横坐标、纵坐标及其他两条边
                m_mouse.DrawLine(pen1, new PointF(55, 210), new PointF(55, 6));
                m_mouse.DrawLine(pen1, new PointF(55, 210), new PointF(431, 210));
                m_mouse.DrawLine(pen1, new PointF(55, 6), new PointF(431, 6));
                m_mouse.DrawLine(pen1, new PointF(431, 6), new PointF(431, 210));

                //Brush pBrush = new HatchBrush(HatchStyle.Percent70, Color.WhiteSmoke);
                m_mouse.FillRectangle(Brushes.White, 56, 7, 375, 203);       //填充区域及背景图
                //
                dblPery = 200 / (pLine.Envelope.ZMax - pLine.Envelope.ZMin); //将纵坐标的高度分线段的高程差段
                dblPerx = 368 / pLine.Length;                                //将横坐标的宽度分成线段长度份
                double x, y, x1, y1;
                x = 0;
                y = 0;
                object before = Type.Missing;
                object after  = Type.Missing;
                Pen    pen3   = new Pen(Color.Red, 2);

                Font         drawFont   = new Font("宋体", 8.0f, FontStyle.Regular);
                StringFormat drawFormat = new StringFormat();
                Brush        drawBrush  = new SolidBrush(Color.Black);

                drawFormat.FormatFlags = StringFormatFlags.DisplayFormatControl;
                //绘制横坐标刻度值
                for (int i = 0; i <= 4; i++)
                {
                    if (i == 0)
                    {
                        m_mouse.DrawString(i.ToString(), drawFont, Brushes.Black, new PointF(52, 214), drawFormat);
                    }
                    else
                    {
                        Single Lenvlae = Convert.ToSingle((pLine.Length / 4) * i);
                        m_mouse.DrawLine(pen1, new PointF(55 + 92 * i, 210), new PointF(55 + 92 * i, 214));
                        m_mouse.DrawString(Lenvlae.ToString(), drawFont, drawBrush, new PointF(20 + 92 * i, 215), drawFormat);
                    }
                }

                //绘制纵坐标刻度值
                for (int i = 1; i <= 10; i++)
                {
                    m_mouse.DrawLine(pen1, new PointF(55, 210 - 20 * i), new PointF(51, 210 - 20 * i));
                    Pen pen = new Pen(Color.Black, 1);
                    pen.DashStyle = DashStyle.Dot;
                    m_mouse.DrawLine(pen, new PointF(55, 210 - 20 * i), new PointF(431, 210 - 20 * i));
                    Single Lenvlae = Convert.ToSingle((((dblMaxY - dblminY) / 10) * i) + dblminY);
                    m_mouse.DrawString(Lenvlae.ToString(), drawFont, Brushes.Black, new PointF(1, 210 - 21 * i), drawFormat);
                }

                for (lLOOP = 0; lLOOP < pPointCol.PointCount; lLOOP++)
                {
                    pPointCol2.AddPoint(pPointCol.get_Point(lLOOP), ref before, ref after);
                    pPolyline2 = pPointCol2 as IPolyline;
                    x1         = pPolyline2.Length * dblPerx + 57; //37为坐标图在pictureBox1中离左边的距离
                    y1         = 210 - ((pPointCol.get_Point(lLOOP).Z - pLine.Envelope.ZMin) * dblPery);
                    if (lLOOP == 0)                                //绘制起点
                    {
                        SolidBrush pSolidBrush = new SolidBrush(Color.Blue);
                        m_mouse.FillEllipse(pSolidBrush, Convert.ToSingle(x1 - 2), Convert.ToSingle(y1 - 2), 6, 6);
                    }
                    if (lLOOP > 0)
                    {
                        //绘制沿线高程变化线
                        m_mouse.DrawLine(pen3, new PointF(Convert.ToSingle(x), Convert.ToSingle(y)), new PointF(Convert.ToSingle(x1), Convert.ToSingle(y1)));
                    }

                    if (lLOOP == pPointCol.PointCount - 1)//绘制终点
                    {
                        SolidBrush pSolidBrush = new SolidBrush(Color.Green);
                        m_mouse.FillEllipse(pSolidBrush, Convert.ToSingle(x1 - 2), Convert.ToSingle(y1 - 2), 6, 6);
                    }
                    x = x1;
                    y = y1;
                }

                pictureBox1.Image = pImage;
                m_mouse.Dispose();
                drawFont.Dispose();
                drawBrush.Dispose();
            }
            catch
            {
                return;
            }
        }
Example #43
0
            public static void GenerateScaledSpace(CelestialBody body, Mesh meshinput)
            {
                PQS    bodyPQS       = body.pqsController;
                Single joolScaledRad = 1000f;
                Single joolRad       = 6000000f;
                Single scale         = (float)bodyPQS.radius / joolScaledRad;

                Vector3[] vertices = new Vector3[meshinput.vertices.Count()];

                // One could use pqs.radiusMin and pqs.radiusMax to determine minimum and maximum height.
                // But to be safe, the height limit values will be determined manually.
                Single radiusMin = 0;
                Single radiusMax = 0;

                bodyPQS.isBuildingMaps = true;
                for (Int32 i = 0; i < meshinput.vertices.Count(); i++)
                {
                    Vector3 vertex  = meshinput.vertices[i];
                    Single  rootrad = (float)Math.Sqrt(vertex.x * vertex.x +
                                                       vertex.y * vertex.y +
                                                       vertex.z * vertex.z);
                    Single localRadius = (float)bodyPQS.GetSurfaceHeight(vertex) / scale;
                    vertices[i] = vertex * (localRadius / rootrad);

                    if (i == 0)
                    {
                        radiusMin = radiusMax = localRadius;
                    }
                    else
                    {
                        if (radiusMin > localRadius)
                        {
                            radiusMin = localRadius;
                        }
                        if (radiusMax < localRadius)
                        {
                            radiusMax = localRadius;
                        }
                    }
                }
                bodyPQS.isBuildingMaps = false;

                // Adjust the mesh so the maximum radius has 1000 unit in scaled space.
                // (so the planets will fit in the science archive list)
                Single r = radiusMax / 1000;

                for (Int32 i = 0; i < vertices.Count(); i++)
                {
                    vertices[i] /= r;
                }

                // Use the lowest radius as collision radius.
                Single radius = radiusMin / r;

                // Calculate the local scale.
                Vector3 localScale = Vector3.one * ((float)bodyPQS.radius / joolRad) * r;

                // Apply the mesh to ScaledSpace
                MeshFilter     meshfilter = body.scaledBody.GetComponent <MeshFilter>();
                SphereCollider collider   = body.scaledBody.GetComponent <SphereCollider>();

                meshfilter.sharedMesh.vertices = vertices;
                meshfilter.sharedMesh.RecalculateNormals();
                Utility.RecalculateTangents(meshfilter.sharedMesh);
                collider.radius = radius;
                body.scaledBody.transform.localScale = localScale;

                // Serialize
                Directory.CreateDirectory(KSPUtil.ApplicationRootPath + Body.ScaledSpaceCacheDirectory);
                Utility.SerializeMesh(meshfilter.sharedMesh, KSPUtil.ApplicationRootPath + Body.ScaledSpaceCacheDirectory + "/" + body.name + ".bin");
            }
 public void OneColorGradient(NetOffice.OfficeApi.Enums.MsoGradientStyle style, Int32 variant, Single degree)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(style, variant, degree);
     Invoker.Method(this, "OneColorGradient", paramsArray);
 }
Example #45
0
 public static void FF9ShadowSetOffsetField(Int32 uid, Single xOffset, Single zOffset)
 {
     FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].xOffset = xOffset;
     FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].zOffset = zOffset;
 }
Example #46
0
 public LinkedHashMap(Int32 initialCapacity, Single loadFactor, Boolean accessOrder) : this(initialCapacity) { }
 private protected override void SetNaOutput(ref Single output)
 {
     output = Single.NaN;
 }
Example #48
0
 /// <summary>
 /// Creates a new percentage value.
 /// </summary>
 /// <param name="value">The value in percent (0 to 100).</param>
 public Percent(Single value)
 {
     _value = value;
 }
Example #49
0
 public Point2F(Single x, Single y)
 {
     this.X = x;
     this.Y = y;
 }
 internal void WriteSingle(Single value)
 {
     dataWriter.Write(value);
 }
Example #51
0
 public static Boolean TryParseSingle(String value, NumberStyles options, IFormatProvider provider, out Single result)
 {
     return(FormatProvider.Number.TryParseSingle(value, options, provider, out result));
 }
Example #52
0
        /// <summary>
        /// Converts the value into the column type.
        /// </summary>
        /// <param name="value">Value to use</param>
        /// <param name="result">Object to hold the converted value.</param>
        /// <returns>true if the conversion was successful, otherwise false.</returns>
        public bool TryConvert(string value, out object result)
        {
            bool converted;

            switch (typeName)
            {
            case "Guid":
                try
                {
                    result    = new Guid(value);
                    converted = true;
                }
                catch
                {
                    result    = Guid.Empty;
                    converted = false;
                }
                break;

            case "Byte[]":
            {
                try
                {
                    result    = System.Convert.FromBase64String(value);
                    converted = true;
                }
                catch
                {
                    result    = new byte[0];
                    converted = false;
                }
            }
            break;

            case "Boolean":
            {
                int x;
                converted = Int32.TryParse(value, NumberStyles, Culture, out x);
                if (converted)
                {
                    result = x != 0;
                }
                else
                {
                    bool y;
                    converted = Boolean.TryParse(value, out y);
                    result    = y;
                }
            }
            break;

            case "Int32":
            {
                int x;
                converted = Int32.TryParse(value, NumberStyles, Culture, out x);
                result    = x;
            }
            break;

            case "Int64":
            {
                long x;
                converted = Int64.TryParse(value, NumberStyles, Culture, out x);
                result    = x;
            }
            break;

            case "Single":
            {
                float x;
                converted = Single.TryParse(value, NumberStyles, Culture, out x);
                result    = x;
            }
            break;

            case "Double":
            {
                double x;
                converted = Double.TryParse(value, NumberStyles, Culture, out x);
                result    = x;
            }
            break;

            case "Decimal":
            {
                decimal x;
                converted = Decimal.TryParse(value, NumberStyles, Culture, out x);
                result    = x;
            }
            break;

            case "DateTime":
            {
                DateTime x;
                if (!String.IsNullOrEmpty(DateParseExact))
                {
                    converted = DateTime.TryParseExact(value, DateParseExact, Culture, DateTimeStyles, out x);
                }
                else
                {
                    converted = DateTime.TryParse(value, Culture, DateTimeStyles, out x);
                }
                result = x;
            }
            break;

            default:
                converted = false;
                result    = value;
                break;
            }

            return(converted);
        }
Example #53
0
		protected override void HandlePartyCharacters(Character p_sorcerer, SpellEventArgs p_result, List<Object> p_targets, Single p_magicFactor)
		{
			base.HandlePartyCharacters(p_sorcerer, p_result, p_targets, p_magicFactor);
			foreach (Object obj in p_targets)
			{
				if (obj is Character)
				{
					p_result.SpellTargets.Add(new SpellTarget(obj));
				}
			}
		}
Example #54
0
        private static void ParseFile(Device device, string path)
        {
            List <ShaderWrapper> localShaders = new List <ShaderWrapper>();
            List <Tuple <string, int, int, int> > computeRegisters = new List <Tuple <String, int, int, int> >();

            using (StreamReader sr = new StreamReader(path))
            {
                while (!sr.EndOfStream)
                {
                    String line                   = sr.ReadLine();
                    Match  matchShaderRegex       = m_RegexWrapper.shaderRegex.Match(line);
                    Match  matchCbufferRegex      = m_RegexWrapper.cbufferRegex.Match(line);
                    Match  matchSamplerRegex      = m_RegexWrapper.samplerRegex.Match(line);
                    Match  matchNumThreadsRegex   = m_RegexWrapper.numThreadsRegex.Match(line);
                    Match  matchGlobalDefineRegex = m_RegexWrapper.globalDefineRegex.Match(line);

                    if (matchGlobalDefineRegex.Success)
                    {
                        string defineName = matchGlobalDefineRegex.Groups[1].Value;
                        float  value      = Single.Parse(matchGlobalDefineRegex.Groups[2].Value, CultureInfo.InvariantCulture);

                        if (m_GlobalDefineValues.ContainsKey(defineName))
                        {
                            m_GlobalDefineValues[defineName] = value;
                        }
                        else
                        {
                            m_GlobalDefineValues.Add(defineName, value);
                        }
                    }

                    if (matchCbufferRegex.Success)
                    {
                        Match globalBufferMatch = m_RegexWrapper.globalBufferRegex.Match(line);
                        Match registerMatch     = m_RegexWrapper.registerRegex.Match(line);
                        if (!registerMatch.Success)
                        {
                            throw new Exception("Unable to find register for constant buffer");
                        }
                        int cbufferRegister = Int32.Parse(registerMatch.Groups[1].Value);

                        // We have a new cbuffer
                        string cbufferName = matchCbufferRegex.Groups[1].Value;

                        string cbufferText = "";
                        while (!sr.EndOfStream)
                        {
                            line = sr.ReadLine();
                            if (line.Contains('{'))
                            {
                                continue;
                            }

                            if (line.Contains('}'))
                            {
                                if (m_ConstantBuffers.ContainsKey(cbufferName))
                                {
                                    m_ConstantBuffers[cbufferName].ParseConstantBuffer(cbufferText, cbufferRegister, globalBufferMatch.Success);
                                }
                                else
                                {
                                    CustomConstantBufferDefinition myNewConstantBuffer =
                                        new CustomConstantBufferDefinition(
                                            cbufferName,
                                            cbufferText,
                                            cbufferRegister,
                                            globalBufferMatch.Success,
                                            path);

                                    m_ConstantBuffers.Add(cbufferName, myNewConstantBuffer);
                                }
                                break;
                            }

                            cbufferText += line.Trim() + "\n";
                        }

                        continue;
                    }

                    if (matchShaderRegex.Success)
                    {
                        // We have a new shader
                        string     shaderType    = matchShaderRegex.Groups[1].Value;
                        string     shaderName    = matchShaderRegex.Groups[2].Value;
                        string     shaderEntry   = matchShaderRegex.Groups[3].Value;
                        string     shaderDefines = matchShaderRegex.Groups[4].Value;
                        ShaderType type          = ShaderType.PixelShader;

                        switch (shaderType.ToLower())
                        {
                        case "pixel": type = ShaderType.PixelShader;
                            break;

                        case "vertex": type = ShaderType.VertexShader;
                            break;

                        case "compute": type = ShaderType.ComputeShader;
                            break;

                        case "geometry": type = ShaderType.GeometryShader;
                            break;
                        }

                        HashSet <string> defines = new HashSet <String>();

                        if (shaderDefines.Length > 0)
                        {
                            var tokens = shaderDefines.Split(new String[] { " ", "\t" }, StringSplitOptions.RemoveEmptyEntries);
                            for (int i = 1; i < tokens.Length; ++i)
                            {
                                defines.Add(tokens[i]);
                            }
                        }

                        ShaderWrapper newShader = new ShaderWrapper()
                        {
                            m_FilePath     = path,
                            m_ShaderName   = shaderName,
                            m_ShaderType   = type,
                            m_ShaderEntry  = shaderEntry,
                            m_UsedIncludes = new HashSet <String>(),
                            m_Defines      = defines
                        };

                        localShaders.Add(newShader);
                    }

                    if (matchNumThreadsRegex.Success)
                    {
                        int threadsX = Int32.Parse(matchNumThreadsRegex.Groups[1].Value);
                        int threadsY = Int32.Parse(matchNumThreadsRegex.Groups[2].Value);
                        int threadsZ = Int32.Parse(matchNumThreadsRegex.Groups[3].Value);

                        string nextLine = sr.ReadLine();
                        var    tokens   = nextLine.Split(new String[] { " ", "(" }, StringSplitOptions.RemoveEmptyEntries);

                        computeRegisters.Add(new Tuple <String, int, int, int>(tokens[1], threadsX, threadsY, threadsZ));
                    }

                    if (matchSamplerRegex.Success)
                    {
                        string samplerType     = matchSamplerRegex.Groups[1].Value;
                        string samplerName     = matchSamplerRegex.Groups[2].Value;
                        string samplerRegister = matchSamplerRegex.Groups[3].Value;

                        m_SamplerStates[Int32.Parse(samplerRegister)] = SamplerStates.GetSamplerStateForName(samplerName);
                    }
                }
            }

            foreach (var shader in localShaders)
            {
                CompileShader(shader, device);
            }

            foreach (var registers in computeRegisters)
            {
                var shaderFit = localShaders.Where
                                    (shader => shader.m_ShaderEntry == registers.Item1);

                foreach (var fittingShader in shaderFit)
                {
                    fittingShader.m_ThreadsX = registers.Item2;
                    fittingShader.m_ThreadsY = registers.Item3;
                    fittingShader.m_ThreadsZ = registers.Item4;
                }
            }
        }
Example #55
0
 public void CustomDrop(Single drop)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(drop);
     Invoker.Method(this, "CustomDrop", paramsArray);
 }
 public static USTableSpoon USTableSpoons(this Single input) => new USTableSpoon(input);
Example #57
0
 public void AddNodes(NetOffice.OfficeApi.Enums.MsoSegmentType segmentType, NetOffice.OfficeApi.Enums.MsoEditingType editingType, Single x1, Single y1, object x2, object y2, object x3)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(segmentType, editingType, x1, y1, x2, y2, x3);
     Invoker.Method(this, "AddNodes", paramsArray);
 }
Example #58
0
 public static void FF9ShadowLockYRotWorld(Int32 uid, Single rotY)
 {
     global::Debug.LogError("Not implement FF9ShadowLockYRotWorld");
 }
Example #59
0
    public static NumberSequential NewNumberSequential(int i32, uint ui32, short s1, ushort us1, Byte b, SByte sb,
                                                       Int16 i16, UInt16 ui16, Int64 i64, UInt64 ui64, Single sgl, Double d)
    {
        NumberSequential str1 = new NumberSequential();

        str1.i32  = i32;
        str1.ui32 = ui32;
        str1.s1   = s1;
        str1.us1  = us1;
        str1.b    = b;
        str1.sb   = sb;
        str1.i16  = i16;
        str1.ui16 = ui16;
        str1.i64  = i64;
        str1.ui64 = ui64;
        str1.sgl  = sgl;
        str1.d    = d;
        return(str1);
    }
Example #60
0
 public void Value(Single x)
 {
     CommaCheck();
     m_w.Write(x.ToString("R", CultureInfo.InvariantCulture));
 }