Esempio n. 1
0
        private void DrawBox(IncrementalModeling model)
        {
            int num1 = model._countX * model._countY * model._countZ;

            for (int index1 = 0; index1 < num1; ++index1)
            {
                float   num2    = 1f;
                Vector3 vector3 = ((Matrix4x4) ref this.invTransform).MultiplyPoint(model._positionMap[index1]);
                for (int index2 = 0; index2 < 3; ++index2)
                {
                    float num3 = Mathf.Abs(((Vector3) ref vector3).get_Item(index2));
                    float num4 = ((Vector3) ref this.boxExtents).get_Item(index2);
                    if ((double)num3 < (double)num4)
                    {
                        if ((double)this.fadeRadius > 0.0)
                        {
                            num2 *= Mathf.Clamp01((num4 - num3) / this.fadeRadius);
                        }
                    }
                    else
                    {
                        num2 = 0.0f;
                        break;
                    }
                }
                if ((double)num2 > 0.0)
                {
                    model._powerMap[index1]  = Mathf.Clamp01(model._powerMap[index1] + this.powerScale * num2);
                    model._powerMap[index1] *= model._powerMapMask[index1];
                }
            }
        }
Esempio n. 2
0
        void DrawBox(IncrementalModeling model)
        {
            int count = model._countX * model._countY * model._countZ;

            for (int i = 0; i < count; ++i)
            {
                float   power    = 1.0f;
                Vector3 position = invTransform.MultiplyPoint(model._positionMap[i]);

                for (int j = 0; j < 3; ++j)
                {
                    float distance = Mathf.Abs(position[j]);

                    float r = boxExtents[j];
                    if (distance < r)
                    {
                        if (fadeRadius > 0.0f)
                        {
                            power *= Mathf.Clamp01((r - distance) / fadeRadius);
                        }
                    }
                    else
                    {
                        power = 0.0f;
                        break;
                    }
                }

                if (power > 0.0f)
                {
                    model._powerMap[i]  = Mathf.Clamp01(model._powerMap[i] + powerScale * power);
                    model._powerMap[i] *= model._powerMapMask[i];
                }
            }
        }
Esempio n. 3
0
        public void Draw(IncrementalModeling model)
        {
            switch (this.shape)
            {
            case IncrementalModeling.Brush.Shape.sphere:
                this.DrawSphere(model);
                break;

            case IncrementalModeling.Brush.Shape.box:
                this.DrawBox(model);
                break;
            }
        }
Esempio n. 4
0
        public void Draw(IncrementalModeling model)
        {
            switch (shape)
            {
            case Shape.sphere:
                DrawSphere(model);
                break;

            case Shape.box:
                DrawBox(model);
                break;
            }
        }
Esempio n. 5
0
 public void Draw()
 {
     if (Object.op_Equality((Object)this.im, (Object)null))
     {
         this.im = Utils.FindComponentInParents <IncrementalModeling>(((Component)this).get_transform());
     }
     if (Object.op_Inequality((Object)this.im, (Object)null))
     {
         this.DoDraw();
     }
     else
     {
         Debug.LogError((object)"no IncrementalModeling component for this brush found in hierarchy.");
     }
 }
Esempio n. 6
0
    public void Draw()
    {
        if (im == null)
        {
            im = Utils.FindComponentInParents <IncrementalModeling>(transform);
        }

        if (im != null)
        {
            DoDraw();
        }
        else
        {
            Debug.LogError("no IncrementalModeling component for this brush found in hierarchy.");
        }
    }
Esempio n. 7
0
        private void DrawSphere(IncrementalModeling model)
        {
            int num1 = model._countX * model._countY * model._countZ;

            for (int index = 0; index < num1; ++index)
            {
                Vector3 vector3   = ((Matrix4x4) ref this.invTransform).MultiplyPoint(model._positionMap[index]);
                float   magnitude = ((Vector3) ref vector3).get_magnitude();
                if ((double)magnitude < (double)this.sphereRadius)
                {
                    float num2 = 1f;
                    if ((double)this.fadeRadius > 0.0)
                    {
                        num2 = Mathf.Clamp01((this.sphereRadius - magnitude) / this.fadeRadius);
                    }
                    model._powerMap[index]  = Mathf.Clamp01(model._powerMap[index] + this.powerScale * num2);
                    model._powerMap[index] *= model._powerMapMask[index];
                }
            }
        }
Esempio n. 8
0
        void DrawSphere(IncrementalModeling model)
        {
            int count = model._countX * model._countY * model._countZ;

            for (int i = 0; i < count; ++i)
            {
                float distance = invTransform.MultiplyPoint(model._positionMap[i]).magnitude;
                if (distance < sphereRadius)
                {
                    float power = 1.0f;

                    if (fadeRadius > 0.0f)
                    {
                        power = Mathf.Clamp01((sphereRadius - distance) / fadeRadius);
                    }
                    model._powerMap[i]  = Mathf.Clamp01(model._powerMap[i] + powerScale * power);
                    model._powerMap[i] *= model._powerMapMask[i];
                }
            }
        }