| 1 | |
| 2 | class OctaMapSampcxx . . $ OctaMapSamp#{ |
| 3 | public: |
| 4 | |
| 5 | int TotTexSizeXcxx . . $ OctaMapSamp#TotTexSizeX(b126dc7c1de90089).(){ |
| 6 | return sizecxx . . $ OctaMapSamp#size.; |
| 7 | } |
| 8 | |
| 9 | int TotTexSizeYcxx . . $ OctaMapSamp#TotTexSizeY(b126dc7c1de90089).(){ |
| 10 | return sizecxx . . $ OctaMapSamp#size.; |
| 11 | } |
| 12 | |
| 13 | static vectorcxx . . $ std/vector#<int> mapcxx . . $ OctaMapSamp#map.; // mappa 2d di indici a dir |
| 14 | static vectorcxx . . $ std/vector#<Point3fcxx . . $ vcg/Point3f#> dircxx . . $ OctaMapSamp#dir.; // direzioni (uniche!) |
| 15 | static vectorcxx . . $ std/vector#<Point3fcxx . . $ vcg/Point3f#> dirrotcxx . . $ OctaMapSamp#dirrot.; // direzioni ruotate (uniche!) |
| 16 | |
| 17 | vectorcxx . . $ std/vector#<float> sumcxx . . $ OctaMapSamp#sum.; // somme (uniche!) |
| 18 | vectorcxx . . $ std/vector#<float> divcxx . . $ OctaMapSamp#div.; // divisioni (uniche!) |
| 19 | |
| 20 | static int sizecxx . . $ OctaMapSamp#size.; |
| 21 | |
| 22 | void Shadecxx . . $ OctaMapSamp#Shade(49f6e7a06ebc5aa8).(){ |
| 23 | //col.resize(dir.size()); |
| 24 | /*for (int i=0; i<dir.size(); i++) { |
| 25 | col[i]=dir[i]*Point3d(0.6,0.8,0); |
| 26 | if (col[i]<0) col[i]*=-1; |
| 27 | if (col[i]>1) col[i]=1; |
| 28 | }*/ |
| 29 | } |
| 30 | |
| 31 | static inline int nsampcxx . . $ OctaMapSamp#nsamp(b126dc7c1de90089).(){ |
| 32 | return dircxx . . $ OctaMapSamp#dir..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | // duplicates those texels that are already douplicated |
| 37 | void DuplicateTexelscxx . . $ OctaMapSamp#DuplicateTexels(54e11277e2b28f45).(vectorcxx . . $ std/vector#<Bytecxx . . $ Byte#> &t, int s, int tx, int ty){ |
| 38 | int e=sizecxx . . $ OctaMapSamp#size.-1; // the end |
| 39 | // four corners |
| 40 | int k0=(tx+ (ty )*s)*3; |
| 41 | int k1=(tx+e+(ty )*s)*3; |
| 42 | int k2=(tx+e+(ty+e)*s)*3; |
| 43 | int k3=(tx+ (ty+e)*s)*3; |
| 44 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0 ]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1 ]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2 ]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3 ]; |
| 45 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3+1]; |
| 46 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3+2]; |
| 47 | |
| 48 | // sides |
| 49 | for (int i=1; i<sizecxx . . $ OctaMapSamp#size./2; i++) { |
| 50 | int k0a=(tx + (ty +i )*s)*3; |
| 51 | int k0b=(tx + (ty +e-i)*s)*3; |
| 52 | |
| 53 | int k1a=(tx+e + (ty +i )*s)*3; |
| 54 | int k1b=(tx+e + (ty +e-i)*s)*3; |
| 55 | |
| 56 | int k2a=(tx+i + (ty )*s)*3; |
| 57 | int k2b=(tx+e-i+ (ty )*s)*3; |
| 58 | |
| 59 | int k3a=(tx+i + (ty +e )*s)*3; |
| 60 | int k3b=(tx+e-i+ (ty +e )*s)*3; |
| 61 | |
| 62 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0a+0]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0b+0]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1a+0]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1b+0]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2a+0]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2b+0]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3a+0]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3b+0]; |
| 63 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0a+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0b+1]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1a+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1b+1]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2a+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2b+1]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3a+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3b+1]; |
| 64 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0a+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k0b+2]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1a+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k1b+2]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2a+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k2b+2]; t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3a+2]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k3b+2]; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | |
| 69 | void FillTexturecxx . . $ OctaMapSamp#FillTexture(75de56d795bd0575).(vectorcxx . . $ std/vector#<Bytecxx . . $ Byte#> &t, int s, int tx, int ty, |
| 70 | float cr,float cg,float cb){ |
| 71 | for (int y=0; y<sizecxx . . $ OctaMapSamp#size.; y++) { |
| 72 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.; x++) |
| 73 | { |
| 74 | int k=(x+tx+(y+ty)*s)*3; |
| 75 | //Byte shade=(int)( col[ Index( x , y ) ] ); |
| 76 | /*t[k++]= shade; |
| 77 | t[k++]= shade; |
| 78 | t[k++]= shade;*/ |
| 79 | |
| 80 | Point3fcxx . . $ vcg/Point3f# p=dircxx . . $ vcg/Point3#Point3(5401f57a7bce03f4).[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( x , y ) ]; |
| 81 | |
| 82 | Point3fcxx . . $ vcg/Point3f# q=(p+cxx . . $ vcg/Point3#operator+(df3b8fd47e21bd0c).Point3fcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).(1,1,1))/cxx . . $ vcg/Point3#`operator/`(19a42edf8b0c4f9d).2.0*cxx . . $ vcg/Point3#`operator*`(19a42edf8b0c4f9d).255.0; |
| 83 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k++]= (Bytecxx . . $ Byte#)q[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]; |
| 84 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k++]= (Bytecxx . . $ Byte#)q[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]; |
| 85 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k++]= (Bytecxx . . $ Byte#)q[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).2]; |
| 86 | |
| 87 | /*int shade=(int)(p*Point3d(0.8,0.6,0)*255.0); |
| 88 | if (shade<0) shade=-shade/2; |
| 89 | if (shade>255) shade=255; |
| 90 | t[k++]= shade; |
| 91 | t[k++]= shade; |
| 92 | t[k++]= shade;*/ |
| 93 | |
| 94 | |
| 95 | /* float i=255.0*float(map[Index( x , y )])/(size*size*size); |
| 96 | t[k++]= (int)i; |
| 97 | t[k++]= (int)i; |
| 98 | t[k++]= (int)i; |
| 99 | |
| 100 | |
| 101 | int r=0, g=0, b=0; |
| 102 | if (y<size) r=255; |
| 103 | if (x<size) b=255; if (x>=size*2) g=255; |
| 104 | k=(x+(y)*s)*3; |
| 105 | t[k++]= t[k++]/2+r/2; |
| 106 | t[k++]= t[k++]/2+g/2; |
| 107 | t[k++]= t[k++]/2+b/2; |
| 108 | */ |
| 109 | |
| 110 | /* |
| 111 | int r=0, g=0, b=0; |
| 112 | if (y<size) r=255; |
| 113 | if (x<size) b=255; if (x>=size*2) g=255; |
| 114 | t[k++]= r; |
| 115 | t[k++]= g; |
| 116 | t[k++]= b;*/ |
| 117 | // printf("%4d ",map[Index( x , y )]); |
| 118 | //printf("%3d ",shade); |
| 119 | |
| 120 | } |
| 121 | //printf("\n"); |
| 122 | } |
| 123 | |
| 124 | } |
| 125 | |
| 126 | inline static int Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).(int x, int y){ |
| 127 | return x+y*sizecxx . . $ OctaMapSamp#size.; |
| 128 | } |
| 129 | |
| 130 | inline static float signcxx . . $ OctaMapSamp#sign(fbcf3211dfe1bfd1).(float x){ |
| 131 | return (x<0)?-1:+1; |
| 132 | } |
| 133 | inline static float Abscxx . . $ OctaMapSamp#Abs(fbcf3211dfe1bfd1).(float x){ |
| 134 | return (x<0)?-x:+x; |
| 135 | } |
| 136 | |
| 137 | void Zerocxx . . $ OctaMapSamp#Zero(49f6e7a06ebc5aa8).(){ |
| 138 | int n=dircxx . . $ OctaMapSamp#dir..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); |
| 139 | sumcxx . . $ OctaMapSamp#sum..resizecxx . . $ std/vector#resize(3804226c8c0acbc3).(n,0); |
| 140 | divcxx . . $ OctaMapSamp#div..resizecxx . . $ std/vector#resize(3804226c8c0acbc3).(n,0); |
| 141 | } |
| 142 | |
| 143 | // smoothing of an octamap! |
| 144 | void Smoothcxx . . $ OctaMapSamp#Smooth(54e11277e2b28f45).(vectorcxx . . $ std/vector#<Bytecxx . . $ Byte#> &t, int s, int tx, int ty){ |
| 145 | vectorcxx . . $ std/vector#<int> oldvaluecxx . . $ std/vector#vector(83fdeebbe0501a83).(sizecxx . . $ OctaMapSamp#size.*sizecxx . . $ OctaMapSamp#size.*6); |
| 146 | // copy old values |
| 147 | for (int y=0; y<sizecxx . . $ OctaMapSamp#size.*2; y++) |
| 148 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.*3; x++) |
| 149 | { |
| 150 | int k=(x+tx+(y+ty)*s)*3; |
| 151 | int i= Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( x , y ); |
| 152 | oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k]; |
| 153 | } |
| 154 | |
| 155 | int dy=sizecxx . . $ OctaMapSamp#size., dx=1; |
| 156 | |
| 157 | int e=sizecxx . . $ OctaMapSamp#size.-1; |
| 158 | // smooth old values |
| 159 | for (int y=0; y<sizecxx . . $ OctaMapSamp#size.; y++) |
| 160 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.; x++) |
| 161 | { |
| 162 | /* int i= Index( x , y ); |
| 163 | int sum=oldvalue[i]; |
| 164 | |
| 165 | if (y!=0) sum+=oldvalue[i-dy]; |
| 166 | else sum+=oldvalue[ Index( e-x , 1 ) ]; |
| 167 | |
| 168 | if (x!=0) sum+=oldvalue[i-dx]; |
| 169 | else sum+=oldvalue[ Index( 1 , e-y ) ]; |
| 170 | |
| 171 | if (y!=e) sum+=oldvalue[i+dy]; |
| 172 | else sum+=oldvalue[ Index( e-x ,e-1 ) ]; |
| 173 | |
| 174 | if (x!=e) sum+=oldvalue[i+dx]; |
| 175 | else sum+=oldvalue[ Index( e-1 , e-y ) ]; |
| 176 | |
| 177 | sum=(sum+3)/5; |
| 178 | */ |
| 179 | int i= Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( x , y ); |
| 180 | const int TH=2; |
| 181 | int sum=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]; |
| 182 | int ddiv=1; |
| 183 | int w; |
| 184 | |
| 185 | if (y!=0) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i-dy]; |
| 186 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( e-x , 1 ) ]; |
| 187 | if(w>TH) {sum+=w; ddiv++; } |
| 188 | |
| 189 | if (x!=0) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i-dx]; |
| 190 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( 1 , e-y ) ]; |
| 191 | if(w>TH) {sum+=w; ddiv++; } |
| 192 | |
| 193 | if (y!=e) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i+dy]; |
| 194 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( e-x ,e-1 ) ]; |
| 195 | if(w>TH) {sum+=w; ddiv++; } |
| 196 | |
| 197 | if (x!=e) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i+dx]; |
| 198 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( e-1 , e-y ) ]; |
| 199 | if(w>TH) {sum+=w; ddiv++; } |
| 200 | |
| 201 | sum=(sum+ddiv/2)/ddiv; |
| 202 | |
| 203 | |
| 204 | int k=(x+tx+(y+ty)*s)*3; |
| 205 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k+1]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k+2]=sum; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | // smoothing of an octamap! |
| 210 | void Smoothcxx . . $ OctaMapSamp#Smooth(3bfd93d33b581538).(vectorcxx . . $ std/vector#<int> &t, int s, int tx, int ty){ |
| 211 | vectorcxx . . $ std/vector#<int> oldvaluecxx . . $ std/vector#vector(83fdeebbe0501a83).(sizecxx . . $ OctaMapSamp#size.*sizecxx . . $ OctaMapSamp#size.*6); |
| 212 | // copy old values |
| 213 | for (int y=0; y<sizecxx . . $ OctaMapSamp#size.*2; y++) |
| 214 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.*3; x++) |
| 215 | { |
| 216 | int k=(x+tx+(y+ty)*s); |
| 217 | int i= Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( x , y ); |
| 218 | oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]=t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k]; |
| 219 | } |
| 220 | |
| 221 | int dy=sizecxx . . $ OctaMapSamp#size., dx=1; |
| 222 | |
| 223 | int e=sizecxx . . $ OctaMapSamp#size.-1; |
| 224 | // smooth old values |
| 225 | for (int y=0; y<sizecxx . . $ OctaMapSamp#size.; y++) |
| 226 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.; x++) |
| 227 | { |
| 228 | int i= Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( x , y ); |
| 229 | const int TH=5; |
| 230 | int sum=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]; |
| 231 | int ddiv=1; |
| 232 | int w; |
| 233 | |
| 234 | if (y!=0) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i-dy]; |
| 235 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( e-x , 1 ) ]; |
| 236 | if(w>TH) {sum+=w; ddiv++; } |
| 237 | |
| 238 | if (x!=0) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i-dx]; |
| 239 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( 1 , e-y ) ]; |
| 240 | if(w>TH) {sum+=w; ddiv++; } |
| 241 | |
| 242 | if (y!=e) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i+dy]; |
| 243 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( e-x ,e-1 ) ]; |
| 244 | if(w>TH) {sum+=w; ddiv++; } |
| 245 | |
| 246 | if (x!=e) w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i+dx]; |
| 247 | else w=oldvalue[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce). Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).( e-1 , e-y ) ]; |
| 248 | if(w>TH) {sum+=w; ddiv++; } |
| 249 | |
| 250 | sum=(sum+ddiv/2)/ddiv; |
| 251 | |
| 252 | int k=(x+tx+(y+ty)*s); |
| 253 | t[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k]=sum; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | static void SetSizecxx . . $ OctaMapSamp#SetSize(d4f767463ce0a6b3).(int _size){ |
| 258 | sizecxx . . $ OctaMapSamp#size.=_size; |
| 259 | initMapcxx . . $ OctaMapSamp#initMap(49f6e7a06ebc5aa8).(); |
| 260 | ComputeWeightcxx . . $ OctaMapSamp#ComputeWeight(49f6e7a06ebc5aa8).(); |
| 261 | } |
| 262 | |
| 263 | static Point3fcxx . . $ vcg/Point3f# getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(float x, float y){ |
| 264 | float fs=float(sizecxx . . $ OctaMapSamp#size.)-1; |
| 265 | Point3fcxx . . $ vcg/Point3f# pcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).(x*2/fs-1,y*2/fs-1,0); |
| 266 | float ax=Abscxx . . $ OctaMapSamp#Abs(fbcf3211dfe1bfd1).(p[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]), ay=Abscxx . . $ OctaMapSamp#Abs(fbcf3211dfe1bfd1).(p[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]), az=+1; |
| 267 | if (ax+ay>1.0) { |
| 268 | p=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).Point3fcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).( signcxx . . $ OctaMapSamp#sign(fbcf3211dfe1bfd1).(p[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0])*(1-ay), |
| 269 | signcxx . . $ OctaMapSamp#sign(fbcf3211dfe1bfd1).(p[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1])*(1-ax), 0); |
| 270 | az=-1; |
| 271 | } |
| 272 | p[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).2]=(1-ax-ay)*az; |
| 273 | p.Normalizecxx . . $ vcg/Point3#Normalize(f55c2490dff4ff58).(); |
| 274 | return pcxx . . $ vcg/Point3#Point3(5401f57a7bce03f4).; |
| 275 | } |
| 276 | |
| 277 | static void initMapcxx . . $ OctaMapSamp#initMap(49f6e7a06ebc5aa8).(){ |
| 278 | dircxx . . $ OctaMapSamp#dir..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(sizecxx . . $ OctaMapSamp#size.*sizecxx . . $ OctaMapSamp#size.); |
| 279 | |
| 280 | for (int y=0; y<sizecxx . . $ OctaMapSamp#size.; y++) |
| 281 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.; x++) |
| 282 | dircxx . . $ OctaMapSamp#dir.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).Indexcxx . . $ OctaMapSamp#Index(9b79fb6aee4c0440).(x,y)]=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x,y); |
| 283 | } |
| 284 | |
| 285 | static vectorcxx . . $ std/vector#<float> weightcxx . . $ OctaMapSamp#weight.; |
| 286 | |
| 287 | static float Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).(Point3fcxx . . $ vcg/Point3f# a, Point3fcxx . . $ vcg/Point3f# b, Point3fcxx . . $ vcg/Point3f# c){ |
| 288 | return Abscxx . . $ OctaMapSamp#Abs(fbcf3211dfe1bfd1).( ((b-cxx . . $ vcg/Point3#operator-(df3b8fd47e21bd0c).a)^cxx . . $ vcg/Point3#`operator^`(df3b8fd47e21bd0c).(c-cxx . . $ vcg/Point3#operator-(df3b8fd47e21bd0c).a)).Normcxx . . $ vcg/Point3#Norm(8f5363d873dd4781).()*0.5 ); |
| 289 | } |
| 290 | |
| 291 | static void ComputeWeightcxx . . $ OctaMapSamp#ComputeWeight(49f6e7a06ebc5aa8).(){ |
| 292 | weightcxx . . $ OctaMapSamp#weight..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(sizecxx . . $ OctaMapSamp#size.*sizecxx . . $ OctaMapSamp#size.); |
| 293 | |
| 294 | for (int y=0,k=0; y<sizecxx . . $ OctaMapSamp#size.; y++) |
| 295 | for (int x=0; x<sizecxx . . $ OctaMapSamp#size.; x++,k++){ |
| 296 | float h=0.5; |
| 297 | |
| 298 | Point3fcxx . . $ vcg/Point3f# p00=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x-h,y-h); |
| 299 | Point3fcxx . . $ vcg/Point3f# p01=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x-h,y+0); |
| 300 | Point3fcxx . . $ vcg/Point3f# p02=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x-h,y+h); |
| 301 | Point3fcxx . . $ vcg/Point3f# p10=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x+0,y-h); |
| 302 | Point3fcxx . . $ vcg/Point3f# p11=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x+0,y+0); |
| 303 | Point3fcxx . . $ vcg/Point3f# p12=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x+0,y+h); |
| 304 | Point3fcxx . . $ vcg/Point3f# p20=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x+h,y-h); |
| 305 | Point3fcxx . . $ vcg/Point3f# p21=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x+h,y+0); |
| 306 | Point3fcxx . . $ vcg/Point3f# p22=getDircxx . . $ OctaMapSamp#getDir(e12f3a3e08f6d20a).(x+h,y+h); |
| 307 | |
| 308 | float tota=0; int c=0; int e=sizecxx . . $ OctaMapSamp#size.-1; |
| 309 | |
| 310 | if ( (x!=0) && (y!=0) ){ |
| 311 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p00cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p10cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p01cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 312 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p10cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p11cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p01cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 313 | c++; |
| 314 | } |
| 315 | if ( (x!=0) && (y!=e) ){ |
| 316 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p01cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p11cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p12cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 317 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p01cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p12cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p02cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 318 | c++; |
| 319 | } |
| 320 | if ( (x!=e) && (y!=0) ){ |
| 321 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p10cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p20cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p21cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 322 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p21cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p11cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p10cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 323 | c++; |
| 324 | } |
| 325 | if ( (x!=e) && (y!=e) ){ |
| 326 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p11cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p21cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p12cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 327 | tota+=Areacxx . . $ OctaMapSamp#Area(dc219cade1ea3e8e).( p21cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p22cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4)., p12cxx . . $ vcg/Point3#Point3(5401f57a7bce03f4). ); |
| 328 | c++; |
| 329 | } |
| 330 | weightcxx . . $ OctaMapSamp#weight.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).k]=1.0/(tota*4/c); |
| 331 | //printf("%8.6f%c",weight[k], (x%size==size-1)?'\n':' ' ); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | void FillTexturecxx . . $ OctaMapSamp#FillTexture(4ac75cfcc75bdb0b).(vectorcxx . . $ std/vector#<Bytecxx . . $ Byte#> &texture, const vectorcxx . . $ std/vector#<int> &sumtable, |
| 336 | int texsize, float div, int tx, int ty ); |
| 337 | |
| 338 | OctaMapSampcxx . . $ OctaMapSamp#OctaMapSamp(49f6e7a06ebc5aa8).(){ } |
| 339 | |
| 340 | }; |
| 341 | |
| 342 | |
| 343 |