update volume rendering shader

This commit is contained in:
wyq 2022-07-25 09:47:33 +08:00
parent c0e042033d
commit eca9a0ba64
5 changed files with 27 additions and 4 deletions

View File

@ -269,11 +269,11 @@ public class VolumeRender extends JOGLGraphicRender {
program.allocateUniform(gl, "colorMap", (gl2, loc) -> {
gl2.glUniform1i(loc, 1);
});
if (this.getRayCastingType() == RayCastingType.SPECULAR) {
//if (this.getRayCastingType() == RayCastingType.SPECULAR) {
program.allocateUniform(gl, "normals", (gl2, loc) -> {
gl2.glUniform1i(loc, 2);
});
}
// }
program.allocateUniform(gl, "brightness", (gl2, loc) -> {
gl2.glUniform1f(loc, this.getBrightness());
});

View File

@ -11,6 +11,7 @@ uniform mat4 iV;
uniform mat4 iP;
uniform sampler3D tex;
uniform sampler3D normals;
uniform sampler2D colorMap;
uniform int depthSampleCount;
uniform vec3 aabbMin;

View File

@ -11,6 +11,7 @@ uniform mat4 iV;
uniform mat4 iP;
uniform sampler3D tex;
uniform sampler3D normals;
uniform sampler2D colorMap;
uniform int depthSampleCount;
uniform vec3 aabbMin;

View File

@ -267,6 +267,29 @@ public class DimArray {
return new DimArray(rr, dims);
}
/**
* Section
* @param ranges ranges
* @return Section result dim array
* @throws InvalidRangeException
*/
public DimArray section(List<Range> ranges) throws InvalidRangeException {
Array r = this.array.section(ranges);
Array rr = Array.factory(r.getDataType(), r.getShape());
MAMath.copy(rr, r);
Section section = new Section(ranges);
List<Dimension> dims = new ArrayList<>();
for (int i = 0; i < section.getRank(); i++) {
Range range = section.getRange(i);
if (range.length() > 1) {
Dimension dim = this.dimensions.get(i).extract(range);
dims.add(dim);
}
}
return new DimArray(rr, dims);
}
@Override
public String toString() {
return this.array.toString();

View File

@ -22,13 +22,11 @@
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective_2.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective_2.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_perspective_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_1.py"/>
</RecentFiles>
</File>
<Font>