Skip to content

Commit

Permalink
Updated c_rasterizer enums
Browse files Browse the repository at this point in the history
  • Loading branch information
twist84 committed Dec 23, 2024
1 parent 6efbfdd commit 94efec0
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 206 deletions.
44 changes: 22 additions & 22 deletions game/source/rasterizer/dx9/rasterizer_dx9_dynamic_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,47 +47,47 @@ void __cdecl c_rasterizer::draw_debug_line(real_point3d const& p0, real_point3d
point_list[1].point = p1;
point_list[1].color.value = color1;

if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_explicit_shader_debug))
if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_shader_debug))
{
set_cull_mode(_cull_mode_none);
set_z_buffer_mode(_z_buffer_mode_unknown1);
set_z_buffer_mode(_z_buffer_mode_read);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_line_list, 1, point_list, sizeof(rasterizer_vertex_debug));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}
}

void __cdecl c_rasterizer::draw_debug_line_list2d_explicit(rasterizer_vertex_debug const* vertex_debug, long primitive_count)
{
INVOKE(0x00A458B0, draw_debug_line_list2d_explicit, vertex_debug, primitive_count);

//if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_explicit_shader_debug2d))
//if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_shader_debug2d))
//{
// real_vector4d constants[1]
// {
// { 1.0f, 1.0f, 1.0f, 1.0f }
// };
//
// set_cull_mode(_cull_mode_none);
// set_z_buffer_mode(_z_buffer_mode_unknown2);
// set_z_buffer_mode(_z_buffer_mode_off);
// set_pixel_shader_constant(1, NUMBEROF(constants), constants);
// set_indices(NULL);
// draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_line_list, primitive_count, vertex_debug, sizeof(rasterizer_vertex_debug));
// set_cull_mode(_cull_mode_clockwise);
// set_cull_mode(_cull_mode_cw);
//}
}

void __cdecl c_rasterizer::draw_debug_line_list_explicit(rasterizer_vertex_debug const* vertex_debug, long primitive_count)
{
//INVOKE(0x00A45920, draw_debug_line_list_explicit, vertex_debug, primitive_count);

if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_explicit_shader_debug))
if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_shader_debug))
{
set_cull_mode(_cull_mode_none);
set_z_buffer_mode(_z_buffer_mode_unknown1);
set_z_buffer_mode(_z_buffer_mode_read);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_line_list, primitive_count, vertex_debug, sizeof(rasterizer_vertex_debug));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}
}

Expand All @@ -100,13 +100,13 @@ void __cdecl c_rasterizer::draw_debug_polygon2d(rasterizer_vertex_debug const* p
{
//INVOKE(0x00A45B40, draw_debug_polygon2d, polygon2d, primitive_count, primitive_type);

if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_explicit_shader_debug2d))
if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_shader_debug2d))
{
set_cull_mode(_cull_mode_none);
set_z_buffer_mode(_z_buffer_mode_unknown2);
set_z_buffer_mode(_z_buffer_mode_off);
set_indices(NULL);
draw_primitive_up(primitive_type, primitive_count, polygon2d, sizeof(rasterizer_vertex_debug));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}
}

Expand All @@ -116,13 +116,13 @@ void __cdecl c_rasterizer::draw_debug_polygon(rasterizer_vertex_debug const* pol

if (primitive_count > 0)
{
if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_explicit_shader_debug))
if (rasterizer_set_explicit_debug_shader(c_rasterizer_globals::_shader_debug))
{
set_cull_mode(_cull_mode_none);
set_z_buffer_mode(_z_buffer_mode_unknown1);
set_z_buffer_mode(_z_buffer_mode_read);
set_indices(NULL);
draw_primitive_up(primitive_type, primitive_count, polygon, sizeof(rasterizer_vertex_debug));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}
}
}
Expand Down Expand Up @@ -163,7 +163,7 @@ void __cdecl c_rasterizer::draw_fullscreen_quad(int width, int height)
set_cull_mode(_cull_mode_none);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_triangle_strip, 2, triangle_fan, sizeof(rasterizer_vertex_screen));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}

void __cdecl draw_tesselated_quad()
Expand Down Expand Up @@ -199,7 +199,7 @@ void __cdecl draw_tesselated_quad()
c_rasterizer::set_cull_mode(c_rasterizer::e_cull_mode::_cull_mode_none);
c_rasterizer::set_indices(NULL);
c_rasterizer::draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_triangle_strip, 2, triangle_fan, sizeof(rasterizer_vertex_screen));
c_rasterizer::set_cull_mode(c_rasterizer::e_cull_mode::_cull_mode_clockwise);
c_rasterizer::set_cull_mode(c_rasterizer::e_cull_mode::_cull_mode_cw);
}

void __cdecl c_rasterizer::draw_fullscreen_quad_with_texture_xform(int width, int height, real_rectangle2d const* bounds)
Expand Down Expand Up @@ -238,7 +238,7 @@ void __cdecl c_rasterizer::draw_fullscreen_quad_with_texture_xform(int width, in
set_cull_mode(_cull_mode_none);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_triangle_strip, 2, triangle_fan, sizeof(rasterizer_vertex_screen));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}

//.text:00A461B0
Expand Down Expand Up @@ -277,7 +277,7 @@ void __cdecl c_rasterizer::draw_textured_screen_quad(real a1, real a2, real a3,
set_cull_mode(_cull_mode_none);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_triangle_strip, 2, triangle_fan, sizeof(rasterizer_vertex_screen));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}

void __cdecl c_rasterizer::draw_textured_screen_quad(rasterizer_vertex_screen const* textured_screen_quad, bool a2)
Expand All @@ -290,10 +290,10 @@ void __cdecl c_rasterizer::draw_textured_screen_triangle_list(rasterizer_vertex_
//INVOKE(0x00A46640, draw_textured_screen_triangle_list, textured_screen_triangle_list, primitive_count);

set_cull_mode(_cull_mode_none);
set_z_buffer_mode(_z_buffer_mode_unknown2);
set_z_buffer_mode(_z_buffer_mode_off);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_triangle_list, primitive_count, textured_screen_triangle_list, sizeof(rasterizer_vertex_screen));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}

void __cdecl c_rasterizer::draw_textured_transparent_polygon(rasterizer_vertex_transparent const* textured_transparent_polygon, long polygon_count, e_alpha_blend_mode alpha_blend_mode)
Expand Down Expand Up @@ -325,7 +325,7 @@ void __cdecl c_rasterizer::draw_worldspace_polygon(rasterizer_vertex_world const
set_cull_mode(_cull_mode_none);
set_indices(NULL);
draw_primitive_up(c_rasterizer_index_buffer::_primitive_type_triangle_fan, polygon_count - 2, worldspace_polygon, sizeof(rasterizer_vertex_world));
set_cull_mode(_cull_mode_clockwise);
set_cull_mode(_cull_mode_cw);
}

void __cdecl rasterizer_quad_screenspace(int16_point2d const(&points)[4], dword color, s_tag_reference const* reference, short bitmap_index, bool a5)
Expand Down
34 changes: 17 additions & 17 deletions game/source/rasterizer/rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ bool __cdecl c_rasterizer::end_albedo(short_rectangle2d const* bounds)

c_screen_postprocess::setup_rasterizer_for_postprocess(true);
c_screen_postprocess::copy(
c_rasterizer_globals::_explicit_shader_copy_surface,
c_rasterizer_globals::_shader_copy_scaled,
surface,
c_rasterizer::_surface_disable,
c_rasterizer::_sampler_filter_mode_unknown1,
c_rasterizer::_sampler_filter_mode_point,
c_rasterizer::_sampler_address_clamp,
1.0f,
1.0f,
Expand Down Expand Up @@ -1049,9 +1049,9 @@ void __cdecl c_rasterizer::initialize_window()
ERROR_EVENT("failed to create a window");
}

c_rasterizer::e_gpr_allocation __cdecl c_rasterizer::set_gprs_allocation(e_gpr_allocation a1)
c_rasterizer::e_gpr_allocation __cdecl c_rasterizer::set_gprs_allocation(e_gpr_allocation type)
{
return INVOKE(0x00A228C0, c_rasterizer::set_gprs_allocation, a1);
return INVOKE(0x00A228C0, c_rasterizer::set_gprs_allocation, type);
}

void __cdecl c_rasterizer::clear_sampler_textures(dword a1)
Expand Down Expand Up @@ -1252,36 +1252,36 @@ void __cdecl c_rasterizer::set_separate_alpha_blend_mode(e_separate_alpha_blend_
//
//switch (separate_alpha_blend_mode)
//{
//case _separate_alpha_blend_mode_unknown0:
//case _separate_alpha_blend_off:
//{
// g_device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
//}
//break;
//case _separate_alpha_blend_mode_unknown1:
//case _separate_alpha_blend_opaque:
//{
// g_device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
// g_device->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLEND_ZERO);
// g_device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
// g_device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ZERO);
//}
//break;
//case _separate_alpha_blend_mode_unknown2:
//case _separate_alpha_blend_additive:
//{
// g_device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
// g_device->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLEND_ZERO);
// g_device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
// g_device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ONE);
//}
//break;
//case _separate_alpha_blend_mode_unknown3:
//case _separate_alpha_blend_multiply:
//{
// g_device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
// g_device->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLEND_ZERO);
// g_device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_DESTALPHA);
// g_device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ZERO);
//}
//break;
//case _separate_alpha_blend_mode_unknown4:
//case _separate_alpha_blend_to_constant:
//{
// g_device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
// g_device->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLEND_ZERO);
Expand Down Expand Up @@ -1372,26 +1372,26 @@ void __cdecl c_rasterizer::set_z_buffer_mode(e_z_buffer_mode z_buffer_mode)
//
//switch (z_buffer_mode)
//{
//case _z_buffer_mode_unknown0:
//case _z_buffer_mode_write:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZFUNC, zfunc_value);
//}
//break;
//case _z_buffer_mode_unknown1:
//case _z_buffer_mode_read:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
// g_device->SetRenderState(D3DRS_ZFUNC, zfunc_value);
//}
//break;
//case _z_buffer_mode_unknown2:
//case _z_buffer_mode_off:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, FALSE);
//}
//break;
//case _z_buffer_mode_unknown3: // shadow_generate?
//case _z_buffer_mode_shadow_generate:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
Expand All @@ -1401,7 +1401,7 @@ void __cdecl c_rasterizer::set_z_buffer_mode(e_z_buffer_mode z_buffer_mode)
// z_bias = flt_1910534;
//}
//break;
//case _z_buffer_mode_unknown4: // shadow_generate_dynamic_lights?
//case _z_buffer_mode_shadow_generate_dynamic_lights:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
Expand All @@ -1411,7 +1411,7 @@ void __cdecl c_rasterizer::set_z_buffer_mode(e_z_buffer_mode z_buffer_mode)
// z_bias = flt_191053C;
//}
//break;
//case _z_buffer_mode_unknown5: // shadow_apply?
//case _z_buffer_mode_shadow_apply:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
Expand All @@ -1421,7 +1421,7 @@ void __cdecl c_rasterizer::set_z_buffer_mode(e_z_buffer_mode z_buffer_mode)
// z_bias = flt_1910544;
//}
//break;
//case _z_buffer_mode_unknown6: // decal?
//case _z_buffer_mode_decals:
//{
// g_device->SetRenderState(D3DRS_ZENABLE, TRUE);
// g_device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
Expand Down Expand Up @@ -1460,7 +1460,7 @@ void __cdecl c_rasterizer::setup_occlusion_state()

//if (g_device)
//{
// set_z_buffer_mode(_z_buffer_mode_unknown1);
// set_z_buffer_mode(_z_buffer_mode_read);
// set_depth_stencil_surface(_surface_depth_stencil);
// set_render_target(0, _surface_albedo, 0xFFFFFFFF);
// set_render_target(1, _surface_normal, 0xFFFFFFFF);
Expand Down
Loading

0 comments on commit 94efec0

Please sign in to comment.