Rev 6243 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6243 | Rev 6523 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | add edi,12 |
15 | add edi,12 |
16 | stdcall glopMaterial,eax,edi |
16 | stdcall glopMaterial,eax,edi |
17 | mov ecx,GL_BACK |
17 | mov ecx,GL_BACK |
18 | @@: |
18 | @@: |
19 | mov edi,eax |
19 | mov edi,eax |
20 | add edi,offs_cont_materials |
20 | add edi,GLContext.materials |
21 | cmp ecx,GL_FRONT ;if (mode == GL_FRONT) m=&context.materials[0] |
21 | cmp ecx,GL_FRONT ;if (mode == GL_FRONT) m=&context.materials[0] |
22 | je @f |
22 | je @f |
23 | add edi,sizeof.GLMaterial ;else m=&context.materials[1] |
23 | add edi,sizeof.GLMaterial ;else m=&context.materials[1] |
24 | @@: |
24 | @@: |
Line 86... | Line 86... | ||
86 | align 4 |
86 | align 4 |
87 | proc glopColorMaterial uses eax ebx ecx, context:dword, p:dword |
87 | proc glopColorMaterial uses eax ebx ecx, context:dword, p:dword |
88 | mov eax,[context] |
88 | mov eax,[context] |
89 | mov ebx,[p] |
89 | mov ebx,[p] |
90 | mov ecx,[ebx+4] ;ecx = p[1] |
90 | mov ecx,[ebx+4] ;ecx = p[1] |
91 | mov dword[eax+offs_cont_current_color_material_mode],ecx |
91 | mov dword[eax+GLContext.current_color_material_mode],ecx |
92 | mov ecx,[ebx+8] ;ecx = p[2] |
92 | mov ecx,[ebx+8] ;ecx = p[2] |
93 | mov dword[eax+offs_cont_current_color_material_type],ecx |
93 | mov dword[eax+GLContext.current_color_material_type],ecx |
94 | ret |
94 | ret |
95 | endp |
95 | endp |
Line 96... | Line 96... | ||
96 | 96 | ||
97 | align 4 |
97 | align 4 |
Line 107... | Line 107... | ||
107 | ; assert(edx >= GL_LIGHT0 && edx < GL_LIGHT0+MAX_LIGHTS ); |
107 | ; assert(edx >= GL_LIGHT0 && edx < GL_LIGHT0+MAX_LIGHTS ); |
Line 108... | Line 108... | ||
108 | 108 | ||
109 | sub edx,GL_LIGHT0 |
109 | sub edx,GL_LIGHT0 |
110 | imul edx,sizeof.GLLight |
110 | imul edx,sizeof.GLLight |
111 | add edx,eax |
111 | add edx,eax |
Line 112... | Line 112... | ||
112 | add edx,offs_cont_lights |
112 | add edx,GLContext.lights |
113 | 113 | ||
114 | mov ecx,[ebx+8] ;ecx = p[2] |
114 | mov ecx,[ebx+8] ;ecx = p[2] |
115 | cmp ecx,GL_AMBIENT |
115 | cmp ecx,GL_AMBIENT |
Line 149... | Line 149... | ||
149 | jne @f |
149 | jne @f |
150 | mov edi,ebx ;ebx = [ebp+12] = [p] = &p[0] |
150 | mov edi,ebx ;ebx = [ebp+12] = [p] = &p[0] |
151 | add edi,12 ;&p[3] |
151 | add edi,12 ;&p[3] |
152 | mov esi,ebp |
152 | mov esi,ebp |
153 | sub esi,16 ;&pos |
153 | sub esi,16 ;&pos |
154 | stdcall gl_M4_MulV4, esi,dword[eax+offs_cont_matrix_stack_ptr],edi |
154 | stdcall gl_M4_MulV4, esi,dword[eax+GLContext.matrix_stack_ptr],edi |
155 | mov edi,edx |
155 | mov edi,edx |
156 | add edi,offs_ligh_position |
156 | add edi,offs_ligh_position |
157 | mov ecx,4 |
157 | mov ecx,4 |
158 | rep movsd ;l.position=pos |
158 | rep movsd ;l.position=pos |
Line 265... | Line 265... | ||
265 | add esi,8 ;&p[2] |
265 | add esi,8 ;&p[2] |
Line 266... | Line 266... | ||
266 | 266 | ||
267 | cmp ebx,GL_LIGHT_MODEL_AMBIENT |
267 | cmp ebx,GL_LIGHT_MODEL_AMBIENT |
268 | jne @f |
268 | jne @f |
269 | mov ecx,4 |
269 | mov ecx,4 |
270 | add edi,offs_cont_ambient_light_model |
270 | add edi,GLContext.ambient_light_model |
271 | rep movsd ;for(i=0;i<4;i++) context.ambient_light_model.v[i]=v[i] |
271 | rep movsd ;for(i=0;i<4;i++) context.ambient_light_model.v[i]=v[i] |
272 | jmp .end_f |
272 | jmp .end_f |
273 | align 4 |
273 | align 4 |
274 | @@: |
274 | @@: |
275 | cmp ebx,GL_LIGHT_MODEL_LOCAL_VIEWER |
275 | cmp ebx,GL_LIGHT_MODEL_LOCAL_VIEWER |
276 | jne @f |
276 | jne @f |
277 | fld dword[esi] ;st0 = p[2] |
277 | fld dword[esi] ;st0 = p[2] |
278 | fistp dword[edi+offs_cont_local_light_model] |
278 | fistp dword[edi+GLContext.local_light_model] |
279 | jmp .end_f |
279 | jmp .end_f |
280 | align 4 |
280 | align 4 |
281 | @@: |
281 | @@: |
282 | cmp ebx,GL_LIGHT_MODEL_TWO_SIDE |
282 | cmp ebx,GL_LIGHT_MODEL_TWO_SIDE |
283 | jne @f |
283 | jne @f |
284 | fld dword[esi] ;st0 = p[2] |
284 | fld dword[esi] ;st0 = p[2] |
285 | fistp dword[edi+offs_cont_light_model_two_side] |
285 | fistp dword[edi+GLContext.light_model_two_side] |
286 | jmp .end_f |
286 | jmp .end_f |
287 | align 4 |
287 | align 4 |
288 | @@: ;default: |
288 | @@: ;default: |
289 | ; tgl_warning("glopLightModel: illegal pname: 0x%x\n", ebx); |
289 | ; tgl_warning("glopLightModel: illegal pname: 0x%x\n", ebx); |
Line 325... | Line 325... | ||
325 | proc gl_enable_disable_light uses eax ebx ecx, context:dword, light:dword, v:dword |
325 | proc gl_enable_disable_light uses eax ebx ecx, context:dword, light:dword, v:dword |
326 | mov eax,[context] |
326 | mov eax,[context] |
327 | mov ebx,[light] |
327 | mov ebx,[light] |
328 | imul ebx,sizeof.GLLight |
328 | imul ebx,sizeof.GLLight |
329 | add ebx,eax |
329 | add ebx,eax |
330 | add ebx,offs_cont_lights |
330 | add ebx,GLContext.lights |
Line 331... | Line 331... | ||
331 | 331 | ||
332 | xor ecx,ecx |
332 | xor ecx,ecx |
333 | cmp dword[ebx+offs_ligh_enabled],0 |
333 | cmp dword[ebx+offs_ligh_enabled],0 |
334 | jne @f |
334 | jne @f |
Line 337... | Line 337... | ||
337 | and ecx,[v] |
337 | and ecx,[v] |
338 | or ecx,ecx |
338 | or ecx,ecx |
339 | jz @f |
339 | jz @f |
340 | ;if (v && !l.enabled) |
340 | ;if (v && !l.enabled) |
341 | mov dword[ebx+offs_ligh_enabled],1 |
341 | mov dword[ebx+offs_ligh_enabled],1 |
342 | mov ecx,[eax+offs_cont_first_light] |
342 | mov ecx,[eax+GLContext.first_light] |
343 | mov [ebx+offs_ligh_next],ecx |
343 | mov [ebx+offs_ligh_next],ecx |
344 | mov [eax+offs_cont_first_light],ebx ;context.first_light = l |
344 | mov [eax+GLContext.first_light],ebx ;context.first_light = l |
345 | mov dword[ebx+offs_ligh_prev],0 ;l.prev = NULL |
345 | mov dword[ebx+offs_ligh_prev],0 ;l.prev = NULL |
346 | jmp .end_f |
346 | jmp .end_f |
347 | align 4 |
347 | align 4 |
348 | @@: |
348 | @@: |
349 | xor ecx,ecx |
349 | xor ecx,ecx |
Line 357... | Line 357... | ||
357 | ;else if (!v && l.enabled) |
357 | ;else if (!v && l.enabled) |
358 | mov dword[ebx+offs_ligh_enabled],0 ;l.enabled = 0 |
358 | mov dword[ebx+offs_ligh_enabled],0 ;l.enabled = 0 |
359 | mov ecx,[ebx+offs_ligh_next] |
359 | mov ecx,[ebx+offs_ligh_next] |
360 | cmp dword[ebx+offs_ligh_prev],0 ;if (l.prev == NULL) |
360 | cmp dword[ebx+offs_ligh_prev],0 ;if (l.prev == NULL) |
361 | jne .els_0 |
361 | jne .els_0 |
362 | mov [eax+offs_cont_first_light],ecx ;context.first_light = l.next |
362 | mov [eax+GLContext.first_light],ecx ;context.first_light = l.next |
363 | jmp @f |
363 | jmp @f |
364 | align 4 |
364 | align 4 |
365 | .els_0: |
365 | .els_0: |
366 | mov eax,[ebx+offs_ligh_prev] |
366 | mov eax,[ebx+offs_ligh_prev] |
367 | mov [eax+offs_ligh_next],ecx ;l.prev.next = l.next |
367 | mov [eax+offs_ligh_next],ecx ;l.prev.next = l.next |
Line 414... | Line 414... | ||
414 | ;dot_spec = n*s |
414 | ;dot_spec = n*s |
Line 415... | Line 415... | ||
415 | 415 | ||
416 | mov esi,[v] |
416 | mov esi,[v] |
417 | mov edx,[context] |
417 | mov edx,[context] |
418 | mov ecx,edx |
418 | mov ecx,edx |
419 | add ecx,offs_cont_materials ;ecx(m) = &context.materials[0] |
419 | add ecx,GLContext.materials ;ecx(m) = &context.materials[0] |
420 | mov eax,[edx+offs_cont_light_model_two_side] |
420 | mov eax,[edx+GLContext.light_model_two_side] |
Line 421... | Line 421... | ||
421 | mov [twoside],eax |
421 | mov [twoside],eax |
422 | 422 | ||
423 | add esi,offs_vert_normal |
423 | add esi,offs_vert_normal |
424 | mov edi,ebp |
424 | mov edi,ebp |
425 | sub edi,24 ;edi = &n |
425 | sub edi,24 ;edi = &n |
426 | movsd ;n.X=v.normal.X |
426 | movsd ;n.X=v.normal.X |
427 | movsd ;n.Y=v.normal.Y |
427 | movsd ;n.Y=v.normal.Y |
Line 428... | Line 428... | ||
428 | movsd ;n.Z=v.normal.Z |
428 | movsd ;n.Z=v.normal.Z |
429 | mov esi,[v] |
429 | mov esi,[v] |
430 | 430 | ||
431 | fld dword[edx+offs_cont_ambient_light_model] |
431 | fld dword[edx+GLContext.ambient_light_model] |
432 | fmul dword[ecx+offs_mate_ambient] |
432 | fmul dword[ecx+offs_mate_ambient] |
433 | fadd dword[ecx] ;offs_mate_emission=0 |
433 | fadd dword[ecx] ;offs_mate_emission=0 |
434 | fstp dword[R] ;R=m.emission.v[0]+m.ambient.v[0]*context.ambient_light_model.v[0] |
434 | fstp dword[R] ;R=m.emission.v[0]+m.ambient.v[0]*context.ambient_light_model.v[0] |
435 | fld dword[edx+offs_cont_ambient_light_model+4] |
435 | fld dword[edx+GLContext.ambient_light_model+4] |
436 | fmul dword[ecx+offs_mate_ambient+4] |
436 | fmul dword[ecx+offs_mate_ambient+4] |
437 | fadd dword[ecx+offs_mate_emission+4] |
437 | fadd dword[ecx+offs_mate_emission+4] |
438 | fstp dword[G] |
438 | fstp dword[G] |
439 | fld dword[edx+offs_cont_ambient_light_model+8] |
439 | fld dword[edx+GLContext.ambient_light_model+8] |
440 | fmul dword[ecx+offs_mate_ambient+8] |
440 | fmul dword[ecx+offs_mate_ambient+8] |
441 | fadd dword[ecx+offs_mate_emission+8] |
441 | fadd dword[ecx+offs_mate_emission+8] |
Line 442... | Line 442... | ||
442 | fstp dword[B] |
442 | fstp dword[B] |
443 | clampf [ecx+offs_mate_diffuse+12],0,1 |
443 | clampf [ecx+offs_mate_diffuse+12],0,1 |
444 | mov [A],eax ;A=clampf(m.diffuse.v[3],0,1) |
444 | mov [A],eax ;A=clampf(m.diffuse.v[3],0,1) |
445 | 445 | ||
Line 446... | Line 446... | ||
446 | mov ebx,[edx+offs_cont_first_light] |
446 | mov ebx,[edx+GLContext.first_light] |
Line 635... | Line 635... | ||
635 | ffree st0 ;dot_spot |
635 | ffree st0 ;dot_spot |
636 | fincstp |
636 | fincstp |
637 | .if1_end: |
637 | .if1_end: |
Line 638... | Line 638... | ||
638 | 638 | ||
639 | ; specular light |
639 | ; specular light |
640 | cmp dword[edx+offs_cont_local_light_model],0 ;if (c.local_light_model) |
640 | cmp dword[edx+GLContext.local_light_model],0 ;if (c.local_light_model) |
641 | je .els_2 |
641 | je .els_2 |
642 | mov eax,[esi+offs_vert_ec] |
642 | mov eax,[esi+offs_vert_ec] |
643 | mov [vcoord],eax ;vcoord.X=v.ec.X |
643 | mov [vcoord],eax ;vcoord.X=v.ec.X |
644 | mov eax,[esi+offs_vert_ec+offs_Y] |
644 | mov eax,[esi+offs_vert_ec+offs_Y] |