@@ -782,9 +782,9 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
782
782
FSSource ,
783
783
'//VTK::TCoord::Impl' ,
784
784
[
785
- 'vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);' ,
786
- 'gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)* ' ,
787
- ' vec4( tcolor.r,tcolor.r,tcolor.r,1.0) ;' ,
785
+ ' vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);' ,
786
+ ' ambientColor = ambientColor*tcolor.r; ' ,
787
+ ' diffuseColor = diffuseColor* tcolor.r;' ,
788
788
]
789
789
) . result ;
790
790
break ;
@@ -793,17 +793,23 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
793
793
FSSource ,
794
794
'//VTK::TCoord::Impl' ,
795
795
[
796
- 'vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);' ,
797
- 'gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*' ,
798
- ' vec4(tcolor.r,tcolor.r,tcolor.r,tcolor.g);' ,
796
+ ' vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);' ,
797
+ ' ambientColor = ambientColor*tcolor.r;' ,
798
+ ' diffuseColor = diffuseColor*tcolor.r;' ,
799
+ ' opacity = opacity * tcolor.g;' ,
799
800
]
800
801
) . result ;
801
802
break ;
802
803
default :
803
804
FSSource = vtkShaderProgram . substitute (
804
805
FSSource ,
805
806
'//VTK::TCoord::Impl' ,
806
- 'gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*texture2D(texture1, tcoordVCVSOutput.st);'
807
+ [
808
+ ' vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);' ,
809
+ ' ambientColor = ambientColor*tcolor.rgb;' ,
810
+ ' diffuseColor = diffuseColor*tcolor.rgb;' ,
811
+ ' opacity = opacity * tcolor.a;' ,
812
+ ]
807
813
) . result ;
808
814
}
809
815
}
@@ -832,9 +838,9 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
832
838
FSSource ,
833
839
'//VTK::TCoord::Impl' ,
834
840
[
835
- 'vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);' ,
836
- 'gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)* ' ,
837
- ' vec4( tcolor.r,tcolor.r,tcolor.r,1.0) ;' ,
841
+ ' vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);' ,
842
+ ' ambientColor = ambientColor*tcolor.r; ' ,
843
+ ' diffuseColor = diffuseColor* tcolor.r;' ,
838
844
]
839
845
) . result ;
840
846
break ;
@@ -843,17 +849,23 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
843
849
FSSource ,
844
850
'//VTK::TCoord::Impl' ,
845
851
[
846
- 'vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);' ,
847
- 'gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*' ,
848
- ' vec4(tcolor.r,tcolor.r,tcolor.r,tcolor.g);' ,
852
+ ' vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);' ,
853
+ ' ambientColor = ambientColor*tcolor.r;' ,
854
+ ' diffuseColor = diffuseColor*tcolor.r;' ,
855
+ ' opacity = opacity * tcolor.g;' ,
849
856
]
850
857
) . result ;
851
858
break ;
852
859
default :
853
860
FSSource = vtkShaderProgram . substitute (
854
861
FSSource ,
855
862
'//VTK::TCoord::Impl' ,
856
- 'gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*textureCube(texture1, tcoordVCVSOutput);'
863
+ [
864
+ ' vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);' ,
865
+ ' ambientColor = ambientColor*tcolor.rgb;' ,
866
+ ' diffuseColor = diffuseColor*tcolor.rgb;' ,
867
+ ' opacity = opacity * tcolor.a;' ,
868
+ ]
857
869
) . result ;
858
870
}
859
871
}
0 commit comments