BrushStrokes.qml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (C) 2020 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick
  4. import QtQuick3D
  5. Effect {
  6. property TextureInput noiseSample: TextureInput {
  7. texture: Texture {
  8. tilingModeHorizontal: Texture.Repeat
  9. tilingModeVertical: Texture.Repeat
  10. source: "qrc:/qtquick3deffects/maps/brushnoise.png"
  11. }
  12. }
  13. property real brushLength: 1.0 // 0 - 3
  14. property real brushSize: 100.0 // 10 - 200
  15. property real brushAngle: 45.0
  16. readonly property real sinAlpha: Math.sin(degrees_to_radians(brushAngle))
  17. readonly property real cosAlpha: Math.cos(degrees_to_radians(brushAngle))
  18. function degrees_to_radians(degrees) {
  19. var pi = Math.PI;
  20. return degrees * (pi/180);
  21. }
  22. Shader {
  23. id: brushstrokes
  24. stage: Shader.Fragment
  25. shader: "qrc:/qtquick3deffects/shaders/brushstrokes.frag"
  26. }
  27. passes: [
  28. Pass {
  29. shaders: [ brushstrokes ]
  30. }
  31. ]
  32. }