当前位置: 首页>>代码示例>>C#>>正文


C# BlendMode类代码示例

本文整理汇总了C#中BlendMode的典型用法代码示例。如果您正苦于以下问题:C# BlendMode类的具体用法?C# BlendMode怎么用?C# BlendMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BlendMode类属于命名空间,在下文中一共展示了BlendMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawTechnique

 /// <summary>
 /// Creates a new DrawTechnique using the specified <see cref="BlendMode"/> and <see cref="Duality.Resources.ShaderProgram"/>.
 /// </summary>
 /// <param name="blendType"></param>
 /// <param name="shader"></param>
 /// <param name="formatPref"></param>
 public DrawTechnique(BlendMode blendType, ContentRef<ShaderProgram> shader, VertexDeclaration formatPref = null)
 {
     this.blendType = blendType;
     this.shader = shader;
     this.prefFormat = formatPref;
     this.prefType = formatPref != null ? formatPref.DataType : null;
 }
开发者ID:SirePi,项目名称:duality,代码行数:13,代码来源:DrawTechnique.cs

示例2: SetupMaterialWithBlendMode

 public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
 {
     switch (blendMode)
     {
     case BlendMode.Opaque:
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
         material.SetInt("_ZWrite", 1);
         material.DisableKeyword("_ALPHATEST_ON");
         material.DisableKeyword("_ALPHABLEND_ON");
         material.renderQueue = -1;
         break;
     case BlendMode.Cutout:
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
         material.SetInt("_ZWrite", 1);
         material.EnableKeyword("_ALPHATEST_ON");
         material.DisableKeyword("_ALPHABLEND_ON");
         material.renderQueue = 2450;
         break;
     case BlendMode.Transparent:
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
         material.SetInt("_ZWrite", 0);
         material.DisableKeyword("_ALPHATEST_ON");
         material.EnableKeyword("_ALPHABLEND_ON");
         material.renderQueue = 3000;
         break;
     }
 }
开发者ID:SilentSupernova,项目名称:Getaway,代码行数:30,代码来源:StandardShaderCurveGUI.cs

示例3: RenderStates

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct a set of render states with all its attributes
 /// </summary>
 /// <param name="blendMode">Blend mode to use</param>
 /// <param name="transform">Transform to use</param>
 /// <param name="texture">Texture to use</param>
 /// <param name="shader">Shader to use</param>
 ////////////////////////////////////////////////////////////
 public RenderStates(BlendMode blendMode, Transform transform, Texture texture, Shader shader)
 {
     BlendMode = blendMode;
     Transform = transform;
     Texture = texture;
     Shader = shader;
 }
开发者ID:mateuscezar,项目名称:netgore,代码行数:16,代码来源:RenderStates.cs

示例4: GetNewInstanceOfBatch

		protected override Batch GetNewInstanceOfBatch(Material material, BlendMode blendMode,
			int numberOfQuadsToAdd)
		{
			if ((material.Shader as ShaderWithFormat).Format.Is3D)
				throw new BatchRenderer2DCannotBeUsedToRender3D(); //ncrunch: no coverage
			return new Batch2D(material, blendMode, numberOfQuadsToAdd);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:BatchRenderer2D.cs

示例5: DrawVertexBuffer

 public void DrawVertexBuffer(IVertexBuffer<Vertex> buffer, int start, int length, PrimitiveType type, Sheet sheet, BlendMode blendMode)
 {
     shader.SetTexture("DiffuseTexture", sheet.GetTexture());
     renderer.Device.SetBlendMode(blendMode);
     shader.Render(() => renderer.DrawBatch(buffer, start, length, type));
     renderer.Device.SetBlendMode(BlendMode.None);
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:SpriteRenderer.cs

示例6: UPALayer

	// Constructor
	public UPALayer (UPAImage img) {
		name = "Layer " + (img.layers.Count + 1);
		opacity = 1;
		mode = BlendMode.NORMAL;
		
		map = new Color[img.width * img.height];
		tex = new Texture2D (img.width, img.height);
		
		for (int x = 0; x < img.width; x++) {
			for (int y = 0; y < img.height; y++) {
				map[x + y * img.width] = Color.clear;
				tex.SetPixel (x,y, Color.clear);
			}
		}
		
		tex.filterMode = FilterMode.Point;
		tex.Apply ();
		
		enabled = true;
		locked = false;
		parentImg = img;
		
		// Because Unity won't record map (Color[]) as an undo,
		// we instead register a callback to LoadMapFromTex since undoing textures works fine
		Undo.undoRedoPerformed += LoadMapFromTex; // subscribe to the undo event
	}
开发者ID:Jordan-Mark,项目名称:BlackoutGame,代码行数:27,代码来源:UPALayer.cs

示例7: Begin

        public void Begin(GraphicsDevice gd)
        {
            Debug.Assert(batchMode == BatchMode.None, "Bad batch mode: " + batchMode);

            matrixStack.Clear();
            matrix = Matrix.Identity;

            drawColor = Color.White;
            blendMode = BlendMode.AlphaBlend;

            if (graphicsDevice != gd)
            {
                graphicsDevice = gd;
                spriteBatch = new SpriteBatch(graphicsDevice);
                basicEffect = new BasicEffect(graphicsDevice);

                int width = gd.Viewport.Width;
                int height = gd.Viewport.Height;

                Matrix worldMatrix = Matrix.Identity;
                Matrix viewMatrix = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up);
                Matrix projection = Matrix.CreateOrthographicOffCenter(0.0f, width, height, 0, 1.0f, 1000.0f);
                camera = new Camera(worldMatrix, viewMatrix, projection);

                basicEffect.World = worldMatrix;
                basicEffect.View = viewMatrix;
                basicEffect.Projection = projection;
                basicEffect.VertexColorEnabled = true;
            }
        }
开发者ID:bbqchickenrobot,项目名称:atomic-bomberman-xna,代码行数:30,代码来源:Context.cs

示例8: TerrainSpriteLayer

        public TerrainSpriteLayer(World world, WorldRenderer wr, Sheet sheet, BlendMode blendMode, PaletteReference palette, bool restrictToBounds)
        {
            worldRenderer = wr;
            this.restrictToBounds = restrictToBounds;
            Sheet = sheet;
            BlendMode = blendMode;
            paletteIndex = palette.TextureIndex;

            map = world.Map;
            rowStride = 4 * map.MapSize.X;

            vertices = new Vertex[rowStride * map.MapSize.Y];
            vertexBuffer = Game.Renderer.Device.CreateVertexBuffer(vertices.Length);
            emptySprite = new Sprite(sheet, Rectangle.Empty, TextureChannel.Alpha);

            wr.PaletteInvalidated += () =>
            {
                paletteIndex = palette.TextureIndex;

                // Everything in the layer uses the same palette,
                // so we can fix the indices in one pass
                for (var i = 0; i < vertices.Length; i++)
                {
                    var v = vertices[i];
                    vertices[i] = new Vertex(v.X, v.Y, v.Z, v.U, v.V, paletteIndex, v.C);
                }

                for (var row = 0; row < map.MapSize.Y; row++)
                    dirtyRows.Add(row);
            };
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:31,代码来源:TerrainSpriteLayer.cs

示例9: LayerProperties

		public LayerProperties (string name, bool hidden, double opacity, BlendMode blendmode)
		{
			this.Opacity = opacity;			
			this.Hidden = hidden;
			this.Name = name;
			this.BlendMode = blendmode;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:7,代码来源:LayerProperties.cs

示例10: SetBlendMode

        public void SetBlendMode(BlendMode blendMode)
        {
            Assert.IsNotNull(renderer, Errors.E_RENDER_TARGET_NULL);

            int result = SDL.SDL_SetTextureBlendMode(Handle, (SDL.SDL_BlendMode)blendMode);
            if (Utilities.IsError(result))
                throw new InvalidOperationException(Utilities.GetErrorMessage("SDL_SetTextureBlendMode"));
        }
开发者ID:richardlalancette,项目名称:SharpDL,代码行数:8,代码来源:RenderTarget.cs

示例11: Blit

 /// <summary>
 /// http://en.wikipedia.org/wiki/Alpha_compositing
 /// </summary>
 /// <param name="destination_rect"></param>
 /// <param name="source"></param>
 /// <param name="source_rect"></param>
 /// <param name="blendMode"></param>
 public void Blit(
     Rectangle destination_rect,
     IPixelCanvas source,
     Rectangle source_rect,
     BlendMode blendMode)
 {
     Blit(destination_rect, source, source_rect, 255, 255, 255, 255, blendMode);
 }
开发者ID:squaredinfinity,项目名称:Foundation,代码行数:15,代码来源:PixelCanvas.Blit.cs

示例12: Layer

        public Layer(ImageSurface surface, bool hidden, double opacity, string name)
        {
            Surface = surface;

            this.hidden = hidden;
            this.opacity = opacity;
            this.name = name;
            this.blend_mode = BlendMode.Normal;
        }
开发者ID:PintaProject,项目名称:Pinta,代码行数:9,代码来源:Layer.cs

示例13: OnInspectorGUI

 public void OnInspectorGUI(Action onValueChanged)
 {
     // blend mode.
     var newBlendMode = (BlendMode)EditorGUILayout.Popup("Rendering Mode", (int)blendMode, Enum.GetNames(typeof(BlendMode)), new GUILayoutOption[0]);
     if (newBlendMode != blendMode) {
         this.blendMode = newBlendMode;
         onValueChanged();
     }
 }
开发者ID:unity3d-jp,项目名称:AssetGraph,代码行数:9,代码来源:MaterialModifier.cs

示例14: Blit

 /// <summary>
 /// http://en.wikipedia.org/wiki/Alpha_compositing
 /// </summary>
 /// <param name="destination_rect"></param>
 /// <param name="source"></param>
 /// <param name="source_rect"></param>
 /// <param name="blendMode"></param>
 public void Blit(
     System.Drawing.Rectangle destination_rect,
     IPixelCanvas source,
     System.Drawing.Rectangle source_rect,
     BlendMode blendMode
     )
 {
     Blit(destination_rect, source, source_rect, 255, 255, 255, 255, blendMode);
 }
开发者ID:squaredinfinity,项目名称:Foundation,代码行数:16,代码来源:PixelCanvas.Blit.cs

示例15: SetRenderStateForSprite

		void SetRenderStateForSprite(Sprite s)
		{
			renderer.CurrentBatchRenderer = this;

			if (s.BlendMode != currentBlend || s.Sheet != currentSheet || nv + 4 > renderer.TempBufferSize)
				Flush();

			currentBlend = s.BlendMode;
			currentSheet = s.Sheet;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:10,代码来源:SpriteRenderer.cs


注:本文中的BlendMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。