.. | .. |
---|
118 | 118 | return current / anchor; |
---|
119 | 119 | } |
---|
120 | 120 | |
---|
121 | | - void Draw(CameraPane display, boolean selected) |
---|
122 | | - { |
---|
123 | | - //new Exception().printStackTrace(); |
---|
124 | | - |
---|
125 | | - if (display.IsFrozen() && !selected || display.ambientOcclusion) // || display.drawMode == display.SHADOW) |
---|
126 | | - { |
---|
127 | | - return; |
---|
128 | | - } |
---|
129 | | - |
---|
130 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
131 | | - |
---|
132 | | - //Color col = Color.getHSBColor(color,modulation,1); |
---|
133 | | - //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
134 | | - if (!multiply) |
---|
135 | | - { |
---|
136 | | - display.color = color; |
---|
137 | | - display.saturation = modulation; |
---|
138 | | - } |
---|
139 | | - else |
---|
140 | | - { |
---|
141 | | - display.color *= color*2; |
---|
142 | | - display.saturation *= modulation*2; |
---|
143 | | - } |
---|
144 | | - |
---|
145 | | - cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
146 | | - |
---|
147 | | - float[] colorV = GrafreeD.colorV; |
---|
148 | | - |
---|
149 | | - /**/ |
---|
150 | | - if (display.drawMode == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
151 | | - { |
---|
152 | | - colorV[0] = display.modelParams0[0] * diffuse; |
---|
153 | | - colorV[1] = display.modelParams0[1] * diffuse; |
---|
154 | | - colorV[2] = display.modelParams0[2] * diffuse; |
---|
155 | | - colorV[3] = opacity; |
---|
156 | | - |
---|
157 | | - gl.glColor4f(colorV[0], colorV[1], colorV[2], opacity); |
---|
158 | | - //System.out.println("Opacity = " + opacity); |
---|
159 | | - |
---|
160 | | - gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
161 | | - //color[0] /= 2; color[1] /= 2; color[2] /= 2; |
---|
162 | | - gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
163 | | - |
---|
164 | | - float amb = ambient; |
---|
165 | | - if (amb < cameralight) |
---|
166 | | - { |
---|
167 | | - amb = cameralight; |
---|
168 | | - } |
---|
169 | | - colorV[0] = display.modelParams0[0] * diffuse * amb; |
---|
170 | | - colorV[1] = display.modelParams0[1] * diffuse * amb; |
---|
171 | | - colorV[2] = display.modelParams0[2] * diffuse * amb; |
---|
172 | | - gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, colorV, 0); |
---|
173 | | - //color[0] /= 2; color[1] /= 2; color[2] /= 2; |
---|
174 | | - gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT, colorV, 0); |
---|
175 | | - |
---|
176 | | - /**/ |
---|
177 | | - colorV[0] = ((1 - metalness) + display.modelParams0[0] * metalness) * specular; |
---|
178 | | - colorV[1] = ((1 - metalness) + display.modelParams0[1] * metalness) * specular; |
---|
179 | | - colorV[2] = ((1 - metalness) + display.modelParams0[2] * metalness) * specular; |
---|
180 | | - gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, colorV, 0); |
---|
181 | | - //color[0] /= 2; color[1] /= 2; color[2] /= 2; |
---|
182 | | - gl.glMaterialfv(gl.GL_BACK, gl.GL_SPECULAR, colorV, 0); |
---|
183 | | - colorV[0] = 10 / shininess; // 1/0.005f; |
---|
184 | | - //System.out.println("shininess = " + colorV[0]); |
---|
185 | | - if (colorV[0] > 128) |
---|
186 | | - { |
---|
187 | | - colorV[0] = 128; |
---|
188 | | - } |
---|
189 | | - gl.glMaterialfv(gl.GL_FRONT, gl.GL_SHININESS, colorV, 0); |
---|
190 | | - gl.glMaterialfv(gl.GL_BACK, gl.GL_SHININESS, colorV, 0); |
---|
191 | | - /**/ |
---|
192 | | - } |
---|
193 | | - /**/ |
---|
194 | | - |
---|
195 | | - //selected = false; |
---|
196 | | - selected = selected && display.flash; |
---|
197 | | - |
---|
198 | | - //display.modelParams0[0] = 0; // pigment.r; |
---|
199 | | - //display.modelParams0[1] = 0; // pigment.g; |
---|
200 | | - //display.modelParams0[2] = 0; // pigment.b; |
---|
201 | | - if (!multiply) |
---|
202 | | - { |
---|
203 | | - display.modelParams0[3] = metalness; |
---|
204 | | - display.modelParams1[0] = diffuse; |
---|
205 | | - display.modelParams1[1] = specular; |
---|
206 | | - display.modelParams1[2] = 1 / shininess; |
---|
207 | | - display.modelParams1[3] = shift; |
---|
208 | | - display.modelParams2[0] = ambient; |
---|
209 | | - display.modelParams2[1] = lightarea; |
---|
210 | | - //System.out.println("light area = " + lightarea); |
---|
211 | | - display.modelParams2[2] = 1 / factor; // diffuseness |
---|
212 | | - display.modelParams2[3] = velvet; |
---|
213 | | - display.modelParams3[0] = sheen; |
---|
214 | | - display.modelParams3[1] = subsurface; |
---|
215 | | - display.modelParams3[2] = bump; // backlit |
---|
216 | | - display.modelParams3[3] = aniso; |
---|
217 | | - display.modelParams4[0] = anisoV; |
---|
218 | | - display.modelParams4[1] = selected ? 100 : cameralight; |
---|
219 | | - //System.out.println("selected = " + selected); |
---|
220 | | - display.modelParams4[2] = diffuseness; |
---|
221 | | - display.modelParams4[3] = shadow; |
---|
222 | | - display.modelParams5[0] = texture; |
---|
223 | | - display.modelParams5[1] = opacity; |
---|
224 | | - display.modelParams5[2] = fakedepth; |
---|
225 | | - display.modelParams5[3] = CameraPane.SHADOWCULLFACE ? 0f : (shadowbias - 0.005f) / 10; |
---|
226 | | - } |
---|
227 | | - else |
---|
228 | | - { |
---|
229 | | - display.modelParams0[3] *= metalness*2; |
---|
230 | | - display.modelParams1[0] *= diffuse*2; |
---|
231 | | - display.modelParams1[1] *= specular*2; |
---|
232 | | - display.modelParams1[2] *= shininess*2; |
---|
233 | | - display.modelParams1[3] *= shift*2; |
---|
234 | | - display.modelParams2[0] *= ambient*2; |
---|
235 | | - display.modelParams2[1] *= lightarea*2; |
---|
236 | | - display.modelParams2[2] *= factor*2; |
---|
237 | | - display.modelParams2[3] *= velvet*2; |
---|
238 | | - display.modelParams3[0] *= sheen*2; |
---|
239 | | - display.modelParams3[1] *= subsurface*2; |
---|
240 | | - display.modelParams3[2] *= bump*2; |
---|
241 | | - display.modelParams3[3] *= aniso*2; |
---|
242 | | - display.modelParams4[0] *= anisoV*2; |
---|
243 | | - display.modelParams4[1] *= cameralight*2; |
---|
244 | | - //System.out.println("selected = " + selected); |
---|
245 | | - display.modelParams4[2] *= diffuseness*2; |
---|
246 | | - display.modelParams4[3] *= shadow*2; |
---|
247 | | - display.modelParams5[0] *= texture*2; |
---|
248 | | - display.modelParams5[1] *= opacity*2; |
---|
249 | | - display.modelParams5[2] *= fakedepth*2; |
---|
250 | | - display.modelParams5[3] *= shadowbias*2; |
---|
251 | | - } |
---|
252 | | - |
---|
253 | | - display.modelParams6[0] = 0; |
---|
254 | | - display.modelParams6[1] = 0; |
---|
255 | | - display.modelParams6[2] = 0; |
---|
256 | | - display.modelParams6[3] = 0; |
---|
257 | | - |
---|
258 | | - display.modelParams7[0] = 0; |
---|
259 | | - display.modelParams7[1] = 1000; |
---|
260 | | - display.modelParams7[2] = 0; |
---|
261 | | - display.modelParams7[3] = 0; |
---|
262 | | - |
---|
263 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
264 | | - |
---|
265 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
266 | | - if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
267 | | - { |
---|
268 | | - display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
269 | | - display.modelParams6[1] = extparams[0].y / 1000.0f; // noise |
---|
270 | | - if (extparams.length > 1) |
---|
271 | | - { |
---|
272 | | - display.modelParams6[2] = extparams[1].x / 1000.0f; // borderfade |
---|
273 | | - display.modelParams6[3] = extparams[1].y / 1000.0f; // (float)Math.exp(-extparams[1].y / 1000.0f); // fog punchthrough |
---|
274 | | - if (extparams.length > 2) |
---|
275 | | - { |
---|
276 | | - display.modelParams7[0] = extparams[2].x / 1000.0f; // noise power |
---|
277 | | - float x = extparams[2].y / 1000.0f; |
---|
278 | | - //if (x == 0) |
---|
279 | | - // x = 1f; |
---|
280 | | - display.modelParams7[1] = 1 / x / x / x / x / x / x / x / x / x / x / x / x / x; // (float)Math.pow(-Math.log((extparams[2].y+0.00) / 1000.0f), 1); // opacity power |
---|
281 | | - if (extparams[2].y > 0) |
---|
282 | | - { |
---|
283 | | - //System.out.println("extparams[1].y = " + extparams[1].y); |
---|
284 | | - //System.out.println("extparams[2].y = " + extparams[2].y); |
---|
285 | | - //System.out.println("opacity power = " + display.modelParams7[1]); |
---|
286 | | - } |
---|
287 | | - } |
---|
288 | | - } |
---|
289 | | - } |
---|
290 | | - |
---|
291 | | - //if (display.modelParams6[2] != 0) |
---|
292 | | - /* |
---|
293 | | - System.out.println("modelParams0[0] = " + display.modelParams0[0]); |
---|
294 | | - System.out.println("modelParams0[1] = " + display.modelParams0[1]); |
---|
295 | | - System.out.println("modelParams0[2] = " + display.modelParams0[2]); |
---|
296 | | - System.out.println("modelParams0[3] = " + display.modelParams0[3]); |
---|
297 | | - System.out.println("modelParams1[0] = " + display.modelParams1[0]); |
---|
298 | | - System.out.println("modelParams1[1] = " + display.modelParams1[1]); |
---|
299 | | - System.out.println("modelParams1[2] = " + display.modelParams1[2]); |
---|
300 | | - System.out.println("modelParams1[3] = " + display.modelParams1[3]); |
---|
301 | | - System.out.println("modelParams2[0] = " + display.modelParams2[0]); |
---|
302 | | - System.out.println("modelParams2[1] = " + display.modelParams2[1]); |
---|
303 | | - System.out.println("modelParams2[2] = " + display.modelParams2[2]); |
---|
304 | | - System.out.println("modelParams2[3] = " + display.modelParams2[3]); |
---|
305 | | - System.out.println("modelParams3[0] = " + display.modelParams3[0]); |
---|
306 | | - System.out.println("modelParams3[1] = " + display.modelParams3[1]); |
---|
307 | | - System.out.println("modelParams3[2] = " + display.modelParams3[2]); |
---|
308 | | - System.out.println("modelParams3[3] = " + display.modelParams3[3]); |
---|
309 | | - System.out.println("modelParams4[0] = " + display.modelParams4[0]); |
---|
310 | | - System.out.println("modelParams4[1] = " + display.modelParams4[1]); |
---|
311 | | - System.out.println("modelParams4[2] = " + display.modelParams4[2]); |
---|
312 | | - System.out.println("modelParams4[3] = " + display.modelParams4[3]); |
---|
313 | | - System.out.println("modelParams5[0] = " + display.modelParams5[0]); |
---|
314 | | - System.out.println("modelParams5[1] = " + display.modelParams5[1]); |
---|
315 | | - System.out.println("modelParams5[2] = " + display.modelParams5[2]); |
---|
316 | | - System.out.println("modelParams5[3] = " + display.modelParams5[3]); |
---|
317 | | - System.out.println("modelParams6[0] = " + display.modelParams6[0]); |
---|
318 | | - System.out.println("modelParams6[1] = " + display.modelParams6[1]); |
---|
319 | | - System.out.println("modelParams6[2] = " + display.modelParams6[2]); |
---|
320 | | - System.out.println("modelParams6[3] = " + display.modelParams6[3]); |
---|
321 | | - System.out.println("modelParams7[0] = " + display.modelParams7[0]); |
---|
322 | | - System.out.println("modelParams7[1] = " + display.modelParams7[1]); |
---|
323 | | - System.out.println("modelParams7[2] = " + display.modelParams7[2]); |
---|
324 | | - System.out.println("modelParams7[3] = " + display.modelParams7[3]); |
---|
325 | | - /**/ |
---|
326 | | - //assert (display.modelParams6[2] == 0); |
---|
327 | | - |
---|
328 | | - //System.out.println("noise power = " + display.modelParams7[0]); |
---|
329 | | - //System.out.println("shadowbias = " + shadowbias); |
---|
330 | | - |
---|
331 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
332 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 1, display.modelParams1, 0); |
---|
333 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 2, display.modelParams2, 0); |
---|
334 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 3, display.modelParams3, 0); |
---|
335 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
336 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
337 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 6, display.modelParams6, 0); |
---|
338 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 7, display.modelParams7, 0); |
---|
339 | | - |
---|
340 | | - int mode = display.FP_SHADER; |
---|
341 | | - |
---|
342 | | - if (aniso != anisoV || aniso > 0.002) |
---|
343 | | - { |
---|
344 | | - mode |= display.FP_ANISO; |
---|
345 | | - } |
---|
346 | | - |
---|
347 | | - display.EnableProgram(mode); |
---|
348 | | - |
---|
349 | | - //System.out.println("opacity power = " + display.modelParams7[1]); |
---|
350 | | - |
---|
351 | | - if (!multiply) |
---|
352 | | - { |
---|
353 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
354 | | - gl.glDepthMask(opacity >= 0.9 && display.modelParams7[1] > 0.1); |
---|
355 | | - else |
---|
356 | | - gl.glDepthMask(opacity >= 0.99); |
---|
357 | | - } |
---|
358 | | - } |
---|
| 121 | +// void Draw(iCameraPane display, boolean selected) |
---|
| 122 | +// { |
---|
| 123 | +// //new Exception().printStackTrace(); |
---|
| 124 | +// |
---|
| 125 | +// if (display.IsFrozen() && !selected || display.IsAmbientOcclusionOn()) // || display.drawMode == display.SHADOW) |
---|
| 126 | +// { |
---|
| 127 | +// return; |
---|
| 128 | +// } |
---|
| 129 | +// |
---|
| 130 | +// javax.media.opengl.GL gl = display.GetGL(); |
---|
| 131 | +// |
---|
| 132 | +// //Color col = Color.getHSBColor(color,modulation,1); |
---|
| 133 | +// //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
| 134 | +// if (!multiply) |
---|
| 135 | +// { |
---|
| 136 | +// display.color = color; |
---|
| 137 | +// display.saturation = modulation; |
---|
| 138 | +// } |
---|
| 139 | +// else |
---|
| 140 | +// { |
---|
| 141 | +// display.color *= color*2; |
---|
| 142 | +// display.saturation *= modulation*2; |
---|
| 143 | +// } |
---|
| 144 | +// |
---|
| 145 | +// cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
| 146 | +// |
---|
| 147 | +// float[] colorV = GrafreeD.colorV; |
---|
| 148 | +// |
---|
| 149 | +// /**/ |
---|
| 150 | +// if (display.drawMode == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
| 151 | +// { |
---|
| 152 | +// colorV[0] = display.modelParams0[0] * diffuse; |
---|
| 153 | +// colorV[1] = display.modelParams0[1] * diffuse; |
---|
| 154 | +// colorV[2] = display.modelParams0[2] * diffuse; |
---|
| 155 | +// colorV[3] = opacity; |
---|
| 156 | +// |
---|
| 157 | +// gl.glColor4f(colorV[0], colorV[1], colorV[2], opacity); |
---|
| 158 | +// //System.out.println("Opacity = " + opacity); |
---|
| 159 | +// |
---|
| 160 | +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
| 161 | +// //color[0] /= 2; color[1] /= 2; color[2] /= 2; |
---|
| 162 | +// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
| 163 | +// |
---|
| 164 | +// float amb = ambient; |
---|
| 165 | +// if (amb < cameralight) |
---|
| 166 | +// { |
---|
| 167 | +// amb = cameralight; |
---|
| 168 | +// } |
---|
| 169 | +// colorV[0] = display.modelParams0[0] * diffuse * amb; |
---|
| 170 | +// colorV[1] = display.modelParams0[1] * diffuse * amb; |
---|
| 171 | +// colorV[2] = display.modelParams0[2] * diffuse * amb; |
---|
| 172 | +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, colorV, 0); |
---|
| 173 | +// //color[0] /= 2; color[1] /= 2; color[2] /= 2; |
---|
| 174 | +// gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT, colorV, 0); |
---|
| 175 | +// |
---|
| 176 | +// /**/ |
---|
| 177 | +// colorV[0] = ((1 - metalness) + display.modelParams0[0] * metalness) * specular; |
---|
| 178 | +// colorV[1] = ((1 - metalness) + display.modelParams0[1] * metalness) * specular; |
---|
| 179 | +// colorV[2] = ((1 - metalness) + display.modelParams0[2] * metalness) * specular; |
---|
| 180 | +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, colorV, 0); |
---|
| 181 | +// //color[0] /= 2; color[1] /= 2; color[2] /= 2; |
---|
| 182 | +// gl.glMaterialfv(gl.GL_BACK, gl.GL_SPECULAR, colorV, 0); |
---|
| 183 | +// colorV[0] = 10 / shininess; // 1/0.005f; |
---|
| 184 | +// //System.out.println("shininess = " + colorV[0]); |
---|
| 185 | +// if (colorV[0] > 128) |
---|
| 186 | +// { |
---|
| 187 | +// colorV[0] = 128; |
---|
| 188 | +// } |
---|
| 189 | +// gl.glMaterialfv(gl.GL_FRONT, gl.GL_SHININESS, colorV, 0); |
---|
| 190 | +// gl.glMaterialfv(gl.GL_BACK, gl.GL_SHININESS, colorV, 0); |
---|
| 191 | +// /**/ |
---|
| 192 | +// } |
---|
| 193 | +// /**/ |
---|
| 194 | +// |
---|
| 195 | +// //selected = false; |
---|
| 196 | +// selected = selected && display.flash; |
---|
| 197 | +// |
---|
| 198 | +// //display.modelParams0[0] = 0; // pigment.r; |
---|
| 199 | +// //display.modelParams0[1] = 0; // pigment.g; |
---|
| 200 | +// //display.modelParams0[2] = 0; // pigment.b; |
---|
| 201 | +// if (!multiply) |
---|
| 202 | +// { |
---|
| 203 | +// display.modelParams0[3] = metalness; |
---|
| 204 | +// display.modelParams1[0] = diffuse; |
---|
| 205 | +// display.modelParams1[1] = specular; |
---|
| 206 | +// display.modelParams1[2] = 1 / shininess; |
---|
| 207 | +// display.modelParams1[3] = shift; |
---|
| 208 | +// display.modelParams2[0] = ambient; |
---|
| 209 | +// display.modelParams2[1] = lightarea; |
---|
| 210 | +// //System.out.println("light area = " + lightarea); |
---|
| 211 | +// display.modelParams2[2] = 1 / factor; // diffuseness |
---|
| 212 | +// display.modelParams2[3] = velvet; |
---|
| 213 | +// display.modelParams3[0] = sheen; |
---|
| 214 | +// display.modelParams3[1] = subsurface; |
---|
| 215 | +// display.modelParams3[2] = bump; // backlit |
---|
| 216 | +// display.modelParams3[3] = aniso; |
---|
| 217 | +// display.modelParams4[0] = anisoV; |
---|
| 218 | +// display.modelParams4[1] = selected ? 100 : cameralight; |
---|
| 219 | +// //System.out.println("selected = " + selected); |
---|
| 220 | +// display.modelParams4[2] = diffuseness; |
---|
| 221 | +// display.modelParams4[3] = shadow; |
---|
| 222 | +// display.modelParams5[0] = texture; |
---|
| 223 | +// display.modelParams5[1] = opacity; |
---|
| 224 | +// display.modelParams5[2] = fakedepth; |
---|
| 225 | +// display.modelParams5[3] = CameraPane.SHADOWCULLFACE ? 0f : (shadowbias - 0.005f) / 10; |
---|
| 226 | +// } |
---|
| 227 | +// else |
---|
| 228 | +// { |
---|
| 229 | +// display.modelParams0[3] *= metalness*2; |
---|
| 230 | +// display.modelParams1[0] *= diffuse*2; |
---|
| 231 | +// display.modelParams1[1] *= specular*2; |
---|
| 232 | +// display.modelParams1[2] *= shininess*2; |
---|
| 233 | +// display.modelParams1[3] *= shift*2; |
---|
| 234 | +// display.modelParams2[0] *= ambient*2; |
---|
| 235 | +// display.modelParams2[1] *= lightarea*2; |
---|
| 236 | +// display.modelParams2[2] *= factor*2; |
---|
| 237 | +// display.modelParams2[3] *= velvet*2; |
---|
| 238 | +// display.modelParams3[0] *= sheen*2; |
---|
| 239 | +// display.modelParams3[1] *= subsurface*2; |
---|
| 240 | +// display.modelParams3[2] *= bump*2; |
---|
| 241 | +// display.modelParams3[3] *= aniso*2; |
---|
| 242 | +// display.modelParams4[0] *= anisoV*2; |
---|
| 243 | +// display.modelParams4[1] *= cameralight*2; |
---|
| 244 | +// //System.out.println("selected = " + selected); |
---|
| 245 | +// display.modelParams4[2] *= diffuseness*2; |
---|
| 246 | +// display.modelParams4[3] *= shadow*2; |
---|
| 247 | +// display.modelParams5[0] *= texture*2; |
---|
| 248 | +// display.modelParams5[1] *= opacity*2; |
---|
| 249 | +// display.modelParams5[2] *= fakedepth*2; |
---|
| 250 | +// display.modelParams5[3] *= shadowbias*2; |
---|
| 251 | +// } |
---|
| 252 | +// |
---|
| 253 | +// display.modelParams6[0] = 0; |
---|
| 254 | +// display.modelParams6[1] = 0; |
---|
| 255 | +// display.modelParams6[2] = 0; |
---|
| 256 | +// display.modelParams6[3] = 0; |
---|
| 257 | +// |
---|
| 258 | +// display.modelParams7[0] = 0; |
---|
| 259 | +// display.modelParams7[1] = 1000; |
---|
| 260 | +// display.modelParams7[2] = 0; |
---|
| 261 | +// display.modelParams7[3] = 0; |
---|
| 262 | +// |
---|
| 263 | +// display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 264 | +// |
---|
| 265 | +// Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 266 | +// if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
| 267 | +// { |
---|
| 268 | +// display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
| 269 | +// display.modelParams6[1] = extparams[0].y / 1000.0f; // noise |
---|
| 270 | +// if (extparams.length > 1) |
---|
| 271 | +// { |
---|
| 272 | +// display.modelParams6[2] = extparams[1].x / 1000.0f; // borderfade |
---|
| 273 | +// display.modelParams6[3] = extparams[1].y / 1000.0f; // (float)Math.exp(-extparams[1].y / 1000.0f); // fog punchthrough |
---|
| 274 | +// if (extparams.length > 2) |
---|
| 275 | +// { |
---|
| 276 | +// display.modelParams7[0] = extparams[2].x / 1000.0f; // noise power |
---|
| 277 | +// float x = extparams[2].y / 1000.0f; |
---|
| 278 | +// //if (x == 0) |
---|
| 279 | +// // x = 1f; |
---|
| 280 | +// display.modelParams7[1] = 1 / x / x / x / x / x / x / x / x / x / x / x / x / x; // (float)Math.pow(-Math.log((extparams[2].y+0.00) / 1000.0f), 1); // opacity power |
---|
| 281 | +// if (extparams[2].y > 0) |
---|
| 282 | +// { |
---|
| 283 | +// //System.out.println("extparams[1].y = " + extparams[1].y); |
---|
| 284 | +// //System.out.println("extparams[2].y = " + extparams[2].y); |
---|
| 285 | +// //System.out.println("opacity power = " + display.modelParams7[1]); |
---|
| 286 | +// } |
---|
| 287 | +// } |
---|
| 288 | +// } |
---|
| 289 | +// } |
---|
| 290 | +// |
---|
| 291 | +// //if (display.modelParams6[2] != 0) |
---|
| 292 | +// /* |
---|
| 293 | +// System.out.println("modelParams0[0] = " + display.modelParams0[0]); |
---|
| 294 | +// System.out.println("modelParams0[1] = " + display.modelParams0[1]); |
---|
| 295 | +// System.out.println("modelParams0[2] = " + display.modelParams0[2]); |
---|
| 296 | +// System.out.println("modelParams0[3] = " + display.modelParams0[3]); |
---|
| 297 | +// System.out.println("modelParams1[0] = " + display.modelParams1[0]); |
---|
| 298 | +// System.out.println("modelParams1[1] = " + display.modelParams1[1]); |
---|
| 299 | +// System.out.println("modelParams1[2] = " + display.modelParams1[2]); |
---|
| 300 | +// System.out.println("modelParams1[3] = " + display.modelParams1[3]); |
---|
| 301 | +// System.out.println("modelParams2[0] = " + display.modelParams2[0]); |
---|
| 302 | +// System.out.println("modelParams2[1] = " + display.modelParams2[1]); |
---|
| 303 | +// System.out.println("modelParams2[2] = " + display.modelParams2[2]); |
---|
| 304 | +// System.out.println("modelParams2[3] = " + display.modelParams2[3]); |
---|
| 305 | +// System.out.println("modelParams3[0] = " + display.modelParams3[0]); |
---|
| 306 | +// System.out.println("modelParams3[1] = " + display.modelParams3[1]); |
---|
| 307 | +// System.out.println("modelParams3[2] = " + display.modelParams3[2]); |
---|
| 308 | +// System.out.println("modelParams3[3] = " + display.modelParams3[3]); |
---|
| 309 | +// System.out.println("modelParams4[0] = " + display.modelParams4[0]); |
---|
| 310 | +// System.out.println("modelParams4[1] = " + display.modelParams4[1]); |
---|
| 311 | +// System.out.println("modelParams4[2] = " + display.modelParams4[2]); |
---|
| 312 | +// System.out.println("modelParams4[3] = " + display.modelParams4[3]); |
---|
| 313 | +// System.out.println("modelParams5[0] = " + display.modelParams5[0]); |
---|
| 314 | +// System.out.println("modelParams5[1] = " + display.modelParams5[1]); |
---|
| 315 | +// System.out.println("modelParams5[2] = " + display.modelParams5[2]); |
---|
| 316 | +// System.out.println("modelParams5[3] = " + display.modelParams5[3]); |
---|
| 317 | +// System.out.println("modelParams6[0] = " + display.modelParams6[0]); |
---|
| 318 | +// System.out.println("modelParams6[1] = " + display.modelParams6[1]); |
---|
| 319 | +// System.out.println("modelParams6[2] = " + display.modelParams6[2]); |
---|
| 320 | +// System.out.println("modelParams6[3] = " + display.modelParams6[3]); |
---|
| 321 | +// System.out.println("modelParams7[0] = " + display.modelParams7[0]); |
---|
| 322 | +// System.out.println("modelParams7[1] = " + display.modelParams7[1]); |
---|
| 323 | +// System.out.println("modelParams7[2] = " + display.modelParams7[2]); |
---|
| 324 | +// System.out.println("modelParams7[3] = " + display.modelParams7[3]); |
---|
| 325 | +// /**/ |
---|
| 326 | +// //assert (display.modelParams6[2] == 0); |
---|
| 327 | +// |
---|
| 328 | +// //System.out.println("noise power = " + display.modelParams7[0]); |
---|
| 329 | +// //System.out.println("shadowbias = " + shadowbias); |
---|
| 330 | +// |
---|
| 331 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 332 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 1, display.modelParams1, 0); |
---|
| 333 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 2, display.modelParams2, 0); |
---|
| 334 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 3, display.modelParams3, 0); |
---|
| 335 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
| 336 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 337 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 6, display.modelParams6, 0); |
---|
| 338 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 7, display.modelParams7, 0); |
---|
| 339 | +// |
---|
| 340 | +// int mode = display.FP_SHADER; |
---|
| 341 | +// |
---|
| 342 | +// if (aniso != anisoV || aniso > 0.002) |
---|
| 343 | +// { |
---|
| 344 | +// mode |= display.FP_ANISO; |
---|
| 345 | +// } |
---|
| 346 | +// |
---|
| 347 | +// display.EnableProgram(mode); |
---|
| 348 | +// |
---|
| 349 | +// //System.out.println("opacity power = " + display.modelParams7[1]); |
---|
| 350 | +// |
---|
| 351 | +// if (!multiply) |
---|
| 352 | +// { |
---|
| 353 | +// if (display.drawMode == CameraPane.SHADOW) |
---|
| 354 | +// gl.glDepthMask(opacity >= 0.9 && display.modelParams7[1] > 0.1); |
---|
| 355 | +// else |
---|
| 356 | +// gl.glDepthMask(opacity >= 0.99); |
---|
| 357 | +// } |
---|
| 358 | +// } |
---|
359 | 359 | |
---|
360 | 360 | float color = 0.5f, modulation /*SATURATION*/ = 0.001f, metalness = 0.001f; |
---|
361 | 361 | float diffuse = 0.75f, specular = 0.25f, shininess = 0.75f, shift = 1; |
---|