Beispiel #1
0
        public void ShadingModel_Fill()
        {
            ShadingModel shadingUT = new ShadingModel();

            shadingUT.Fill = "test";
            Assert.IsTrue(shadingUT.Fill == "test");
        }
Beispiel #2
0
 public Material(string name, int editorX, int editorY, Node[] children, ParsedPropertyBag ambientOcclusion, ShadingModel shadingModel, BlendMode blendMode, DecalBlendMode decalBlendMode, MaterialDomain materialDomain, TranslucencyLightingMode translucencyLightingMode, bool isTwoSided, ParsedPropertyBag baseColor, ParsedPropertyBag metallic, ParsedPropertyBag normal, ParsedPropertyBag refraction, ParsedPropertyBag roughness, ParsedPropertyBag specular, ParsedPropertyBag emissiveColor, ParsedPropertyBag opacity, ParsedPropertyBag opacityMask, float opacityMaskClipValue, ExpressionReference[] expressionReferences, ExpressionReference[] editorComments, int textureStreamingDataVersion, ParsedPropertyBag[] textureStreamingData, bool ditherOpacityMask)
     : base(name, editorX, editorY, children)
 {
     AmbientOcclusion         = ambientOcclusion;
     ShadingModel             = shadingModel;
     BlendMode                = blendMode;
     DecalBlendMode           = decalBlendMode;
     MaterialDomain           = materialDomain;
     TranslucencyLightingMode = translucencyLightingMode;
     IsTwoSided               = isTwoSided;
     BaseColor                = baseColor;
     Metallic                    = metallic;
     Normal                      = normal;
     Refraction                  = refraction;
     Roughness                   = roughness;
     Specular                    = specular;
     EmissiveColor               = emissiveColor;
     Opacity                     = opacity;
     OpacityMask                 = opacityMask;
     OpacityMaskClipValue        = opacityMaskClipValue;
     Expressions                 = expressionReferences;
     EditorComments              = editorComments;
     TextureStreamingDataVersion = textureStreamingDataVersion;
     TextureStreamingData        = textureStreamingData;
     DitherOpacityMask           = ditherOpacityMask;
 }
Beispiel #3
0
        public void ShadingModel_Color()
        {
            ShadingModel shadingUT = new ShadingModel();

            shadingUT.Color = "test";
            Assert.IsTrue(shadingUT.Color == "test");
        }
Beispiel #4
0
        public void ShadingModel_ThemeTint()
        {
            ShadingModel shadingUT = new ShadingModel();

            shadingUT.ThemeTint = "test";
            Assert.IsTrue(shadingUT.ThemeTint == "test");
        }
Beispiel #5
0
        public void ShadingModel_ThemeFillShade()
        {
            ShadingModel shadingUT = new ShadingModel();

            shadingUT.ThemeFillShade = "test";
            Assert.IsTrue(shadingUT.ThemeFillShade == "test");
        }
Beispiel #6
0
        public static void ShadeModel(ShadingModel model)
        {
#if USE_OPENGL
            OpenTK.Graphics.OpenGL.GL.ShadeModel((OpenTK.Graphics.OpenGL.ShadingModel)model);
#else
            OpenTK.Graphics.ES11.GL.ShadeModel((OpenTK.Graphics.ES11.All)model);
#endif
        }
Beispiel #7
0
        public void ShadingModel_ThemeFill()
        {
            ShadingModel     shadingUT = new ShadingModel();
            ThemeColorValues value     = new ThemeColorValues();

            if (shadingUT.ThemeFill.HasValue)
            {
                shadingUT.ThemeFill = value;
                Assert.IsTrue(shadingUT.ThemeFill == value);
            }
        }
Beispiel #8
0
        public static IDisposable SetColor(Color value, ShadingModel shadingModel, bool solidBody)
        {
            var revert = new CompositeDisposable();

            GL.ShadeModel(shadingModel);
            if (shadingModel == ShadingModel.Smooth)
            {
                GL.Enable(EnableCap.ColorMaterial);
                GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);

                GL.Enable(EnableCap.ColorMaterial);
                GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);

                /*
                 * GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Specular, SpecularColor);
                 * GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, EmissionColor);
                 * GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Shininess, Shinyness);
                 */
                GL.Enable(EnableCap.Lighting);
            }
            else
            {
                GL.Disable(EnableCap.ColorMaterial);
                GL.Disable(EnableCap.Lighting);
            }

            var isTransparent = value.A < 255;

            if (!solidBody || isTransparent)
            {
                if (GL.IsEnabled(EnableCap.CullFace))
                {
                    revert.Add(Disposable.Create(() => GL.Enable(EnableCap.CullFace)));
                }
                GL.Disable(EnableCap.CullFace);
            }

            if (isTransparent)
            {
                GL.DepthMask(false);
                revert.Add(Disposable.Create(() => GL.DepthMask(true)));

                GL.Enable(EnableCap.Blend);
                revert.Add(Disposable.Create(() => GL.Disable(EnableCap.Blend)));

                GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            }

            var color = new[] { value.R / 255d, value.G / 255d, value.B / 255d, value.A / 255d };

            GL.Color4(color);

            return(revert);
        }
Beispiel #9
0
        public static void ShadeModel(ShadingModel model)
        {
#if USE_OPENGL
            if (HardwareAvailable)
            {
                OpenTK.Graphics.OpenGL.GL.ShadeModel((OpenTK.Graphics.OpenGL.ShadingModel)model);
            }
#else
            OpenTK.Graphics.ES11.GL.ShadeModel((OpenTK.Graphics.ES11.All)model);
#endif
        }
Beispiel #10
0
        public static void SetupMaterialShadingModel(Material material, ShadingModel shadingModel)
        {
            switch (shadingModel)
            {
            case ShadingModel.Standard:
                material.EnableKeyword("_MATERIAL_MODEL_STANDARD");
                material.DisableKeyword("_MATERIAL_MODEL_SSS");
                break;

            case ShadingModel.SubsurfaceScattering:
                material.DisableKeyword("_MATERIAL_MODEL_STANDARD");
                material.EnableKeyword("_MATERIAL_MODEL_SSS");
                break;
            }
        }
Beispiel #11
0
        private void ToggleFillMode()
        {
            _rasterizerDescription.FillMode = (_rasterizerDescription.FillMode == FillMode.Solid) ? FillMode.Wireframe : FillMode.Solid;
            var fillMode = _rasterizerDescription.FillMode;

            switch (fillMode)
            {
            case FillMode.Solid:
                _shadingModel = ShadingModel.Lambert;
                break;

            case FillMode.Wireframe:
                _shadingModel = ShadingModel.SolidGreen;
                break;

            default:
                throw new Exception($"Unknown {nameof(FillMode)}: {fillMode}");
            }
            _deviceContext.Rasterizer.State = RasterizerState.FromDescription(_device, _rasterizerDescription);
        }
        public void Test_Model_ShadingModel()
        {
            ShadingModel testSM = new ShadingModel();

            testSM.ThemeFillShade = "toto";
            testSM.ThemeFillTint  = "toto";
            Assert.AreEqual(testSM.ThemeFillShade, testSM.ThemeFillTint);

            testSM.Color = "color";
            testSM.Fill  = "color";
            Assert.AreEqual(testSM.Color, testSM.Fill);

            testSM.ThemeShade = "toto";
            testSM.ThemeTint  = "toto";
            Assert.AreEqual(testSM.ThemeShade, testSM.ThemeTint);

            testSM.Val = (ShadingPatternValues)0;
            Assert.AreEqual((ShadingPatternValues)0, testSM.Val);

            testSM.ThemeColor = (ThemeColorValues)0;
            testSM.ThemeFill  = (ThemeColorValues)0;
            Assert.AreEqual(testSM.ThemeColor, testSM.ThemeFill);
        }
Beispiel #13
0
 public static void ShadeModel(ShadingModel mode)
 {
     gl.glShadeModel((int)mode);
 }
Beispiel #14
0
 public static void glShadeModel(ShadingModel mode)
 {
     i_OpenGL1_0.glShadeModel(mode);
 }
Beispiel #15
0
 internal static extern void glShadeModel(ShadingModel mode);
Beispiel #16
0
 public static void ShadeModel(ShadingModel mode)
 {
     Interop.Calli((int)mode, ShadeModelAddress);
 }
Beispiel #17
0
		internal static extern void glShadeModel(ShadingModel mode);
Beispiel #18
0
 public void ShadeModel(ShadingModel mode)
 {
     gl.glShadeModel((int)mode);
     CheckException();
 }
Beispiel #19
0
 public void ShadeModel(ShadingModel shadingModel)
 {
     GL.ShadeModel(shadingModel);
 }
Beispiel #20
0
 public static void ShadeModel(ShadingModel model)
 {
     Instance?.ShadeModel(model);
     CheckForError();
 }
Beispiel #21
0
 public void ShadeModel(ShadingModel mode) =>
 shadeModel(mode);
Beispiel #22
0
 public GLShadingModel(GraphicsInterface gi, ShadingModel aModel)
     :base(gi)
 {
     fShadingModel = aModel;
 }
Beispiel #23
0
		public static void ShadeModel(ShadingModel mode)
		{
			Debug.Assert(Delegates.pglShadeModel != null, "pglShadeModel not implemented");
			Delegates.pglShadeModel((Int32)mode);
			CallLog("glShadeModel({0})", mode);
			DebugCheckErrors();
		}
Beispiel #24
0
 public virtual void SetModel(ShadingModel aModel)
 {
     fShadingModel = aModel;
     Realize();
 }
 public static extern void ShadeModel( ShadingModel mode );
Beispiel #26
0
 public void ShadeModel(ShadingModel model)
 {
     glShadeModel((int)model);
 }
Beispiel #27
0
		public static void ShadeModel(ShadingModel model)
		{
#if USE_OPENGL
			if (openGlHardwareAvailable)
			{
				OpenTK.Graphics.OpenGL.GL.ShadeModel((OpenTK.Graphics.OpenGL.ShadingModel)model);
			}
#else
			OpenTK.Graphics.ES11.GL.ShadeModel ((OpenTK.Graphics.ES11.All)model);
#endif
		}
Beispiel #28
0
 static extern void shadeModel(ShadingModel mode);
Beispiel #29
0
 public static void ShadeModel(ShadingModel model)
 {
     Instance?.ShadeModel(model);
 }
Beispiel #30
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Q:
                scale += 0.05;
                CreateVertices1(slices, stacks);
                break;

            case Key.A:
                scale -= 0.05;
                CreateVertices1(slices, stacks);
                break;

            case Key.W:
                rej = !rej;
                CreateVertices1(slices, stacks);
                break;

            case Key.S:
                peg = !peg;
                CreateVertices1(slices, stacks);
                break;

            case Key.D:
                angleX += 0.5;
                //CreateVertices(slices, stacks);
                break;

            case Key.F:
                angleY += 0.5;
                //CreateVertices(slices, stacks);
                break;

            case Key.X:
                angleX -= 0.5;
                //CreateVertices(slices, stacks);
                break;

            case Key.C:
                angleY -= 0.5;
                //CreateVertices(slices, stacks);
                break;

            case Key.G:
                angleZ += 1;
                //CreateVertices(slices, stacks);
                break;

            case Key.V:
                angleZ -= 1;
                //CreateVertices(slices, stacks);
                break;

            case Key.E:
                checkT = !checkT;
                break;

            case Key.R:
                SaveStateToFile("1.txt");
                break;

            case Key.T:
                LoadStateFromFile("1.txt");
                break;

            case Key.Y:
                if (mod == PolygonMode.Fill)
                {
                    mod = PolygonMode.Line;
                }
                else
                {
                    mod = PolygonMode.Fill;
                }
                break;

            case Key.U:
                slices += 10;
                stacks += 10;
                CreateVertices1(slices, stacks);
                break;

            case Key.I:
                slices -= 10;
                stacks -= 10;
                CreateVertices1(slices, stacks);
                break;

            case Key.H:
                if (mod2 == ShadingModel.Smooth)
                {
                    mod2 = ShadingModel.Flat;
                }
                else
                {
                    mod2 = ShadingModel.Smooth;
                }
                break;

            case Key.J:
                lp0 -= 50;
                break;

            case Key.N:
                lp0 += 50;
                break;

            case Key.K:
                lp1 -= 50;
                break;

            case Key.M:
                lp1 += 50;
                break;


            default:
                break;
            }
            glControl.Invalidate();
        }