* Updates the scale and offset for the LUT sampling coordinates. * * @private
()
| 175 | */ |
| 176 | |
| 177 | updateScaleOffset() { |
| 178 | |
| 179 | const lut = this.lut; |
| 180 | |
| 181 | if(lut !== null) { |
| 182 | |
| 183 | const size = Math.min(lut.image.width, lut.image.height); |
| 184 | const scale = this.uniforms.get("scale").value; |
| 185 | const offset = this.uniforms.get("offset").value; |
| 186 | |
| 187 | if(this.tetrahedralInterpolation && lut instanceof Data3DTexture) { |
| 188 | |
| 189 | if(this.defines.has("CUSTOM_INPUT_DOMAIN")) { |
| 190 | |
| 191 | const domainScale = lut.domainMax.clone().sub(lut.domainMin); |
| 192 | scale.setScalar(size - 1).divide(domainScale); |
| 193 | offset.copy(lut.domainMin).negate().multiply(scale); |
| 194 | |
| 195 | } else { |
| 196 | |
| 197 | scale.setScalar(size - 1); |
| 198 | offset.setScalar(0); |
| 199 | |
| 200 | } |
| 201 | |
| 202 | } else { |
| 203 | |
| 204 | if(this.defines.has("CUSTOM_INPUT_DOMAIN")) { |
| 205 | |
| 206 | const domainScale = lut.domainMax.clone().sub(lut.domainMin).multiplyScalar(size); |
| 207 | scale.setScalar(size - 1).divide(domainScale); |
| 208 | offset.copy(lut.domainMin).negate().multiply(scale).addScalar(1.0 / (2.0 * size)); |
| 209 | |
| 210 | } else { |
| 211 | |
| 212 | scale.setScalar((size - 1) / size); |
| 213 | offset.setScalar(1.0 / (2.0 * size)); |
| 214 | |
| 215 | } |
| 216 | |
| 217 | } |
| 218 | |
| 219 | } |
| 220 | |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Configures parameters for tetrahedral interpolation. |
no test coverage detected