Subversion Repositories Kolibri OS

Rev

Rev 5153 | Rev 5256 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5153 Rev 5218
Line 58... Line 58...
58
	mov ecx,[ebx+8] ;ecx = p[2]
58
	mov ecx,[ebx+8] ;ecx = p[2]
59
	mov dword[eax+offs_cont_current_color_material_type],ecx
59
	mov dword[eax+offs_cont_current_color_material_type],ecx
60
	ret
60
	ret
61
endp
61
endp
Line -... Line 62...
-
 
62
 
62
 
63
align 4
63
;void glopLight(GLContext *c,GLParam *p)
-
 
64
;{
64
proc glopLight uses eax ebx ecx edx, context:dword, p:dword
65
;  int light=p[1].i;
65
	mov eax,[context]
-
 
66
	mov ebx,[p]
-
 
67
	mov edx,[ebx+4] ;edx = p[1]
66
;  int type=p[2].i;
68
 
67
;  V4 v;
-
 
68
;  GLLight *l;
-
 
69
;  int i;
69
;  V4 v;
70
;  
70
 
71
;  assert(light >= GL_LIGHT0 && light < GL_LIGHT0+MAX_LIGHTS );
71
;  assert(edx >= GL_LIGHT0 && edx < GL_LIGHT0+MAX_LIGHTS );
72
;
72
 
-
 
73
	sub edx,GL_LIGHT0
-
 
74
	imul edx,sizeof.GLLight
-
 
75
	add edx,eax
73
;  l=&c->lights[light-GL_LIGHT0];
76
	add edx,offs_cont_lights
74
;
77
 
-
 
78
	mov ecx,[ebx+8] ;ecx = p[2]
75
;  for(i=0;i<4;i++) v.v[i]=p[3+i].f;
79
	cmp ecx,GL_AMBIENT
76
;
80
	jne @f
77
;  switch(type) {
81
		mov esi,ebx
-
 
82
		add esi,12
-
 
83
		mov edi,edx
-
 
84
		;add edi,offs_ligh_ambient ;offs_ligh_ambient = 0
78
;  case GL_AMBIENT:
85
		mov ecx,4
79
;    l->ambient=v;
86
		rep movsd ;l.ambient=v
-
 
87
		jmp .end_f
80
;    break;
88
	@@:
-
 
89
	cmp ecx,GL_DIFFUSE
-
 
90
	jne @f
-
 
91
		mov esi,ebx
-
 
92
		add esi,12
-
 
93
		mov edi,edx
-
 
94
		add edi,offs_ligh_diffuse
81
;  case GL_DIFFUSE:
95
		mov ecx,4
82
;    l->diffuse=v;
96
		rep movsd ;l.diffuse=v
-
 
97
		jmp .end_f
83
;    break;
98
	@@:
-
 
99
	cmp ecx,GL_SPECULAR
-
 
100
	jne @f
-
 
101
		mov esi,ebx
-
 
102
		add esi,12
-
 
103
		mov edi,edx
-
 
104
		add edi,offs_ligh_specular
84
;  case GL_SPECULAR:
105
		mov ecx,4
85
;    l->specular=v;
106
		rep movsd ;l.specular=v
-
 
107
		jmp .end_f
86
;    break;
108
	@@:
-
 
109
	cmp ecx,GL_POSITION
87
;  case GL_POSITION:
110
	jne @f
-
 
111
;    {
88
;    {
112
;  for(i=0;i<4;i++) v.v[i]=p[3+i].f;
89
;      V4 pos;
113
;      V4 pos;
90
;      gl_M4_MulV4(&pos,c->matrix_stack_ptr[0],&v);
114
;      gl_M4_MulV4(&pos,c->matrix_stack_ptr[0],&v);
91
;
115
;
92
;      l->position=pos;
116
;      l->position=pos;
Line 97... Line 121...
97
;        l->norm_position.Z=pos.Z;
121
;        l->norm_position.Z=pos.Z;
98
;        
122
;        
99
;        gl_V3_Norm(&l->norm_position);
123
;        gl_V3_Norm(&l->norm_position);
100
;      }
124
;      }
101
;    }
125
;    }
102
;    break;
126
		jmp .end_f
-
 
127
	@@:
103
;  case GL_SPOT_DIRECTION:
128
	cmp ecx,GL_SPOT_DIRECTION
-
 
129
	jne @f
-
 
130
		mov esi,ebx
-
 
131
		add esi,12
-
 
132
		mov edi,edx
104
;    for(i=0;i<3;i++) {
133
		add edi,offs_ligh_spot_direction
-
 
134
		mov ecx,3
105
;      l->spot_direction.v[i]=v.v[i];
135
		rep movsd ;l.spot_direction=v[0,1,2]
-
 
136
		mov esi,ebx
-
 
137
		add esi,12
-
 
138
		mov edi,edx
106
;      l->norm_spot_direction.v[i]=v.v[i];
139
		add edi,offs_ligh_norm_spot_direction
107
;    }
140
		mov ecx,3
-
 
141
		rep movsd ;l.norm_spot_direction=v[0,1,2]
108
;    gl_V3_Norm(&l->norm_spot_direction);
142
		add edx,offs_ligh_norm_spot_direction
-
 
143
		stdcall gl_V3_Norm,edx
109
;    break;
144
		jmp .end_f
-
 
145
	@@:
110
;  case GL_SPOT_EXPONENT:
146
	cmp ecx,GL_SPOT_EXPONENT
-
 
147
	jne @f
-
 
148
		mov ecx,[ebx+12]
111
;    l->spot_exponent=v.v[0];
149
		mov [edi+offs_ligh_spot_exponent],ecx ;l.spot_exponent=p[3]
112
;    break;
150
		jmp .end_f
-
 
151
	@@:
113
;  case GL_SPOT_CUTOFF:
152
	cmp ecx,GL_SPOT_CUTOFF
-
 
153
	jne @f
114
;    {
154
;    {
115
;      float a=v.v[0];
155
;      float a=v.v[0];
116
;      assert(a == 180 || (a>=0 && a<=90));
156
;      assert(a == 180 || (a>=0 && a<=90));
117
;      l->spot_cutoff=a;
157
;      l->spot_cutoff=a;
118
;      if (a != 180) l->cos_spot_cutoff=cos(a * M_PI / 180.0);
158
;      if (a != 180) l->cos_spot_cutoff=cos(a * M_PI / 180.0);
119
;    }
159
;    }
120
;    break;
160
		jmp .end_f
-
 
161
	@@:
121
;  case GL_CONSTANT_ATTENUATION:
162
	cmp ecx,GL_CONSTANT_ATTENUATION
-
 
163
		mov ecx,[ebx+12]
122
;    l->attenuation[0]=v.v[0];
164
		mov [edi+offs_ligh_attenuation],ecx ;l->attenuation[0]=p[3]
123
;    break;
165
		jmp .end_f
-
 
166
	@@:
124
;  case GL_LINEAR_ATTENUATION:
167
	cmp ecx,GL_LINEAR_ATTENUATION
-
 
168
		mov ecx,[ebx+12]
125
;    l->attenuation[1]=v.v[0];
169
		mov [edi+offs_ligh_attenuation+4],ecx ;l->attenuation[1]=p[3]
126
;    break;
170
		jmp .end_f
-
 
171
	@@:
127
;  case GL_QUADRATIC_ATTENUATION:
172
	cmp ecx,GL_QUADRATIC_ATTENUATION
-
 
173
		mov ecx,[ebx+12]
128
;    l->attenuation[2]=v.v[0];
174
		mov [edi+offs_ligh_attenuation+8],ecx ;l->attenuation[2]=p[3]
129
;    break;
175
		jmp .end_f
130
;  default:
176
	@@: ;default:
131
;    assert(0);
177
;    assert(0);
-
 
178
	.end_f:
-
 
179
	ret
132
;  }
180
endp
133
;}
181
 
Line 134... Line 182...
134
  
182
  
135
align 4
183
align 4
136
proc glopLightModel uses ebx ecx esi edi, context:dword, p:dword
184
proc glopLightModel uses ebx ecx esi edi, context:dword, p:dword
137
	mov edi,[context]
185
	mov edi,[context]