Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6522 → Rev 6523

/programs/develop/libraries/TinyGL/asm_fork/init.asm
4,9 → 4,9
mov ebx,[context]
 
stdcall gl_zalloc, 4*MAX_DISPLAY_LISTS
mov [ebx+offs_cont_shared_state],eax ;...lists=gl_zalloc(...)
mov [ebx+GLContext.shared_state],eax ;...lists=gl_zalloc(...)
stdcall gl_zalloc, 4*TEXTURE_HASH_TABLE_SIZE
mov [ebx+offs_cont_shared_state+4],eax ;...texture_hash_table=gl_zalloc(...)
mov [ebx+GLContext.shared_state+4],eax ;...texture_hash_table=gl_zalloc(...)
 
stdcall alloc_texture, [context],0
ret
19,8 → 19,8
; for(i=0;i<MAX_DISPLAY_LISTS;i++) {
; /* TODO */
; }
stdcall gl_free, dword[ebx+offs_cont_shared_state] ;lists
stdcall gl_free, dword[ebx+offs_cont_shared_state+4] ;texture_hash_table
stdcall gl_free, dword[ebx+GLContext.shared_state] ;lists
stdcall gl_free, dword[ebx+GLContext.shared_state+4] ;texture_hash_table
ret
endp
 
31,37 → 31,37
mov edx,eax
 
mov ecx,[zbuffer1]
mov dword[edx+offs_cont_zb],ecx
mov dword[edx+GLContext.zb],ecx
 
; allocate GLVertex array
mov dword[edx+offs_cont_vertex_max],POLYGON_MAX_VERTEX
mov dword[edx+GLContext.vertex_max],POLYGON_MAX_VERTEX
stdcall gl_malloc, POLYGON_MAX_VERTEX*sizeof.GLVertex
mov dword[edx+offs_cont_vertex],eax
mov dword[edx+GLContext.vertex],eax
 
; viewport
xor eax,eax
mov dword[edx+offs_cont_viewport+offs_vpor_xmin],eax
mov dword[edx+offs_cont_viewport+offs_vpor_ymin],eax
mov dword[edx+GLContext.viewport+offs_vpor_xmin],eax
mov dword[edx+GLContext.viewport+offs_vpor_ymin],eax
mov eax,[ecx+offs_zbuf_xsize]
mov dword[edx+offs_cont_viewport+offs_vpor_xsize],eax
mov dword[edx+GLContext.viewport+offs_vpor_xsize],eax
mov eax,[ecx+offs_zbuf_ysize]
mov dword[edx+offs_cont_viewport+offs_vpor_ysize],eax
mov dword[edx+offs_cont_viewport+offs_vpor_updated],1
mov dword[edx+GLContext.viewport+offs_vpor_ysize],eax
mov dword[edx+GLContext.viewport+offs_vpor_updated],1
 
; shared state
stdcall initSharedState,edx
 
; lists
mov dword[edx+offs_cont_exec_flag],1
mov dword[edx+offs_cont_compile_flag],0
mov dword[edx+offs_cont_print_flag],0
mov dword[edx+GLContext.exec_flag],1
mov dword[edx+GLContext.compile_flag],0
mov dword[edx+GLContext.print_flag],0
 
mov dword[edx+offs_cont_in_begin],0
mov dword[edx+GLContext.in_begin],0
 
; lights
mov ecx,MAX_LIGHTS
mov eax,edx
add eax,offs_cont_lights
add eax,GLContext.lights
.cycle_0:
gl_V4_New eax+offs_ligh_ambient, 0.0,0.0,0.0,1.0
gl_V4_New eax+offs_ligh_diffuse, 1.0,1.0,1.0,1.0
79,16 → 79,16
cmp ecx,0
jg .cycle_0
 
mov dword[edx+offs_cont_first_light],0 ;NULL
gl_V4_New edx+offs_cont_ambient_light_model, 0.2,0.2,0.2,1.0
mov dword[edx+offs_cont_local_light_model],0
mov dword[edx+offs_cont_lighting_enabled],0
mov dword[edx+offs_cont_light_model_two_side],0
mov dword[edx+GLContext.first_light],0 ;NULL
gl_V4_New edx+GLContext.ambient_light_model, 0.2,0.2,0.2,1.0
mov dword[edx+GLContext.local_light_model],0
mov dword[edx+GLContext.lighting_enabled],0
mov dword[edx+GLContext.light_model_two_side],0
 
; default materials
mov ecx,2 ;for(i=0;i<2;i++)
mov eax,edx
add eax,offs_cont_materials
add eax,GLContext.materials
@@:
gl_V4_New eax+offs_mate_emission, 0.0,0.0,0.0,1.0
gl_V4_New eax+offs_mate_ambient, 0.2,0.2,0.2,1.0
98,54 → 98,54
add eax,sizeof.GLMaterial
loop @b
 
mov dword[edx+offs_cont_current_color_material_mode],GL_FRONT_AND_BACK
mov dword[edx+offs_cont_current_color_material_type],GL_AMBIENT_AND_DIFFUSE
mov dword[edx+offs_cont_color_material_enabled],0
mov dword[edx+GLContext.current_color_material_mode],GL_FRONT_AND_BACK
mov dword[edx+GLContext.current_color_material_type],GL_AMBIENT_AND_DIFFUSE
mov dword[edx+GLContext.color_material_enabled],0
 
; textures
stdcall glInitTextures,edx
 
; default state
gl_V4_New edx+offs_cont_current_color, 1.0,1.0,1.0,1.0
gl_V3_New edx+offs_cont_longcurrent_color, 65535,65535,65535
gl_V4_New edx+GLContext.current_color, 1.0,1.0,1.0,1.0
gl_V3_New edx+GLContext.longcurrent_color, 65535,65535,65535
 
gl_V4_New edx+offs_cont_current_normal, 1.0,0.0,0.0,0.0
gl_V4_New edx+GLContext.current_normal, 1.0,0.0,0.0,0.0
 
mov dword[edx+offs_cont_current_edge_flag],1
mov dword[edx+GLContext.current_edge_flag],1
gl_V4_New edx+offs_cont_current_tex_coord, 0.0,0.0,0.0,1.0
gl_V4_New edx+GLContext.current_tex_coord, 0.0,0.0,0.0,1.0
 
mov dword[edx+offs_cont_polygon_mode_front],GL_FILL
mov dword[edx+offs_cont_polygon_mode_back],GL_FILL
mov dword[edx+GLContext.polygon_mode_front],GL_FILL
mov dword[edx+GLContext.polygon_mode_back],GL_FILL
 
mov dword[edx+offs_cont_current_front_face],0 ;0 = GL_CCW 1 = GL_CW
mov dword[edx+offs_cont_current_cull_face],GL_BACK
mov dword[edx+offs_cont_current_shade_model],GL_SMOOTH
mov dword[edx+offs_cont_cull_face_enabled],0
mov dword[edx+GLContext.current_front_face],0 ;0 = GL_CCW 1 = GL_CW
mov dword[edx+GLContext.current_cull_face],GL_BACK
mov dword[edx+GLContext.current_shade_model],GL_SMOOTH
mov dword[edx+GLContext.cull_face_enabled],0
; clear
gl_V4_New edx+offs_cont_clear_color, 0.0,0.0,0.0,0.0
mov dword[edx+offs_cont_clear_depth],0
gl_V4_New edx+GLContext.clear_color, 0.0,0.0,0.0,0.0
mov dword[edx+GLContext.clear_depth],0
 
; selection
mov dword[edx+offs_cont_render_mode],GL_RENDER
mov dword[edx+offs_cont_select_buffer],0 ;NULL
mov dword[edx+offs_cont_name_stack_size],0
mov dword[edx+GLContext.render_mode],GL_RENDER
mov dword[edx+GLContext.select_buffer],0 ;NULL
mov dword[edx+GLContext.name_stack_size],0
 
; matrix
mov dword[edx+offs_cont_matrix_mode],0
mov dword[edx+GLContext.matrix_mode],0
 
gl_V3_New edx+offs_cont_matrix_stack_depth_max,\
gl_V3_New edx+GLContext.matrix_stack_depth_max,\
MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH
 
mov ecx,3 ;for(i=0;i<3;i++)
mov ebx,edx
@@:
mov edi,[ebx+offs_cont_matrix_stack_depth_max]
mov edi,[ebx+GLContext.matrix_stack_depth_max]
shl edi,6 ;вместо imul edi,sizeof(M4)
stdcall gl_zalloc,edi
mov [ebx+offs_cont_matrix_stack],eax
mov [ebx+offs_cont_matrix_stack_ptr],eax
mov [ebx+GLContext.matrix_stack],eax
mov [ebx+GLContext.matrix_stack_ptr],eax
add ebx,4
loop @b
 
156,24 → 156,24
stdcall glMatrixMode,GL_MODELVIEW
call glLoadIdentity
 
mov dword[edx+offs_cont_matrix_model_projection_updated],1
mov dword[edx+GLContext.matrix_model_projection_updated],1
 
; opengl 1.1 arrays
mov dword[edx+offs_cont_client_states],0
mov dword[edx+GLContext.client_states],0
; opengl 1.1 polygon offset
mov dword[edx+offs_cont_offset_states],0
mov dword[edx+GLContext.offset_states],0
; clear the resize callback function pointer
mov dword[edx+offs_cont_gl_resize_viewport],0 ;NULL
mov dword[edx+GLContext.gl_resize_viewport],0 ;NULL
; specular buffer
mov dword[edx+offs_cont_specbuf_first],0 ;NULL
mov dword[edx+offs_cont_specbuf_used_counter],0
mov dword[edx+offs_cont_specbuf_num_buffers],0
mov dword[edx+GLContext.specbuf_first],0 ;NULL
mov dword[edx+GLContext.specbuf_used_counter],0
mov dword[edx+GLContext.specbuf_num_buffers],0
 
; depth test
mov dword[edx+offs_cont_depth_test],0
mov dword[edx+GLContext.depth_test],0
 
ret
endp