|
Last change
on this file since 567 was 2, checked in by Dmitry A. Kuminov, 17 years ago |
|
Initially imported qt-all-opensource-src-4.5.1 from Trolltech.
|
|
File size:
562 bytes
|
| Line | |
|---|
| 1 | uniform sampler1D palette;
|
|---|
| 2 | uniform vec2 fmp;
|
|---|
| 3 | uniform float fmp2_m_radius2;
|
|---|
| 4 | uniform vec3 inv_matrix_m0;
|
|---|
| 5 | uniform vec3 inv_matrix_m1;
|
|---|
| 6 | uniform vec3 inv_matrix_m2;
|
|---|
| 7 |
|
|---|
| 8 | vec4 brush()
|
|---|
| 9 | {
|
|---|
| 10 | mat3 mat;
|
|---|
| 11 |
|
|---|
| 12 | mat[0] = inv_matrix_m0;
|
|---|
| 13 | mat[1] = inv_matrix_m1;
|
|---|
| 14 | mat[2] = inv_matrix_m2;
|
|---|
| 15 |
|
|---|
| 16 | vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1);
|
|---|
| 17 | vec2 A = hcoords.xy / hcoords.z;
|
|---|
| 18 | vec2 B = fmp;
|
|---|
| 19 |
|
|---|
| 20 | float a = fmp2_m_radius2;
|
|---|
| 21 | float b = 2.0*dot(A, B);
|
|---|
| 22 | float c = -dot(A, A);
|
|---|
| 23 |
|
|---|
| 24 | float val = (-b + sqrt(b*b - 4.0*a*c)) / (2.0*a);
|
|---|
| 25 |
|
|---|
| 26 | return texture1D(palette, val);
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.