/// <summary> /// 彩色的色标带。 /// </summary> /// <param name="anchor"></param> /// <param name="margin"></param> /// <param name="size"></param> /// <param name="zNear"></param> /// <param name="zFar"></param> public UIColorPaletteBarRenderer( CodedColor[] codedColors, System.Windows.Forms.AnchorStyles anchor, System.Windows.Forms.Padding margin, System.Drawing.Size size, int zNear, int zFar) : base(anchor, margin, size, zNear, zFar) { this.codedColors = codedColors; var model = new QuadStripModel(1); this.Renderer = QuadStripRenderer.Create(model); }
public static QuadStripRenderer Create(QuadStripModel model) { var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\QuadStripTexture.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\QuadStripTexture.frag"), ShaderType.FragmentShader); var map = new AttributeMap(); map.Add("in_Position", QuadStripModel.position); map.Add("in_TexCoord", QuadStripModel.texCoord); var renderer = new QuadStripRenderer(model, shaderCodes, map); return renderer; }