Draws a line using the states of the renderer
| 1961 | |
| 1962 | // Draws a line using the states of the renderer |
| 1963 | void rend_DrawSpecialLine(g3Point *p0, g3Point *p1) { |
| 1964 | g3_RefreshTransforms(true); |
| 1965 | |
| 1966 | int x_add = gpu_state.clip_x1; |
| 1967 | int y_add = gpu_state.clip_y1; |
| 1968 | float fr, fg, fb, alpha; |
| 1969 | int i; |
| 1970 | |
| 1971 | fr = GR_COLOR_RED(gpu_state.cur_color); |
| 1972 | fg = GR_COLOR_GREEN(gpu_state.cur_color); |
| 1973 | fb = GR_COLOR_BLUE(gpu_state.cur_color); |
| 1974 | |
| 1975 | fr /= 255.0f; |
| 1976 | fg /= 255.0f; |
| 1977 | fb /= 255.0f; |
| 1978 | |
| 1979 | alpha = gpu_Alpha_multiplier * gpu_Alpha_factor; |
| 1980 | |
| 1981 | // And draw! |
| 1982 | dglBegin(GL_LINES); |
| 1983 | for (i = 0; i < 2; i++) { |
| 1984 | g3Point *pnt = p0; |
| 1985 | |
| 1986 | if (i == 1) |
| 1987 | pnt = p1; |
| 1988 | |
| 1989 | if (gpu_state.cur_alpha_type & ATF_VERTEX) |
| 1990 | alpha = pnt->p3_a * gpu_Alpha_multiplier * gpu_Alpha_factor; |
| 1991 | |
| 1992 | // If we have a lighting model, apply the correct lighting! |
| 1993 | if (gpu_state.cur_light_state != LS_NONE) { |
| 1994 | if (gpu_state.cur_light_state == LS_FLAT_GOURAUD) { |
| 1995 | dglColor4f(fr, fg, fb, alpha); |
| 1996 | } else { |
| 1997 | // Do lighting based on intesity (MONO) or colored (RGB) |
| 1998 | if (gpu_state.cur_color_model == CM_MONO) |
| 1999 | dglColor4f(pnt->p3_l, pnt->p3_l, pnt->p3_l, alpha); |
| 2000 | else { |
| 2001 | dglColor4f(pnt->p3_r, pnt->p3_g, pnt->p3_b, alpha); |
| 2002 | } |
| 2003 | } |
| 2004 | } else { |
| 2005 | dglColor4f(fr, fg, fb, alpha); |
| 2006 | } |
| 2007 | |
| 2008 | // Finally, specify a vertex |
| 2009 | float z = std::clamp(1.0 - (1.0 / (pnt->p3_z + Z_bias)), 0.0, 1.0); |
| 2010 | dglVertex3f(pnt->p3_sx + x_add, pnt->p3_sy + y_add, -z); |
| 2011 | } |
| 2012 | |
| 2013 | dglEnd(); |
| 2014 | } |
| 2015 | |
| 2016 | // Takes a screenshot of the current frame and puts it into the handle passed |
| 2017 | std::unique_ptr<NewBitmap> rend_Screenshot() { |
no test coverage detected