ShadowSection.qml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. // Copyright (C) 2021 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick 2.15
  4. import QtQuick.Layouts 1.15
  5. import HelperWidgets 2.0
  6. import StudioTheme 1.0 as StudioTheme
  7. Section {
  8. caption: qsTr("Shadows")
  9. width: parent.width
  10. SectionLayout {
  11. PropertyLabel {
  12. text: qsTr("Casts Shadow")
  13. tooltip: qsTr("Enables shadow casting for this light.")
  14. }
  15. SecondColumnLayout {
  16. CheckBox {
  17. id: shadowCheckBox
  18. text: backendValues.castsShadow.valueToString
  19. backendValue: backendValues.castsShadow
  20. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  21. + StudioTheme.Values.actionIndicatorWidth
  22. }
  23. ExpandingSpacer {}
  24. }
  25. // ### all the following should only be shown when shadows are enabled
  26. PropertyLabel {
  27. visible: shadowCheckBox.checked
  28. text: qsTr("Amount")
  29. tooltip: qsTr("Sets how dark the cast shadows should be.")
  30. }
  31. SecondColumnLayout {
  32. visible: shadowCheckBox.checked
  33. SpinBox {
  34. minimumValue: 0.0
  35. maximumValue: 100.0
  36. decimals: 0
  37. sliderIndicatorVisible: true
  38. backendValue: backendValues.shadowFactor
  39. enabled: shadowCheckBox.backendValue.value === true
  40. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  41. + StudioTheme.Values.actionIndicatorWidth
  42. }
  43. ExpandingSpacer {}
  44. }
  45. PropertyLabel {
  46. visible: shadowCheckBox.checked
  47. text: qsTr("Quality")
  48. tooltip: qsTr("Sets the quality of the shadow map created for shadow rendering.")
  49. }
  50. SecondColumnLayout {
  51. visible: shadowCheckBox.checked
  52. ComboBox {
  53. scope: "Light"
  54. model: ["ShadowMapQualityLow", "ShadowMapQualityMedium", "ShadowMapQualityHigh", "ShadowMapQualityVeryHigh", "ShadowMapQualityUltra"]
  55. backendValue: backendValues.shadowMapQuality
  56. enabled: shadowCheckBox.backendValue.value === true
  57. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  58. + StudioTheme.Values.actionIndicatorWidth
  59. }
  60. ExpandingSpacer {}
  61. }
  62. PropertyLabel {
  63. visible: shadowCheckBox.checked
  64. text: qsTr("Bias")
  65. tooltip: qsTr("Sets a slight offset to avoid self-shadowing artifacts.")
  66. }
  67. SecondColumnLayout {
  68. visible: shadowCheckBox.checked
  69. SpinBox {
  70. minimumValue: 0
  71. maximumValue: 9999999
  72. decimals: 2
  73. stepSize: 1
  74. backendValue: backendValues.shadowBias
  75. enabled: shadowCheckBox.backendValue.value === true
  76. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  77. + StudioTheme.Values.actionIndicatorWidth
  78. }
  79. ExpandingSpacer {}
  80. }
  81. PropertyLabel {
  82. visible: shadowCheckBox.checked
  83. text: qsTr("Soft Shadow Quality")
  84. tooltip: qsTr("Sets the quality of the soft shadows.")
  85. }
  86. SecondColumnLayout {
  87. visible: shadowCheckBox.checked
  88. ComboBox {
  89. scope: "Light"
  90. model: ["Hard", "PCF4", "PCF8", "PCF16", "PCF32", "PCF64"]
  91. backendValue: backendValues.softShadowQuality
  92. enabled: shadowCheckBox.backendValue.value === true
  93. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  94. + StudioTheme.Values.actionIndicatorWidth
  95. }
  96. ExpandingSpacer {}
  97. }
  98. PropertyLabel {
  99. visible: shadowCheckBox.checked
  100. text: qsTr("PCF Factor")
  101. tooltip: qsTr("Sets the PCF (percentage-closer filtering) factor.")
  102. }
  103. SecondColumnLayout {
  104. visible: shadowCheckBox.checked
  105. SpinBox {
  106. minimumValue: 0
  107. maximumValue: 9999999
  108. decimals: 1
  109. stepSize: 0.1
  110. backendValue: backendValues.pcfFactor
  111. enabled: shadowCheckBox.backendValue.value === true
  112. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  113. + StudioTheme.Values.actionIndicatorWidth
  114. }
  115. ExpandingSpacer {}
  116. }
  117. PropertyLabel {
  118. visible: shadowCheckBox.checked
  119. text: qsTr("Far Distance")
  120. tooltip: qsTr("Sets the maximum distance for the shadow map.")
  121. }
  122. SecondColumnLayout {
  123. visible: shadowCheckBox.checked
  124. SpinBox {
  125. minimumValue: 0
  126. maximumValue: 9999999
  127. decimals: 0
  128. stepSize: 10
  129. backendValue: backendValues.shadowMapFar
  130. enabled: shadowCheckBox.backendValue.value === true
  131. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  132. + StudioTheme.Values.actionIndicatorWidth
  133. }
  134. ExpandingSpacer {}
  135. }
  136. PropertyLabel {
  137. visible: shadowCheckBox.checked
  138. text: qsTr("Use 32-bit Shadowmap")
  139. tooltip: qsTr("Enables a 32-bit shadowmap texture for this light.")
  140. }
  141. SecondColumnLayout {
  142. visible: shadowCheckBox.checked
  143. CheckBox {
  144. text: backendValues.use32BitShadowmap.valueToString
  145. backendValue: backendValues.use32BitShadowmap
  146. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  147. + StudioTheme.Values.actionIndicatorWidth
  148. }
  149. ExpandingSpacer {}
  150. }
  151. }
  152. }