Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/layer/multi_channel_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ type MakeLayerFn = (
const MULTICHANNEL_FRAGMENT_MAIN = `#uicontrol invlerp contrast
#uicontrol vec3 color color
void main() {
float contrast_value = contrast();
if (VOLUME_RENDERING) {
float contrast_value = contrast(true /* with trilinear interpolation */);
emitRGBA(vec4(color * contrast_value, contrast_value));
}
else {
float contrast_value = contrast();
emitRGB(color * contrast_value);
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/webgl/shader_ui_controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,15 @@ export function addControlsToBuilder(
float ${uName}() {
return ${uName}(getDataValue(${builderValue.channel.join(",")}));
}
float ${uName}(bool interpolate) {
if (interpolate) {
return ${uName}(getInterpolatedDataValue(${builderValue.channel.join(",")}));
}
else {
return ${uName}(getDataValue(${builderValue.channel.join(",")}));
}
}

`,
];
builder.addFragmentCode(code);
Expand Down
8 changes: 8 additions & 0 deletions src/widget/transfer_function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,14 @@ vec4 ${name}(${shaderType} inputValue) {
vec4 ${name}() {
return ${name}(getDataValue(${channel.join(",")}));
}
vec4 ${name}(bool interpolate) {
if (interpolate) {
return ${name}(getInterpolatedDataValue(${channel.join(",")}));
}
else {
return ${name}(getDataValue(${channel.join(",")}));
}
}
`;
if (dataType !== DataType.UINT64 && dataType !== DataType.FLOAT32) {
const scalarType = DATA_TYPE_SIGNED[dataType] ? "int" : "uint";
Expand Down
Loading