Exemplo n.º 1
0
    static Color32 GetColor(Vector3 vertex, ShadingMode mode)
    {
        //if (mode == ShadingMode.heightmap)
        return(HeightmapColor(vertex));

        //return new Color32(255, 255, 255, 255);
    }
Exemplo n.º 2
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            WriteableBitmap bmp = new WriteableBitmap(640, 480);

            frontBuffer.Source = bmp;

            cameraMode     = CameraMode.Static;
            shadingMode    = ShadingMode.Flat;
            reflectionMode = ReflectionMode.Blin;

            device = new Device(bmp, shadingMode, reflectionMode);
            SetStaticCamera();

            var carLoaded = await device.LoadJSONFileAsync("ms-appx:///Assets/car6.babylon");

            var donutLoaded = await device.LoadJSONFileAsync("ms-appx:///Assets/torus.babylon");

            car    = carLoaded[0];
            donut  = donutLoaded[0];
            meshes = new Mesh[] { car, donut };

            Time = 0;

            CompositionTarget.Rendering += CompositionTarget_Rendering;
        }
Exemplo n.º 3
0
        /// <summary>
        /// This methods draws a trapezoid whose 90° angle is in the left side.
        /// </summary>
        /// <param name="position">The topLeft point of the trapezoid</param>
        /// <param name="size">The <b>whole size</b> of the trapezoid</param>
        /// <param name="triangleWidth">The extra width of the greater base side</param>
        /// <param name="isTriangleUpside">If the triangle part is to be drawn upside</param>
        /// <param name="isShaded">If shading is to be applied to the trapezoid polygons</param>
        /// <param name="color">Color of the trapezoid's inner area. The specified ShadeVertices
        /// delegate will then proceed to create a shaded version.</param>
        /// <param name="shadeMode">ShadeVertices delegate used.</param>
        /// <returns>A Trapezoidal ShapeDescriptor object.</returns>
        public static ShapeDescriptor DrawLeftTrapezoid(Vector2 position, Size size,
                                                        int triangleWidth, bool isTriangleUpside,
                                                        Color color, int borderSize,
                                                        ShadingMode shadeMode)
        {
            CustomVertex.TransformedColored[] vertices = new CustomVertex.TransformedColored[5];
            int[]   indices = new int[9];
            Vector2 topLeft = new Vector2(position.X + triangleWidth, position.Y);

            Size innerSize = new Size(size.Width - borderSize, size.Height - borderSize);

            ShapeDescriptor sTrapezoid;

            int width  = innerSize.Width;
            int height = innerSize.Height;

            int[] colors = shadeMode(color);

            int colorTopLeft     = colors[0];
            int colorTopRight    = colors[1];
            int colorBottomleft  = colors[2];
            int colorBottomRight = colors[3];

            vertices[0] =
                new CustomVertex.TransformedColored(topLeft.X + innerSize.Width, topLeft.Y, 0, 1, colorTopRight);
            vertices[1] =
                new CustomVertex.TransformedColored(topLeft.X + innerSize.Width, topLeft.Y + innerSize.Height, 0, 1,
                                                    colorBottomRight);
            vertices[2] =
                new CustomVertex.TransformedColored(topLeft.X, topLeft.Y + innerSize.Height, 0, 1, colorBottomleft);
            vertices[4] = new CustomVertex.TransformedColored(topLeft.X, topLeft.Y, 0, 1, colorTopLeft);


            if (isTriangleUpside)
            {
                vertices[3] =
                    new CustomVertex.TransformedColored(topLeft.X - triangleWidth, topLeft.Y + innerSize.Height, 0, 1,
                                                        colorBottomleft);
            }
            else
            {
                vertices[3] =
                    new CustomVertex.TransformedColored(topLeft.X - triangleWidth, topLeft.Y, 0, 1, colorTopLeft);
            }

            indices[0] = 0;
            indices[1] = 2;
            indices[2] = 4;
            indices[3] = 0;
            indices[4] = 1;
            indices[5] = 2;
            indices[6] = 3;
            indices[7] = 4;
            indices[8] = 2;


            sTrapezoid = new ShapeDescriptor(3, vertices, indices);
            return(sTrapezoid);
        }
Exemplo n.º 4
0
 public void ChangeFillMode(ShadingMode wireframe)
 {
     if (AssetRenderer != null)
     {
         AssetRenderer.ChangeFillMode(wireframe);
     }
     Invalidate();
 }
 public GradientSettingsHolder(ShadingMode _mode, GradientSettings _settings, Color _color1, Color _color2, float _gradHeight, float _gradYPos, float _Rotation)
 {
     Mode         = _mode;
     gradSettings = _settings;
     color1       = _color1;
     color2       = _color2;
     gradHeight   = _gradHeight;
     gradYPos     = _gradYPos;
     Rotation     = _Rotation;
 }
Exemplo n.º 6
0
 public Device(WriteableBitmap bmp, ShadingMode sMode, ReflectionMode rMode)
 {
     this.bmp       = bmp;
     screenWidth    = bmp.PixelWidth;
     ScreenHeight   = bmp.PixelHeight;
     backBuffer     = new byte[screenWidth * ScreenHeight * 4];
     zBuffer        = new double[screenWidth * ScreenHeight];
     lockBuffer     = new object[screenWidth * ScreenHeight];
     shadingMode    = sMode;
     reflectionMode = rMode;
     for (var i = 0; i < lockBuffer.Length; i++)
     {
         lockBuffer[i] = new object();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// This methods draws a trapezoid whose 90° angle is in the right side.
        /// </summary>
        /// <param name="position">The topLeft point of the trapezoid</param>
        /// <param name="size">The <b>whole size</b> of the trapezoid</param>
        /// <param name="triangleWidth">The extra width of the greater base side</param>
        /// <param name="isTriangleUpside">If the triangle part is to be drawn upside</param>
        /// <param name="isShaded">If shading is to be applied to the trapezoid polygons</param>
        /// <param name="color">Color of the trapezoid's inner area. The specified ShadeVertices
        /// delegate will then proceed to create a shaded version.</param>
        /// <param name="borderSize">Size in pixels of the border.</param>
        /// <param name="borderColor">Average color of the border.</param>
        /// <param name="rectangleBorders">Which borders of the rectangular part of the outline to draw.</param>
        /// <param name="triangleBorders">Which borders of the triangular part of the outline to draw.</param>
        /// <param name="shadeMode">ShadeVertices delegate used.</param>
        /// <returns>A Trapezoidal ShapeDescriptor object.</returns>
        public static ShapeDescriptor DrawFullRightTrapezoid(Vector2 position, Size size,
                                                             int triangleWidth, bool isTriangleUpside,
                                                             Color color,
                                                             int borderSize, Color borderColor,
                                                             BorderStyle style, Border rectangleBorders,
                                                             Border triangleBorders,
                                                             ShadingMode shadeMode)
        {
            ShapeDescriptor sTrapezoid = DrawRightTrapezoid(position, size, triangleWidth, isTriangleUpside,
                                                            color, borderSize, shadeMode);
            ShapeDescriptor sOutline = DrawRightTrapezoidalOutline(position, size, triangleWidth, isTriangleUpside,
                                                                   color, borderSize, borderColor, style,
                                                                   rectangleBorders, triangleBorders);

            return(ShapeDescriptor.Join(sTrapezoid, sOutline));
        }
Exemplo n.º 8
0
 private void ChangeFillModeSolid(object sender, EventArgs e)
 {
     _shadingMode = ShadingMode.Solid;
     ChangeFillMode();
 }
Exemplo n.º 9
0
		public override void ChangeFillMode(ShadingMode shadingMode)
		{
			_shadingMode = shadingMode;
		}
 	public void ChangeFillMode(ShadingMode wireframe)
 	{
 		graphicsDeviceControl.ChangeFillMode(wireframe);
 	}
Exemplo n.º 11
0
 public ThreeDProperties()
 {
     _enabled        = false;
     _projectionMode = ProjectionMode3DForRendering.Perspective;
     _shading        = ShadingMode.None;
 }
Exemplo n.º 12
0
 public virtual void ChangeFillMode(ShadingMode wireframe)
 {
 }
Exemplo n.º 13
0
 private void ChangeFillModeSolidAndWireframe(object sender, EventArgs e)
 {
     _shadingMode = ShadingMode.SolidAndWireframe;
     ChangeFillMode();
 }
Exemplo n.º 14
0
 private void ChangeFillModeSolid(object sender, EventArgs e)
 {
     _shadingMode = ShadingMode.Solid;
     ChangeFillMode();
 }
Exemplo n.º 15
0
        public static ShapeDescriptor DrawRectangle(Vector2 topLeft, Size size, Color color, ShadingMode shadeMode)
        {
            CustomVertex.TransformedColored[] vertices = new CustomVertex.TransformedColored[4];

            int width  = size.Width;
            int height = size.Height;

            int[] colors = shadeMode(color);

            int colorTopLeft     = colors[0];
            int colorTopRight    = colors[1];
            int colorBottomleft  = colors[2];
            int colorBottomRight = colors[3];

            vertices[0] = new CustomVertex.TransformedColored(topLeft.X, topLeft.Y, 0, 1, colorTopLeft);
            vertices[1] = new CustomVertex.TransformedColored(topLeft.X, topLeft.Y + size.Height, 0, 1, colorBottomleft);
            vertices[2] =
                new CustomVertex.TransformedColored(topLeft.X + size.Width, topLeft.Y + size.Height, 0, 1,
                                                    colorBottomRight);
            vertices[3] = new CustomVertex.TransformedColored(topLeft.X + size.Width, topLeft.Y, 0, 1, colorTopRight);

            int[] indices = new int[6];

            indices[0] = 0;
            indices[1] = 3;
            indices[2] = 2;
            indices[3] = 0;
            indices[4] = 2;
            indices[5] = 1;

            return(new ShapeDescriptor(2, vertices, indices));
        }
Exemplo n.º 16
0
 private void ChangeFillModeWireframe(object sender, EventArgs e)
 {
     _shadingMode = ShadingMode.Wireframe;
     ChangeFillMode();
 }
Exemplo n.º 17
0
        public static void Fill(DirectBitmap bitmap, List <Point> points, Color color, List <double> zs, double[,] Ztable,
                                List <Vector <double> > positions, List <Vector <double> > normals, SurfaceInfo surface, List <Light> lights, ShadingMode shadingMode = ShadingMode.Flat)
        {
            int margin = 500;
            var maxY   = points.Max(x => x.Y);

            if (maxY < -margin || maxY > bitmap.Height + margin)
            {
                return;
            }

            var minY = points.Min(x => x.Y);

            if (minY < -margin || minY > bitmap.Height + margin)
            {
                return;
            }

            var maxX = points.Max(x => x.X);

            if (maxX < -margin || maxX > bitmap.Width + margin)
            {
                return;
            }

            var minX = points.Min(x => x.X);

            if (minX < -margin || minX > bitmap.Width + margin)
            {
                return;
            }

            var etTable = new List <EdgeStruct> [maxY - minY + 1];

            var area = GetAreaInv(points[0], points[1], points[2]);

            for (int i = 0; i < points.Count; i++)
            {
                var p1 = points[i];
                var p2 = points[i + 1 == points.Count ? 0 : i + 1];
                if (p1.Y == p2.Y)
                {
                    continue;
                }
                if (p1.Y > p2.Y)
                {
                    var tmp = p2;
                    p2 = p1;
                    p1 = tmp;
                }
                //double slp;
                var str = new EdgeStruct {
                    YMax = p2.Y, X = p1.Y < p2.Y ? p1.X : p2.X, Slope = (double)(p1.X - p2.X) / (p1.Y - p2.Y)
                };
                if (etTable[p1.Y - minY] == null)
                {
                    etTable[p1.Y - minY] = new List <EdgeStruct>();
                }
                etTable[p1.Y - minY].Add(str);
            }

            var aetTable = new List <EdgeStruct>();
            int y        = minY;

            Color shadingCol = color;

            if (shadingMode == ShadingMode.Flat)
            {
                var middle     = positions[0].Add(positions[1]).Add(positions[2]).Multiply(1.0 / 3);
                var sideNormal = normals[0].Add(normals[1]).Add(normals[2]).Normalize(2);
                shadingCol = PhongeIllumination(middle, sideNormal, Color2ColorInfo(color), surface, lights);
            }

            var firstColor  = Color.Blue;
            var secondColor = Color.Red;
            var thirdColor  = Color.Green;

            if (shadingMode == ShadingMode.Gouraud)
            {
                firstColor  = PhongeIllumination(positions[0], normals[0], Color2ColorInfo(color), surface, lights);
                secondColor = PhongeIllumination(positions[1], normals[1], Color2ColorInfo(color), surface, lights);
                thirdColor  = PhongeIllumination(positions[2], normals[2], Color2ColorInfo(color), surface, lights);
            }

            while (y <= maxY)
            {
                if (etTable[y - minY] != null)
                {
                    var tempList = etTable[y - minY];
                    //foreach (var edge in tempList)
                    //{
                    //    //if(edge.Slope < 0)
                    //        edge.X = edge.X - (edge.YMax - y) * edge.Slope;
                    //}

                    aetTable.AddRange(tempList);
                }

                aetTable = aetTable.OrderBy(x => x.X).ToList();
                for (int i = 0; i < aetTable.Count; i += 2)
                {
                    if (aetTable.Count - i == 1)
                    {
                        continue;
                    }
                    var first  = aetTable[i];
                    var second = aetTable[i + 1];

                    for (int j = (int)(first.X); j < second.X; j++)
                    {
                        if (!(j >= 0 && j < bitmap.Width && y >= 0 && y < bitmap.Height))
                        {
                            continue;
                        }

                        var w = GetBaricentricRatio(j, y, points[0], points[1], points[2], area);

                        if (w.Item1 < 0 || w.Item2 < 0 || w.Item3 < 0)
                        {
                            continue;
                        }

                        var z = zs[0] * w.Item1 + zs[1] * w.Item2 + zs[2] * w.Item3;

                        if (z < Ztable[j, y])
                        {
                            Ztable[j, y] = z;

                            if (shadingMode == ShadingMode.Gouraud)
                            {
                                var gR = firstColor.R * w.Item1 + secondColor.R * w.Item2 + thirdColor.R * w.Item3;
                                var gG = firstColor.G * w.Item1 + secondColor.G * w.Item2 + thirdColor.G * w.Item3;
                                var gB = firstColor.B * w.Item1 + secondColor.B * w.Item2 + thirdColor.B * w.Item3;

                                shadingCol = Color.FromArgb((int)gR, (int)gG, (int)gB);
                            }

                            if (shadingMode == ShadingMode.Phong)
                            {
                                var normal = normals[0] * w.Item1 + normals[1] * w.Item2 + normals[2] * w.Item3;
                                normal = normal.Normalize(2);
                                var position = positions[0] * w.Item1 + positions[1] * w.Item2 + positions[2] * w.Item3;
                                shadingCol = PhongeIllumination(position, normal, Color2ColorInfo(color), surface, lights);
                            }

                            bitmap.SetPixel(j, y, shadingCol);
                        }
                    }
                }
                foreach (var edge in aetTable.ToList())
                {
                    if (edge.YMax == y + 1)
                    {
                        aetTable.Remove(edge);
                    }
                    else
                    {
                        edge.X += edge.Slope;
                    }
                }
                y++;
            }
        }
Exemplo n.º 18
0
 public void ChangeFillMode(ShadingMode wireframe)
 {
     if (AssetRenderer != null)
         AssetRenderer.ChangeFillMode(wireframe);
     Invalidate();
 }
Exemplo n.º 19
0
    /*
     *
     * smoothness = numX + numY
     */
    public static PlotMeshT MakePlot(GameObject obj, Tuple <float, float> xBound, Tuple <float, float> zBound, int smoothness, ShadingMode mode)
    {
        float diffX = xBound.Item2 - xBound.Item1;
        float diffZ = zBound.Item2 - zBound.Item1;

        int numX = (int)(diffX * smoothness / (diffX + diffZ));
        int numZ = smoothness - numX;

        float deltaX = diffX / numX;
        float deltaZ = diffZ / numZ;

        float curX = xBound.Item1;
        float curZ = zBound.Item1;

        List <Vector3> vertices = new List <Vector3>();
        List <int>     faces    = new List <int>();
        List <Color32> colors   = new List <Color32>();

        Function func = obj.GetComponent <Plot>().Equation;

        for (int i = 0; i <= numX; i++)
        {
            for (int j = 0; j <= numZ; j++)
            {
                Vector3 newVertex = obj.transform.InverseTransformVector(new Vector3(curX, (float)func.calculate(curX, curZ), curZ));
                vertices.Add(newVertex);

                colors.Add(GetColor(newVertex, mode));

                curX += deltaX;
            }
            curX  = xBound.Item1;
            curZ += deltaZ;
        }

        int k = 0;

        for (int i = 0; i < numX; i++)
        {
            for (int j = 0; j < numZ; j++)
            {
                faces.Add(k + 1);
                faces.Add(k);
                faces.Add(k + numX + 1);

                faces.Add(k + 1);
                faces.Add(k + numX + 1);
                faces.Add(k + numX + 2);

                k++;
            }
            k++;
        }

        List <Vector3> normals = new List <Vector3>();

        for (int i = 0; i < vertices.Count; i++)
        {
            normals.Add(new Vector3(0, 1, 0));
        }

        Mesh top = new Mesh();

        top.Clear();
        top.SetVertices(vertices);
        top.SetTriangles(faces, 0);
        top.SetNormals(normals);
        top.SetColors(colors);

        Mesh bot = new Mesh();

        bot.Clear();
        bot.SetVertices(vertices);

        faces.Reverse();
        bot.SetTriangles(faces, 0);

        for (int i = 0; i < normals.Count; i++)
        {
            normals[i] = -normals[i];
        }

        bot.SetNormals(normals);
        bot.SetColors(colors);

        PlotMeshT ret = new PlotMeshT {
            topMesh = top,
            botMesh = bot,
        };

        return(ret);
    }
 public void ChangeFillMode(ShadingMode wireframe)
 {
     graphicsDeviceControl.ChangeFillMode(wireframe);
 }
Exemplo n.º 21
0
 public static ShapeDescriptor DrawFullRectangle(Vector2 position, Size size, Color color, ShadingMode shadeMode,
                                                 int borderSize, Color borderColor, BorderStyle style)
 {
     return(DrawFullRectangle(position, size, color, shadeMode, borderSize, borderColor, style,
                              (style != BorderStyle.None) ? Border.All : Border.None));
 }
Exemplo n.º 22
0
 public override void ChangeFillMode(ShadingMode shadingMode)
 {
     _shadingMode = shadingMode;
 }
Exemplo n.º 23
0
 public static ShapeDescriptor DrawFullRectangle(Vector2 position, Size size, Color color, ShadingMode shadeMode,
                                                 int borderSize, Color borderColor, BorderStyle style,
                                                 Border borders)
 {
     return(ShapeDescriptor.Join(
                DrawRectangle(new Vector2(position.X + borderSize, position.Y + borderSize),
                              new Size(size.Width - borderSize * 2, size.Height - borderSize * 2),
                              color,
                              shadeMode),
                DrawRectangularOutline(position, size, borderSize, borderColor, style, borders)));
 }
    private void InitializeHelperVars()
    {
        if (_ShowFront.floatValue == 0)
        {
            showFrontShading = false;
        }
        else if (_ShowFront.floatValue == 1)
        {
            showFrontShading = true;
        }
        if (_ShowBack.floatValue == 0)
        {
            showBackShading = false;
        }
        else if (_ShowBack.floatValue == 1)
        {
            showBackShading = true;
        }
        if (_ShowLeft.floatValue == 0)
        {
            showLeftShading = false;
        }
        else if (_ShowLeft.floatValue == 1)
        {
            showLeftShading = true;
        }
        if (_ShowRight.floatValue == 0)
        {
            showRightShading = false;
        }
        else if (_ShowRight.floatValue == 1)
        {
            showRightShading = true;
        }
        if (_ShowTop.floatValue == 0)
        {
            showTopShading = false;
        }
        else if (_ShowTop.floatValue == 1)
        {
            showTopShading = true;
        }
        if (_ShowBottom.floatValue == 0)
        {
            showBottomShading = false;
        }
        else if (_ShowBottom.floatValue == 1)
        {
            showBottomShading = true;
        }

        frontShadingMode  = (ShadingMode)_Shading_F.floatValue;
        backShadingMode   = (ShadingMode)_Shading_B.floatValue;
        leftShadingMode   = (ShadingMode)_Shading_L.floatValue;
        rightShadingMode  = (ShadingMode)_Shading_R.floatValue;
        topShadingMode    = (ShadingMode)_Shading_T.floatValue;
        bottomShadingMode = (ShadingMode)_Shading_D.floatValue;

        frontGradientSettings  = (GradientSettings)_GradSettings_F.floatValue;
        backGradientSettings   = (GradientSettings)_GradSettings_B.floatValue;
        leftGradientSettings   = (GradientSettings)_GradSettings_L.floatValue;
        rightGradientSettings  = (GradientSettings)_GradSettings_R.floatValue;
        topGradientSettings    = (GradientSettings)_GradSettings_T.floatValue;
        bottomGradientSettings = (GradientSettings)_GradSettings_D.floatValue;
    }
    private void CustomShadingModule(
        ref bool ShowShading, ref MaterialProperty Show, string ShadingSide,
        ref ShadingMode ShadingType, ref MaterialProperty ShadeMode, ref MaterialProperty Color1,
        ref MaterialProperty Color2, ref GradientSettings GradSettings, ref MaterialProperty GradientSettings,
        ref MaterialProperty GradHeight, ref MaterialProperty GradPivot,
        ref MaterialProperty Rotation, string shaderKeywordG, string shaderKeywordS, MaterialProperty Gizmopos)
    {
        EditorGUILayout.BeginVertical();
        {
            ShowShading = EditorGUILayout.Foldout(ShowShading, ShadingSide);
        }
        EditorGUILayout.EndVertical();
        if (ShowShading)
        {
            Show.floatValue      = 1;
            ShadingType          = (ShadingMode)EditorGUILayout.EnumPopup("Shading Mode", ShadingType);
            ShadeMode.floatValue = (float)ShadingType;
            if (ShadingType == ShadingMode.VertexColor)
            {
                targetMat.DisableKeyword(shaderKeywordS);
            }
            else if (ShadingType == ShadingMode.SolidColor)
            {
                ColorProperty(Color1, "Color");
                targetMat.EnableKeyword(shaderKeywordS);
            }
            else if (ShadingType == ShadingMode.Gradient_ProOnly)
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.BeginHorizontal("Box");
                {
                    EditorGUILayout.BeginVertical(GUILayout.Width(50));
                    {
                        Color1.colorValue = EditorGUILayout.ColorField(Color1.colorValue);
                        Color2.colorValue = EditorGUILayout.ColorField(Color2.colorValue);
                        if (GUILayout.Button("Swap"))
                        {
                        }
                        Rect R = EditorGUILayout.GetControlRect(GUILayout.Height(50), GUILayout.Width(50));

                        if (ShadingSide == TOP || ShadingSide == DOWN)
                        {
                            GUI.DrawTexture(R, GetTexture(Color1.colorValue, Color2.colorValue, true));
                        }
                        else
                        {
                            GUI.DrawTexture(R, GetTexture(Color1.colorValue, Color2.colorValue, false));
                        }
                    }
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width - 112));
                    {
                        GradSettings = (GradientSettings)EditorGUILayout.EnumPopup("", GradSettings, GUILayout.Width(Screen.width - 110));
                        GradientSettings.floatValue = (float)GradSettings;
                        EditorGUI.BeginDisabledGroup(IsGlobal(GradSettings));
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width - 142));
                                {
                                    if (IsGlobal(GradSettings))
                                    {
                                        GradHeight.floatValue = CEditor.FloatField("Falloff", 70, _GradientHeight_G.floatValue);
                                        EditorGUILayout.LabelField("Pivot", GUILayout.Width(60));
                                        GradPivot.vectorValue = EditorGUILayout.Vector2Field("", _GradPivot_G.vectorValue, GUILayout.Width(Screen.width - 142));
                                        EditorGUILayout.LabelField("Rotation", GUILayout.Width(60));
                                        Rotation.floatValue = EditorGUILayout.Slider(_Rotation_G.floatValue, 0f, 360f, GUILayout.Width(Screen.width - 142));
                                    }
                                    else
                                    {
                                        GradHeight.floatValue = CEditor.FloatField("Falloff", 70, GradHeight.floatValue);
                                        EditorGUILayout.LabelField("Pivot", GUILayout.Width(60));
                                        GradPivot.vectorValue = EditorGUILayout.Vector2Field("", GradPivot.vectorValue, GUILayout.Width(Screen.width - 142));
                                        EditorGUILayout.LabelField("Rotation", GUILayout.Width(60));
                                        Rotation.floatValue = EditorGUILayout.Slider(Rotation.floatValue, 0f, 360f, GUILayout.Width(Screen.width - 142));
                                    }
                                }
                                EditorGUILayout.EndVertical();

                                EditorGUILayout.BeginVertical();
                                {
                                    EditorGUI.BeginDisabledGroup(!isAnythingSelected());
                                    {
                                        if (GUILayout.Button(EditorGUIUtility.IconContent("EditCollider", "Edit in Scene"), GUILayout.Height(28)))
                                        {
                                        }
                                        if (GUILayout.Button(EditorGUIUtility.IconContent("TreeEditor.Duplicate"), GUILayout.Height(28)))
                                        {
                                        }
                                        if (GUILayout.Button(EditorGUIUtility.IconContent("Clipboard", "Paste"), GUILayout.Height(28)))
                                        {
                                        }
                                    }
                                    EditorGUI.EndDisabledGroup();
                                }
                                EditorGUILayout.EndVertical();
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUI.EndDisabledGroup();
            }
            else
            {
                Color1.colorValue = Color.white;
                Color2.colorValue = Color.white;
            }
        }
        else
        {
            Show.floatValue = 0;
        }
    }
Exemplo n.º 26
0
		public virtual void ChangeFillMode(ShadingMode wireframe)
		{
			
		}
Exemplo n.º 27
0
        public void DrawSide(DirectBitmap bitmap, Matrix <double> projectionMatrix, int radius, double [,] zTable, SurfaceInfo surface, List <Light> lights, ShadingMode shadingMode)
        {
            var pos   = GetPositions();
            var norms = GetNormals();

            Process(projectionMatrix, false);
            var convPoints = new List <Point>();
            var zPoints    = new List <double>();



            foreach (var point in Points)
            {
                convPoints.Add(new Point((int)((point.X + 1) * radius), (int)((point.Y + 1) * radius)));

                zPoints.Add(point.Z);
            }

            var sMode = shadingMode;

            if (IsGlowing)
            {
                sMode = ShadingMode.None;
            }

            Helpers.Fill(bitmap, convPoints, paintColor, zPoints, zTable, pos, norms, surface, lights, sMode);;
        }