private void GenerateTexMat() { if (this.material != null) { this.material.Dispose(); } if (this.texture != null) { this.texture.Dispose(); } if (this.pixelData == null) { return; } this.texture = new Texture(this.pixelData, TextureSizeMode.Enlarge, this.IsPixelGridAligned ? TextureMagFilter.Nearest : TextureMagFilter.Linear, this.IsPixelGridAligned ? TextureMinFilter.Nearest : TextureMinFilter.LinearMipmapLinear); // Select DrawTechnique to use ContentRef <DrawTechnique> technique; if (this.renderMode == RenderMode.MonochromeBitmap) { technique = DrawTechnique.Mask; } else if (this.renderMode == RenderMode.GrayscaleBitmap) { technique = DrawTechnique.Alpha; } else if (this.renderMode == RenderMode.SmoothBitmap) { technique = DrawTechnique.Alpha; } else { technique = DrawTechnique.SharpAlpha; } // Create and configure internal BatchInfo BatchInfo matInfo = new BatchInfo(technique, ColorRgba.White, this.texture); if (technique == DrawTechnique.SharpAlpha) { matInfo.SetUniform("smoothness", this.size * 4.0f); } this.material = new Material(matInfo); }
private void GenerateMaterial() { if (this.material != null) { this.material.Dispose(); } if (this.texture == null) { return; } // Select DrawTechnique to use ContentRef <DrawTechnique> technique; if (this.renderMode == RenderMode.MonochromeBitmap) { technique = DrawTechnique.Mask; } else if (this.renderMode == RenderMode.GrayscaleBitmap) { technique = DrawTechnique.Alpha; } else if (this.renderMode == RenderMode.SmoothBitmap) { technique = DrawTechnique.Alpha; } else { technique = DrawTechnique.SharpAlpha; } // Create and configure internal BatchInfo BatchInfo matInfo = new BatchInfo(technique, ColorRgba.White, this.texture); if (technique == DrawTechnique.SharpAlpha) { matInfo.SetUniform("smoothness", this.size * 4.0f); } this.material = new Material(matInfo); }