| 1 |
#cxx . . $ `<file>/src/CgUtil.cpp`/include <GL/glew.h> |
| 2 |
#include "CgUtil.h"cxx . . $ `<file>/src/CgUtil.h`/ |
| 3 |
|
| 4 |
#if defined(_WIN32) |
| 5 |
#include <windows.h> |
| 6 |
#else |
| 7 |
#include <string.h> // for strlen |
| 8 |
#endif |
| 9 |
|
| 10 |
//#include <GL/gl.h> |
| 11 |
#include <stdio.h> |
| 12 |
|
| 13 |
#include "HardSettings.h"cxx . . $ `<file>/src/HardSettings.h`/ |
| 14 |
|
| 15 |
#include "MyCanvas.h"cxx . . $ `<file>/src/MyCanvas.h`/ |
| 16 |
|
| 17 |
extern int CSIZEcxx . . $ CSIZE.; |
| 18 |
extern int BSIZEcxx . . $ BSIZE.; |
| 19 |
//extern GeoSettings geoSettings; |
| 20 |
|
| 21 |
void CgUtilcxx . . $ CgUtil#::Setcxx . . $ CgUtil#Set(49f6e7a06ebc5aa8).(){ |
| 22 |
} |
| 23 |
|
| 24 |
bool CgUtilcxx . . $ CgUtil#::UseHalocxx . . $ CgUtil#UseHalo(c9857a73d68e59ba).(){ |
| 25 |
return P_halo_sizecxx . . $ CgUtil#P_halo_size. * P_halo_strcxx . . $ CgUtil#P_halo_str. >0; |
| 26 |
} |
| 27 |
|
| 28 |
bool CgUtilcxx . . $ CgUtil#::can_use_doubleshadowcxx . . $ CgUtil#can_use_doubleshadow(c9857a73d68e59ba).(){ |
| 29 |
return ((P_light_basecxx . . $ CgUtil#P_light_base.==0.0) && (hardSettingscxx . . $ hardSettings..doubleSMcxx . . $ HardSettings#doubleSM.) ); |
| 30 |
} |
| 31 |
|
| 32 |
bool CgUtilcxx . . $ CgUtil#::do_use_doubleshadowcxx . . $ CgUtil#do_use_doubleshadow(c9857a73d68e59ba).(){ |
| 33 |
return ((P_double_shadowscxx . . $ CgUtil#P_double_shadows.) && (can_use_doubleshadowcxx . . $ CgUtil#can_use_doubleshadow(c9857a73d68e59ba).())); |
| 34 |
} |
| 35 |
|
| •36 |
static char* FORMATcxx . . $ FORMAT.=(char *)"void CgUtil::Set(int K){\nif (K==0){\n P_light_base = %f ;\n P_lighting = %f ;\n P_phong = %f ;\n P_phong_size = %f ;\n P_col_atoms_sat = %f ;\n P_col_atoms_bri = %f ;\n P_texture = %f ;\n P_border_inside = %f ;\n P_border_outside = %f ;\n P_depth_full = %f ;\n P_sem_effect = %d ;\n P_halo_size = %f ;\n P_halo_col = %f ;\n P_halo_str = %f ;\n P_halo_aware = %f ;\n P_fog = %f ;\n P_capping = %d ;\n P_shadowstrenght = %f ;\n P_bg_color_R = %f ;\n P_bg_color_G = %f ;\n P_bg_color_B = %f ;\n auto_normalize = %d ;\n P_double_shadows = %d ;\n P_border_fixed = %d ;\n}\n}"; |
| 37 |
|
| 38 |
bool CgUtilcxx . . $ CgUtil#::Loadcxx . . $ CgUtil#Load(c5f7da30cbc0f4e9).(const char* filename){ |
| 39 |
FILE *f=fopen(filename, "rt"); |
| 40 |
if (!f) return false; |
| 41 |
fscanf(f,FORMATcxx . . $ FORMAT. |
| 42 |
,&P_light_basecxx . . $ CgUtil#P_light_base.,&P_lightingcxx . . $ CgUtil#P_lighting.,&P_phongcxx . . $ CgUtil#P_phong.,&P_phong_sizecxx . . $ CgUtil#P_phong_size.,&P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.,&P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.,&P_texturecxx . . $ CgUtil#P_texture.,&P_border_insidecxx . . $ CgUtil#P_border_inside.,&P_border_outsidecxx . . $ CgUtil#P_border_outside.,&P_depth_fullcxx . . $ CgUtil#P_depth_full.,&P_sem_effectcxx . . $ CgUtil#P_sem_effect.,&P_halo_sizecxx . . $ CgUtil#P_halo_size.,&P_halo_colcxx . . $ CgUtil#P_halo_col.,&P_halo_strcxx . . $ CgUtil#P_halo_str.,&P_halo_awarecxx . . $ CgUtil#P_halo_aware.,&P_fogcxx . . $ CgUtil#P_fog.,&P_cappingcxx . . $ CgUtil#P_capping.,&P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.,&P_bg_color_Rcxx . . $ CgUtil#P_bg_color_R.,&P_bg_color_Gcxx . . $ CgUtil#P_bg_color_G.,&P_bg_color_Bcxx . . $ CgUtil#P_bg_color_B.,&auto_normalizecxx . . $ CgUtil#auto_normalize.,&P_double_shadowscxx . . $ CgUtil#P_double_shadows.,&P_border_fixedcxx . . $ CgUtil#P_border_fixed.); |
| 43 |
fclose(f); |
| 44 |
return true; |
| 45 |
} |
| 46 |
|
| 47 |
bool CgUtilcxx . . $ CgUtil#::Savecxx . . $ CgUtil#Save(c5f7da30cbc0f4e9).(const char* filename){ |
| 48 |
FILE *f=fopen(filename, "wt"); |
| 49 |
if (!f) return false; |
| 50 |
fprintf(f,FORMATcxx . . $ FORMAT. |
| 51 |
,P_light_basecxx . . $ CgUtil#P_light_base.,P_lightingcxx . . $ CgUtil#P_lighting.,P_phongcxx . . $ CgUtil#P_phong.,P_phong_sizecxx . . $ CgUtil#P_phong_size.,P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.,P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.,P_texturecxx . . $ CgUtil#P_texture.,P_border_insidecxx . . $ CgUtil#P_border_inside.,P_border_outsidecxx . . $ CgUtil#P_border_outside.,P_depth_fullcxx . . $ CgUtil#P_depth_full.,P_sem_effectcxx . . $ CgUtil#P_sem_effect.,P_halo_sizecxx . . $ CgUtil#P_halo_size.,P_halo_colcxx . . $ CgUtil#P_halo_col.,P_halo_strcxx . . $ CgUtil#P_halo_str.,P_halo_awarecxx . . $ CgUtil#P_halo_aware.,P_fogcxx . . $ CgUtil#P_fog.,P_cappingcxx . . $ CgUtil#P_capping.,P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.,P_bg_color_Rcxx . . $ CgUtil#P_bg_color_R.,P_bg_color_Gcxx . . $ CgUtil#P_bg_color_G.,P_bg_color_Bcxx . . $ CgUtil#P_bg_color_B.,auto_normalizecxx . . $ CgUtil#auto_normalize.,P_double_shadowscxx . . $ CgUtil#P_double_shadows.,P_border_fixedcxx . . $ CgUtil#P_border_fixed.); |
| 52 |
fclose(f); |
| 53 |
return true; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
float CgUtilcxx . . $ CgUtil#::_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).(){ |
| 58 |
return P_border_outsidecxx . . $ CgUtil#P_border_outside.*0.075; |
| 59 |
} |
| 60 |
|
| 61 |
float CgUtilcxx . . $ CgUtil#::_border_insidecxx . . $ CgUtil#_border_inside(9b8c9e39889c762c).(){ |
| 62 |
return P_border_insidecxx . . $ CgUtil#P_border_inside.*0.5; |
| 63 |
} |
| 64 |
|
| 65 |
void CgUtilcxx . . $ CgUtil#::setGeoSettingscxx . . $ CgUtil#setGeoSettings(31d11fe37d1238f2).(const GeoSettingscxx . . $ GeoSettings# &gs){ |
| 66 |
if (gs.modecxx . . $ GeoSettings#mode.==GeoSettingscxx . . $ GeoSettings#::BALL_N_STICKScxx . . $ GeoSettings#BALL_N_STICKS.) { |
| 67 |
P_cyl_const_colorcxx . . $ CgUtil#P_cyl_const_color.=gs.use_stick_const_colorcxx . . $ GeoSettings#use_stick_const_color.; |
| 68 |
P_cyl_smooth_colorcxx . . $ CgUtil#P_cyl_smooth_color.=gs.stick_smooth_colorcxx . . $ GeoSettings#stick_smooth_color.; |
| 69 |
P_cyl_const_color_Rcxx . . $ CgUtil#P_cyl_const_color_R. = gs.stick_const_color_Rcxx . . $ GeoSettings#stick_const_color_R.; |
| 70 |
P_cyl_const_color_Gcxx . . $ CgUtil#P_cyl_const_color_G. = gs.stick_const_color_Gcxx . . $ GeoSettings#stick_const_color_G.; |
| 71 |
P_cyl_const_color_Bcxx . . $ CgUtil#P_cyl_const_color_B. = gs.stick_const_color_Bcxx . . $ GeoSettings#stick_const_color_B.; |
| 72 |
} |
| 73 |
if (gs.modecxx . . $ GeoSettings#mode.==GeoSettingscxx . . $ GeoSettings#::LICORICEcxx . . $ GeoSettings#LICORICE.) { |
| 74 |
P_cyl_const_colorcxx . . $ CgUtil#P_cyl_const_color.=false; |
| 75 |
P_cyl_smooth_colorcxx . . $ CgUtil#P_cyl_smooth_color.=false; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
CgUtilcxx . . $ CgUtil#::CgUtilcxx . . $ CgUtil#CgUtil(49f6e7a06ebc5aa8).() { |
| 80 |
loadedcxx . . $ CgUtil#loaded.=false; idfcxx . . $ CgUtil#idf.=666; idvcxx . . $ CgUtil#idv.=666; auto_normalizecxx . . $ CgUtil#auto_normalize.=false; normcxx . . $ CgUtil#norm.=1; |
| 81 |
loadedVertexHalocxx . . $ CgUtil#loadedVertexHalo.=false; |
| 82 |
ResetHalocxx . . $ CgUtil#ResetHalo(49f6e7a06ebc5aa8).(); |
| 83 |
proj_figacxx . . $ CgUtil#proj_figa.=false; |
| 84 |
idfStickcxx . . $ CgUtil#idfStick.=idvStickcxx . . $ CgUtil#idvStick.=666; loadedStickcxx . . $ CgUtil#loadedStick.=false; |
| 85 |
idvHalocxx . . $ CgUtil#idvHalo.=666; |
| 86 |
cyl_radiuscxx . . $ CgUtil#cyl_radius.=0.2; |
| 87 |
shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.=false; |
| 88 |
accurateShadowmapBuildingcxx . . $ CgUtil#accurateShadowmapBuilding.=false; |
| 89 |
doingAlphaSnapshotcxx . . $ CgUtil#doingAlphaSnapshot.=false; |
| 90 |
|
| 91 |
shadersMadecxx . . $ CgUtil#shadersMade.=false; |
| 92 |
} |
| 93 |
|
| 94 |
void CgUtilcxx . . $ CgUtil#::ResetHalocxx . . $ CgUtil#ResetHalo(49f6e7a06ebc5aa8).(){ |
| 95 |
|
| 96 |
for (int i=0; i<MAXPOWcxx . . $ CgUtil#MAXPOW.; i++) { |
| 97 |
loadedHalocxx . . $ CgUtil#loadedHalo.[i]=false; |
| 98 |
idfHalocxx . . $ CgUtil#idfHalo.[i]=666; |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
char CgUtilcxx . . $ CgUtil#::lasterrcxx . . $ CgUtil#lasterr.[255]; |
| 103 |
|
| 104 |
bool CgUtilcxx . . $ CgUtil#::BindHaloShadercxx . . $ CgUtil#BindHaloShader(83c267b20bac841a).(int pow){ |
| 105 |
if (idfHalocxx . . $ CgUtil#idfHalo.[pow]==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &(idfHalocxx . . $ CgUtil#idfHalo.[pow])); |
| 106 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfHalocxx . . $ CgUtil#idfHalo.[pow]); |
| 107 |
|
| 108 |
if (!loadedHalocxx . . $ CgUtil#loadedHalo.[pow]) MakeHaloShadercxx . . $ CgUtil#MakeHaloShader(83c267b20bac841a).(pow); |
| 109 |
|
| 110 |
if (idvHalocxx . . $ CgUtil#idvHalo.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idvHalocxx . . $ CgUtil#idvHalo.); |
| 111 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, idvHalocxx . . $ CgUtil#idvHalo.); |
| 112 |
if (!loadedVertexHalocxx . . $ CgUtil#loadedVertexHalo.) LoadVertexHaloShadercxx . . $ CgUtil#LoadVertexHaloShader(49f6e7a06ebc5aa8).(); |
| 113 |
|
| 114 |
loadedHalocxx . . $ CgUtil#loadedHalo.[pow]=true; |
| 115 |
loadedVertexHalocxx . . $ CgUtil#loadedVertexHalo.=true; |
| 116 |
|
| 117 |
return true; |
| 118 |
} |
| 119 |
|
| 120 |
void CgUtilcxx . . $ CgUtil#::LoadVertexHaloShadercxx . . $ CgUtil#LoadVertexHaloShader(49f6e7a06ebc5aa8).(){ |
| 121 |
char vp[10096]; |
| 122 |
|
| 123 |
sprintf(vp,"\ |
| 124 |
!!ARBvp1.0\n\ |
| 125 |
\n\ |
| 126 |
ATTRIB pos = vertex.position;\n\ |
| 127 |
ATTRIB dataA = vertex.texcoord[0];\n\ |
| 128 |
ATTRIB dataB = vertex.texcoord[1];\n\ |
| 129 |
\n\ |
| 130 |
"); |
| 131 |
|
| 132 |
|
| 133 |
sprintf(vp,"%s\ |
| 134 |
\n\ |
| 135 |
PARAM mat[4] = { state.matrix.mvp };\n\ |
| 136 |
PARAM matP[4] = { state.matrix.projection };\n\ |
| 137 |
\n\ |
| 138 |
TEMP p,po, disp, dataout, tmp;\n\ |
| 139 |
\n\ |
| 140 |
# Transform by concatenation of the\n\ |
| 141 |
# MODELVIEW and PROJECTION matrices.\n\ |
| 142 |
DP4 p.x, mat[0], pos;\n\ |
| 143 |
DP4 p.y, mat[1], pos;\n\ |
| 144 |
DP4 p.z, mat[2], pos;\n\ |
| 145 |
DP4 p.w, mat[3], pos;\n\ |
| 146 |
#MOV p.w, 1; \n\ |
| 147 |
\n\ |
| 148 |
MOV dataout, dataA;\n\ |
| 149 |
MOV dataout.z, dataB.y;\n\ |
| 150 |
", vp); |
| 151 |
|
| 152 |
sprintf(vp,"%s\ |
| 153 |
\n\ |
| 154 |
MUL disp, dataA, dataB.x; \n\ |
| 155 |
MUL disp, disp, program.env[0].x; \n\ |
| 156 |
#MUL disp.x, disp.x, matP[0].x;\n\ |
| 157 |
#MUL disp.y, disp.y, matP[1].y;\n\ |
| 158 |
MAD p, {1,1,0,0}, disp, p;\n\ |
| 159 |
", vp); |
| 160 |
|
| 161 |
|
| 162 |
sprintf(vp,"%sMOV result.position, p;\n",vp); |
| 163 |
|
| 164 |
sprintf(vp,"%sMOV result.texcoord, dataout;\n",vp); |
| 165 |
|
| 166 |
sprintf(vp,"%s\nEND\n", vp); |
| 167 |
|
| 168 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(vp), vp); |
| 169 |
|
| 170 |
//printf("\n--------<vp ball>---------\n%s",vp); |
| 171 |
//if(!checkProgramError(vp)) return -1; |
| 172 |
//return true; |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
bool CgUtilcxx . . $ CgUtil#::MakeHaloShadercxx . . $ CgUtil#MakeHaloShader(83c267b20bac841a).(int pow){ |
| 177 |
|
| 178 |
char fp[10096]; |
| 179 |
|
| 180 |
sprintf(fp,"\ |
| 181 |
!!ARBfp1.0\n\ |
| 182 |
\n\ |
| 183 |
ATTRIB data = fragment.texcoord; \n\ |
| 184 |
\n\ |
| 185 |
TEMP tmp,tmp2,tmp3, t,t0,t1,t2,nor,n,nabs,nsign,disp,res,depth,pos,\n\ |
| 186 |
lighting; \n\ |
| 187 |
\n\ |
| 188 |
MOV nor, data; \n\ |
| 189 |
MUL tmp, data, data; \n\ |
| 190 |
ADD tmp2.x, tmp.x, tmp.y;\n\ |
| 191 |
ADD tmp2.z, -tmp2.x, 1;\n\ |
| 192 |
KIL tmp2.z;\n\ |
| 193 |
\n\ |
| 194 |
MAD tmp2.x, -data.z, tmp2.x, data.z;\n\ |
| 195 |
\n\ |
| 196 |
#TEST!\n\ |
| 197 |
#ADD tmp2.x, tmp2.x, %10.8f;\n\ |
| 198 |
#CMP result.color, tmp2.x, {1,0,0,1}, {0,0,1,1};\n\ |
| 199 |
\n\ |
| 200 |
MUL tmp, fragment.position, {%14.12f, %14.12f, 0, 0};\n\ |
| 201 |
#MAD tmp, fragment.position, {0.5, 0.5, 0, 0}, {0.5, 0.5, 0, 0};\n\ |
| 202 |
TEX tmp.z, tmp, texture[1], 2D; # tmp.z = old depth \n\ |
| 203 |
ADD tmp.z, tmp.z, -fragment.position.z; \n\ |
| 204 |
MUL_SAT tmp.z, tmp.z, program.env[0].x; \n\ |
| 205 |
MUL tmp.z, tmp.z, tmp2.x; \n\ |
| 206 |
MUL tmp.z, tmp.z, tmp2.x; # again for smoother edges\n\ |
| 207 |
", +P_halo_strcxx . . $ CgUtil#P_halo_str.-1, 1.0f/(1<<pow), 1.0f/(1<<pow) ); |
| 208 |
|
| 209 |
if (P_halo_strcxx . . $ CgUtil#P_halo_str.<1.0) { |
| 210 |
sprintf(fp,"%sMUL tmp.z , tmp.z, %10.8f;\n",fp, P_halo_strcxx . . $ CgUtil#P_halo_str. ); |
| 211 |
} |
| 212 |
if (!doingAlphaSnapshotcxx . . $ CgUtil#doingAlphaSnapshot.) |
| 213 |
sprintf(fp,"%sMAD result.color, {0,0,0,1}, tmp.z, {%5.4f,%5.4f,%5.4f,0.0} ;\n",fp,P_halo_colcxx . . $ CgUtil#P_halo_col.,P_halo_colcxx . . $ CgUtil#P_halo_col.,P_halo_colcxx . . $ CgUtil#P_halo_col.); |
| 214 |
else { |
| 215 |
if (P_halo_colcxx . . $ CgUtil#P_halo_col.==1.0) // white halo |
| 216 |
sprintf(fp,"%sMOV result.color, tmp.z;\n",fp); |
| 217 |
else |
| 218 |
sprintf(fp,"%sMUL result.color, {0,0,0,1}, tmp.z;\n",fp); |
| 219 |
} |
| 220 |
sprintf(fp,"%sEND\n",fp); |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 226 |
// printf("\n-------<fp HALO>--------\n%s",fp); |
| 227 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 228 |
return true; |
| 229 |
} |
| 230 |
|
| 231 |
static void addDrawAOShaderSnippetcxx . . $ addDrawAOShaderSnippet(fda57c8427c60377).(char* fp) { |
| 232 |
sprintf(fp,"%s\n\ |
| 233 |
# Find shading value \n\ |
| 234 |
DP3 l.x, nor, -param; \n\ |
| 235 |
#MUL_SAT l.x, l.x, param.w; \n\ |
| 236 |
MUL l.x, l.x, param.w; \n\ |
| 237 |
#KIL l.x; \n\ |
| 238 |
",fp); |
| 239 |
|
| 240 |
if ( (!hardSettingscxx . . $ hardSettings..doubleSMcxx . . $ HardSettings#doubleSM.) && (!hardSettingscxx . . $ hardSettings..NVIDIA_PATCHcxx . . $ HardSettings#NVIDIA_PATCH.) ) { |
| 241 |
sprintf(fp,"%s\n\ |
| 242 |
KIL l.x; # early KILL of fragments on the dark side...\n\ |
| 243 |
",fp); |
| 244 |
} |
| 245 |
|
| 246 |
sprintf(fp,"%s\n\ |
| 247 |
# Project! \n\ |
| 248 |
DP4 pos.x, Smat0, origpos; \n\ |
| 249 |
DP4 pos.y, Smat1, origpos; \n\ |
| 250 |
DP4 pos.z, Smat2, origpos; \n\ |
| 251 |
",fp); |
| 252 |
|
| 253 |
if (hardSettingscxx . . $ hardSettings..doubleSMcxx . . $ HardSettings#doubleSM.) sprintf(fp,"%s\n\ |
| 254 |
CMP tmp, l.x, {0.75,0.5,0.5,1}, {0.25,0.5,0.5,1};\n\ |
| 255 |
MAD pos, pos, {0.25,0.5,0.5,0}, tmp; \n\ |
| 256 |
\n\ |
| 257 |
",fp); else |
| 258 |
sprintf(fp,"%s\n\ |
| 259 |
MAD pos, pos, {0.5,0.5,0.5,0}, {0.5,0.5,0.5,1}; \n\ |
| 260 |
",fp); |
| 261 |
|
| 262 |
sprintf(fp,"%s\n\ |
| 263 |
# Access shadow map! \n\ |
| 264 |
TEX tmp.x, pos, texture[1], 2D;\n\ |
| 265 |
SUB l.z, tmp.x, pos.z; \n\ |
| 266 |
",fp); |
| 267 |
|
| 268 |
if (hardSettingscxx . . $ hardSettings..doubleSMcxx . . $ HardSettings#doubleSM.) sprintf(fp,"%s\n\ |
| 269 |
CMP l.z, l.x, -l.z, l.z; \n\ |
| 270 |
CMP l.x, l.x, -l.x, l.x; # DOUBLE SIDE\n\ |
| 271 |
\n\ |
| 272 |
",fp); |
| 273 |
|
| 274 |
sprintf(fp,"%s\n\ |
| 275 |
# NVIDIA BUUUUGUUGUGUGUGUGUUGUUGGUGUUGUG GUUGUGUG GGFUCKFUCKFUCKFUCKFUCKFUCKFUCK!!! \n\ |
| 276 |
%s\ |
| 277 |
CMP result.color, l.z, 0, l.x; # <-- (shadow & shading) \n\ |
| 278 |
#CMP result.color, l.z, 0, 1; # <-- (TEST: only shadow - works) \n\ |
| 279 |
#CMP result.color, 1, 0, l.x; # <-- (TEST: only shading - works) \n\ |
| 280 |
# NVIDIA BUUUUGUUGUGUGUGUGUUGUUGGUGUUGUG GUUGUGUG GGFUCKFUCKFUCKFUCKFUCKFUCKFUCK!!! \n\ |
| 281 |
\n\ |
| 282 |
# TEST1: MAD result.color, {0.5,0.5,0.5,0},nor, {0.5,0.5,0.5,1};\n\ |
| 283 |
# TEST2: MAD result.color, {0.5,0.5,0.5,0},origpos, {0.5,0.5,0.5,1};\n\ |
| 284 |
# TEST3: CMP result.color, l.z, {1,0,0,1}, {0,0,0.5,1};\n\ |
| 285 |
# TEST4: MOV result.color, tmp.x;\n\ |
| 286 |
\n\ |
| 287 |
\n\ |
| 288 |
END\n\ |
| 289 |
", |
| 290 |
fp, |
| 291 |
hardSettingscxx . . $ hardSettings..NVIDIA_PATCHcxx . . $ HardSettings#NVIDIA_PATCH.? |
| 292 |
"MUL l.x, 0.5, param.w; # <-- patch! REMOVE ME when N-VIDIA wakes up \n" |
| 293 |
:"" |
| 294 |
); |
| 295 |
} |
| 296 |
|
| 297 |
bool CgUtilcxx . . $ CgUtil#::MakeDrawAOShadercxx . . $ CgUtil#MakeDrawAOShader(c9857a73d68e59ba).(){ |
| 298 |
char fp[10096]; |
| 299 |
sprintf(fp,"\ |
| 300 |
!!ARBfp1.0 \n\ |
| 301 |
PARAM Smat0 = program.env[0];\n\ |
| 302 |
PARAM Smat1 = program.env[1];\n\ |
| 303 |
PARAM Smat2 = program.env[2];\n\ |
| 304 |
PARAM param = program.env[3];\n\ |
| 305 |
ATTRIB tc = fragment.texcoord; \n\ |
| 306 |
ATTRIB data = fragment.texcoord[1]; \n\ |
| 307 |
TEMP tmp,nor, pos,origpos, abs,l;\n\ |
| 308 |
\n\ |
| 309 |
# Find shpere normal... \n\ |
| 310 |
CMP abs, tc, -tc, tc;\n\ |
| 311 |
MAD nor, -abs, {1,1,0,0}, +1;\n\ |
| 312 |
CMP tmp.x, tc.x, -nor.y, nor.y; # tmp_i = sign_i*( 1-abs_i) \n\ |
| 313 |
CMP tmp.y, tc.y, -nor.x, nor.x; # tmp_i = sign_i*( 1-abs_i) \n\ |
| 314 |
ADD nor.z, abs.x, abs.y; \n\ |
| 315 |
ADD nor.z, nor.z, -1; \n\ |
| 316 |
CMP nor.x, -nor.z, tmp.x, tc.x;\n\ |
| 317 |
CMP nor.y, -nor.z, tmp.y, tc.y;\n\ |
| 318 |
# Normalize \n\ |
| 319 |
DP3 tmp.x, nor, nor; \n\ |
| 320 |
RSQ tmp.x, tmp.x; \n\ |
| 321 |
MUL nor, nor, tmp.x; \n\ |
| 322 |
\n\ |
| 323 |
# Find pos \n\ |
| 324 |
MAD origpos, data.w, nor, data;\n\ |
| 325 |
MOV origpos.w, 1;\n"); |
| 326 |
|
| 327 |
addDrawAOShaderSnippetcxx . . $ addDrawAOShaderSnippet(fda57c8427c60377).(fp); |
| 328 |
|
| 329 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 330 |
// printf("\n-------<fp special>--------\n%s",fp); |
| 331 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 332 |
//ShowShaderInfo(GL_FRAGMENT_PROGRAM_ARB); |
| 333 |
return true; |
| 334 |
}; |
| 335 |
|
| 336 |
bool CgUtilcxx . . $ CgUtil#::MakeDrawAOShaderStickscxx . . $ CgUtil#MakeDrawAOShaderSticks(c9857a73d68e59ba).(){ |
| 337 |
char fp[10096]; |
| 338 |
sprintf(fp,"\ |
| 339 |
!!ARBfp1.0 \n\ |
| 340 |
PARAM Smat0 = program.env[0];\n\ |
| 341 |
PARAM Smat1 = program.env[1];\n\ |
| 342 |
PARAM Smat2 = program.env[2];\n\ |
| 343 |
PARAM param = program.env[3];\n\ |
| 344 |
PARAM radius = program.env[4];\n\ |
| 345 |
ATTRIB axispos= fragment.texcoord[1]; \n\ |
| 346 |
ATTRIB data = fragment.texcoord; \n\ |
| 347 |
TEMP tmp,n,nor, pos,origpos, abs,l;\n\ |
| 348 |
\n\ |
| 349 |
\n\ |
| 350 |
# find norm in cyl space \n\ |
| 351 |
MAD n.y, data.y, -2, 0; \n\ |
| 352 |
CMP n.y, n.y, -n.y, n.y; \n\ |
| 353 |
ADD n.x, 2, -n.y; \n\ |
| 354 |
MIN n.x, n.x, n.y; \n\ |
| 355 |
CMP n.x, data.y, n.x, -n.x; \n\ |
| 356 |
MAD n, n, {1,1,0,0}, {0,-1,0,0};\n\ |
| 357 |
\n\ |
| 358 |
# normalize \n\ |
| 359 |
DP3 tmp.x, n, n;\n\ |
| 360 |
RSQ tmp.x, tmp.x;\n\ |
| 361 |
MUL n, tmp.x, n;\n\ |
| 362 |
\n\ |
| 363 |
# rotate \n\ |
| 364 |
MUL nor, -n.x, fragment.texcoord[2];\n\ |
| 365 |
MAD nor, n.y, fragment.texcoord[3], nor;\n\ |
| 366 |
\n\ |
| 367 |
# find position \n\ |
| 368 |
MAD origpos, nor, radius.y, axispos; \n\ |
| 369 |
MOV origpos.w, 1;\n\ |
| 370 |
"); |
| 371 |
|
| 372 |
addDrawAOShaderSnippetcxx . . $ addDrawAOShaderSnippet(fda57c8427c60377).(fp); |
| 373 |
|
| 374 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 375 |
// printf("\n-------<fp special>--------\n%s",fp); |
| 376 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 377 |
//ShowShaderInfo(GL_FRAGMENT_PROGRAM_ARB); |
| 378 |
return true; |
| 379 |
}; |
| 380 |
|
| 381 |
void CgUtilcxx . . $ CgUtil#::Normalizecxx . . $ CgUtil#Normalize(49f6e7a06ebc5aa8).(){ |
| 382 |
/* if (!auto_normalize) return; |
| 383 |
float sum=P_light_base + P_lighting + P_texture; |
| 384 |
if (sum>1.0) { |
| 385 |
norm=sum; |
| 386 |
P_light_base/=norm; |
| 387 |
P_lighting/=norm; |
| 388 |
P_texture/=norm; |
| 389 |
}*/ |
| 390 |
} |
| 391 |
|
| 392 |
|
| 393 |
void CgUtilcxx . . $ CgUtil#::UndoNormalizecxx . . $ CgUtil#UndoNormalize(49f6e7a06ebc5aa8).(){ |
| 394 |
//P_light_base*=norm; |
| 395 |
P_lightingcxx . . $ CgUtil#P_lighting.*=normcxx . . $ CgUtil#norm.; |
| 396 |
P_texturecxx . . $ CgUtil#P_texture.*=normcxx . . $ CgUtil#norm.; |
| 397 |
} |
| 398 |
|
| 399 |
void CgUtilcxx . . $ CgUtil#::SetDefaultscxx . . $ CgUtil#SetDefaults(49f6e7a06ebc5aa8).(){ |
| 400 |
P_light_basecxx . . $ CgUtil#P_light_base.=0.0; |
| 401 |
P_lightingcxx . . $ CgUtil#P_lighting.=0.9; |
| 402 |
P_phongcxx . . $ CgUtil#P_phong.=0.0; |
| 403 |
P_phong_sizecxx . . $ CgUtil#P_phong_size.=0.75; |
| 404 |
|
| 405 |
P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.=0.5; |
| 406 |
P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.=1.0; |
| 407 |
|
| 408 |
P_texturecxx . . $ CgUtil#P_texture.=0.0; |
| 409 |
P_border_insidecxx . . $ CgUtil#P_border_inside.=0.0; |
| 410 |
|
| 411 |
P_border_outsidecxx . . $ CgUtil#P_border_outside.=0.0; |
| 412 |
P_depth_fullcxx . . $ CgUtil#P_depth_full.=0.5; |
| 413 |
|
| 414 |
P_sem_effectcxx . . $ CgUtil#P_sem_effect.=false; |
| 415 |
//P_use_shadowmap=false; |
| 416 |
P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.=0.0; |
| 417 |
P_double_shadowscxx . . $ CgUtil#P_double_shadows.=true; |
| 418 |
P_fogcxx . . $ CgUtil#P_fog.=0; |
| 419 |
|
| 420 |
P_bg_color_Rcxx . . $ CgUtil#P_bg_color_R.=P_bg_color_Gcxx . . $ CgUtil#P_bg_color_G.=P_bg_color_Bcxx . . $ CgUtil#P_bg_color_B.=0.5; |
| 421 |
|
| 422 |
// textmode=USE_CUBE; |
| 423 |
textmodecxx . . $ CgUtil#textmode.=USE_OCTAcxx . . $ CgUtil#USE_OCTA.; |
| 424 |
projmodecxx . . $ CgUtil#projmode.=ORTHOcxx . . $ CgUtil#ORTHO.; |
| 425 |
|
| 426 |
writeAlphacxx . . $ CgUtil#writeAlpha.=false; |
| 427 |
writeColcxx . . $ CgUtil#writeCol.=true; |
| 428 |
gapcxx . . $ CgUtil#gap. =0.5; |
| 429 |
|
| 430 |
P_cappingcxx . . $ CgUtil#P_capping.=false; |
| 431 |
|
| 432 |
P_halo_sizecxx . . $ CgUtil#P_halo_size.=0.0; // 1.0; |
| 433 |
P_halo_colcxx . . $ CgUtil#P_halo_col. =0.0; // 1.0; |
| 434 |
P_halo_strcxx . . $ CgUtil#P_halo_str. =1.0; // 1.0; |
| 435 |
P_halo_awarecxx . . $ CgUtil#P_halo_aware.=0.5; |
| 436 |
|
| 437 |
} |
| 438 |
|
| 439 |
void CgUtilcxx . . $ CgUtil#::SetForShadowMapcxx . . $ CgUtil#SetForShadowMap(b45ddcbc8423892c).(bool accurate){ |
| 440 |
|
| 441 |
P_light_basecxx . . $ CgUtil#P_light_base.=0.0; |
| 442 |
P_lightingcxx . . $ CgUtil#P_lighting.=0.0; |
| 443 |
P_phongcxx . . $ CgUtil#P_phong.=0.0; |
| 444 |
|
| 445 |
P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.=0.0; |
| 446 |
P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.=0.0; |
| 447 |
P_texturecxx . . $ CgUtil#P_texture.=0.0; |
| 448 |
P_border_insidecxx . . $ CgUtil#P_border_inside.=0.0; |
| 449 |
P_border_outsidecxx . . $ CgUtil#P_border_outside.=0.0; |
| 450 |
P_sem_effectcxx . . $ CgUtil#P_sem_effect.=false; |
| 451 |
//P_use_shadowmap=false; |
| 452 |
P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.=0.0; |
| 453 |
P_fogcxx . . $ CgUtil#P_fog.=0; |
| 454 |
|
| 455 |
projmodecxx . . $ CgUtil#projmode.=ORTHOcxx . . $ CgUtil#ORTHO.; |
| 456 |
|
| 457 |
textmodecxx . . $ CgUtil#textmode.=USE_OCTAcxx . . $ CgUtil#USE_OCTA.; |
| 458 |
writeAlphacxx . . $ CgUtil#writeAlpha.=false; |
| 459 |
writeColcxx . . $ CgUtil#writeCol.=false; |
| 460 |
|
| 461 |
P_cappingcxx . . $ CgUtil#P_capping.=false; |
| 462 |
|
| 463 |
P_halo_sizecxx . . $ CgUtil#P_halo_size.=0.0; |
| 464 |
|
| 465 |
shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.=true; |
| 466 |
accurateShadowmapBuildingcxx . . $ CgUtil#accurateShadowmapBuilding.=accurate; |
| 467 |
} |
| 468 |
|
| 469 |
void CgUtilcxx . . $ CgUtil#::SetForOffLinecxx . . $ CgUtil#SetForOffLine(49f6e7a06ebc5aa8).(){ |
| 470 |
|
| 471 |
P_light_basecxx . . $ CgUtil#P_light_base.=0.0; |
| 472 |
P_lightingcxx . . $ CgUtil#P_lighting.=0.0; |
| 473 |
P_phongcxx . . $ CgUtil#P_phong.=0.0; |
| 474 |
|
| 475 |
P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.=0.0; |
| 476 |
P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.=0.0; |
| 477 |
P_lightingcxx . . $ CgUtil#P_lighting.=0.0; |
| 478 |
P_texturecxx . . $ CgUtil#P_texture.=1.0; |
| 479 |
P_border_insidecxx . . $ CgUtil#P_border_inside.=0.0; |
| 480 |
P_border_outsidecxx . . $ CgUtil#P_border_outside.=0.0; |
| 481 |
P_sem_effectcxx . . $ CgUtil#P_sem_effect.=false; |
| 482 |
//P_use_shadowmap=false; |
| 483 |
P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.=0.0; |
| 484 |
P_fogcxx . . $ CgUtil#P_fog.=0; |
| 485 |
|
| 486 |
projmodecxx . . $ CgUtil#projmode.=ORTHOcxx . . $ CgUtil#ORTHO.; |
| 487 |
|
| 488 |
textmodecxx . . $ CgUtil#textmode.=USE_OCTAcxx . . $ CgUtil#USE_OCTA.; |
| 489 |
|
| 490 |
writeAlphacxx . . $ CgUtil#writeAlpha.=true; |
| 491 |
writeColcxx . . $ CgUtil#writeCol.=true; |
| 492 |
|
| 493 |
P_cappingcxx . . $ CgUtil#P_capping.=false; |
| 494 |
|
| 495 |
gapcxx . . $ CgUtil#gap. =0.2; |
| 496 |
|
| 497 |
P_halo_sizecxx . . $ CgUtil#P_halo_size.=0.0; |
| 498 |
} |
| 499 |
|
| 500 |
void CgUtilcxx . . $ CgUtil#::BindShaderscxx . . $ CgUtil#BindShaders(49f6e7a06ebc5aa8).(){ |
| 501 |
if (!loadedcxx . . $ CgUtil#loaded.) MakeShaderscxx . . $ CgUtil#MakeShaders(49f6e7a06ebc5aa8).(); |
| 502 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfcxx . . $ CgUtil#idf.); |
| 503 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, idvcxx . . $ CgUtil#idv.); |
| 504 |
} |
| 505 |
|
| 506 |
void CgUtilcxx . . $ CgUtil#::MakeShaderscxx . . $ CgUtil#MakeShaders(49f6e7a06ebc5aa8).(){ |
| 507 |
|
| 508 |
if (shadersMadecxx . . $ CgUtil#shadersMade.) return; |
| 509 |
|
| 510 |
shadersMadecxx . . $ CgUtil#shadersMade.=true; |
| 511 |
|
| 512 |
if (idfcxx . . $ CgUtil#idf.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idfcxx . . $ CgUtil#idf.); |
| 513 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfcxx . . $ CgUtil#idf.); |
| 514 |
setBallFragmentProgramcxx . . $ CgUtil#setBallFragmentProgram(c9857a73d68e59ba).(); |
| 515 |
|
| 516 |
if (idvcxx . . $ CgUtil#idv.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idvcxx . . $ CgUtil#idv.); |
| 517 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, idvcxx . . $ CgUtil#idv.); |
| 518 |
setBallVertexProgramcxx . . $ CgUtil#setBallVertexProgram(c9857a73d68e59ba).(); |
| 519 |
|
| 520 |
loadedcxx . . $ CgUtil#loaded.=true; |
| 521 |
|
| 522 |
MakeStickShaderscxx . . $ CgUtil#MakeStickShaders(49f6e7a06ebc5aa8).(); |
| 523 |
|
| 524 |
} |
| 525 |
|
| 526 |
void CgUtilcxx . . $ CgUtil#::BindStickShaderscxx . . $ CgUtil#BindStickShaders(49f6e7a06ebc5aa8).(){ |
| 527 |
if (!loadedStickcxx . . $ CgUtil#loadedStick.) MakeStickShaderscxx . . $ CgUtil#MakeStickShaders(49f6e7a06ebc5aa8).(); |
| 528 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfStickcxx . . $ CgUtil#idfStick.); |
| 529 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, idvStickcxx . . $ CgUtil#idvStick.); |
| 530 |
} |
| 531 |
|
| 532 |
void CgUtilcxx . . $ CgUtil#::MakeStickShaderscxx . . $ CgUtil#MakeStickShaders(49f6e7a06ebc5aa8).(){ |
| 533 |
|
| 534 |
if (idfStickcxx . . $ CgUtil#idfStick.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idfStickcxx . . $ CgUtil#idfStick.); |
| 535 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfStickcxx . . $ CgUtil#idfStick.); |
| 536 |
setStickFragmentProgramcxx . . $ CgUtil#setStickFragmentProgram(c9857a73d68e59ba).(); |
| 537 |
|
| 538 |
if (idvStickcxx . . $ CgUtil#idvStick.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idvStickcxx . . $ CgUtil#idvStick.); |
| 539 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, idvStickcxx . . $ CgUtil#idvStick.); |
| 540 |
setStickVertexProgramcxx . . $ CgUtil#setStickVertexProgram(c9857a73d68e59ba).(); |
| 541 |
|
| 542 |
loadedStickcxx . . $ CgUtil#loadedStick.=true; |
| 543 |
|
| 544 |
} |
| 545 |
|
| 546 |
bool CgUtilcxx . . $ CgUtil#::BindDrawAOShadercxx . . $ CgUtil#BindDrawAOShader(c9857a73d68e59ba).(){ |
| 547 |
if (idfcxx . . $ CgUtil#idf.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idfcxx . . $ CgUtil#idf.); |
| 548 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfcxx . . $ CgUtil#idf.); |
| 549 |
if (!loadedcxx . . $ CgUtil#loaded.) MakeDrawAOShadercxx . . $ CgUtil#MakeDrawAOShader(c9857a73d68e59ba).(); |
| 550 |
loadedcxx . . $ CgUtil#loaded.=true; |
| 551 |
return true; |
| 552 |
} |
| 553 |
|
| 554 |
bool CgUtilcxx . . $ CgUtil#::BindDrawAOShaderStickscxx . . $ CgUtil#BindDrawAOShaderSticks(c9857a73d68e59ba).(){ |
| 555 |
if (idfcxx . . $ CgUtil#idf.==666) glGenProgramsARBcxx . . $ `<external>/18396878532286971346/glew.h:8246:9`!(1, &idfcxx . . $ CgUtil#idf.); |
| 556 |
glBindProgramARBcxx . . $ `<external>/18396878532286971346/glew.h:8242:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, idfcxx . . $ CgUtil#idf.); |
| 557 |
if (!loadedcxx . . $ CgUtil#loaded.) MakeDrawAOShaderStickscxx . . $ CgUtil#MakeDrawAOShaderSticks(c9857a73d68e59ba).(); |
| 558 |
loadedcxx . . $ CgUtil#loaded.=true; |
| 559 |
return true; |
| 560 |
} |
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
bool CgUtilcxx . . $ CgUtil#::setBallVertexProgramcxx . . $ CgUtil#setBallVertexProgram(c9857a73d68e59ba).(){ |
| 565 |
char vp[10096]; |
| 566 |
|
| 567 |
// ##################### |
| 568 |
// # # |
| 569 |
// # VERTEX PROGRAM # |
| 570 |
// # # |
| 571 |
// ##################### |
| 572 |
|
| 573 |
sprintf(vp,"\ |
| 574 |
!!ARBvp1.0\n\ |
| 575 |
\n\ |
| 576 |
ATTRIB pos = vertex.position;\n\ |
| 577 |
ATTRIB data = vertex.normal;\n\ |
| 578 |
\n\ |
| 579 |
"); |
| 580 |
|
| 581 |
// DataOut = ( +- OutradX, +- OutRadY, InRad ) |
| 582 |
|
| 583 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) sprintf(vp,"%s\ |
| 584 |
ATTRIB offset = vertex.texcoord;\n\ |
| 585 |
", vp); |
| 586 |
|
| 587 |
sprintf(vp,"%s\ |
| 588 |
\n\ |
| 589 |
PARAM mat[4] = { state.matrix.mvp };\n\ |
| 590 |
PARAM matP[4] = { state.matrix.projection };\n\ |
| 591 |
\n\ |
| 592 |
TEMP p,po, disp, dataout, tmp;\n\ |
| 593 |
\n\ |
| 594 |
# Transform by concatenation of the\n\ |
| 595 |
# MODELVIEW and PROJECTION matrices.\n\ |
| 596 |
DP4 p.x, mat[0], pos;\n\ |
| 597 |
DP4 p.y, mat[1], pos;\n\ |
| 598 |
DP4 p.z, mat[2], pos;\n\ |
| 599 |
DP4 p.w, mat[3], pos;\n\ |
| 600 |
#MOV p.w, 1; \n\ |
| 601 |
\n\ |
| 602 |
MOV dataout, data;\n\ |
| 603 |
MUL dataout.z, dataout.z, program.env[0].x;\n\ |
| 604 |
", vp); |
| 605 |
|
| 606 |
// Enlarge impostors to include borders |
| 607 |
if (_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()!=0) // Compute 'almost' radius and scale indep. border |
| 608 |
sprintf(vp,"%s\ |
| 609 |
RSQ tmp.y, dataout.z ;\n\ |
| 610 |
#MUL tmp.y, tmp.y , tmp.y; # Comment to 'almost'\n\ |
| 611 |
MUL tmp.x, %7.5f , tmp.y;\n\ |
| 612 |
ADD dataout.w, tmp.x , 1;\n\ |
| 613 |
MUL dataout.xy, dataout, dataout.w ;\n\ |
| 614 |
MAD dataout.w, dataout.w, dataout.w, -1;\n\ |
| 615 |
", |
| 616 |
vp, _border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).() ); |
| 617 |
|
| 618 |
sprintf(vp,"%s\ |
| 619 |
\n\ |
| 620 |
MUL disp, dataout, dataout.z; \n\ |
| 621 |
#MUL disp.x, disp.x, matP[0].x;\n\ |
| 622 |
#MUL disp.y, disp.y, matP[1].y;\n\ |
| 623 |
MAD p, {1,1,0,0}, disp, p;\n\ |
| 624 |
", vp); |
| 625 |
|
| 626 |
|
| 627 |
sprintf(vp,"%s\ |
| 628 |
\n\ |
| 629 |
MOV result.position, p;\n\ |
| 630 |
\n\ |
| 631 |
#MOV dataout.w, p.w;\n" |
| 632 |
,vp); |
| 633 |
|
| 634 |
sprintf(vp,"%sMOV result.texcoord, dataout;\n",vp); |
| 635 |
|
| 636 |
if ((P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.>0)&&(P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.>0)) sprintf(vp,"%sMOV result.color, vertex.color;\n",vp); |
| 637 |
|
| 638 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) sprintf(vp,"%sMOV result.texcoord[2], offset;\n",vp); |
| 639 |
|
| 640 |
if (P_use_shadowmapcxx . . $ CgUtil#P_use_shadowmap(c9857a73d68e59ba).() ) sprintf(vp,"%sMOV result.texcoord[3], vertex.position;\n",vp); |
| 641 |
|
| 642 |
sprintf(vp,"%s\nEND\n", vp); |
| 643 |
|
| 644 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(vp), vp); |
| 645 |
|
| 646 |
//printf("\n--------<vp ball>---------\n%s",vp); |
| 647 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(vp)) return -1; |
| 648 |
return true; |
| 649 |
} |
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
void CgUtilcxx . . $ CgUtil#::addShadowMapComputationFPcxx . . $ CgUtil#addShadowMapComputationFP(fda57c8427c60377).(char* fp) { |
| 654 |
sprintf(fp,"%s\n\ |
| 655 |
#SHADOWMAP\n\ |
| 656 |
\n\ |
| 657 |
#compute orig pos from attributes... MODE 1\n\ |
| 658 |
#MUL t0.x, data.z, ratio.x;\n\ |
| 659 |
#MAD pos, n, t0.x, origpos;\n\ |
| 660 |
#\n\ |
| 661 |
# ...or MODE 2!!! \n\ |
| 662 |
MAD posScreen, fragment.position, {1,1,0,0}, {0,0,0,1} ;\n\ |
| 663 |
MOV posScreen.z, depth.x;\n\ |
| 664 |
\n\ |
| 665 |
DP4 t0.x, Smat0, posScreen; \n\ |
| 666 |
DP4 t0.y, Smat1, posScreen; \n\ |
| 667 |
DP4 t0.z, Smat2, posScreen; \n\ |
| 668 |
",fp); |
| 669 |
|
| 670 |
if (do_use_doubleshadowcxx . . $ CgUtil#do_use_doubleshadow(c9857a73d68e59ba).()) sprintf(fp,"%s\n\ |
| 671 |
CMP t1, lighting.z, {0.75,0.5,0.5,1}, {0.25,0.5,0.5,1};\n\ |
| 672 |
MAD t0, t0, {0.25,0.5,0.5,0}, t1; \n\ |
| 673 |
\n\ |
| 674 |
",fp); else { |
| 675 |
double tmp=(hardSettingscxx . . $ hardSettings..doubleSMcxx . . $ HardSettings#doubleSM.)?0.25:0.5; |
| 676 |
sprintf(fp,"%s\n\ |
| 677 |
MAD t0, t0, {%4.2f,0.5,0.5,0}, {%4.2f,0.5,0.5,1}; \n\ |
| 678 |
",fp,tmp,tmp); |
| 679 |
} |
| 680 |
/* |
| 681 |
sprintf(fp,"%s\n\ |
| 682 |
MAD t0, t0, {0.5,0.5,0.5,0}, {0.5,0.5,0.4999999,0}; \n\ |
| 683 |
",fp); |
| 684 |
*/ |
| 685 |
sprintf(fp,"%s\n\ |
| 686 |
# Access shadow map! \n\ |
| 687 |
TEX t1, t0, texture[1], 2D;\n\ |
| 688 |
",fp); |
| 689 |
|
| 690 |
sprintf(fp,"%s\n\ |
| 691 |
ADD t.z, -t1.z, t0.z; \n\ |
| 692 |
",fp); |
| 693 |
|
| 694 |
if (do_use_doubleshadowcxx . . $ CgUtil#do_use_doubleshadow(c9857a73d68e59ba).()) sprintf(fp,"%s\n\ |
| 695 |
CMP t.z, lighting.z, -t.z, t.z; \n\ |
| 696 |
\n\ |
| 697 |
",fp); |
| 698 |
|
| 699 |
|
| 700 |
if ((!do_use_doubleshadowcxx . . $ CgUtil#do_use_doubleshadow(c9857a73d68e59ba).())&&(P_light_basecxx . . $ CgUtil#P_light_base.>0)) { |
| 701 |
sprintf(fp,"%s\n\ |
| 702 |
CMP t.z, lighting.z, 1, t.z; # if light<0, then in shadow \n\ |
| •703 |
" ,fp); //,1.0-P_shadowstrenght); // error here |
| 704 |
} |
| 705 |
|
| 706 |
if (P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.<1) { |
| 707 |
sprintf(fp,"%s\n\ |
| 708 |
MUL tmp, lighting, %5.4f; # compute attenuated light \n\ |
| 709 |
CMP lighting, t.z, lighting, tmp; # if in shadow, then use attenuated light \n\ |
| 710 |
" ,fp,1.0-P_shadowstrenghtcxx . . $ CgUtil#P_shadowstrenght.); |
| 711 |
} |
| 712 |
else |
| 713 |
sprintf(fp,"%s\n\ |
| 714 |
CMP lighting, t.z, lighting, 0; # if in shadow, then no light \n\ |
| 715 |
#CMP result.color, t.z, {0,1,0,0}, {1,0,0,0}; \n\ |
| 716 |
#\n\ |
| 717 |
#MAD t0, t0, {0.5,0.5, 200.0,0}, {0.5,0.5,196.5,0}; \n\ |
| 718 |
#TEX t1, t0, texture[1], 2D;\n\ |
| 719 |
#MAD t1, t1, 400, -3.5;\n\ |
| 720 |
#MUL t1, t1.z, {1,0,1,0};\n\ |
| 721 |
##ADD t.z, -t1.z, t0.z; \n\ |
| 722 |
#MAD t0, t0.z, {0,1,0,0}, {0,0,0,0};\n\ |
| 723 |
#CMP result.color, mat0.x, t1, t0; \n\ |
| 724 |
#MUL result.color, {0.002,0.002,0,0}, posScreen; \n\ |
| 725 |
",fp); |
| 726 |
|
| 727 |
}; |
| 728 |
|
| 729 |
void CgUtilcxx . . $ CgUtil#::addTexturingSnippetcxx . . $ CgUtil#addTexturingSnippet(fda57c8427c60377).(char* fp){ |
| 730 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) { |
| 731 |
sprintf(fp,"%s%s",fp,"\n\n\ |
| 732 |
# texture access \n\ |
| 733 |
MAD t, t, TNORM, offset; \n\ |
| 734 |
TEX t, t, texture[0], 2D; \n\n"); |
| 735 |
|
| 736 |
if (P_cappingcxx . . $ CgUtil#P_capping.) { |
| 737 |
// overwrite ambient occlusion for close fragments |
| 738 |
sprintf(fp,"%s\n\ |
| 739 |
\n\ |
| 740 |
# lighten OC for close frags \n\ |
| 741 |
MAD tmp.x, depth.x, -250, 0.50; \n\ |
| 742 |
CMP tmp.x, tmp.x, 0, tmp.x; \n\ |
| 743 |
# overwrite OC for cut \n\ |
| 744 |
CMP tmp.x, depth.x, 0.70, tmp.x; \n\ |
| 745 |
LRP t, tmp.x, 1, t; \n\ |
| 746 |
", fp); |
| 747 |
|
| 748 |
} |
| 749 |
|
| 750 |
// Add "future" AO prediction (AO not computed yet) |
| 751 |
|
| 752 |
// Additive prediction: |
| 753 |
//sprintf(fp,"%sADD t, t, program.env[6].x;\n", fp ); |
| 754 |
|
| 755 |
// multiplicative prediction: |
| 756 |
sprintf(fp,"%sMUL t, t, program.env[6].x;\n", fp ); |
| 757 |
|
| 758 |
sprintf(fp,"%sMAD res, %5.2f, t, res;\n", fp, P_texturecxx . . $ CgUtil#P_texture. ); |
| 759 |
if (P_phongcxx . . $ CgUtil#P_phong.>0.0) { |
| 760 |
// weigth phong with AO light. |
| 761 |
sprintf(fp, "%s\nMUL lighting.y,lighting.y, t;\n", fp); |
| 762 |
} |
| 763 |
|
| 764 |
} |
| 765 |
|
| 766 |
float lighting = (!P_sem_effectcxx . . $ CgUtil#P_sem_effect.) ? P_lightingcxx . . $ CgUtil#P_lighting. : (1- P_lightingcxx . . $ CgUtil#P_lighting.); |
| 767 |
|
| 768 |
|
| 769 |
// apply lighting |
| 770 |
if ( lighting>0 ) { |
| 771 |
if (P_sem_effectcxx . . $ CgUtil#P_sem_effect.) { |
| 772 |
sprintf(fp,"%sMAD lighting.x, lighting.x, -1, 1 ;\n",fp ); |
| 773 |
// sprintf(fp,"%sMUL lighting.x, lighting.x, lighting.x ;\n",fp ); |
| 774 |
sprintf(fp,"%s\nMAD lighting.x, %10.8f, lighting.x, %10.8f;\n",fp, lighting, 1-lighting); |
| 775 |
sprintf(fp,"%sMUL res, lighting.x, res;\n",fp ); |
| 776 |
} |
| 777 |
else |
| 778 |
sprintf(fp,"%s\nMAD res, lighting.x, %f, res;\n",fp, lighting); |
| 779 |
} |
| 780 |
|
| 781 |
if (P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.>0) { |
| 782 |
if ((P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.<1)||(P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.<1)) { |
| 783 |
sprintf(fp,"%sMAD tmp, %5.3f, basecol,%5.3f;\n",fp |
| 784 |
,P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.*P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri., (1.0-P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.)*P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri. ); |
| 785 |
sprintf(fp,"%s%s",fp,"MUL res, res, tmp;\n"); |
| 786 |
} else { |
| 787 |
sprintf(fp,"%s%s",fp,"MUL res, res, basecol;\n"); |
| 788 |
} |
| 789 |
} else { |
| 790 |
if (P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.<1.0) |
| 791 |
{ |
| •792 |
sprintf(fp,"%s%s",fp,"MUL res, res, %5.3f;\n"); //, P_col_atoms_bri ); // error here |
| 793 |
} |
| 794 |
} |
| 795 |
|
| 796 |
if (writeColcxx . . $ CgUtil#writeCol.) { |
| 797 |
if (P_phongcxx . . $ CgUtil#P_phong.>0) { |
| 798 |
sprintf(fp,"%s%s",fp,"LRP res, lighting.y, 1, res;\n"); |
| 799 |
} |
| 800 |
|
| 801 |
if (writeAlphacxx . . $ CgUtil#writeAlpha.) |
| 802 |
sprintf(fp,"%s%s",fp,"MOV res.w, nor.z;\n"); |
| 803 |
} |
| 804 |
|
| 805 |
|
| 806 |
// UNUSED: |
| 807 |
if ( _border_insidecxx . . $ CgUtil#_border_inside(9b8c9e39889c762c).()>0 ) { |
| 808 |
sprintf(fp, "%s \n\ |
| 809 |
MAD tmp2.z, border.x, %f, 1; \n\ |
| 810 |
LRP tmp3, tmp2.z, 0, res;\n\ |
| 811 |
CMP res, -tmp2.z, tmp3, res;\n\ |
| 812 |
\n", |
| 813 |
fp, |
| 814 |
(1.0/_border_insidecxx . . $ CgUtil#_border_inside(9b8c9e39889c762c).()) |
| 815 |
); |
| 816 |
}; |
| 817 |
|
| 818 |
if ( _border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()>0 ) { |
| 819 |
// Blackens borders: |
| 820 |
|
| 821 |
#if (1) |
| 822 |
// no AA: |
| 823 |
sprintf(fp,"%sCMP res, -border.x, {0,0,0,0}, res;\n",fp); |
| 824 |
#else |
| 825 |
// internal AA: |
| 826 |
//sprintf(fp,"%sMAD_SAT border.y, -border.x , 10, 1 ;\n",fp); |
| 827 |
//sprintf(fp,"%sMUL res, border.y, res;\n",fp); |
| 828 |
#endif |
| 829 |
} |
| 830 |
|
| 831 |
if ( P_fogcxx . . $ CgUtil#P_fog.>0 ) { |
| 832 |
sprintf(fp,"%sMAD_SAT tmp.x, depth.x, 50, 0;\n",fp); |
| 833 |
sprintf(fp,"%sMUL tmp.x, tmp.x, %5.4f;\n",fp, P_fogcxx . . $ CgUtil#P_fog.); |
| 834 |
sprintf(fp,"%sLRP res, tmp.x, {%10.9f,%10.9f,%10.9f,1}, res;\n",fp, P_bg_color_Rcxx . . $ CgUtil#P_bg_color_R.,P_bg_color_Gcxx . . $ CgUtil#P_bg_color_G.,P_bg_color_Bcxx . . $ CgUtil#P_bg_color_B.); |
| 835 |
} |
| 836 |
|
| 837 |
} |
| 838 |
|
| 839 |
void CgUtilcxx . . $ CgUtil#::addDepthAdjustSnippetcxx . . $ CgUtil#addDepthAdjustSnippet(fda57c8427c60377).(char* fp) { |
| 840 |
|
| 841 |
float depth_full=P_depth_fullcxx . . $ CgUtil#P_depth_full.*120.0f; |
| 842 |
|
| 843 |
// DEPTH AWARE |
| 844 |
if ( _border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()>0 ) { |
| 845 |
sprintf(fp, "%s \n\ |
| 846 |
MUL tmp3.z, -border.x, data.z;\n\ |
| 847 |
MAD tmp3.z, %8.7f , tmp3.z , fragment.position.z;\n\ |
| 848 |
CMP depth.x, -border.x, tmp3.z, depth.x;\n\ |
| 849 |
\n",fp, |
| 850 |
-depth_full/_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).() / 20000.0 //-0.001 |
| 851 |
); |
| 852 |
} |
| 853 |
|
| 854 |
if (P_cappingcxx . . $ CgUtil#P_capping.) { |
| 855 |
|
| 856 |
// |
| 857 |
//sprintf(fp,"%s%s",fp, "MAD tmp.x, depth.x, 0.001, 10;\n"); |
| 858 |
//sprintf(fp,"%s%s",fp, "CMP result.depth, depth.x, tmp.x, depth.x;\n"); |
| 859 |
// |
| 860 |
|
| 861 |
sprintf(fp,"%s%s",fp, "ADD result.depth, depth.x, 0.001;\n"); |
| 862 |
} |
| 863 |
else { |
| 864 |
// sprintf(fp,"%s%s",fp, "CMP result.depth, depth.x, 0, depth.x;\n"); |
| 865 |
sprintf(fp,"%s%s",fp, "MOV result.depth, depth.x;\n"); |
| 866 |
} |
| 867 |
|
| 868 |
sprintf(fp,"%s%s",fp,"MUL res, res, t;\n" ); |
| 869 |
|
| 870 |
float lighting = (!P_sem_effectcxx . . $ CgUtil#P_sem_effect.) ? P_lightingcxx . . $ CgUtil#P_lighting. : (1- P_lightingcxx . . $ CgUtil#P_lighting.); |
| 871 |
|
| 872 |
if ((P_cappingcxx . . $ CgUtil#P_capping.) && ( (lighting>0) || (P_phongcxx . . $ CgUtil#P_phong.>0) ) ) { |
| 873 |
sprintf(fp,"%s\n\ |
| 874 |
# Overwrite capped normal \n\ |
| 875 |
CMP nor, depth.x, {0,0,1,0}, nor;\n", |
| 876 |
fp ); |
| 877 |
} |
| 878 |
} |
| 879 |
|
| 880 |
|
| 881 |
void CgUtilcxx . . $ CgUtil#::addDirectLightingSnippetcxx . . $ CgUtil#addDirectLightingSnippet(fda57c8427c60377).(char* fp) { |
| 882 |
|
| 883 |
/* |
| 884 |
NOTE: |
| 885 |
lighting.x = lambert direct (halved if opposite side) |
| 886 |
lighting.y = phong direct (zeroed if opposite side) |
| 887 |
lighting.z = lamber original (negative if opposite side) |
| 888 |
*/ |
| 889 |
|
| 890 |
float lighting = (!P_sem_effectcxx . . $ CgUtil#P_sem_effect.) ? P_lightingcxx . . $ CgUtil#P_lighting. : (1- P_lightingcxx . . $ CgUtil#P_lighting.); |
| 891 |
|
| 892 |
if (lighting>0) { |
| 893 |
sprintf(fp,"%s%s",fp, " \n\n\ |
| 894 |
## LIGHTING of Normal \n\ |
| 895 |
DP3 lighting.z, nor, LIGHT; \n\ |
| 896 |
MUL tmp.y, -lighting.z, 0.35; \n\ |
| 897 |
CMP lighting.x, lighting.z, tmp.y, lighting.z; \n\n" |
| 898 |
); |
| 899 |
} |
| 900 |
if (P_phongcxx . . $ CgUtil#P_phong.>0.0) { |
| 901 |
// phong |
| 902 |
sprintf(fp, "%s\ |
| 903 |
## PHONG \n\ |
| 904 |
#ADD hwv, {0,0,+1,0}, LIGHT;\n\ |
| 905 |
#DP3 lighting.y, hwv, hwv;\n\ |
| 906 |
#RSQ lighting.y, lighting.y;\n\ |
| 907 |
#MUL hwv, hwv, lighting.y;\n\ |
| 908 |
DP3 lighting.y, nor, hwv;\n", fp); |
| 909 |
|
| 910 |
// compute exponent (TODO: use some sort of EXP funtion) |
| 911 |
for (int i=0; i<(1.0-P_phong_sizecxx . . $ CgUtil#P_phong_size.)*6.0+3; i++) |
| 912 |
sprintf(fp,"%sMUL lighting.y, lighting.y, lighting.y;\n", fp); |
| 913 |
|
| 914 |
if (P_phongcxx . . $ CgUtil#P_phong.<1.0) |
| 915 |
sprintf(fp,"%s\nMUL lighting.y,%5.4f,lighting.y;\n", fp, P_phongcxx . . $ CgUtil#P_phong.); |
| 916 |
|
| 917 |
} |
| 918 |
|
| 919 |
if(P_light_basecxx . . $ CgUtil#P_light_base.>0) { |
| 920 |
sprintf(fp,"%s\nLRP lighting.x,%5.4f, 1, lighting.x; # flatten light \n", fp, P_light_basecxx . . $ CgUtil#P_light_base. ); |
| 921 |
} |
| 922 |
|
| 923 |
sprintf(fp,"%s\nMOV res, %5.4f;\n", fp, 0.0 ); |
| 924 |
|
| 925 |
} |
| 926 |
|
| 927 |
bool CgUtilcxx . . $ CgUtil#::shaderHasChangedcxx . . $ CgUtil#shaderHasChanged.=false; |
| 928 |
|
| 929 |
bool CgUtilcxx . . $ CgUtil#::setStickFragmentProgramcxx . . $ CgUtil#setStickFragmentProgram(c9857a73d68e59ba).(){ |
| 930 |
|
| 931 |
char fp[10096]; |
| 932 |
|
| 933 |
if (shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.) { |
| 934 |
if (!accurateShadowmapBuildingcxx . . $ CgUtil#accurateShadowmapBuilding.) |
| 935 |
|
| 936 |
sprintf(fp,"\ |
| 937 |
!!ARBfp1.0 \n\ |
| 938 |
\n\ |
| 939 |
MOV result.color, 1;\n\ |
| 940 |
END\n" |
| 941 |
); |
| 942 |
else |
| 943 |
sprintf(fp,"\ |
| 944 |
!!ARBfp1.0 \n\ |
| 945 |
\n\ |
| 946 |
ATTRIB data = fragment.texcoord; \n\ |
| 947 |
MOV result.color, 0.8;\n\ |
| 948 |
MAD_SAT tmp.x, data.x, -data.x, 1; # tmp.z=1-x^2 \n\ |
| 949 |
RSQ tmp.x, tmp.x;\n\ |
| 950 |
RCP n.y, tmp.x;\n\ |
| 951 |
MAD tmp.z, n.y, data.z, 0; \n\ |
| 952 |
MAD result.depth, -tmp.z, 0.005, fragment.position.z; \n\ |
| 953 |
END\n"); |
| 954 |
|
| 955 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 956 |
|
| 957 |
//printf("\n-------<fp stick>--------\n%s",fp); |
| 958 |
|
| 959 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 960 |
return true; |
| 961 |
} |
| 962 |
|
| 963 |
sprintf(fp,"\ |
| 964 |
!!ARBfp1.0\n\ |
| 965 |
\n\ |
| 966 |
ATTRIB data = fragment.texcoord; \n\ |
| 967 |
ATTRIB normcenter = fragment.texcoord[1];\n\ |
| 968 |
ATTRIB ROT = fragment.texcoord[2];\n\ |
| 969 |
ATTRIB offset = fragment.texcoord[3];\n\ |
| 970 |
ATTRIB normside = fragment.texcoord[4];\n"); |
| 971 |
|
| 972 |
if (!P_cyl_const_colorcxx . . $ CgUtil#P_cyl_const_color.) { |
| 973 |
sprintf(fp,"%s\ |
| 974 |
ATTRIB col1 = fragment.color.primary;\n\ |
| 975 |
ATTRIB col2 = fragment.color.secondary;\n",fp); |
| 976 |
} |
| 977 |
|
| 978 |
sprintf(fp,"%s\ |
| 979 |
PARAM TNORM={%10.9f,%10.9f,0,0}; \n\ |
| 980 |
PARAM mat0 = program.env[0];\n\ |
| 981 |
PARAM mat1 = program.env[1];\n\ |
| 982 |
PARAM mat2 = program.env[2];\n",fp, |
| 983 |
(moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).()==0)?0:1.0f/moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).(), |
| 984 |
(moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).()==0)?0:1.0f/moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).() |
| 985 |
); |
| 986 |
if (P_use_shadowmapcxx . . $ CgUtil#P_use_shadowmap(c9857a73d68e59ba).()) |
| 987 |
sprintf(fp,"%s\ |
| 988 |
PARAM Smat0 = program.env[3]; \n\ |
| 989 |
PARAM Smat1 = program.env[4]; \n\ |
| 990 |
PARAM Smat2 = program.env[5]; \n\ |
| 991 |
#PARAM ratio = program.env[6]; \n\ |
| 992 |
ATTRIB origpos = fragment.texcoord[4]; \n",fp); |
| 993 |
|
| 994 |
sprintf(fp,"%s\n\ |
| 995 |
PARAM LIGHT= state.light[0].position ; \n\ |
| 996 |
PARAM hwv = state.light[0].half;\n\ |
| 997 |
\n\ |
| 998 |
TEMP tmp, nor, n, lighting, res, t, t0, t1, abs, posScreen; \n\ |
| 999 |
TEMP basecol, border, depth, tmp2, tmp3; \n\ |
| 1000 |
\n\ |
| 1001 |
\n\ |
| 1002 |
MAD_SAT tmp.x, data.x, -data.x, 1; # tmp.z=1-x^2 \n\ |
| 1003 |
RSQ tmp.x, tmp.x;\n\ |
| 1004 |
RCP n.y, tmp.x;\n\ |
| 1005 |
MAD tmp.z, n.y, data.z, 0; \n\ |
| 1006 |
MAD depth.x, -tmp.z, 0.005, fragment.position.z; \n\ |
| 1007 |
\n\ |
| 1008 |
", fp); |
| 1009 |
|
| 1010 |
if ( (_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()>0 ) ) { |
| 1011 |
sprintf(fp,"%s\n\ |
| 1012 |
#CMP border.x, n.y, n.y, -n.y; \n\ |
| 1013 |
MAD border.x, data.x, data.x, -1; \n\ |
| 1014 |
#ADD border.x, 1, -border.x; \n\ |
| 1015 |
", fp); |
| 1016 |
} |
| 1017 |
|
| 1018 |
addDepthAdjustSnippetcxx . . $ CgUtil#addDepthAdjustSnippet(fda57c8427c60377).(fp); |
| 1019 |
|
| 1020 |
sprintf(fp,"%s\n\ |
| 1021 |
# Compute normal\n\ |
| 1022 |
MUL nor, n.y, normcenter;\n\ |
| 1023 |
MAD nor, data.x, normside, nor;\n\ |
| 1024 |
", fp); |
| 1025 |
|
| 1026 |
addDirectLightingSnippetcxx . . $ CgUtil#addDirectLightingSnippet(fda57c8427c60377).(fp); |
| 1027 |
|
| 1028 |
sprintf(fp,"%s\n\ |
| 1029 |
#TEXTURING ON STICKS \n\ |
| 1030 |
\n\ |
| 1031 |
# FIND X (along axis) \n\ |
| 1032 |
MOV t.x, data.y;\n\ |
| 1033 |
MAD t.x, data.w, n.y, t.x;\n\ |
| 1034 |
# FIND Y (project norm) \n\ |
| 1035 |
MOV n.x, data.x; \n\ |
| 1036 |
\n\ |
| 1037 |
\n\ |
| 1038 |
# rotate (n.x, n.y)\n\ |
| 1039 |
MUL tmp, n, {1,1,0,0};\n\ |
| 1040 |
DP3 n.x, tmp, ROT;\n\ |
| 1041 |
MUL n.y, tmp.x, ROT.y;\n\ |
| 1042 |
MAD n.y, tmp.y, -ROT.x , n.y;\n\ |
| 1043 |
\n\ |
| 1044 |
# find x=FindRoll ( n.x, n.y) \n\ |
| 1045 |
ABS abs, n; \n\ |
| 1046 |
ADD abs.z, abs.x, abs.y; \n\ |
| 1047 |
RCP abs.z, abs.z; \n\ |
| 1048 |
MUL n, n, abs.z;\n\ |
| 1049 |
MAD tmp.x, 0.25, n.y, 0.25;\n\ |
| 1050 |
MAD tmp.y, 0.25,-n.y, 0.75;\n\ |
| 1051 |
CMP t.y, n.x, tmp.x, tmp.y;\n\ |
| 1052 |
\n\ |
| 1053 |
\n\ |
| 1054 |
#KILL OUTLIER FRAGMENTS \n\ |
| 1055 |
CMP t.w, t.x, -t.x, t.x;\n\ |
| 1056 |
ADD t.w, t.w, -1; # w = 1-|x|\n\ |
| 1057 |
KIL -t.w;\n\ |
| 1058 |
",fp); |
| 1059 |
|
| 1060 |
|
| 1061 |
if (P_use_shadowmapcxx . . $ CgUtil#P_use_shadowmap(c9857a73d68e59ba).()) { |
| 1062 |
addShadowMapComputationFPcxx . . $ CgUtil#addShadowMapComputationFP(fda57c8427c60377).(fp); |
| 1063 |
}; |
| 1064 |
|
| 1065 |
if ((P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.>0) && (P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.>0)) { |
| 1066 |
if (P_cyl_const_colorcxx . . $ CgUtil#P_cyl_const_color.) sprintf(fp,"%sMOV basecol, {%10.9f,%10.9f,%10.9f,1};\n", |
| 1067 |
fp,P_cyl_const_color_Rcxx . . $ CgUtil#P_cyl_const_color_R., P_cyl_const_color_Gcxx . . $ CgUtil#P_cyl_const_color_G., P_cyl_const_color_Bcxx . . $ CgUtil#P_cyl_const_color_B.); |
| 1068 |
else if (P_cyl_smooth_colorcxx . . $ CgUtil#P_cyl_smooth_color.) { |
| 1069 |
sprintf(fp,"%sMAD t.z, t.x, 0.5,0.5;\n",fp); |
| 1070 |
sprintf(fp,"%sLRP basecol, t.z, col1,col2;\n",fp); |
| 1071 |
} else |
| 1072 |
sprintf(fp,"%sCMP basecol, t.x, col2,col1;\n",fp); |
| 1073 |
} |
| 1074 |
|
| 1075 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) { |
| 1076 |
float sidex=BSIZEcxx . . $ BSIZE., sidey=CSIZEcxx . . $ CSIZE.; |
| 1077 |
sprintf(fp,"%s\n\ |
| 1078 |
MAD t, t, {%5.2f, %5.2f, 0,0}, \n\ |
| 1079 |
{%5.2f, %5.2f, 0,0}; \n\ |
| 1080 |
#FRC t, t; \n\ |
| 1081 |
", |
| 1082 |
fp, |
| 1083 |
(sidex-1)/2.0 , sidey-1.0 , (sidex)/2.0, 0.5); |
| 1084 |
|
| 1085 |
} |
| 1086 |
|
| 1087 |
addTexturingSnippetcxx . . $ CgUtil#addTexturingSnippet(fda57c8427c60377).(fp); |
| 1088 |
|
| 1089 |
sprintf(fp,"%s%s",fp,"ADD result.color, res, {0,0,0,1};\n\n"); |
| 1090 |
sprintf(fp,"%s%s",fp,"END\n"); |
| 1091 |
|
| 1092 |
/*#MOV result.color, n.y;\n\ |
| 1093 |
#MUL tmp.y, data.y, 8;\n\ |
| 1094 |
#FRC result.color.y, tmp.y;\n\ |
| 1095 |
#MOV result.color, fragment.color;\n\ |
| 1096 |
END\n\ |
| 1097 |
");*/ |
| 1098 |
|
| 1099 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 1100 |
// printf("\n-------<fp Sticks>--------\n%s",fp); |
| 1101 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 1102 |
return true; |
| 1103 |
} |
| 1104 |
|
| 1105 |
bool CgUtilcxx . . $ CgUtil#::setStickVertexProgramcxx . . $ CgUtil#setStickVertexProgram(c9857a73d68e59ba).(){ |
| 1106 |
/* |
| 1107 |
RESULT: |
| 1108 |
TC0 = (corner, ... ) |
| 1109 |
TC1 = NORMAL (on central axis) |
| 1110 |
TC2 = ROTATION of basic point |
| 1111 |
TC3 = TEXTURE OFFSET |
| 1112 |
no! -> TC4 = POSITION of proj. over axis (for shadowmap) |
| 1113 |
TC4 = DIRECTION of normal of side point |
| 1114 |
*/ |
| 1115 |
char vp[10096]; |
| 1116 |
|
| 1117 |
sprintf(vp,"\ |
| 1118 |
!!ARBvp1.0\n\ |
| 1119 |
\n\ |
| 1120 |
ATTRIB pos = vertex.position;\n\ |
| 1121 |
\n\ |
| 1122 |
ATTRIB data = vertex.normal;\n\ |
| 1123 |
ATTRIB dire = vertex.texcoord;\n\ |
| 1124 |
ATTRIB startp = vertex.texcoord[1];\n\ |
| 1125 |
\n\ |
| 1126 |
PARAM mat[4] = { state.matrix.mvp };\n\ |
| 1127 |
#PARAM matP[4] = { state.matrix.projection };\n\ |
| 1128 |
PARAM matM[4] = { state.matrix.modelview };\n\ |
| 1129 |
\n\ |
| 1130 |
TEMP p,tmp,tmp2, d,dr, dataout, disp, disp2, norm, normside; \n\ |
| 1131 |
\n\ |
| 1132 |
"); |
| 1133 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) |
| 1134 |
sprintf(vp,"%s\ |
| 1135 |
# pass down texture offest \n\ |
| 1136 |
MOV result.texcoord[3], vertex.texcoord[2];\n\ |
| 1137 |
\n\ |
| 1138 |
", vp); |
| 1139 |
|
| 1140 |
if ((P_col_atoms_satcxx . . $ CgUtil#P_col_atoms_sat.>0) && (P_col_atoms_bricxx . . $ CgUtil#P_col_atoms_bri.>0)) |
| 1141 |
sprintf(vp,"%s\ |
| 1142 |
MOV result.color.primary, vertex.color.primary;\n\ |
| 1143 |
MOV result.color.secondary, vertex.color.secondary;\n\ |
| 1144 |
",vp); |
| 1145 |
|
| 1146 |
sprintf(vp,"%s\ |
| 1147 |
# Project direction View frame.\n\ |
| 1148 |
DP3 d.x, matM[0], dire;\n\ |
| 1149 |
DP3 d.y, matM[1], dire;\n\ |
| 1150 |
DP3 d.z, matM[2], dire;\n\ |
| 1151 |
\n\ |
| 1152 |
",vp); |
| 1153 |
|
| 1154 |
sprintf(vp,"%s\ |
| 1155 |
# find k = 1/sqrt(d.x^2+d.y^2) (= tmp.w) \n\ |
| 1156 |
MUL tmp.w, d.x, d.x; \n\ |
| 1157 |
MAD norm.z, d.y, d.y, tmp.w; \n\ |
| 1158 |
RSQ tmp.w, norm.z; \n\ |
| 1159 |
# \n\ |
| 1160 |
# Using orthonormal base B: \n\ |
| 1161 |
# Bx= (+dx,+dy, 0)*k \n\ |
| 1162 |
# By= (-dy,+dx, 0)*k \n\ |
| 1163 |
# Bz= ( 0, 0, 1) \n\ |
| 1164 |
\n\ |
| 1165 |
# now dr = d in B = ( (dx^2+dy^2)*k, 0, dz ) \n\ |
| 1166 |
\n\ |
| 1167 |
",vp); |
| 1168 |
|
| 1169 |
if (!shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.) |
| 1170 |
sprintf(vp,"%s\ |
| 1171 |
# find normal = ( dr.z*Bx - dr.x*Bz ) = k* (-dx*dz, -dy*dz, dx^2+dy^2)\n\ |
| 1172 |
MUL norm.x, -d.x, d.z;\n\ |
| 1173 |
MUL norm.y, -d.y, d.z;\n\ |
| 1174 |
MUL norm, norm, tmp.w;\n\ |
| 1175 |
\n\ |
| 1176 |
DP3 tmp.x, norm, norm; # normalization, TEMP TEST!\n\ |
| 1177 |
RSQ tmp.x, tmp.x;\n\ |
| 1178 |
MUL norm, norm, tmp.x;\n\ |
| 1179 |
\n\ |
| 1180 |
",vp); |
| 1181 |
|
| 1182 |
sprintf(vp,"%s\ |
| 1183 |
# radius r (=tmp.z) = Raduis*GlobalScaleFactor \n\ |
| 1184 |
MUL tmp.z, program.env[0].y, program.env[0].x; \n\ |
| 1185 |
\n\ |
| 1186 |
SWZ disp, d, y,-x,0,0; \n\ |
| 1187 |
MUL disp, disp, tmp.w; \n\ |
| 1188 |
MUL disp2, disp, tmp.z; \n\ |
| 1189 |
### postponed MAD p, data.x, disp2, p; \n\ |
| 1190 |
\n\ |
| 1191 |
MOV dataout, data;\n\ |
| 1192 |
\n\ |
| 1193 |
",vp); |
| 1194 |
|
| 1195 |
|
| 1196 |
if (!shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.) |
| 1197 |
sprintf(vp,"%s\ |
| 1198 |
# pre-compute Z offset \n\ |
| 1199 |
\n\ |
| 1200 |
# dataout.z = R*(sen*sen/cos+cos) = R*(z*z*k+1/k) \n\ |
| 1201 |
# dataout.z is the z-offset for the center of the cyl \n\ |
| 1202 |
RCP tmp.x , tmp.w;\n\ |
| 1203 |
MUL tmp.y, d.z, d.z;\n\ |
| 1204 |
MAD tmp.y, tmp.y, tmp.w, tmp.x;\n\ |
| 1205 |
MUL dataout.z, program.env[0].y, tmp.y;\n\ |
| 1206 |
# dataout.w = dz/dx \n\ |
| 1207 |
# dataout.w is the y-offset for the center of the cyl \n\ |
| 1208 |
MUL dataout.w, d.z, tmp.w;\n\ |
| 1209 |
MUL dataout.w, dataout.w, dire.w;\n\ |
| 1210 |
MUL dataout.w, dataout.w, program.env[0].z; # (i.e. rad*2)\n\ |
| 1211 |
\n\ |
| 1212 |
",vp); |
| 1213 |
|
| 1214 |
// Further enlarge impostors at sides to include borders |
| 1215 |
if (_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()!=0) // Compute 'almost' radius and scale indep. border |
| 1216 |
sprintf(vp,"%s\ |
| 1217 |
#MUL tmp.z, program.env[0].y, program.env[0].x; \n\ |
| 1218 |
RSQ tmp.x, tmp.z ;\n\ |
| 1219 |
#MUL tmp.x, tmp.x, tmp.x; # Comment to 'almost'\n\ |
| 1220 |
MUL tmp.x, %7.5f , tmp.x;\n\ |
| 1221 |
ADD tmp.x, tmp.x , 1;\n\ |
| 1222 |
MUL dataout.x, dataout.x, tmp.x ;\n\ |
| 1223 |
", |
| 1224 |
vp, _border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).() ); |
| 1225 |
|
| 1226 |
if (!shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.) |
| 1227 |
sprintf(vp,"%s\ |
| 1228 |
# extend cylinder on bottom do deal with ends \n\ |
| 1229 |
MUL tmp.x, -data.y, dataout.w;\n\ |
| 1230 |
SGE tmp.x, tmp.x, 0;\n\ |
| 1231 |
MUL tmp.x, -dataout.w, tmp.x; \n\ |
| 1232 |
ADD dataout.y, dataout.y, tmp.x;\n\ |
| 1233 |
RCP tmp2.x, dire.w; \n\ |
| 1234 |
MUL tmp.x, tmp.x, tmp2.x; \n\ |
| 1235 |
MUL tmp.x, 0.5, tmp.x; \n\ |
| 1236 |
MAD tmp, dire, tmp.x, pos; \n\ |
| 1237 |
",vp); |
| 1238 |
else sprintf(vp,"%s\ |
| 1239 |
MOV tmp, pos; \n\ |
| 1240 |
",vp); |
| 1241 |
|
| 1242 |
sprintf(vp,"%s\ |
| 1243 |
\n\ |
| 1244 |
# Project point in View frame.\n\ |
| 1245 |
MOV tmp.w, 1; \n\ |
| 1246 |
DP4 p.x, mat[0], tmp;\n\ |
| 1247 |
DP4 p.y, mat[1], tmp;\n\ |
| 1248 |
DP4 p.z, mat[2], tmp;\n\ |
| 1249 |
DP4 p.w, mat[3], tmp; \n\ |
| 1250 |
\n\ |
| 1251 |
MAD result.position, dataout.x, disp2, p; \n\ |
| 1252 |
",vp); |
| 1253 |
|
| 1254 |
|
| 1255 |
// Compute normal at side points |
| 1256 |
if (!shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.) |
| 1257 |
sprintf(vp,"%s\ |
| 1258 |
MOV result.texcoord[0], dataout;\n\ |
| 1259 |
MOV result.texcoord[1], norm;\n\ |
| 1260 |
XPD normside, d, norm;\n\ |
| 1261 |
\n\ |
| 1262 |
DP3 tmp.x, normside, normside; # normalization, of normside \n\ |
| 1263 |
RSQ tmp.x, tmp.x;\n\ |
| 1264 |
MUL normside, normside, tmp.x;\n\ |
| 1265 |
\n\ |
| 1266 |
MOV result.texcoord[4], normside;\n\ |
| 1267 |
",vp); |
| 1268 |
|
| 1269 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) |
| 1270 |
sprintf(vp,"%s\ |
| 1271 |
#ROTATE start vector;\n\ |
| 1272 |
DP3 tmp.x, matM[0], startp;\n\ |
| 1273 |
DP3 tmp.y, matM[1], startp;\n\ |
| 1274 |
DP3 tmp.z, matM[2], startp;\n\ |
| 1275 |
DP3 tmp.w, tmp, tmp;\n\ |
| 1276 |
RSQ tmp.w, tmp.w;\n\ |
| 1277 |
MUL tmp, tmp.w, tmp;\n\ |
| 1278 |
MOV tmp.w, tmp.z;\n\ |
| 1279 |
#MOV tmp.z, 0;\n\ |
| 1280 |
DP3 tmp.x, disp, tmp;\n\ |
| 1281 |
\n\ |
| 1282 |
# cheap way: find an offset to add \n\ |
| 1283 |
# tz=2-tz if tw negative \n\ |
| 1284 |
#SGE tmp.w, 0, -tmp.w; \n\ |
| 1285 |
#MAD tmp.z, tmp.w, -2, 1; \n\ |
| 1286 |
#MUL tmp.x, tmp.z, tmp.x; \n\ |
| 1287 |
#MAD tmp.x, tmp.w, -2, tmp.x; \n\ |
| 1288 |
#MUL result.texcoord[2].x, tmp.x, 0.25;\n\ |
| 1289 |
#\n\ |
| 1290 |
# cool way: store 2D rotation via complex numbers \n\ |
| 1291 |
# tmp.y = sign(tw)*sqrt(1-tmp.x^2)\n\ |
| 1292 |
SGE tmp.w, 0, -tmp.w; \n\ |
| 1293 |
MAD tmp.z, tmp.w, -2, 1; \n\ |
| 1294 |
MAD tmp.w, tmp.x, -tmp.x, 1;\n\ |
| 1295 |
RSQ tmp.w, tmp.w;\n\ |
| 1296 |
RCP tmp.w, tmp.w;\n\ |
| 1297 |
MUL tmp.y, tmp.w, -tmp.z;\n\ |
| 1298 |
\n\ |
| 1299 |
MOV result.texcoord[2], tmp;\n\ |
| 1300 |
", |
| 1301 |
vp); |
| 1302 |
|
| 1303 |
/* |
| 1304 |
// Not needed |
| 1305 |
if (P_use_shadowmap()) |
| 1306 |
sprintf(vp,"\%s\n\ |
| 1307 |
MOV result.texcoord[4], pos;\n\ |
| 1308 |
",vp); |
| 1309 |
*/ |
| 1310 |
|
| 1311 |
sprintf(vp,"\%s\n\ |
| 1312 |
END\n\ |
| 1313 |
",vp); |
| 1314 |
|
| 1315 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_VERTEX_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8100:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(vp), vp); |
| 1316 |
|
| 1317 |
//printf("\n--------<vp stick>---------\n%s",vp); |
| 1318 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(vp)) return -1; |
| 1319 |
return true; |
| 1320 |
}; |
| 1321 |
|
| 1322 |
|
| 1323 |
bool CgUtilcxx . . $ CgUtil#::setBallFragmentProgramcxx . . $ CgUtil#setBallFragmentProgram(c9857a73d68e59ba).(){ |
| 1324 |
CgUtilcxx . . $ CgUtil#::shaderHasChangedcxx . . $ CgUtil#shaderHasChanged.=true; |
| 1325 |
char fp[10096]; |
| 1326 |
|
| 1327 |
if (shadowmapBuildingcxx . . $ CgUtil#shadowmapBuilding.) { |
| 1328 |
sprintf(fp,"\ |
| 1329 |
!!ARBfp1.0 \n\ |
| 1330 |
\n\ |
| 1331 |
ATTRIB data = fragment.texcoord; \n\ |
| 1332 |
TEMP tmp; \n\ |
| 1333 |
\n\ |
| 1334 |
MAD tmp.x, data.x, data.x, -1; \n\ |
| 1335 |
MAD tmp.x, data.y, data.y, tmp.x; \n\ |
| 1336 |
KIL -tmp.x;"); |
| 1337 |
if (accurateShadowmapBuildingcxx . . $ CgUtil#accurateShadowmapBuilding.) |
| 1338 |
sprintf(fp,"%s\ |
| 1339 |
RSQ tmp.x, tmp.x; \n\ |
| 1340 |
RCP tmp.x, tmp.x; \n\ |
| 1341 |
MUL tmp.x, tmp.x, data.z; \n\ |
| 1342 |
MAD result.depth, -tmp.x, 0.005, fragment.position.z;\n" |
| 1343 |
,fp); |
| 1344 |
|
| 1345 |
sprintf(fp,"\ |
| 1346 |
%sMOV result.color, 1;\n\ |
| 1347 |
END\n",fp); |
| 1348 |
|
| 1349 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 1350 |
|
| 1351 |
//printf("\n-------<fp>--------\n%s",fp); |
| 1352 |
|
| 1353 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 1354 |
return true; |
| 1355 |
} |
| 1356 |
// ############################ |
| 1357 |
// # # |
| 1358 |
// # FRAGMENT PROGRAM BALL # |
| 1359 |
// # # |
| 1360 |
// ############################ |
| 1361 |
|
| 1362 |
sprintf(fp,"\ |
| 1363 |
!!ARBfp1.0 \n\ |
| 1364 |
\n\ |
| 1365 |
ATTRIB data = fragment.texcoord; \n\ |
| 1366 |
ATTRIB offset = fragment.texcoord[2];\n\ |
| 1367 |
ATTRIB basecol = fragment.color; \n\ |
| 1368 |
"); |
| 1369 |
if (P_use_shadowmapcxx . . $ CgUtil#P_use_shadowmap(c9857a73d68e59ba).()) |
| 1370 |
sprintf(fp,"%s\ |
| 1371 |
PARAM Smat0 = program.env[3]; \n\ |
| 1372 |
PARAM Smat1 = program.env[4]; \n\ |
| 1373 |
PARAM Smat2 = program.env[5]; \n\ |
| 1374 |
#PARAM ratio = program.env[6]; \n\ |
| 1375 |
ATTRIB origpos = fragment.texcoord[3]; \n\ |
| 1376 |
",fp); |
| 1377 |
|
| 1378 |
sprintf(fp,"%s\ |
| 1379 |
\n\ |
| 1380 |
TEMP tmp,tmp2,tmp3, t,t0,t1,t2,nor,n,nabs,nsign,disp,res,depth,\n\ |
| 1381 |
lighting, border, posScreen; \n\ |
| 1382 |
PARAM TNORM={%10.9f,%10.9f,0,0}; \n\ |
| 1383 |
\n\ |
| 1384 |
PARAM LIGHT= state.light[0].position ; \n\ |
| 1385 |
PARAM hwv = state.light[0].half;\n\ |
| 1386 |
\n\ |
| 1387 |
PARAM mat[4] = { state.matrix.projection }; \n\ |
| 1388 |
PARAM mat0 = program.env[0];\n\ |
| 1389 |
PARAM mat1 = program.env[1];\n\ |
| 1390 |
PARAM mat2 = program.env[2];\n\ |
| 1391 |
\n", |
| 1392 |
fp, |
| 1393 |
(moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).()==0)?0:1.0f/moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).(), |
| 1394 |
(moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).()==0)?0:1.0f/moltextureCanvascxx . . $ moltextureCanvas..GetHardRescxx . . $ MyCanvas#GetHardRes(b126dc7c1de90089).() ); |
| 1395 |
|
| 1396 |
sprintf(fp,"%s\ |
| 1397 |
MOV nor, data; \n" |
| 1398 |
,fp); |
| 1399 |
|
| 1400 |
// tentativo prospettiva figa |
| 1401 |
if ((projmodecxx . . $ CgUtil#projmode.==PERSPECTIVEcxx . . $ CgUtil#PERSPECTIVE.)&&(proj_figacxx . . $ CgUtil#proj_figa.)) { |
| 1402 |
/* sprintf(fp,"%s\ |
| 1403 |
MAD tmp, fragment.position, {0.00390625, 0.00390625, 0,0}, {-1,-1,0,0}; \n\ |
| 1404 |
DP4 tmp.x, tmp, data; \n\ |
| 1405 |
MUL tmp.x, tmp.x, 0.5; \n\ |
| 1406 |
MAD data.xy, data, tmp.x, data; \n\ |
| 1407 |
" |
| 1408 |
,fp);*/ |
| 1409 |
|
| 1410 |
} |
| 1411 |
|
| 1412 |
sprintf(fp,"%s\ |
| 1413 |
MUL tmp, data, data; \n\ |
| 1414 |
MOV tmp.z, 1; \n\ |
| 1415 |
DP3 border.x, tmp, {1,1,-1,0}; \n" // border.x = ( (x^2+y^2)-1 ) |
| 1416 |
,fp); |
| 1417 |
|
| 1418 |
// 1.20*.120 -1 = 0.44 |
| 1419 |
|
| 1420 |
if (_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()>0) { |
| 1421 |
sprintf(fp,"%s\n\n\ |
| 1422 |
ADD tmp2.y, -border.x, data.w; # allow for border (part ii) \n\ |
| 1423 |
#MAD tmp2.y, data.z, -border.x, %7.5f;\n\ |
| 1424 |
#MAD tmp2.y, data.z, tmp2.y, %7.5f;\n\ |
| 1425 |
KIL tmp2.y; \n\ |
| 1426 |
",fp, -2*_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).(), _border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()*_border_outsidecxx . . $ CgUtil#_border_outside(9b8c9e39889c762c).()); |
| 1427 |
} |
| 1428 |
else sprintf(fp,"%s\n\nKIL -border.x; \n",fp); |
| 1429 |
|
| 1430 |
sprintf(fp,"%s\ |
| 1431 |
\n\ |
| 1432 |
RSQ tmp2.y, border.x; \n\ |
| 1433 |
RCP tmp2.x, tmp2.y; \n\ |
| 1434 |
MOV nor.z, tmp2.x; \n\ |
| 1435 |
\n\ |
| 1436 |
MAD tmp2.y, tmp2.x, data.z, 0; # note: add an extra range of 0 \n\ |
| 1437 |
\n", |
| 1438 |
fp); // nor = x, y, z=(1- x^2+y^2) |
| 1439 |
|
| 1440 |
|
| 1441 |
/* if (projmode==PERSPECTIVE) // new_z = old_z / (1/W) + sph_z * W |
| 1442 |
sprintf(fp,"%s%s",fp,"\ |
| 1443 |
MUL tmp2.y, tmp2.y, fragment.position.w; \n\ |
| 1444 |
MAD depth.x, fragment.position.z, data.w, -tmp2.y; # prospettiva: new_z = old_z + 0.005*sph_z\n\ |
| 1445 |
MUL depth.x, depth.x, 0.1; \n\ |
| 1446 |
"); |
| 1447 |
else*/ |
| 1448 |
|
| 1449 |
// new_z = old_z + 0.005*sph_z |
| 1450 |
sprintf(fp,"%s%s",fp, "\ |
| 1451 |
MAD depth.x, -tmp2.y, 0.005, fragment.position.z; # ortho \n\ |
| 1452 |
"); |
| 1453 |
|
| 1454 |
addDepthAdjustSnippetcxx . . $ CgUtil#addDepthAdjustSnippet(fda57c8427c60377).(fp); |
| 1455 |
|
| 1456 |
if ((P_texturecxx . . $ CgUtil#P_texture.>0)|| (P_use_shadowmapcxx . . $ CgUtil#P_use_shadowmap(c9857a73d68e59ba).())) { |
| 1457 |
|
| 1458 |
sprintf(fp,"%s%s",fp," \n\n\ |
| 1459 |
# rotate normal \n\ |
| 1460 |
DP3 n.x, mat0, nor; \n\ |
| 1461 |
DP3 n.y, mat1, nor; \n\ |
| 1462 |
DP3 n.z, mat2, nor; \n\ |
| 1463 |
MOV n.w, 0; \n\n"); |
| 1464 |
} |
| 1465 |
|
| 1466 |
addDirectLightingSnippetcxx . . $ CgUtil#addDirectLightingSnippet(fda57c8427c60377).(fp); |
| 1467 |
|
| 1468 |
if (P_use_shadowmapcxx . . $ CgUtil#P_use_shadowmap(c9857a73d68e59ba).()) { |
| 1469 |
addShadowMapComputationFPcxx . . $ CgUtil#addShadowMapComputationFP(fda57c8427c60377).(fp); |
| 1470 |
}; |
| 1471 |
|
| 1472 |
if (P_texturecxx . . $ CgUtil#P_texture.>0) { |
| 1473 |
if (textmodecxx . . $ CgUtil#textmode.==USE_CUBEcxx . . $ CgUtil#USE_CUBE.) |
| 1474 |
sprintf(fp, "%s \n\n\ |
| 1475 |
## TEXTURING CUBEMAP STYLE \n\ |
| 1476 |
# \n\ |
| 1477 |
# project on cube: find face \n\ |
| 1478 |
CMP nabs, n, -n, n; \n\ |
| 1479 |
MOV t, n; \n\ |
| 1480 |
SWZ t0, t, z,x,y,1; \n\ |
| 1481 |
SWZ t1, t0, z,x,y,-1; \n\ |
| 1482 |
# \n\ |
| 1483 |
SUB t2.x, nabs.z, nabs.y; \n\ |
| 1484 |
CMP t, t2.x, t0, t; \n\ |
| 1485 |
# \n\ |
| 1486 |
CMP t2.z, t.z, -t.z, t.z; \n\ |
| 1487 |
SUB t2.x, t2.z, nabs.x; \n\ |
| 1488 |
CMP t, t2.x, t1, t; \n\ |
| 1489 |
# \n\ |
| 1490 |
# find face \n\ |
| 1491 |
ADD disp.x, t.w, 1; \n\ |
| 1492 |
CMP disp.y, t.z, 0, 1; \n\ |
| 1493 |
# \n\ |
| 1494 |
# divide by max coord \n\ |
| 1495 |
RCP t.z, t.z; \n\ |
| 1496 |
MUL t, t, t.z; \n\ |
| 1497 |
# \n\ |
| 1498 |
# find coords on face \n\ |
| 1499 |
MAD t, t, 0.5, 0.5; \n\ |
| 1500 |
MAD t, t, {%5.2f,%5.2f,0,0}, {%5.2f, %5.2f, 0,0}; \n\ |
| 1501 |
MAD t, {%5.2f,%5.2f,0,0}, disp, t; \n\n", |
| •1502 |
fp, CSIZEcxx . . $ CSIZE.-gapcxx . . $ CgUtil#gap.*2.0, CSIZEcxx . . $ CSIZE.-gapcxx . . $ CgUtil#gap.*2.0, gapcxx . . $ CgUtil#gap., gapcxx . . $ CgUtil#gap., (double)CSIZEcxx . . $ CSIZE., (double)CSIZEcxx . . $ CSIZE. ); |
| 1503 |
|
| 1504 |
else sprintf(fp, "%s\n\n\ |
| 1505 |
## TEXTURING OCTAMAP STYLE \n\ |
| 1506 |
# \n\ |
| 1507 |
CMP nabs, n, -n, n; \n\ |
| 1508 |
DP3 tmp.y, {1,1,1,0}, nabs; \n\ |
| 1509 |
RCP tmp.z, tmp.y; \n\ |
| 1510 |
MUL t0, n, tmp.z; \n\ |
| 1511 |
MAD t1, nabs, tmp.z, -1; \n\ |
| 1512 |
# t1= -(1-abs(t)) \n\ |
| 1513 |
CMP t2.x, n.x, t1.y, -t1.y; \n\ |
| 1514 |
CMP t2.y, n.y, t1.x, -t1.x; \n\ |
| 1515 |
CMP t0, n.z, t0, t2; \n\ |
| 1516 |
MAD t, t0, {%5.2f, %5.2f, 0,0}, \n\ |
| 1517 |
{%5.2f, %5.2f, 0,0}; \n\n", |
| 1518 |
fp, |
| 1519 |
CSIZEcxx . . $ CSIZE./2.0 - gapcxx . . $ CgUtil#gap., CSIZEcxx . . $ CSIZE./2.0 - gapcxx . . $ CgUtil#gap., CSIZEcxx . . $ CSIZE./2.0, CSIZEcxx . . $ CSIZE./2.0); |
| 1520 |
|
| 1521 |
} |
| 1522 |
|
| 1523 |
addTexturingSnippetcxx . . $ CgUtil#addTexturingSnippet(fda57c8427c60377).(fp); |
| 1524 |
|
| 1525 |
sprintf(fp,"%s%s",fp,"ADD result.color, res, {0,0,0,1};\n\n"); |
| 1526 |
sprintf(fp,"%s%s",fp,"END\n"); |
| 1527 |
|
| 1528 |
glProgramStringARBcxx . . $ `<external>/18396878532286971346/glew.h:8266:9`!(GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!, GL_PROGRAM_FORMAT_ASCII_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8120:9`!, strlen(fp), fp); |
| 1529 |
|
| 1530 |
//printf("\n-------<fp>--------\n%s",fp); |
| 1531 |
|
| 1532 |
if(!checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(fp)) return false; |
| 1533 |
return true; |
| 1534 |
|
| 1535 |
|
| 1536 |
} |
| 1537 |
|
| 1538 |
|
| 1539 |
bool CgUtilcxx . . $ CgUtil#::initcxx . . $ CgUtil#init(c9857a73d68e59ba).() { |
| 1540 |
|
| 1541 |
GLenum err=glewInit(); |
| 1542 |
if(err!=GLEW_OKcxx . . $ `<external>/18396878532286971346/glew.h:27009:9`!) { |
| 1543 |
sprintf(lasterrcxx . . $ CgUtil#lasterr.,"%s\n",glewGetErrorString(err)); |
| 1544 |
return false; |
| 1545 |
} |
| 1546 |
/* |
| 1547 |
if(!GLEW_ARB_vertex_program || !GLEW_ARB_fragment_program ) |
| 1548 |
{ |
| 1549 |
printf("Extension: 'ARB_fragment_program' and/or 'ARB_vertex_program' not supported.\n"); |
| 1550 |
return false; |
| 1551 |
} |
| 1552 |
*/ |
| 1553 |
return true; |
| 1554 |
} |
| 1555 |
|
| 1556 |
/* |
| 1557 |
int CgUtil::loadVertexProgram(const char *str) { |
| 1558 |
unsigned int program; |
| 1559 |
checkError(); |
| 1560 |
glGenProgramsARB(1, &program); |
| 1561 |
checkError(); |
| 1562 |
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, program); |
| 1563 |
checkError(); |
| 1564 |
char *text = readFile(str); |
| 1565 |
if(!text) { |
| 1566 |
printf("could not find file %s\n", str); |
| 1567 |
exit(0); |
| 1568 |
} |
| 1569 |
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(text), text); |
| 1570 |
|
| 1571 |
if(!checkProgramError(text)) { |
| 1572 |
delete []text; |
| 1573 |
return -1; |
| 1574 |
} |
| 1575 |
delete []text; |
| 1576 |
return program; |
| 1577 |
} |
| 1578 |
int CgUtil::loadFragmentProgram(const char *str) { |
| 1579 |
unsigned int program; |
| 1580 |
glGenProgramsARB(1, &program); |
| 1581 |
checkError(); |
| 1582 |
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, program); |
| 1583 |
checkError(); |
| 1584 |
char *text = readFile(str); |
| 1585 |
if(!text) { |
| 1586 |
printf("could not find file %s\n", str); |
| 1587 |
exit(0); |
| 1588 |
} |
| 1589 |
char *c=text; |
| 1590 |
while ((*c)!=0) { |
| 1591 |
if ((*c == '(') || (*c == ')') ) *c=' '; |
| 1592 |
if ( *c == '/') *c='#'; |
| 1593 |
c++; |
| 1594 |
} |
| 1595 |
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(text), text); |
| 1596 |
if(!checkProgramError(text)) { |
| 1597 |
delete []text; |
| 1598 |
return -1; |
| 1599 |
} |
| 1600 |
return program; |
| 1601 |
} |
| 1602 |
*/ |
| 1603 |
|
| 1604 |
bool CgUtilcxx . . $ CgUtil#::checkErrorcxx . . $ CgUtil#checkError(c9857a73d68e59ba).() { |
| 1605 |
int error = glGetError(); |
| 1606 |
if(error == GL_NO_ERRORcxx . . $ `<external>/18396878532286971346/glew.h:329:9`!) |
| 1607 |
return true; |
| 1608 |
const char *str; |
| 1609 |
switch(error) { |
| 1610 |
case GL_INVALID_ENUMcxx . . $ `<external>/18396878532286971346/glew.h:390:9`!: str = "Invalid Enum"; break; |
| 1611 |
case GL_INVALID_OPERATIONcxx . . $ `<external>/18396878532286971346/glew.h:392:9`!: str = "Invalid Operation"; break; |
| 1612 |
case GL_INVALID_VALUEcxx . . $ `<external>/18396878532286971346/glew.h:391:9`!: str = "Invalid Value"; break; |
| 1613 |
case GL_STACK_OVERFLOWcxx . . $ `<external>/18396878532286971346/glew.h:14702:9`!: str = "Stack Overflow"; break; |
| 1614 |
case GL_STACK_UNDERFLOWcxx . . $ `<external>/18396878532286971346/glew.h:14703:9`!: str = "Stack Underflow"; break; |
| 1615 |
case GL_OUT_OF_MEMORYcxx . . $ `<external>/18396878532286971346/glew.h:395:9`!: str = "Out of memory"; break; |
| 1616 |
default: str = "Unknown error"; break; |
| 1617 |
} |
| 1618 |
printf("Error %s (%d)\n", str, error); |
| 1619 |
return false; |
| 1620 |
} |
| 1621 |
|
| 1622 |
bool CgUtilcxx . . $ CgUtil#::checkProgramErrorcxx . . $ CgUtil#checkProgramError(c6b7e35ff6de5671).(char *st) { |
| 1623 |
bool res=true; |
| 1624 |
while (1) { |
| 1625 |
int error = glGetError(); |
| 1626 |
if(error == GL_NO_ERRORcxx . . $ `<external>/18396878532286971346/glew.h:329:9`! ) return res; |
| 1627 |
|
| 1628 |
res=false; |
| 1629 |
if(error == GL_INVALID_OPERATIONcxx . . $ `<external>/18396878532286971346/glew.h:392:9`!) { |
| 1630 |
|
| 1631 |
GLint errPos; |
| 1632 |
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8115:9`!, &errPos ); |
| 1633 |
const GLubyte *errString = glGetString( GL_PROGRAM_ERROR_STRING_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8119:9`!); |
| 1634 |
fprintf( stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error at position: %d\n[%s]\n", errPos, errString ); |
| 1635 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"\n\"..."); |
| 1636 |
for (int i=errPos-40; i<errPos+40; i++) |
| 1637 |
if (i>=0) { |
| 1638 |
if (!st[i]) break; |
| 1639 |
if (i==errPos) fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"(*)"); |
| 1640 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"%c", (st[i]=='\n')?'\\':st[i] ); |
| 1641 |
} |
| 1642 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"...\"\n"); |
| 1643 |
} else { |
| 1644 |
const GLubyte *errString = gluErrorString( error ); |
| 1645 |
fprintf( stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error: [%s]\n", errString ); |
| 1646 |
} |
| 1647 |
} |
| 1648 |
} |
| 1649 |
|
| 1650 |
|
| 1651 |
char *CgUtilcxx . . $ CgUtil#::readFilecxx . . $ CgUtil#readFile(a8b8e32347182212).(const char *file) { |
| 1652 |
FILE *fp = fopen(file, "r"); |
| 1653 |
if(!fp) return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 1654 |
char *pippo = new char[1<<18]; |
| 1655 |
int tot = 0; |
| 1656 |
while(1) { |
| 1657 |
int nread = fread(pippo + tot, 1, 1024, fp); |
| 1658 |
tot += nread; |
| 1659 |
if(nread < 1024) { |
| 1660 |
pippo[tot] = '\0'; |
| 1661 |
break; |
| 1662 |
} |
| 1663 |
} |
| 1664 |
fclose(fp); |
| 1665 |
return pippo; |
| 1666 |
} |
| 1667 |
|
| 1668 |
|
| 1669 |
void CgUtilcxx . . $ CgUtil#::ShowShaderInfocxx . . $ CgUtil#ShowShaderInfo(d4f767463ce0a6b3).(int fp){ |
| 1670 |
static GLint i[10],j[10],k[10],h[10]; |
| 1671 |
|
| 1672 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8123:9`!, i); |
| 1673 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4782:9`!, i+1); |
| 1674 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4783:9`!, i+2); |
| 1675 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4784:9`!, i+3); |
| 1676 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_TEMPORARIES_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8127:9`!, i+4); |
| 1677 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_PARAMETERS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8131:9`!, i+5); |
| 1678 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_ATTRIBS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8135:9`!, i+6); |
| 1679 |
|
| 1680 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8122:9`!, j); |
| 1681 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_ALU_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4776:9`!, i+1); |
| 1682 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_TEX_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4777:9`!, j+2); |
| 1683 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_TEX_INDIRECTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4778:9`!, j+3); |
| 1684 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_TEMPORARIES_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8126:9`!, j+4); |
| 1685 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_PARAMETERS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8130:9`!, j+5); |
| 1686 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_ATTRIBS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8134:9`!, j+6); |
| 1687 |
|
| 1688 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8124:9`!, k); |
| 1689 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4779:9`!, k+1); |
| 1690 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4780:9`!, k+2); |
| 1691 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4781:9`!, k+3); |
| 1692 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_TEMPORARIES_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8128:9`!, k+4); |
| 1693 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_PARAMETERS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8132:9`!, k+5); |
| 1694 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_PROGRAM_NATIVE_ATTRIBS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8136:9`!, k+6); |
| 1695 |
|
| 1696 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8125:9`!, h); |
| 1697 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4785:9`!, h+1); |
| 1698 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4786:9`!, h+2); |
| 1699 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4787:9`!, h+3); |
| 1700 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8129:9`!, h+4); |
| 1701 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8133:9`!, h+5); |
| 1702 |
glGetProgramivARBcxx . . $ `<external>/18396878532286971346/glew.h:8252:9`!(fp, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARBcxx . . $ `<external>/18396878532286971346/glew.h:8137:9`!, h+6); |
| 1703 |
|
| 1704 |
|
| 1705 |
char st[10][10]={"Instr","Alu Instr","Tex Instr","Tex Indir","Temp","Param","Attr"}; |
| 1706 |
printf(" %s PROGRAM STATS \n", |
| 1707 |
(fp==GL_FRAGMENT_PROGRAM_ARBcxx . . $ `<external>/18396878532286971346/glew.h:4775:9`!)?"FRAGMENT":"VERTEX"); |
| 1708 |
printf(" original | native \n"); |
| 1709 |
printf(" MAX current | MAX current\n"); |
| 1710 |
for (int c=0; c<7; c++) { |
| 1711 |
printf( "%10s %5d %5d | %5d %5d\n",st[c],i[c],j[c],h[c],k[c]); |
| 1712 |
} |
| 1713 |
printf("\n\n"); |
| 1714 |
} |