Skip to content

Commit

Permalink
Map Renderer|Fixed: Development/debug sky drawing mode (rend-dev-sky=1)
Browse files Browse the repository at this point in the history
Also made the color data argument of the RL_Add* family of functions
optional; all vertices of the primitive will be written with the
implicit color values [R:255, G:255, B:255, A:255].
  • Loading branch information
danij-deng committed May 29, 2012
1 parent b6c51f3 commit 5634f14
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 77 deletions.
19 changes: 19 additions & 0 deletions doomsday/engine/portable/include/rend_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ void RL_MapRtu(uint idx, const rtexmapunit_t* rtu);
*/
void RL_CopyRtu(uint idx, const rtexmapunit_t* rtu);

/// @todo Avoid modifying the RTU write state for the purposes of primitive
/// specific translations by implementing these as arguments to the
/// RL_Add* family of functions.

/// Change the scale property of the identified @a idx texture unit.
void RL_Rtu_SetScale(uint idx, float s, float t);
void RL_Rtu_SetScalev(uint idx, float const st[2]);
Expand All @@ -140,6 +144,9 @@ void RL_Rtu_SetTextureUnmanaged(uint idx, DGLuint glName);
/**
* @param primType Type of primitive being written.
* @param flags @see rendpolyFlags
* @param colors Color data values for the primitive. If @c NULL the default
* value set [R:255, G:255, B:255, A:255] will be used for all
* vertices of the primitive.
*/
void RL_AddPolyWithCoordsModulationReflection(primtype_t primType, int flags,
uint numElements, const rvertex_t* vertices, const ColorRawf* colors,
Expand All @@ -151,6 +158,9 @@ void RL_AddPolyWithCoordsModulationReflection(primtype_t primType, int flags,
/**
* @param primType Type of primitive being written.
* @param flags @see rendpolyFlags
* @param colors Color data values for the primitive. If @c NULL the default
* value set [R:255, G:255, B:255, A:255] will be used for all
* vertices of the primitive.
*/
void RL_AddPolyWithCoordsModulation(primtype_t primType, int flags,
uint numElements, const rvertex_t* vertices, const ColorRawf* colors,
Expand All @@ -160,6 +170,9 @@ void RL_AddPolyWithCoordsModulation(primtype_t primType, int flags,
/**
* @param primType Type of primitive being written.
* @param flags @see rendpolyFlags
* @param colors Color data values for the primitive. If @c NULL the default
* value set [R:255, G:255, B:255, A:255] will be used for all
* vertices of the primitive.
*/
void RL_AddPolyWithCoords(primtype_t primType, int flags, uint numElements,
const rvertex_t* vertices, const ColorRawf* colors,
Expand All @@ -168,6 +181,9 @@ void RL_AddPolyWithCoords(primtype_t primType, int flags, uint numElements,
/**
* @param primType Type of primitive being written.
* @param flags @see rendpolyFlags
* @param colors Color data values for the primitive. If @c NULL the default
* value set [R:255, G:255, B:255, A:255] will be used for all
* vertices of the primitive.
*/
void RL_AddPolyWithModulation(primtype_t primType, int flags, uint numElements,
const rvertex_t* vertices, const ColorRawf* colors,
Expand All @@ -176,6 +192,9 @@ void RL_AddPolyWithModulation(primtype_t primType, int flags, uint numElements,
/**
* @param primType Type of primitive being written.
* @param flags @see rendpolyFlags
* @param colors Color data values for the primitive. If @c NULL the default
* value set [R:255, G:255, B:255, A:255] will be used for all
* vertices of the primitive.
*/
void RL_AddPoly(primtype_t primType, int flags, uint numElements,
const rvertex_t* vertices, const ColorRawf* colors);
Expand Down
7 changes: 4 additions & 3 deletions doomsday/engine/portable/src/linedef.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

#include "de_base.h"
#include "de_console.h"
#include "de_refresh.h"
#include "de_play.h"
#include "de_refresh.h"
#include "de_render.h"

#include "m_bams.h"
#include "m_misc.h"
Expand Down Expand Up @@ -396,8 +397,8 @@ boolean LineDef_MiddleMaterialCoversOpening(LineDef *line, int side,
{
// Possibly; check the placement.
const boolean unpegBottom = !!(line->flags & DDLF_DONTPEGBOTTOM);
const boolean clipBottom = !(!P_IsInVoid(viewPlayer) && Surface_IsSkyMasked(&frontSec->SP_floorsurface) && Surface_IsSkyMasked(&backSec->SP_floorsurface));
const boolean clipTop = !(!P_IsInVoid(viewPlayer) && Surface_IsSkyMasked(&frontSec->SP_ceilsurface) && Surface_IsSkyMasked(&backSec->SP_ceilsurface));
const boolean clipBottom = !(!(devRendSkyMode || P_IsInVoid(viewPlayer)) && Surface_IsSkyMasked(&frontSec->SP_floorsurface) && Surface_IsSkyMasked(&backSec->SP_floorsurface));
const boolean clipTop = !(!(devRendSkyMode || P_IsInVoid(viewPlayer)) && Surface_IsSkyMasked(&frontSec->SP_ceilsurface) && Surface_IsSkyMasked(&backSec->SP_ceilsurface));

if(LineDef_MiddleMaterialCoords(line, side, &matBottom[0], &matBottom[1],
&matTop[0], &matTop[1], NULL, unpegBottom,
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/r_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ boolean R_FindBottomTop(LineDef* line, int side, SideDefSection section,

if(!stretchMiddle)
{
const boolean clipBottom = !(!P_IsInVoid(viewPlayer) && Surface_IsSkyMasked(&ffloor->surface) && Surface_IsSkyMasked(&bfloor->surface));
const boolean clipTop = !(!P_IsInVoid(viewPlayer) && Surface_IsSkyMasked(&fceil->surface) && Surface_IsSkyMasked(&bceil->surface));
const boolean clipBottom = !(!(devRendSkyMode || P_IsInVoid(viewPlayer)) && Surface_IsSkyMasked(&ffloor->surface) && Surface_IsSkyMasked(&bfloor->surface));
const boolean clipTop = !(!(devRendSkyMode || P_IsInVoid(viewPlayer)) && Surface_IsSkyMasked(&fceil->surface) && Surface_IsSkyMasked(&bceil->surface));
coord_t bottomRight, topRight;

if(LineDef_MiddleMaterialCoords(line, side, low, &bottomRight, hi,
Expand Down
15 changes: 11 additions & 4 deletions doomsday/engine/portable/src/rend_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,10 +876,17 @@ static void writePrimitive(const rendlist_t* list, uint base,
const ColorRawf* rcolor = &rcolors[i];
dgl_color_t* color = &colors[base + i];

color->rgba[CR] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CR], 1));
color->rgba[CG] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CG], 1));
color->rgba[CB] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CB], 1));
color->rgba[CA] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CA], 1));
if(rcolors)
{
color->rgba[CR] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CR], 1));
color->rgba[CG] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CG], 1));
color->rgba[CB] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CB], 1));
color->rgba[CA] = (DGLubyte) (255 * MINMAX_OF(0, rcolor->rgba[CA], 1));
}
else
{
color->rgba[CR] = color->rgba[CG] = color->rgba[CB] = color->rgba[CA] = 255;
}
}
}
}
Expand Down
Loading

0 comments on commit 5634f14

Please sign in to comment.