Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
vp_renderR.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "vp_global.h"
00032
00033 #define COMP_AR1PB_FUNC VPCompAR1PB
00034 extern void VPCompAR1PB();
00035
00036 #define COMP_AR3PB_FUNC VPCompAR3PB
00037 extern void VPCompAR3PB();
00038
00039 #ifdef COMP_AR11B
00040 #define COMP_AR11B_FUNC VPCompAR11B
00041 extern void VPCompAR11B();
00042 #else
00043 #define COMP_AR11B_FUNC VPCompAR1NB
00044 #endif
00045
00046 #ifdef COMP_AR31B
00047 #define COMP_AR31B_FUNC VPCompAR31B
00048 extern void VPCompAR31B();
00049 #else
00050 #define COMP_AR31B_FUNC VPCompAR3NB
00051 #endif
00052
00053 #ifdef COMP_AR12B
00054 #define COMP_AR12B_FUNC VPCompAR12B
00055 extern void VPCompAR12B();
00056 #else
00057 #define COMP_AR12B_FUNC VPCompAR1NB
00058 #endif
00059
00060 #ifdef COMP_AR32B
00061 #define COMP_AR32B_FUNC VPCompAR32B
00062 extern void VPCompAR32B();
00063 #else
00064 #define COMP_AR32B_FUNC VPCompAR3NB
00065 #endif
00066
00067 #define COMP_AR1NB_FUNC VPCompAR1NB
00068 extern void VPCompAR1NB();
00069
00070 #define COMP_AR3NB_FUNC VPCompAR3NB
00071 extern void VPCompAR3NB();
00072
00073
00074 #define COMP_AR1PS_FUNC VPCompAR1PB
00075
00076 #define COMP_AR3PS_FUNC VPCompAR3PB
00077
00078 #ifdef COMP_AR11S
00079 #define COMP_AR11S_FUNC VPCompAR11S
00080 extern void VPCompAR11S();
00081 #else
00082 #define COMP_AR11S_FUNC VPCompAR1NS
00083 #endif
00084
00085 #ifdef COMP_AR31S
00086 #define COMP_AR31S_FUNC VPCompAR31S
00087 extern void VPCompAR31S();
00088 #else
00089 #define COMP_AR31S_FUNC VPCompAR3NS
00090 #endif
00091
00092 #ifdef COMP_AR12S
00093 #define COMP_AR12S_FUNC VPCompAR12S
00094 extern void VPCompAR12S();
00095 #else
00096 #define COMP_AR12S_FUNC VPCompAR1NS
00097 #endif
00098
00099 #ifdef COMP_AR32S
00100 #define COMP_AR32S_FUNC VPCompAR32S
00101 extern void VPCompAR32S();
00102 #else
00103 #define COMP_AR32S_FUNC VPCompAR3NS
00104 #endif
00105
00106 #define COMP_AR1NS_FUNC VPCompAR1NS
00107 extern void VPCompAR1NS();
00108
00109 #define COMP_AR3NS_FUNC VPCompAR3NS
00110 extern void VPCompAR3NS();
00111
00112 #ifdef INDEX_VOLUME
00113 extern void VPCompAI11B();
00114 #endif
00115
00116 #define SHADOWS_OFF 0
00117 #define SHADOWS_ON 1
00118 #define SHADOW_OPTS 2
00119
00120 #define MATERIAL_CALLBACK 0
00121 #define MATERIAL_ONE 1
00122 #define MATERIAL_TWO 2
00123 #define MATERIAL_MORE 3
00124 #define MATERIAL_OPTS 4
00125
00126 #define COLOR_GRAY 0
00127 #define COLOR_RGB 1
00128 #define COLOR_OPTS 2
00129
00130 static void (*AffineProcTable[SHADOW_OPTS][MATERIAL_OPTS][COLOR_OPTS])() = {
00131 {
00132 { COMP_AR1PB_FUNC, COMP_AR3PB_FUNC },
00133 { COMP_AR11B_FUNC, COMP_AR31B_FUNC },
00134 { COMP_AR12B_FUNC, COMP_AR32B_FUNC },
00135 { COMP_AR1NB_FUNC, COMP_AR3NB_FUNC }
00136 },
00137 {
00138 { COMP_AR1PS_FUNC, COMP_AR3PS_FUNC },
00139 { COMP_AR11S_FUNC, COMP_AR31S_FUNC },
00140 { COMP_AR12S_FUNC, COMP_AR32S_FUNC },
00141 { COMP_AR1NS_FUNC, COMP_AR3NS_FUNC }
00142 }
00143 };
00144
00145
00146
00147
00148
00149
00150
00151 vpResult
00152 vpRenderRawVolume(vpc)
00153 vpContext *vpc;
00154 {
00155 int retcode;
00156 void (*composite_func)();
00157 int shadow_option, material_option, color_option;
00158
00159
00160 if ((retcode = VPCheckRawVolume(vpc)) != VP_OK)
00161 return(retcode);
00162 if ((retcode = VPCheckClassifier(vpc)) != VP_OK)
00163 return(retcode);
00164 if ((retcode = VPCheckShader(vpc)) != VP_OK)
00165 return(retcode);
00166 if ((retcode = VPCheckImage(vpc)) != VP_OK)
00167 return(retcode);
00168 if (vpc->num_clsfy_params > 2)
00169 return(VPSetError(vpc, VPERROR_LIMIT_EXCEEDED));
00170 if ((retcode = VPFactorView(vpc)) != VP_OK)
00171 return(retcode);
00172
00173 Debug((vpc, VPDEBUG_RENDER, "Algorithm: affine RAWvolume (%s)\n",
00174 vpc->mm_octree == NULL ? "no octree" : "with octree"));
00175
00176
00177 if (vpc->enable_shadows)
00178 shadow_option = SHADOWS_ON;
00179 else
00180 shadow_option = SHADOWS_OFF;
00181 if (vpc->shading_mode == CALLBACK_SHADER)
00182 material_option = MATERIAL_CALLBACK;
00183 else if (vpc->num_materials == 1)
00184 material_option = MATERIAL_ONE;
00185 else if (vpc->num_materials == 2)
00186 material_option = MATERIAL_TWO;
00187 else
00188 material_option = MATERIAL_MORE;
00189 if (vpc->color_channels == 1)
00190 color_option = COLOR_GRAY;
00191 else
00192 color_option = COLOR_RGB;
00193
00194
00195 if (vpc->affine_view) {
00196
00197 composite_func = AffineProcTable[shadow_option][material_option]
00198 [color_option];
00199 VPRenderAffine(vpc, USE_RAWVOLUME, composite_func);
00200 } else {
00201
00202 return(VPSetError(vpc, VPERROR_BAD_OPTION));
00203 }
00204
00205 return(VP_OK);
00206 }