<commit_before>// Copyright 2016, <NAME> <<EMAIL>>
// See the LICENSE file for more details.

package eweygewey

import (
	mgl "github.com/go-gl/mathgl/mgl32"
)

// constants used for polling the state of a mouse button
const (
	MouseDown        = 0
	MouseUp          = 1
	MouseClick       = 2
	MouseDoubleClick = 4
)

// Style defines parameters to the drawing functions that control the way
// the widgets are organized and drawn.
type Style struct {
	ButtonColor          mgl.Vec4 // button background color
	ButtonHoverColor     mgl.Vec4 // button background color with mouse hovering
	ButtonActiveColor    mgl.Vec4 // button background color when clicked
	ButtonTextColor      mgl.Vec4 // button text color
	ButtonMargin         mgl.Vec4 // [left,right,top,bottom] margin values for buttons
	ButtonPadding        mgl.Vec4 // [left,right,top,bottom] padding values for buttons
	CheckboxColor        mgl.Vec4 // checkbox background color
	CheckboxCheckColor   mgl.Vec4 // checkbox cursor color when clicked
	CheckboxCursorWidth  float32  // checkbox inner check cursor size
	CheckboxMargin       mgl.Vec4 // [left,right,top,bottom] margin values for checkbox
	CheckboxPadding      mgl.Vec4 // [left,right,top,bottom] padding values for checkbox
	EditboxBgColor       mgl.Vec4 // Editbox background color
	EditboxActiveColor   mgl.Vec4 // Editbox background color when clicked
	EditboxCursorColor   mgl.Vec4 // color for the editbox cursor
	EditboxCursorWidth   float32  // width of the editbox cursor in pixels
	EditboxBlinkDuration float32  // how long the cursor is visible during a blink (in seconds)
	EditboxBlinkInterval float32  // how many seconds between the start of the cursor blink (in seconds)
	EditboxTextColor     mgl.Vec4 // Editbox text color
	EditboxMargin        mgl.Vec4 // [left,right,top,bottom] margin values for Editbox
	EditboxPadding       mgl.Vec4 // [left,right,top,bottom] padding values for Editbox
	FontName             string   // font name to use by default
	ImageMargin          mgl.Vec4 // margin for the image widgets
	ScrollBarCursorColor mgl.Vec4 // the color of the cursor of the scroll bar
	ScrollBarBgColor     mgl.Vec4 // the color of the background of the scroll bar
	ScrollBarWidth       float32  // the width of the scroll bar
	ScrollBarCursorWidth float32  // the width of the scroll bar cursor
	SeparatorColor       mgl.Vec4 // the color of the separator bar
	SeparatorHeight      float32  // the height of the separator rectangle
	SeparatorMargin      mgl.Vec4 // the margin for the separator rectangle
	SliderBgColor        mgl.Vec4 // slider background color
	SliderCursorColor    mgl.Vec4 // slider cursor color
	SliderFloatFormat    string   // formatting string for the float value in a slider
	SliderIntFormat      string   // formatting string for the int value in a slider
	SliderMargin         mgl.Vec4 // margin for the slider text strings
	SliderPadding        mgl.Vec4 // padding for the slider text strings
	SliderTextColor      mgl.Vec4 // slider text color
	SliderCursorWidth    float32  // slider cursor width
	TextColor            mgl.Vec4 // text color
	TextMargin           mgl.Vec4 // margin for text widgets
	TitleBarTextColor    mgl.Vec4 // text color
	TitleBarBgColor      mgl.Vec4 // window background color
	WindowBgColor        mgl.Vec4 // window background color
	WindowPadding        mgl.Vec4 // [left,right,top,bottom] padding values for windows
}

var (
	// VertShader330 is the GLSL vertex shader program for the user interface.
	VertShader330 = `#version 330
  uniform mat4 VIEW;
  in vec2 VERTEX_POSITION;
  in vec2 VERTEX_UV;
  in float VERTEX_TEXTURE_INDEX;
  in vec4 VERTEX_COLOR;
  out vec2 vs_uv;
  out vec4 vs_color;
  out float vs_tex_index;
  void main()
  {
    vs_uv = VERTEX_UV;
    vs_color = VERTEX_COLOR;
	vs_tex_index = VERTEX_TEXTURE_INDEX;
    gl_Position = VIEW * vec4(VERTEX_POSITION, 0.0, 1.0);
  }`

	// FragShader330 is the GLSL fragment shader program for the user interface.
	// NOTE: 4 samplers is a hardcoded value now, but there's no reason it has to be that specifically.
	FragShader330 = `#version 330
  uniform sampler2D TEX[4];
  in vec2 vs_uv;
  in vec4 vs_color;
  in float vs_tex_index;
  out vec4 frag_color;
  void main()
  {
  	int i = int(vs_tex_index);
	frag_color = vs_color * texture(TEX[i], vs_uv).rgba;
  }`

	// DefaultStyle is the default style to use for drawing widgets
	DefaultStyle = Style{
		ButtonColor:          ColorIToV(171, 102, 102, 153),
		ButtonActiveColor:    ColorIToV(204, 128, 120, 255),
		ButtonHoverColor:     ColorIToV(171, 102, 102, 255),
		ButtonTextColor:      ColorIToV(230, 230, 230, 255),
		ButtonMargin:         mgl.Vec4{2, 2, 4, 4},
		ButtonPadding:        mgl.Vec4{4, 4, 2, 2},
		CheckboxColor:        ColorIToV(128, 128, 128, 179),
		CheckboxCheckColor:   ColorIToV(204, 128, 120, 255),
		CheckboxCursorWidth:  16.0,
		CheckboxMargin:       mgl.Vec4{2, 2, 4, 4},
		CheckboxPadding:      mgl.Vec4{4, 4, 2, 2},
		EditboxBgColor:       ColorIToV(128, 128, 128, 179),
		EditboxActiveColor:   ColorIToV(204, 128, 120, 255),
		EditboxCursorColor:   ColorIToV(230, 230, 230, 255),
		EditboxCursorWidth:   3.0,
		EditboxBlinkDuration: 0.25,
		EditboxBlinkInterval: 1.0,
		EditboxTextColor:     ColorIToV(230, 230, 230, 255),
		EditboxMargin:        mgl.Vec4{2, 2, 4, 4},
		EditboxPadding:       mgl.Vec4{4, 4, 2, 2},
		FontName:             "Default",<commit_msg>fix frag shader<commit_after>// Copyright 2016, <NAME> <<EMAIL>>
// See the LICENSE file for more details.

package eweygewey

import (
	mgl "github.com/go-gl/mathgl/mgl32"
)

// constants used for polling the state of a mouse button
const (
	MouseDown        = 0
	MouseUp          = 1
	MouseClick       = 2
	MouseDoubleClick = 4
)

// Style defines parameters to the drawing functions that control the way
// the widgets are organized and drawn.
type Style struct {
	ButtonColor          mgl.Vec4 // button background color
	ButtonHoverColor     mgl.Vec4 // button background color with mouse hovering
	ButtonActiveColor    mgl.Vec4 // button background color when clicked
	ButtonTextColor      mgl.Vec4 // button text color
	ButtonMargin         mgl.Vec4 // [left,right,top,bottom] margin values for buttons
	ButtonPadding        mgl.Vec4 // [left,right,top,bottom] padding values for buttons
	CheckboxColor        mgl.Vec4 // checkbox background color
	CheckboxCheckColor   mgl.Vec4 // checkbox cursor color when clicked
	CheckboxCursorWidth  float32  // checkbox inner check cursor size
	CheckboxMargin       mgl.Vec4 // [left,right,top,bottom] margin values for checkbox
	CheckboxPadding      mgl.Vec4 // [left,right,top,bottom] padding values for checkbox
	EditboxBgColor       mgl.Vec4 // Editbox background color
	EditboxActiveColor   mgl.Vec4 // Editbox background color when clicked
	EditboxCursorColor   mgl.Vec4 // color for the editbox cursor
	EditboxCursorWidth   float32  // width of the editbox cursor in pixels
	EditboxBlinkDuration float32  // how long the cursor is visible during a blink (in seconds)
	EditboxBlinkInterval float32  // how many seconds between the start of the cursor blink (in seconds)
	EditboxTextColor     mgl.Vec4 // Editbox text color
	EditboxMargin        mgl.Vec4 // [left,right,top,bottom] margin values for Editbox
	EditboxPadding       mgl.Vec4 // [left,right,top,bottom] padding values for Editbox
	FontName             string   // font name to use by default
	ImageMargin          mgl.Vec4 // margin for the image widgets
	ScrollBarCursorColor mgl.Vec4 // the color of the cursor of the scroll bar
	ScrollBarBgColor     mgl.Vec4 // the color of the background of the scroll bar
	ScrollBarWidth       float32  // the width of the scroll bar
	ScrollBarCursorWidth float32  // the width of the scroll bar cursor
	SeparatorColor       mgl.Vec4 // the color of the separator bar
	SeparatorHeight      float32  // the height of the separator rectangle
	SeparatorMargin      mgl.Vec4 // the margin for the separator rectangle
	SliderBgColor        mgl.Vec4 // slider background color
	SliderCursorColor    mgl.Vec4 // slider cursor color
	SliderFloatFormat    string   // formatting string for the float value in a slider
	SliderIntFormat      string   // formatting string for the int value in a slider
	SliderMargin         mgl.Vec4 // margin for the slider text strings
	SliderPadding        mgl.Vec4 // padding for the slider text strings
	SliderTextColor      mgl.Vec4 // slider text color
	SliderCursorWidth    float32  // slider cursor width
	TextColor            mgl.Vec4 // text color
	TextMargin           mgl.Vec4 // margin for text widgets
	TitleBarTextColor    mgl.Vec4 // text color
	TitleBarBgColor      mgl.Vec4 // window background color
	WindowBgColor        mgl.Vec4 // window background color
	WindowPadding        mgl.Vec4 // [left,right,top,bottom] padding values for windows
}

var (
	// VertShader330 is the GLSL vertex shader program for the user interface.
	VertShader330 = `#version 330
  uniform mat4 VIEW;
  in vec2 VERTEX_POSITION;
  in vec2 VERTEX_UV;
  in float VERTEX_TEXTURE_INDEX;
  in vec4 VERTEX_COLOR;
  out vec2 vs_uv;
  out vec4 vs_color;
  out float vs_tex_index;
  void main()
  {
    vs_uv = VERTEX_UV;
    vs_color = VERTEX_COLOR;
    vs_tex_index = VERTEX_TEXTURE_INDEX;
    gl_Position = VIEW * vec4(VERTEX_POSITION, 0.0, 1.0);
  }`

	// FragShader330 is the GLSL fragment shader program for the user interface.
	// NOTE: 4 samplers is a hardcoded value now, but there's no reason it has to be that specifically.
	FragShader330 = `#version 330
  uniform sampler2D TEX[4];
  in vec2 vs_uv;
  in vec4 vs_color;
  in float vs_tex_index;
  out vec4 frag_color;
  void main()
  {
    int i = int(vs_tex_index);
    switch(int(vs_tex_index))
    {
      case 0: frag_color = vs_color * texture(TEX[0], vs_uv).rgba;
      case 1: frag_color = vs_color * texture(TEX[1], vs_uv).rgba;
      case 2: frag_color = vs_color * texture(TEX[2], vs_uv).rgba;
      case 3: frag_color = vs_color * texture(TEX[3], vs_uv).rgba;
    }
    
  }`

	// DefaultStyle is the default style to use for drawing widgets
	DefaultStyle = Style{
		ButtonColor:          ColorIToV(171, 102, 102, 153),
		ButtonActiveColor:    ColorIToV(204, 128, 120, 255),
		ButtonHoverColor:     ColorIToV(171, 102, 102, 255),
		ButtonTextColor:      ColorIToV(230, 230, 230, 255),
		ButtonMargin:         mgl.Vec4{2, 2, 4, 4},
		ButtonPadding:        mgl.Vec4{4, 4, 2, 2},
		CheckboxColor:        ColorIToV(128, 128, 128, 179),
		CheckboxCheckColor:   ColorIToV(204, 128, 120, 255),
		CheckboxCursorWidth:  16.0,
		CheckboxMargin:       mgl.Vec4{2, 2, 4, 4},
		CheckboxPadding:      mgl.Vec4{4, 4, 2, 2},
		EditboxBgColor:       ColorIToV(128, 128, 128, 179),
		EditboxActiveColor:   ColorIToV(204, 128, 120, 255),
		EditboxCursorColor:   ColorIToV(230, 230, 230, 255),
		EditboxCursorWidth:   3.0,
		EditboxBlinkDuration: 0.25,
		EditboxBlinkInterval: 1.0,
		EditboxTextColor:     ColorIToV(230, 230, 230, 255),
		EditboxMargin:        mgl.Vec4{2, 2, 4, 4},
		EditboxPadding:       mgl.Vec4{4, 4, 2, 2},
		FontName:             "Default",
{'fraction_non_alphanumeric': 0.07653475164518164, 'fraction_numerical': 0.046335526908861446, 'mean_word_length': 3.068206820682068, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '561064', 'n_tokens_mistral': 3923, 'n_tokens_neox': 3511, 'n_words': 1180}