sources.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. // File generated by G3NSHADERS. Do not edit.
  2. // To regenerate this file install 'g3nshaders' and execute:
  3. // 'go generate' in this folder.
  4. package shaders
  5. const include_phong_model_source = `/***
  6. phong lighting model
  7. Parameters:
  8. position: input vertex position in camera coordinates
  9. normal: input vertex normal in camera coordinates
  10. camDir: input camera directions
  11. matAmbient: input material ambient color
  12. matDiffuse: input material diffuse color
  13. ambdiff: output ambient+diffuse color
  14. spec: output specular color
  15. Uniforms:
  16. AmbientLightColor[]
  17. DiffuseLightColor[]
  18. DiffuseLightPosition[]
  19. PointLightColor[]
  20. PointLightPosition[]
  21. PointLightLinearDecay[]
  22. PointLightQuadraticDecay[]
  23. MatSpecularColor
  24. MatShininess
  25. *****/
  26. void phongModel(vec4 position, vec3 normal, vec3 camDir, vec3 matAmbient, vec3 matDiffuse, out vec3 ambdiff, out vec3 spec) {
  27. vec3 ambientTotal = vec3(0.0);
  28. vec3 diffuseTotal = vec3(0.0);
  29. vec3 specularTotal = vec3(0.0);
  30. #if AMB_LIGHTS>0
  31. // Ambient lights
  32. for (int i = 0; i < AMB_LIGHTS; i++) {
  33. ambientTotal += AmbientLightColor[i] * matAmbient;
  34. }
  35. #endif
  36. #if DIR_LIGHTS>0
  37. // Directional lights
  38. for (int i = 0; i < DIR_LIGHTS; i++) {
  39. // Diffuse reflection
  40. // DirLightPosition is the direction of the current light
  41. vec3 lightDirection = normalize(DirLightPosition(i));
  42. // Calculates the dot product between the light direction and this vertex normal.
  43. float dotNormal = max(dot(lightDirection, normal), 0.0);
  44. diffuseTotal += DirLightColor(i) * matDiffuse * dotNormal;
  45. // Specular reflection
  46. // Calculates the light reflection vector
  47. vec3 ref = reflect(-lightDirection, normal);
  48. if (dotNormal > 0.0) {
  49. specularTotal += DirLightColor(i) * MatSpecularColor * pow(max(dot(ref, camDir), 0.0), MatShininess);
  50. }
  51. }
  52. #endif
  53. #if POINT_LIGHTS>0
  54. // Point lights
  55. for (int i = 0; i < POINT_LIGHTS; i++) {
  56. // Common calculations
  57. // Calculates the direction and distance from the current vertex to this point light.
  58. vec3 lightDirection = PointLightPosition(i) - vec3(position);
  59. float lightDistance = length(lightDirection);
  60. // Normalizes the lightDirection
  61. lightDirection = lightDirection / lightDistance;
  62. // Calculates the attenuation due to the distance of the light
  63. float attenuation = 1.0 / (1.0 + PointLightLinearDecay(i) * lightDistance +
  64. PointLightQuadraticDecay(i) * lightDistance * lightDistance);
  65. // Diffuse reflection
  66. float dotNormal = max(dot(lightDirection, normal), 0.0);
  67. diffuseTotal += PointLightColor(i) * matDiffuse * dotNormal * attenuation;
  68. // Specular reflection
  69. // Calculates the light reflection vector
  70. vec3 ref = reflect(-lightDirection, normal);
  71. if (dotNormal > 0.0) {
  72. specularTotal += PointLightColor(i) * MatSpecularColor *
  73. pow(max(dot(ref, camDir), 0.0), MatShininess) * attenuation;
  74. }
  75. }
  76. #endif
  77. // Sets output colors
  78. ambdiff = ambientTotal + MatEmissiveColor + diffuseTotal;
  79. spec = specularTotal;
  80. }
  81. `
  82. const include_material_source = `//
  83. // Material properties uniform
  84. //
  85. uniform vec3 Material[6];
  86. // Macros to access elements inside the MatTexinfo array
  87. // Each texture uses 3 vec2 elements.
  88. #define MatAmbientColor Material[0]
  89. #define MatDiffuseColor Material[1]
  90. #define MatEmissiveColor Material[2]
  91. #define MatSpecularColor Material[3]
  92. #define MatShininess Material[4].x
  93. #define MatOpacity Material[4].y
  94. #define MatPointSize Material[4].z
  95. #define MatPointRotationZ Material[5].x
  96. #if MAT_TEXTURES > 0
  97. // Texture unit sampler array
  98. uniform sampler2D MatTexture[MAT_TEXTURES];
  99. // Texture parameters (3*vec2 per texture)
  100. uniform mat3 MatTexinfo[MAT_TEXTURES];
  101. // Macros to access elements inside the MatTexinfo array
  102. #define MatTexOffset(a) MatTexinfo[a][0].xy
  103. #define MatTexRepeat(a) MatTexinfo[a][1].xy
  104. #define MatTexFlipY(a) bool(MatTexinfo[a][2].x)
  105. #define MatTexVisible(a) bool(MatTexinfo[a][2].y)
  106. #endif
  107. `
  108. const include_lights_source = `//
  109. // Lights uniforms
  110. //
  111. // Ambient lights uniforms
  112. #if AMB_LIGHTS>0
  113. uniform vec3 AmbientLightColor[AMB_LIGHTS];
  114. #endif
  115. // Directional lights uniform array. Each directional light uses 2 elements
  116. #if DIR_LIGHTS>0
  117. uniform vec3 DirLight[2*DIR_LIGHTS];
  118. // Macros to access elements inside the DirectionalLight uniform array
  119. #define DirLightColor(a) DirLight[2*a]
  120. #define DirLightPosition(a) DirLight[2*a+1]
  121. #endif
  122. // Point lights uniform array. Each point light uses 3 elements
  123. #if POINT_LIGHTS>0
  124. uniform vec3 PointLight[3*POINT_LIGHTS];
  125. // Macros to access elements inside the PointLight uniform array
  126. #define PointLightColor(a) PointLight[3*a]
  127. #define PointLightPosition(a) PointLight[3*a+1]
  128. #define PointLightLinearDecay(a) PointLight[3*a+2].x
  129. #define PointLightQuadraticDecay(a) PointLight[3*a+2].y
  130. #endif
  131. #if SPOT_LIGHTS>0
  132. // Spot lights uniforms. Each spot light uses 5 elements
  133. uniform vec3 SpotLight[5*SPOT_LIGHTS];
  134. // Macros to access elements inside the PointLight uniform array
  135. #define SpotLightColor(a) SpotLight[5*a]
  136. #define SpotLightPosition(a) SpotLight[5*a+1]
  137. #define SpotLightDirection(a) SpotLight[5*a+2]
  138. #define SpotLightAngularDecay(a) SpotLight[5*a+3].x
  139. #define SpotLightCutoffAngle(a) SpotLight[5*a+3].y
  140. #define SpotLightLinearDecay(a) SpotLight[5*a+3].z
  141. #define SpotLightQuadraticDecay(a) SpotLight[5*a+4].x
  142. #endif
  143. `
  144. const include_attributes_source = `//
  145. // Vertex attributes
  146. //
  147. layout(location = 0) in vec3 VertexPosition;
  148. layout(location = 1) in vec3 VertexNormal;
  149. layout(location = 2) in vec3 VertexColor;
  150. layout(location = 3) in vec2 VertexTexcoord;
  151. layout(location = 4) in float VertexDistance;
  152. layout(location = 5) in vec4 VertexTexoffsets;
  153. `
  154. const basic_fragment_source = `//
  155. // Fragment Shader template
  156. //
  157. in vec3 Color;
  158. out vec4 FragColor;
  159. void main() {
  160. FragColor = vec4(Color, 1.0);
  161. }
  162. `
  163. const standard_fragment_source = `//
  164. // Fragment Shader template
  165. //
  166. #include <material>
  167. // Inputs from Vertex shader
  168. in vec3 ColorFrontAmbdiff;
  169. in vec3 ColorFrontSpec;
  170. in vec3 ColorBackAmbdiff;
  171. in vec3 ColorBackSpec;
  172. in vec2 FragTexcoord;
  173. // Output
  174. out vec4 FragColor;
  175. void main() {
  176. vec4 texCombined = vec4(1);
  177. #if MAT_TEXTURES > 0
  178. // Combine all texture colors and opacity
  179. for (int i = 0; i < MAT_TEXTURES; i++) {
  180. if (MatTexVisible(i) == false) {
  181. continue;
  182. }
  183. vec4 texcolor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));
  184. if (i == 0) {
  185. texCombined = texcolor;
  186. } else {
  187. texCombined = mix(texCombined, texcolor, texcolor.a);
  188. }
  189. }
  190. #endif
  191. vec4 colorAmbDiff;
  192. vec4 colorSpec;
  193. if (gl_FrontFacing) {
  194. colorAmbDiff = vec4(ColorFrontAmbdiff, MatOpacity);
  195. colorSpec = vec4(ColorFrontSpec, 0);
  196. } else {
  197. colorAmbDiff = vec4(ColorBackAmbdiff, MatOpacity);
  198. colorSpec = vec4(ColorBackSpec, 0);
  199. }
  200. FragColor = min(colorAmbDiff * texCombined + colorSpec, vec4(1));
  201. }
  202. `
  203. const panel_vertex_source = `//
  204. // Vertex shader panel
  205. //
  206. #include <attributes>
  207. // Model uniforms
  208. uniform mat4 ModelMatrix;
  209. // Outputs for fragment shader
  210. out vec2 FragTexcoord;
  211. void main() {
  212. // Always flip texture coordinates
  213. vec2 texcoord = VertexTexcoord;
  214. texcoord.y = 1 - texcoord.y;
  215. FragTexcoord = texcoord;
  216. // Set position
  217. vec4 pos = vec4(VertexPosition.xyz, 1);
  218. gl_Position = ModelMatrix * pos;
  219. }
  220. `
  221. const sprite_fragment_source = `//
  222. // Fragment shader for sprite
  223. //
  224. #include <material>
  225. // Inputs from vertex shader
  226. in vec3 Color;
  227. in vec2 FragTexcoord;
  228. // Output
  229. out vec4 FragColor;
  230. void main() {
  231. // Combine all texture colors and opacity
  232. vec4 texCombined = vec4(1);
  233. #if MAT_TEXTURES>0
  234. for (int i = 0; i < {{.MatTexturesMax}}; i++) {
  235. vec4 texcolor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));
  236. if (i == 0) {
  237. texCombined = texcolor;
  238. } else {
  239. texCombined = mix(texCombined, texcolor, texcolor.a);
  240. }
  241. }
  242. #endif
  243. // Combine material color with texture
  244. FragColor = min(vec4(Color, MatOpacity) * texCombined, vec4(1));
  245. }
  246. `
  247. const point_fragment_source = `#include <material>
  248. // Inputs from vertex shader
  249. in vec3 Color;
  250. flat in mat2 Rotation;
  251. // Output
  252. out vec4 FragColor;
  253. void main() {
  254. vec4 texCombined = vec4(1);
  255. #if MAT_TEXTURES > 0
  256. // Combine all texture colors and opacity
  257. for (int i = 0; i < MAT_TEXTURES; i++) {
  258. vec2 pt = gl_PointCoord - vec2(0.5);
  259. vec4 texcolor = texture(MatTexture[i], (Rotation * pt + vec2(0.5)) * MatTexRepeat(i) + MatTexOffset(i));
  260. if (i == 0) {
  261. texCombined = texcolor;
  262. } else {
  263. texCombined = mix(texCombined, texcolor, texcolor.a);
  264. }
  265. }
  266. #endif
  267. // Combine material color with texture
  268. FragColor = min(vec4(Color, MatOpacity) * texCombined, vec4(1));
  269. }
  270. `
  271. const phong_vertex_source = `//
  272. // Vertex Shader
  273. //
  274. #include <attributes>
  275. // Model uniforms
  276. uniform mat4 ModelViewMatrix;
  277. uniform mat3 NormalMatrix;
  278. uniform mat4 MVP;
  279. #include <material>
  280. // Output variables for Fragment shader
  281. out vec4 Position;
  282. out vec3 Normal;
  283. out vec3 CamDir;
  284. out vec2 FragTexcoord;
  285. void main() {
  286. // Transform this vertex position to camera coordinates.
  287. Position = ModelViewMatrix * vec4(VertexPosition, 1.0);
  288. // Transform this vertex normal to camera coordinates.
  289. Normal = normalize(NormalMatrix * VertexNormal);
  290. // Calculate the direction vector from the vertex to the camera
  291. // The camera is at 0,0,0
  292. CamDir = normalize(-Position.xyz);
  293. // Flips texture coordinate Y if requested.
  294. vec2 texcoord = VertexTexcoord;
  295. #if MAT_TEXTURES>0
  296. if (MatTexFlipY(0)) {
  297. texcoord.y = 1 - texcoord.y;
  298. }
  299. #endif
  300. FragTexcoord = texcoord;
  301. gl_Position = MVP * vec4(VertexPosition, 1.0);
  302. }
  303. `
  304. const panel_fragment_source = `//
  305. // Fragment Shader template
  306. //
  307. // Textures uniforms
  308. uniform sampler2D MatTexture[1];
  309. uniform mat3 MatTexinfo[1];
  310. // Macros to access elements inside MatTexinfo uniform
  311. #define MatTexOffset(a) MatTexinfo[a][0].xy
  312. #define MatTexRepeat(a) MatTexinfo[a][1].xy
  313. #define MatTexFlipY(a) bool(MatTexinfo[a][2].x)
  314. #define MatTexVisible(a) bool(MatTexinfo[a][2].y)
  315. // Inputs from vertex shader
  316. in vec2 FragTexcoord;
  317. // Input uniform
  318. uniform vec4 Panel[8];
  319. #define Bounds Panel[0] // panel bounds in texture coordinates
  320. #define Border Panel[1] // panel border in texture coordinates
  321. #define Padding Panel[2] // panel padding in texture coordinates
  322. #define Content Panel[3] // panel content area in texture coordinates
  323. #define BorderColor Panel[4] // panel border color
  324. #define PaddingColor Panel[5] // panel padding color
  325. #define ContentColor Panel[6] // panel content color
  326. #define TextureValid bool(Panel[7].x) // texture valid flag
  327. // Output
  328. out vec4 FragColor;
  329. /***
  330. * Checks if current fragment texture coordinate is inside the
  331. * supplied rectangle in texture coordinates:
  332. * rect[0] - position x [0,1]
  333. * rect[1] - position y [0,1]
  334. * rect[2] - width [0,1]
  335. * rect[3] - height [0,1]
  336. */
  337. bool checkRect(vec4 rect) {
  338. if (FragTexcoord.x < rect[0]) {
  339. return false;
  340. }
  341. if (FragTexcoord.x > rect[0] + rect[2]) {
  342. return false;
  343. }
  344. if (FragTexcoord.y < rect[1]) {
  345. return false;
  346. }
  347. if (FragTexcoord.y > rect[1] + rect[3]) {
  348. return false;
  349. }
  350. return true;
  351. }
  352. void main() {
  353. // Discard fragment outside of received bounds
  354. // Bounds[0] - xmin
  355. // Bounds[1] - ymin
  356. // Bounds[2] - xmax
  357. // Bounds[3] - ymax
  358. if (FragTexcoord.x <= Bounds[0] || FragTexcoord.x >= Bounds[2]) {
  359. discard;
  360. }
  361. if (FragTexcoord.y <= Bounds[1] || FragTexcoord.y >= Bounds[3]) {
  362. discard;
  363. }
  364. // Check if fragment is inside content area
  365. if (checkRect(Content)) {
  366. // If no texture, the color will be the material color.
  367. vec4 color = ContentColor;
  368. if (TextureValid) {
  369. // Adjust texture coordinates to fit texture inside the content area
  370. vec2 offset = vec2(-Content[0], -Content[1]);
  371. vec2 factor = vec2(1/Content[2], 1/Content[3]);
  372. vec2 texcoord = (FragTexcoord + offset) * factor;
  373. vec4 texColor = texture(MatTexture[0], texcoord * MatTexRepeat(0) + MatTexOffset(0));
  374. // Mix content color with texture color ???
  375. //color = mix(color, texColor, texColor.a);
  376. color = texColor;
  377. }
  378. FragColor = color;
  379. return;
  380. }
  381. // Checks if fragment is inside paddings area
  382. if (checkRect(Padding)) {
  383. FragColor = PaddingColor;
  384. return;
  385. }
  386. // Checks if fragment is inside borders area
  387. if (checkRect(Border)) {
  388. FragColor = BorderColor;
  389. return;
  390. }
  391. // Fragment is in margins area (always transparent)
  392. FragColor = vec4(1,1,1,0);
  393. }
  394. `
  395. const phong_fragment_source = `//
  396. // Fragment Shader template
  397. //
  398. // Inputs from vertex shader
  399. in vec4 Position; // Vertex position in camera coordinates.
  400. in vec3 Normal; // Vertex normal in camera coordinates.
  401. in vec3 CamDir; // Direction from vertex to camera
  402. in vec2 FragTexcoord;
  403. #include <lights>
  404. #include <material>
  405. #include <phong_model>
  406. // Final fragment color
  407. out vec4 FragColor;
  408. void main() {
  409. // Combine all texture colors
  410. vec4 texCombined = vec4(1);
  411. #if MAT_TEXTURES>0
  412. for (int i = 0; i < MAT_TEXTURES; i++) {
  413. if (MatTexVisible(i) == false) {
  414. continue;
  415. }
  416. vec4 texcolor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));
  417. if (i == 0) {
  418. texCombined = texcolor;
  419. } else {
  420. texCombined = mix(texCombined, texcolor, texcolor.a);
  421. }
  422. }
  423. #endif
  424. // Combine material with texture colors
  425. vec4 matDiffuse = vec4(MatDiffuseColor, MatOpacity) * texCombined;
  426. vec4 matAmbient = vec4(MatAmbientColor, MatOpacity) * texCombined;
  427. // Inverts the fragment normal if not FrontFacing
  428. vec3 fragNormal = Normal;
  429. if (!gl_FrontFacing) {
  430. fragNormal = -fragNormal;
  431. }
  432. // Calculates the Ambient+Diffuse and Specular colors for this fragment using the Phong model.
  433. vec3 Ambdiff, Spec;
  434. phongModel(Position, fragNormal, CamDir, vec3(matAmbient), vec3(matDiffuse), Ambdiff, Spec);
  435. // Final fragment color
  436. FragColor = min(vec4(Ambdiff + Spec, matDiffuse.a), vec4(1.0));
  437. }
  438. `
  439. const sprite_vertex_source = `//
  440. // Vertex shader for sprites
  441. //
  442. #include <attributes>
  443. // Input uniforms
  444. uniform mat4 MVP;
  445. #include <material>
  446. // Outputs for fragment shader
  447. out vec3 Color;
  448. out vec2 FragTexcoord;
  449. void main() {
  450. // Applies transformation to vertex position
  451. gl_Position = MVP * vec4(VertexPosition, 1.0);
  452. // Outputs color
  453. Color = MatDiffuseColor;
  454. // Flips texture coordinate Y if requested.
  455. vec2 texcoord = VertexTexcoord;
  456. #if MAT_TEXTURES>0
  457. if (MatTexFlipY[0]) {
  458. texcoord.y = 1 - texcoord.y;
  459. }
  460. #endif
  461. FragTexcoord = texcoord;
  462. }
  463. `
  464. const standard_vertex_source = `//
  465. // Vertex shader standard
  466. //
  467. #include <attributes>
  468. // Model uniforms
  469. uniform mat4 ModelViewMatrix;
  470. uniform mat3 NormalMatrix;
  471. uniform mat4 MVP;
  472. #include <lights>
  473. #include <material>
  474. #include <phong_model>
  475. // Outputs for the fragment shader.
  476. out vec3 ColorFrontAmbdiff;
  477. out vec3 ColorFrontSpec;
  478. out vec3 ColorBackAmbdiff;
  479. out vec3 ColorBackSpec;
  480. out vec2 FragTexcoord;
  481. void main() {
  482. // Transform this vertex normal to camera coordinates.
  483. vec3 normal = normalize(NormalMatrix * VertexNormal);
  484. // Calculate this vertex position in camera coordinates
  485. vec4 position = ModelViewMatrix * vec4(VertexPosition, 1.0);
  486. // Calculate the direction vector from the vertex to the camera
  487. // The camera is at 0,0,0
  488. vec3 camDir = normalize(-position.xyz);
  489. // Calculates the vertex Ambient+Diffuse and Specular colors using the Phong model
  490. // for the front and back
  491. phongModel(position, normal, camDir, MatAmbientColor, MatDiffuseColor, ColorFrontAmbdiff, ColorFrontSpec);
  492. phongModel(position, -normal, camDir, MatAmbientColor, MatDiffuseColor, ColorBackAmbdiff, ColorBackSpec);
  493. vec2 texcoord = VertexTexcoord;
  494. #if MAT_TEXTURES > 0
  495. // Flips texture coordinate Y if requested.
  496. if (MatTexFlipY(0)) {
  497. texcoord.y = 1 - texcoord.y;
  498. }
  499. #endif
  500. FragTexcoord = texcoord;
  501. gl_Position = MVP * vec4(VertexPosition, 1.0);
  502. }
  503. `
  504. const point_vertex_source = `#include <attributes>
  505. // Model uniforms
  506. uniform mat4 MVP;
  507. // Material uniforms
  508. #include <material>
  509. // Outputs for fragment shader
  510. out vec3 Color;
  511. flat out mat2 Rotation;
  512. void main() {
  513. // Rotation matrix for fragment shader
  514. float rotSin = sin(MatPointRotationZ);
  515. float rotCos = cos(MatPointRotationZ);
  516. Rotation = mat2(rotCos, rotSin, - rotSin, rotCos);
  517. // Sets the vertex position
  518. vec4 pos = MVP * vec4(VertexPosition, 1.0);
  519. gl_Position = pos;
  520. // Sets the size of the rasterized point decreasing with distance
  521. gl_PointSize = (1.0 - pos.z / pos.w) * MatPointSize;
  522. // Outputs color
  523. Color = MatEmissiveColor;
  524. }
  525. `
  526. const basic_vertex_source = `//
  527. // Vertex shader basic
  528. //
  529. #include <attributes>
  530. // Model uniforms
  531. uniform mat4 MVP;
  532. // Final output color for fragment shader
  533. out vec3 Color;
  534. void main() {
  535. Color = VertexColor;
  536. gl_Position = MVP * vec4(VertexPosition, 1.0);
  537. }
  538. `
  539. // Maps include name with its source code
  540. var includeMap = map[string]string{
  541. "phong_model": include_phong_model_source,
  542. "material": include_material_source,
  543. "lights": include_lights_source,
  544. "attributes": include_attributes_source,
  545. }
  546. // Maps shader name with its source code
  547. var shaderMap = map[string]string{
  548. "basic_fragment": basic_fragment_source,
  549. "standard_fragment": standard_fragment_source,
  550. "panel_vertex": panel_vertex_source,
  551. "sprite_fragment": sprite_fragment_source,
  552. "point_fragment": point_fragment_source,
  553. "phong_vertex": phong_vertex_source,
  554. "panel_fragment": panel_fragment_source,
  555. "phong_fragment": phong_fragment_source,
  556. "sprite_vertex": sprite_vertex_source,
  557. "standard_vertex": standard_vertex_source,
  558. "point_vertex": point_vertex_source,
  559. "basic_vertex": basic_vertex_source,
  560. }
  561. // Maps program name with Proginfo struct with shaders names
  562. var programMap = map[string]ProgramInfo{
  563. "basic": {"basic_vertex", "basic_fragment", ""},
  564. "panel": {"panel_vertex", "panel_fragment", ""},
  565. "phong": {"phong_vertex", "phong_fragment", ""},
  566. "point": {"point_vertex", "point_fragment", ""},
  567. "sprite": {"sprite_vertex", "sprite_fragment", ""},
  568. "standard": {"standard_vertex", "standard_fragment", ""},
  569. }