| 2696 | } |
| 2697 | |
| 2698 | int vtkFixedPointVolumeRayCastMapper::UpdateShadingTable(vtkRenderer* ren, vtkVolume* vol) |
| 2699 | { |
| 2700 | if (this->ShadingRequired == 0) |
| 2701 | { |
| 2702 | return 0; |
| 2703 | } |
| 2704 | |
| 2705 | // How many components? |
| 2706 | int components = this->CurrentScalars->GetNumberOfComponents(); |
| 2707 | |
| 2708 | int c; |
| 2709 | for (c = 0; c < ((vol->GetProperty()->GetIndependentComponents()) ? (components) : (1)); c++) |
| 2710 | { |
| 2711 | this->GradientShader->SetActiveComponent(c); |
| 2712 | this->GradientShader->UpdateShadingTable(ren, vol, this->GradientEstimator); |
| 2713 | |
| 2714 | float* r = this->GradientShader->GetRedDiffuseShadingTable(vol); |
| 2715 | float* g = this->GradientShader->GetGreenDiffuseShadingTable(vol); |
| 2716 | float* b = this->GradientShader->GetBlueDiffuseShadingTable(vol); |
| 2717 | |
| 2718 | float* rptr = r; |
| 2719 | float* gptr = g; |
| 2720 | float* bptr = b; |
| 2721 | |
| 2722 | unsigned short* tablePtr = this->DiffuseShadingTable[c]; |
| 2723 | |
| 2724 | int i; |
| 2725 | for (i = 0; i < this->DirectionEncoder->GetNumberOfEncodedDirections(); i++) |
| 2726 | { |
| 2727 | *(tablePtr++) = static_cast<unsigned short>((*(rptr++)) * VTKKW_FP_SCALE + 0.5); |
| 2728 | *(tablePtr++) = static_cast<unsigned short>((*(gptr++)) * VTKKW_FP_SCALE + 0.5); |
| 2729 | *(tablePtr++) = static_cast<unsigned short>((*(bptr++)) * VTKKW_FP_SCALE + 0.5); |
| 2730 | } |
| 2731 | |
| 2732 | r = this->GradientShader->GetRedSpecularShadingTable(vol); |
| 2733 | g = this->GradientShader->GetGreenSpecularShadingTable(vol); |
| 2734 | b = this->GradientShader->GetBlueSpecularShadingTable(vol); |
| 2735 | |
| 2736 | rptr = r; |
| 2737 | gptr = g; |
| 2738 | bptr = b; |
| 2739 | |
| 2740 | tablePtr = this->SpecularShadingTable[c]; |
| 2741 | |
| 2742 | for (i = 0; i < this->DirectionEncoder->GetNumberOfEncodedDirections(); i++) |
| 2743 | { |
| 2744 | *(tablePtr++) = static_cast<unsigned short>((*(rptr++)) * VTKKW_FP_SCALE + 0.5); |
| 2745 | *(tablePtr++) = static_cast<unsigned short>((*(gptr++)) * VTKKW_FP_SCALE + 0.5); |
| 2746 | *(tablePtr++) = static_cast<unsigned short>((*(bptr++)) * VTKKW_FP_SCALE + 0.5); |
| 2747 | } |
| 2748 | } |
| 2749 | |
| 2750 | return 1; |
| 2751 | } |
| 2752 | |
| 2753 | int vtkFixedPointVolumeRayCastMapper::UpdateGradients(vtkVolume* vol) |
| 2754 | { |
no test coverage detected