|
@@ -11,7 +11,7 @@ import vtkColorTransferFunction from "@kitware/vtk.js/Rendering/Core/ColorTransf
|
|
|
import vtkLookupTable from '@kitware/vtk.js/Common/Core/LookupTable';
|
|
|
import { Representation } from "@kitware/vtk.js/Rendering/Core/Property/Constants";
|
|
|
import vtkPolyData from "@kitware/vtk.js/Common/DataModel/PolyData";
|
|
|
-
|
|
|
+import vtkLight from "@kitware/vtk.js/Rendering/Core/Light";
|
|
|
import { throttle } from '@kitware/vtk.js/macros';
|
|
|
import {
|
|
|
FieldDataTypes,
|
|
@@ -100,11 +100,16 @@ export class VtkModel {
|
|
|
this.scalarBarActor.setBoxPosition([1, 0]);
|
|
|
// 修改设条颜色
|
|
|
const ctf = vtkColorTransferFunction.newInstance();
|
|
|
- ctf.addRGBPoint(0.0, 0.0, 0.0, 1.0);
|
|
|
- ctf.addRGBPoint(1.0, 0.0, 1.0, 0.5);
|
|
|
- ctf.addRGBPoint(2.0, 0.0, 1.0, 0.0);
|
|
|
- ctf.addRGBPoint(3.0, 1.0, 0.5, 0.0);
|
|
|
- ctf.addRGBPoint(4.0, 1.0, 0.0, 0.0);
|
|
|
+ ctf.addRGBPoint(0.0,0, 1, 154/255.0);
|
|
|
+ ctf.addRGBPoint(1.0, 1.0, 165.0/255.0, 0.0);
|
|
|
+ ctf.addRGBPoint(2.0, 230/255.0, 0.0, 92.0/225.0);
|
|
|
+
|
|
|
+ // ctf.addRGBPoint(0.0, 0.0, 0.0, 1.0);
|
|
|
+ // ctf.addRGBPoint(1.0, 0.0, 1.0, 0.5);
|
|
|
+ // ctf.addRGBPoint(2.0, 0.0, 1.0, 0.0);
|
|
|
+ // ctf.addRGBPoint(3.0, 1.0, 0.5, 0.0);
|
|
|
+ // ctf.addRGBPoint(4.0, 1.0, 0.0, 0.0);
|
|
|
+
|
|
|
this.jgMapper.setLookupTable(ctf);
|
|
|
this.jgActor.setMapper(this.jgMapper);
|
|
|
const lut = this.jgMapper.getLookupTable();
|
|
@@ -130,7 +135,7 @@ export class VtkModel {
|
|
|
// alphaRange: [1.0, 1.0], //透明度
|
|
|
gjlut.setAlphaRange([1,1]);
|
|
|
gjlut.setValueRange([0.5,1]);
|
|
|
- gjlut.setHueRange([0.66667,0.0]);//蓝色到红色
|
|
|
+ // gjlut.setHueRange([0.66667,0.0]);//蓝色到红色
|
|
|
gjlut.setHueRange([0.3375,0.0]);//绿色到红色
|
|
|
// this.gjscalarBarActor.setScalarsToColors(gjlut);
|
|
|
this.gjMapper.setInterpolateScalarsBeforeMapping(true);//有无渐变
|
|
@@ -139,6 +144,7 @@ export class VtkModel {
|
|
|
this.ways = [];
|
|
|
this.wayActors = [];
|
|
|
|
|
|
+
|
|
|
}
|
|
|
waysInit(ways) {
|
|
|
this.renderWindowWith.resize();
|
|
@@ -490,8 +496,22 @@ export class VtkModel {
|
|
|
// cam.setViewUp([0,1,1]);
|
|
|
console.log("近远平面", cam.getClippingRange());// [9141.491986233214, 9913.53967078369]
|
|
|
// cam.setClippingRange(9241.491986233214,9300.53967078369);
|
|
|
- this.renderWindow.render();
|
|
|
+
|
|
|
+ // 设置环境光和光照
|
|
|
+ const light = vtkLight.newInstance();
|
|
|
+ light.setColor(1.0, 1.0, 1.0); // 白色环境光
|
|
|
+ light.setIntensity(3.0); // 强度为1.0
|
|
|
+ this.renderer.addLight(light);
|
|
|
+
|
|
|
+ // const cameraLight = vtkLight.newInstance();
|
|
|
+ // cameraLight.setColor(1.0, 0.0, 0.0); // 红色光照
|
|
|
+ // cameraLight.setPositional(true); // 定向光源
|
|
|
+ // cameraLight.setConeAngle(-30.0); // 光束角度
|
|
|
+ // cameraLight.setPosition(this.renderer.getActiveCamera().getFocalPoint());
|
|
|
+ // cameraLight.setIntensity(0.8);
|
|
|
+ // this.renderer.addLight(cameraLight);
|
|
|
|
|
|
+ this.renderer.resetCamera();
|
|
|
}
|
|
|
|
|
|
modelClearShow() {
|