Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Hanicef/SRB2Classic
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
118 results
Show changes
Commits on Source (11)
  • Eidolon's avatar
    Remove MINI_GL_COMPATIBILITY. · d13968ae
    Eidolon authored
    The rationale for this is that MiniGL hasn't been relevant for 17
    years or longer. Removing it helps cleanup this horrifying section of
    the codebase.
    
    This possibly breaks upscaling in fullscreen in OpenGL mode.
    d13968ae
  • Eidolon's avatar
    Remove SHUFFLE define. · e11b3c52
    Eidolon authored
    Honestly, under no circumstances when GL is compiled into the game
    should the PostImgRedraw not be available. Removing this helps
    make the GL code slightly more readable.
    e11b3c52
  • Eidolon's avatar
    Remove KOS_GL_COMPATIBILITY. · f634a921
    Eidolon authored
    All the effort I've made to research into what exactly this is has
    been moot. Since we really only need to target GLES and GL, we should
    just worry about supporting those. Our public builds don't rely on
    this at all. This helps readability in the OpenGL code.
    f634a921
  • Eidolon's avatar
    Merge branch 'master' into cleanup-opengl · 80bde9e0
    Eidolon authored
    Synchronizing new CMake improvements with OpenGL cleanup branch for
    ease of development.
    80bde9e0
  • Eidolon's avatar
    Use vertex arrays to draw in DrawPolygon for OpenGL. · fe7d19cc
    Eidolon authored
    This should introduce a minor performance boost for slow CPUs in
    OpenGL mode. If it doesn't, it shouldn't be any slower. It also puts
    us a little closer to supporting GLES as well.
    
    This introduces several new pgl function pointers that are from
    GL 1.1. I do not check for their existence because no driver out in
    the wild in active use doesn't support 1.1.
    fe7d19cc
  • Eidolon's avatar
    Remove unused 'stride' variable in DrawPolygon. · d1d05fad
    Eidolon authored
    This is an artifact of the last commit that I was using because I had
    misunderstood the meaning of the stride argument for the array
    pointers.
    d1d05fad
  • Eidolon's avatar
    Add resizeable vertex array data structure. · 54f25c8f
    Eidolon authored
    This will be used for the vertex array buckets when building the
    render lists for each FSurfaceInfo being used by the hardware
    renderer. Generally, we will replace DrawPolygon calls with
    operations to fill these resizeable arrays, one for each
    FSurfaceInfo. After the initial BSP node draw call, we will go
    through the buckets calling DrawPolygon on each one.
    54f25c8f
  • Eidolon's avatar
    Add vertex buckets interface. · 5bf1e5b7
    Eidolon authored
    5bf1e5b7
  • Eidolon's avatar
    Merge branch 'master' into cleanup-opengl · a604624f
    Eidolon authored
    Re-synchronize with master for build system changes.
    a604624f
  • Eidolon's avatar
    Use AA trees for managing vertex array buckets. · 084cf8e6
    Eidolon authored
    Might as well leverage an existing data structure, right? AA trees
    use numbers as keys and we can iterate through them in order. I'm
    surprised this was in the codebase!
    084cf8e6
  • Eidolon's avatar
    Render most flats and sides with texture arrays. · 5c16a91f
    Eidolon authored
    This breaks stencil buffer clipping, transparent flats, the whole
    nine yards.
    
    Unfortunately, this is about as far as I will be taking this
    approach to cleaning up OpenGL. It's unfortunate, but this
    renderer is basically unsalvagable. I will have to rewrite it
    completely from scratch to get what I want out of this.
    5c16a91f
Showing
with 449 additions and 426 deletions
...@@ -351,6 +351,8 @@ if(${SRB2_CONFIG_HWRENDER}) ...@@ -351,6 +351,8 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_trick.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_trick.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_vertarray.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_vertbuckets.c
) )
set (SRB2_HWRENDER_HEADERS set (SRB2_HWRENDER_HEADERS
...@@ -363,6 +365,8 @@ if(${SRB2_CONFIG_HWRENDER}) ...@@ -363,6 +365,8 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_vertarray.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_vertbuckets.h
) )
set(SRB2_R_OPENGL_SOURCES set(SRB2_R_OPENGL_SOURCES
......
...@@ -472,11 +472,6 @@ extern const char *compdate, *comptime, *comprevision; ...@@ -472,11 +472,6 @@ extern const char *compdate, *comptime, *comprevision;
/// Most modifications should probably enable this. /// Most modifications should probably enable this.
//#define SAVEGAME_OTHERVERSIONS //#define SAVEGAME_OTHERVERSIONS
#if !defined (_NDS) && !defined (_PSP)
/// Shuffle's incomplete OpenGL sorting code.
#define SHUFFLE // This has nothing to do with sorting, why was it disabled?
#endif
#if !defined (_NDS) && !defined (_PSP) #if !defined (_NDS) && !defined (_PSP)
/// Allow the use of the SOC RESETINFO command. /// Allow the use of the SOC RESETINFO command.
/// \note Builds that are tight on memory should disable this. /// \note Builds that are tight on memory should disable this.
......
...@@ -1105,4 +1105,9 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum) ...@@ -1105,4 +1105,9 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
} }
int HWR_GetNumCacheTextures(void)
{
return gr_numtextures;
}
#endif //HWRENDER #endif //HWRENDER
...@@ -159,6 +159,12 @@ enum EPolyFlags ...@@ -159,6 +159,12 @@ enum EPolyFlags
PF_Debug = 0x80000000 // print debug message in driver :) PF_Debug = 0x80000000 // print debug message in driver :)
}; };
enum EPolygonPrimitive
{
PP_TriangleFan = 0,
PP_Triangles
};
enum ESurfFlags enum ESurfFlags
{ {
......
...@@ -132,7 +132,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option) ...@@ -132,7 +132,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
flags |= PF_ForceWrapY; flags |= PF_ForceWrapY;
// clip it since it is used for bunny scroll in doom I // clip it since it is used for bunny scroll in doom I
HWD.pfnDrawPolygon(NULL, v, 4, flags); HWD.pfnDrawPolygon(NULL, v, 4, flags, PP_TriangleFan);
} }
void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, const UINT8 *colormap) void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, const UINT8 *colormap)
...@@ -229,10 +229,10 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, ...@@ -229,10 +229,10 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated; flags |= PF_Modulated;
HWD.pfnDrawPolygon(&Surf, v, 4, flags); HWD.pfnDrawPolygon(&Surf, v, 4, flags, PP_TriangleFan);
} }
else else
HWD.pfnDrawPolygon(NULL, v, 4, flags); HWD.pfnDrawPolygon(NULL, v, 4, flags, PP_TriangleFan);
} }
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h) void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
...@@ -305,10 +305,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal ...@@ -305,10 +305,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
flags |= PF_Modulated; flags |= PF_Modulated;
HWD.pfnDrawPolygon(&Surf, v, 4, flags); HWD.pfnDrawPolygon(&Surf, v, 4, flags, PP_TriangleFan);
} }
else else
HWD.pfnDrawPolygon(NULL, v, 4, flags); HWD.pfnDrawPolygon(NULL, v, 4, flags, PP_TriangleFan);
} }
void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum) void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
...@@ -343,7 +343,7 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum) ...@@ -343,7 +343,7 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
// But then, the question is: why not 0 instead of PF_Masked ? // But then, the question is: why not 0 instead of PF_Masked ?
// or maybe PF_Environment ??? (like what I said above) // or maybe PF_Environment ??? (like what I said above)
// BP: PF_Environment don't change anything ! and 0 is undifined // BP: PF_Environment don't change anything ! and 0 is undifined
HWD.pfnDrawPolygon(NULL, v, 4, BLENDMODE | PF_NoDepthTest | PF_Clip | PF_NoZClip); HWD.pfnDrawPolygon(NULL, v, 4, BLENDMODE | PF_NoDepthTest | PF_Clip | PF_NoZClip, PP_TriangleFan);
} }
// ========================================================================== // ==========================================================================
...@@ -419,7 +419,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum ...@@ -419,7 +419,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// BTW, I see we put 0 for PFs, and If I'm right, that // BTW, I see we put 0 for PFs, and If I'm right, that
// means we take the previous PFs as default // means we take the previous PFs as default
// how can we be sure they are ok? // how can we be sure they are ok?
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent); HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest, PP_TriangleFan); //PF_Translucent);
} }
...@@ -452,7 +452,7 @@ void HWR_FadeScreenMenuBack(UINT32 color, INT32 height) ...@@ -452,7 +452,7 @@ void HWR_FadeScreenMenuBack(UINT32 color, INT32 height)
Surf.FlatColor.rgba = UINT2RGBA(color); Surf.FlatColor.rgba = UINT2RGBA(color);
Surf.FlatColor.s.alpha = (UINT8)((0xff/2) * ((float)height / vid.height)); //calum: varies console alpha Surf.FlatColor.s.alpha = (UINT8)((0xff/2) * ((float)height / vid.height)); //calum: varies console alpha
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, PP_TriangleFan);
} }
// Draw the console background with translucency support // Draw the console background with translucency support
...@@ -479,7 +479,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height) ...@@ -479,7 +479,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
Surf.FlatColor.rgba = UINT2RGBA(color); Surf.FlatColor.rgba = UINT2RGBA(color);
Surf.FlatColor.s.alpha = 0x80; Surf.FlatColor.s.alpha = 0x80;
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest, PP_TriangleFan);
} }
...@@ -678,7 +678,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) ...@@ -678,7 +678,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
Surf.FlatColor = V_GetColor(color); Surf.FlatColor = V_GetColor(color);
HWD.pfnDrawPolygon(&Surf, v, 4, HWD.pfnDrawPolygon(&Surf, v, 4,
PF_Modulated|PF_NoTexture|PF_NoDepthTest); PF_Modulated|PF_NoTexture|PF_NoDepthTest, PP_TriangleFan);
} }
#ifdef HAVE_PNG #ifdef HAVE_PNG
......
...@@ -53,7 +53,7 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma); ...@@ -53,7 +53,7 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma);
#endif #endif
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl); EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color); EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags); EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int PrimitiveType);
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags); EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor); EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo); EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
...@@ -75,10 +75,8 @@ EXPORT INT32 HWRAPI(GetRenderVersion) (void); ...@@ -75,10 +75,8 @@ EXPORT INT32 HWRAPI(GetRenderVersion) (void);
// metzgermeister: added for Voodoo detection // metzgermeister: added for Voodoo detection
EXPORT char *HWRAPI(GetRenderer) (void); EXPORT char *HWRAPI(GetRenderer) (void);
#endif #endif
#ifdef SHUFFLE
#define SCREENVERTS 10 #define SCREENVERTS 10
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]); EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
#endif
EXPORT void HWRAPI(StartScreenWipe) (void); EXPORT void HWRAPI(StartScreenWipe) (void);
EXPORT void HWRAPI(EndScreenWipe) (void); EXPORT void HWRAPI(EndScreenWipe) (void);
EXPORT void HWRAPI(DoScreenWipe) (float alpha); EXPORT void HWRAPI(DoScreenWipe) (float alpha);
...@@ -121,9 +119,7 @@ struct hwdriver_s ...@@ -121,9 +119,7 @@ struct hwdriver_s
#ifndef HAVE_SDL #ifndef HAVE_SDL
Shutdown pfnShutdown; Shutdown pfnShutdown;
#endif #endif
#ifdef SHUFFLE
PostImgRedraw pfnPostImgRedraw; PostImgRedraw pfnPostImgRedraw;
#endif
StartScreenWipe pfnStartScreenWipe; StartScreenWipe pfnStartScreenWipe;
EndScreenWipe pfnEndScreenWipe; EndScreenWipe pfnEndScreenWipe;
DoScreenWipe pfnDoScreenWipe; DoScreenWipe pfnDoScreenWipe;
......
...@@ -108,6 +108,9 @@ GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump); ...@@ -108,6 +108,9 @@ GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum); GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
void HWR_GetFadeMask(lumpnum_t fademasklumpnum); void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
/** */
int HWR_GetNumCacheTextures(void);
// -------- // --------
// hw_draw.c // hw_draw.c
// -------- // --------
......
...@@ -768,7 +768,7 @@ void HWR_WallLighting(FOutVector *wlVerts) ...@@ -768,7 +768,7 @@ void HWR_WallLighting(FOutVector *wlVerts)
if (dynlights->mo[j]->state->nextstate == S_NULL) if (dynlights->mo[j]->state->nextstate == S_NULL)
Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha); Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
HWD.pfnDrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS); HWD.pfnDrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS, PP_TriangleFan);
} // end for (j = 0; j < dynlights->nb; j++) } // end for (j = 0; j < dynlights->nb; j++)
} }
...@@ -831,7 +831,7 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts) ...@@ -831,7 +831,7 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts)
if ((dynlights->mo[j]->state->nextstate == S_NULL)) if ((dynlights->mo[j]->state->nextstate == S_NULL))
Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha); Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
HWD.pfnDrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS); HWD.pfnDrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS, PP_TriangleFan);
} // end for (j = 0; j < dynlights->nb; j++) } // end for (j = 0; j < dynlights->nb; j++)
} }
...@@ -928,7 +928,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) ...@@ -928,7 +928,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
HWR_GetPic(coronalumpnum); /// \todo use different coronas HWR_GetPic(coronalumpnum); /// \todo use different coronas
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_Corona | PF_NoDepthTest); HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_Corona | PF_NoDepthTest, PP_TriangleFan);
} }
} }
#endif #endif
...@@ -1008,7 +1008,7 @@ void HWR_DrawCoronas(void) ...@@ -1008,7 +1008,7 @@ void HWR_DrawCoronas(void)
light[3].y = cy+size*1.33f; light[3].y = cy+size*1.33f;
light[3].sow = 0.0f; light[3].tow = 1.0f; light[3].sow = 0.0f; light[3].tow = 1.0f;
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_NoDepthTest | PF_Corona); HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_NoDepthTest | PF_Corona, PP_TriangleFan);
} }
} }
#endif #endif
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "hw_glob.h" #include "hw_glob.h"
#include "hw_light.h" #include "hw_light.h"
#include "hw_drv.h" #include "hw_drv.h"
#include "hw_vertbuckets.h"
#include "../i_video.h" // for rendermode == render_glide #include "../i_video.h" // for rendermode == render_glide
#include "../v_video.h" #include "../v_video.h"
...@@ -758,7 +759,8 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi ...@@ -758,7 +759,8 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
else else
PolyFlags |= PF_Masked|PF_Modulated|PF_Clip; PolyFlags |= PF_Masked|PF_Modulated|PF_Clip;
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags); //HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags);
HWR_InsertVertexArray(HWR_GetVertexArrayForFlat(lumpnum), nrPlaneVerts, planeVerts);
#ifdef ALAM_LIGHTING #ifdef ALAM_LIGHTING
// add here code for dynamic lighting on planes // add here code for dynamic lighting on planes
...@@ -807,7 +809,7 @@ static void HWR_RenderSkyPlane(extrasubsector_t *xsub, fixed_t fixedheight) ...@@ -807,7 +809,7 @@ static void HWR_RenderSkyPlane(extrasubsector_t *xsub, fixed_t fixedheight)
} }
HWD.pfnDrawPolygon(NULL, planeVerts, nrPlaneVerts, HWD.pfnDrawPolygon(NULL, planeVerts, nrPlaneVerts,
PF_Clip|PF_Invisible|PF_NoTexture|PF_Occlude); PF_Clip|PF_Invisible|PF_NoTexture|PF_Occlude, PP_TriangleFan);
} }
#endif //polysky #endif //polysky
...@@ -897,7 +899,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) ...@@ -897,7 +899,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
break; break;
} }
HWD.pfnDrawPolygon(&pSurf2, trVerts, 4, i|PF_Modulated|PF_Clip|PF_Decal); HWD.pfnDrawPolygon(&pSurf2, trVerts, 4, i|PF_Modulated|PF_Clip|PF_Decal, PP_TriangleFan);
} }
} }
#endif #endif
...@@ -942,7 +944,7 @@ static void HWR_AddTransparentWall(wallVert3D *wallVerts, FSurfaceInfo * pSurf, ...@@ -942,7 +944,7 @@ static void HWR_AddTransparentWall(wallVert3D *wallVerts, FSurfaceInfo * pSurf,
*/ */
static void HWR_ProjectWall(wallVert3D * wallVerts, static void HWR_ProjectWall(wallVert3D * wallVerts,
FSurfaceInfo * pSurf, FSurfaceInfo * pSurf,
FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap) FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap, int texnum)
{ {
FOutVector trVerts[4]; FOutVector trVerts[4];
FOutVector *wv; FOutVector *wv;
...@@ -988,7 +990,14 @@ static void HWR_ProjectWall(wallVert3D * wallVerts, ...@@ -988,7 +990,14 @@ static void HWR_ProjectWall(wallVert3D * wallVerts,
pSurf->FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false); pSurf->FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
} }
HWD.pfnDrawPolygon(pSurf, trVerts, 4, blendmode|PF_Modulated|PF_Occlude|PF_Clip); if (texnum == -1)
{
//HWD.pfnDrawPolygon(pSurf, trVerts, 4, blendmode|PF_Modulated|PF_Occlude|PF_Clip, PP_TriangleFan);
}
else
{
HWR_InsertVertexArray(HWR_GetVertexArrayForTexture(texnum), 4, trVerts);
}
#ifdef WALLSPLATS #ifdef WALLSPLATS
if (gr_curline->linedef->splats && cv_splats.value) if (gr_curline->linedef->splats && cv_splats.value)
...@@ -1144,7 +1153,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, ...@@ -1144,7 +1153,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
else if (glTex->mipmap.flags & TF_TRANSPARENT) else if (glTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap, texnum);
if (solid) if (solid)
top = bheight; top = bheight;
...@@ -1181,7 +1190,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, ...@@ -1181,7 +1190,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
else if (glTex->mipmap.flags & TF_TRANSPARENT) else if (glTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap, texnum);
} }
// //
...@@ -1301,7 +1310,7 @@ static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf, fixed_t b ...@@ -1301,7 +1310,7 @@ static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf, fixed_t b
// set top/bottom coords // set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(top); // No real way to find the correct height of this wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(top); // No real way to find the correct height of this
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(bottom); // worldlow/bottom because it needs to cover up the lower thok barrier wall wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(bottom); // worldlow/bottom because it needs to cover up the lower thok barrier wall
HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_Clip|PF_NoTexture, 255, NULL); HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_Clip|PF_NoTexture, 255, NULL, -1);
// PF_Invisible so it's not drawn into the colour buffer // PF_Invisible so it's not drawn into the colour buffer
// PF_NoTexture for no texture // PF_NoTexture for no texture
// PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer // PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer
...@@ -1448,7 +1457,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ...@@ -1448,7 +1457,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else if (grTex->mipmap.flags & TF_TRANSPARENT) else if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, texturetranslation[gr_sidedef->toptexture], PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, texturetranslation[gr_sidedef->toptexture], PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, texturetranslation[gr_sidedef->toptexture]);
} }
// check BOTTOM TEXTURE // check BOTTOM TEXTURE
...@@ -1486,7 +1495,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ...@@ -1486,7 +1495,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else if (grTex->mipmap.flags & TF_TRANSPARENT) else if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, texturetranslation[gr_sidedef->bottomtexture], PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, texturetranslation[gr_sidedef->bottomtexture], PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, texturetranslation[gr_sidedef->bottomtexture]);
} }
gr_midtexture = texturetranslation[gr_sidedef->midtexture]; gr_midtexture = texturetranslation[gr_sidedef->midtexture];
if (gr_midtexture) if (gr_midtexture)
...@@ -1686,7 +1695,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ...@@ -1686,7 +1695,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else if (!(blendmode & PF_Masked)) else if (!(blendmode & PF_Masked))
HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, blendmode, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, blendmode, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap, gr_midtexture);
// If there is a colormap change, remove it. // If there is a colormap change, remove it.
/* if (!(Surf.FlatColor.s.red + Surf.FlatColor.s.green + Surf.FlatColor.s.blue == Surf.FlatColor.s.red/3) /* if (!(Surf.FlatColor.s.red + Surf.FlatColor.s.green + Surf.FlatColor.s.blue == Surf.FlatColor.s.red/3)
...@@ -1810,7 +1819,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ...@@ -1810,7 +1819,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (grTex->mipmap.flags & TF_TRANSPARENT) if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, gr_midtexture);
} }
} }
...@@ -1936,7 +1945,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ...@@ -1936,7 +1945,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (blendmode != PF_Masked) if (blendmode != PF_Masked)
HWR_AddTransparentWall(wallVerts, &Surf, texnum, blendmode, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, texnum, blendmode, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, texnum);
} }
} }
} }
...@@ -2042,7 +2051,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ...@@ -2042,7 +2051,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (blendmode != PF_Masked) if (blendmode != PF_Masked)
HWR_AddTransparentWall(wallVerts, &Surf, texnum, blendmode, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, texnum, blendmode, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, texnum);
} }
} }
} }
...@@ -2785,7 +2794,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, fixed_t fixedheight ...@@ -2785,7 +2794,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, fixed_t fixedheight
else else
blendmode |= PF_Masked|PF_Modulated|PF_Clip; blendmode |= PF_Masked|PF_Modulated|PF_Clip;
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode); HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, PP_TriangleFan);
} }
static void HWR_AddPolyObjectPlanes(void) static void HWR_AddPolyObjectPlanes(void)
...@@ -2979,6 +2988,7 @@ static void HWR_Subsector(size_t num) ...@@ -2979,6 +2988,7 @@ static void HWR_Subsector(size_t num)
{ {
if (sub->validcount != validcount) if (sub->validcount != validcount)
{ {
HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum); HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum);
HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], locFloorHeight, PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap); HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], locFloorHeight, PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap);
} }
...@@ -3814,7 +3824,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) ...@@ -3814,7 +3824,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
if (sSurf.FlatColor.s.alpha > floorheight/4) if (sSurf.FlatColor.s.alpha > floorheight/4)
{ {
sSurf.FlatColor.s.alpha = (UINT8)(sSurf.FlatColor.s.alpha - floorheight/4); sSurf.FlatColor.s.alpha = (UINT8)(sSurf.FlatColor.s.alpha - floorheight/4);
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated|PF_Clip); HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated|PF_Clip, PP_TriangleFan);
} }
} }
} }
...@@ -3886,7 +3896,7 @@ noshadow: ...@@ -3886,7 +3896,7 @@ noshadow:
blend = PF_Translucent|PF_Occlude; blend = PF_Translucent|PF_Occlude;
} }
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated|PF_Clip); HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated|PF_Clip, PP_TriangleFan);
} }
} }
...@@ -3986,7 +3996,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) ...@@ -3986,7 +3996,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
blend = PF_Translucent|PF_Occlude; blend = PF_Translucent|PF_Occlude;
} }
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated|PF_Clip); HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated|PF_Clip, PP_TriangleFan);
} }
#endif #endif
...@@ -4883,7 +4893,7 @@ static void HWR_DrawSkyBackground(player_t *player) ...@@ -4883,7 +4893,7 @@ static void HWR_DrawSkyBackground(player_t *player)
v[0].tow = v[1].tow -= ((float) angle / angleturn); v[0].tow = v[1].tow -= ((float) angle / angleturn);
} }
HWD.pfnDrawPolygon(NULL, v, 4, 0); HWD.pfnDrawPolygon(NULL, v, 4, 0, PP_TriangleFan);
} }
...@@ -5075,7 +5085,9 @@ if (0) ...@@ -5075,7 +5085,9 @@ if (0)
validcount++; validcount++;
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); HWR_RenderBSPNode((INT32)numnodes-1);
HWR_DrawVertexBuckets();
// Make a viewangle int so we can render things based on mouselook // Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
...@@ -5088,18 +5100,27 @@ if (0) ...@@ -5088,18 +5100,27 @@ if (0)
{ {
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); //left HWR_RenderBSPNode((INT32)numnodes-1); //left
HWR_DrawVertexBuckets();
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45)) if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45))
{ {
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); //back HWR_RenderBSPNode((INT32)numnodes-1); //back
HWR_DrawVertexBuckets();
} }
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); //right HWR_RenderBSPNode((INT32)numnodes-1); //right
HWR_DrawVertexBuckets();
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
} }
...@@ -5305,7 +5326,9 @@ if (0) ...@@ -5305,7 +5326,9 @@ if (0)
validcount++; validcount++;
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); HWR_RenderBSPNode((INT32)numnodes-1);
HWR_DrawVertexBuckets();
// Make a viewangle int so we can render things based on mouselook // Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
...@@ -5318,18 +5341,27 @@ if (0) ...@@ -5318,18 +5341,27 @@ if (0)
{ {
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); //left HWR_RenderBSPNode((INT32)numnodes-1); //left
HWR_DrawVertexBuckets();
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45)) if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45))
{ {
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); //back HWR_RenderBSPNode((INT32)numnodes-1); //back
HWR_DrawVertexBuckets();
} }
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_ResetVertexBuckets();
HWR_RenderBSPNode((INT32)numnodes-1); //right HWR_RenderBSPNode((INT32)numnodes-1); //right
HWR_DrawVertexBuckets();
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
} }
...@@ -5774,9 +5806,9 @@ static void HWR_RenderWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, FBITFIE ...@@ -5774,9 +5806,9 @@ static void HWR_RenderWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, FBITFIE
pSurf->FlatColor.s.alpha = alpha; // put the alpha back after lighting pSurf->FlatColor.s.alpha = alpha; // put the alpha back after lighting
if (blend & PF_Environment) if (blend & PF_Environment)
HWD.pfnDrawPolygon(pSurf, trVerts, 4, blend|PF_Modulated|PF_Clip|PF_Occlude); // PF_Occlude must be used for solid objects HWD.pfnDrawPolygon(pSurf, trVerts, 4, blend|PF_Modulated|PF_Clip|PF_Occlude, PP_TriangleFan); // PF_Occlude must be used for solid objects
else else
HWD.pfnDrawPolygon(pSurf, trVerts, 4, blend|PF_Modulated|PF_Clip); // No PF_Occlude means overlapping (incorrect) transparency HWD.pfnDrawPolygon(pSurf, trVerts, 4, blend|PF_Modulated|PF_Clip, PP_TriangleFan); // No PF_Occlude means overlapping (incorrect) transparency
#ifdef WALLSPLATS #ifdef WALLSPLATS
if (gr_curline->linedef->splats && cv_splats.value) if (gr_curline->linedef->splats && cv_splats.value)
...@@ -5830,7 +5862,7 @@ void HWR_DoPostProcessor(player_t *player) ...@@ -5830,7 +5862,7 @@ void HWR_DoPostProcessor(player_t *player)
Surf.FlatColor.s.alpha = 0xc0; // match software mode Surf.FlatColor.s.alpha = 0xc0; // match software mode
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Additive|PF_NoTexture|PF_NoDepthTest|PF_Clip|PF_NoZClip); HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Additive|PF_NoTexture|PF_NoDepthTest|PF_Clip|PF_NoZClip, PP_TriangleFan);
} }
// Capture the screen for intermission and screen waving // Capture the screen for intermission and screen waving
...@@ -5840,7 +5872,6 @@ void HWR_DoPostProcessor(player_t *player) ...@@ -5840,7 +5872,6 @@ void HWR_DoPostProcessor(player_t *player)
if (splitscreen) // Not supported in splitscreen - someone want to add support? if (splitscreen) // Not supported in splitscreen - someone want to add support?
return; return;
#ifdef SHUFFLE
// Drunken vision! WooOOooo~ // Drunken vision! WooOOooo~
if (*type == postimg_water || *type == postimg_heat) if (*type == postimg_water || *type == postimg_heat)
{ {
...@@ -5883,7 +5914,6 @@ void HWR_DoPostProcessor(player_t *player) ...@@ -5883,7 +5914,6 @@ void HWR_DoPostProcessor(player_t *player)
HWD.pfnMakeScreenTexture(); HWD.pfnMakeScreenTexture();
} }
// Flipping of the screen isn't done here anymore // Flipping of the screen isn't done here anymore
#endif // SHUFFLE
} }
void HWR_StartScreenWipe(void) void HWR_StartScreenWipe(void)
......
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2015 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//-----------------------------------------------------------------------------
/// \file
/// \brief Resizeable vertex array implementation
#include "hw_vertarray.h"
#include "../z_zone.h"
#define RESIZE_FACTOR 2
void HWR_InitVertexArray(FVertexArray * varray, unsigned int initialSize)
{
varray->size = initialSize;
varray->used = 0;
varray->buffer = (FOutVector *) Z_Malloc(varray->size * sizeof(FOutVector), PU_STATIC, varray);
}
void HWR_FreeVertexArray(FVertexArray * varray)
{
Z_Free(varray->buffer);
}
void HWR_InsertVertexArray(FVertexArray * varray, int numElements, FOutVector * elements)
{
int i = 0;
FOutVector * actualElements = NULL;
int numActualElements = numElements;
// Expand array from fan to triangles
// Not optimal... but the overhead will make up for it significantly
{
int j = 0;
int k = 0;
numActualElements -= 3;
numActualElements *= 3;
numActualElements += 3;
actualElements = (FOutVector *) Z_Malloc(numActualElements * sizeof(FOutVector), PU_STATIC, NULL);
for (j = 2; j < numElements; j++)
{
actualElements[k] = elements[0];
actualElements[k+1] = elements[j-1];
actualElements[k+2] = elements[j];
k += 3;
}
}
while (varray->used + numActualElements >= varray->size)
{
varray->buffer = (FOutVector *) Z_Realloc(varray->buffer, varray->size * RESIZE_FACTOR * sizeof(FOutVector), PU_STATIC, varray);
varray->size *= RESIZE_FACTOR;
}
for (i = 0; i < numActualElements; i++)
{
varray->buffer[i + varray->used] = actualElements[i];
}
varray->used += numActualElements;
Z_Free(actualElements);
}
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2015 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//-----------------------------------------------------------------------------
/// \file
/// \brief Resizeable vertex array
#ifndef __HWR_VERTARRAY_H__
#define __HWR_VERTARRAY_H__
#include "hw_defs.h"
typedef struct
{
FOutVector * buffer;
unsigned int used;
unsigned int size;
} FVertexArray;
void HWR_InitVertexArray(FVertexArray * varray, unsigned int initialSize);
void HWR_FreeVertexArray(FVertexArray * varray);
void HWR_InsertVertexArray(FVertexArray * varray, int numElements, FOutVector * elements);
#endif // __HWR_VERTARRAY_H__
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2015 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//-----------------------------------------------------------------------------
/// \file
/// \brief Vertex buckets mapping based on texture binding, implementation
#include "hw_vertbuckets.h"
#include "hw_glob.h"
#include "hw_drv.h"
#include "../z_zone.h"
// 6 because we assume at least a quad per texture.
#define INITIAL_BUCKET_SIZE 6
static FVertexArray * buckets = NULL;
static int numTextureBuckets = 0;
static int bucketsHaveBeenInitialized = 0;
static aatree_t * flatArrays;
static aatree_t * textureArrays;
static UINT8 arraysInitialized = 0;
typedef enum
{
RMODE_FLAT,
RMODE_TEXTURE
} EMode;
static EMode rmode;
static void FreeArraysFunc(INT32 key, void * value)
{
FVertexArray * varray = (FVertexArray *) value;
HWR_FreeVertexArray(varray);
Z_Free(varray);
}
static void DrawArraysFunc(INT32 key, void * value)
{
FVertexArray * varray = (FVertexArray *) value;
FSurfaceInfo surf;
if (varray->used == 0)
{
return;
}
surf.FlatColor.rgba = 0xFFFFFFFF;
if (rmode == RMODE_FLAT)
{
HWR_GetFlat(key);
}
else if (rmode == RMODE_TEXTURE)
{
HWR_GetTexture(key);
}
// TODO support flags, translucency, etc
HWD.pfnDrawPolygon(&surf, varray->buffer, varray->used, PF_Occlude, PP_Triangles);
}
static FVertexArray * GetVArray(aatree_t * tree, int index)
{
FVertexArray * varray = (FVertexArray *) M_AATreeGet(tree, index);
if (!varray)
{
// no varray for this flat yet, create it
varray = (FVertexArray *) Z_Calloc(sizeof(FVertexArray), PU_STATIC, NULL);
HWR_InitVertexArray(varray, INITIAL_BUCKET_SIZE);
M_AATreeSet(tree, index, (void *) varray);
}
return varray;
}
void HWR_ResetVertexBuckets(void)
{
if (arraysInitialized)
{
M_AATreeIterate(flatArrays, FreeArraysFunc);
M_AATreeIterate(textureArrays, FreeArraysFunc);
M_AATreeFree(flatArrays);
M_AATreeFree(textureArrays);
}
flatArrays = M_AATreeAlloc(0);
textureArrays = M_AATreeAlloc(0);
}
FVertexArray * HWR_GetVertexArrayForTexture(int texNum)
{
return GetVArray(textureArrays, texNum);
}
FVertexArray * HWR_GetVertexArrayForFlat(lumpnum_t lump)
{
return GetVArray(flatArrays, lump);
}
void HWR_DrawVertexBuckets(void)
{
rmode = RMODE_TEXTURE;
M_AATreeIterate(textureArrays, DrawArraysFunc);
rmode = RMODE_FLAT;
M_AATreeIterate(flatArrays, DrawArraysFunc);
}
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2015 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//-----------------------------------------------------------------------------
/// \file
/// \brief Vertex buckets mapping based on texture binding
#ifndef __HW_VERTBUCKETS_H__
#define __HW_VERTBUCKETS_H__
#include "hw_vertarray.h"
/* The vertex buckets are a mapping of runtime texture number to FVertexArray.
* BSP traversal, instead of sending DrawPolygon calls to the driver directly,
* will add vertices to these buckets based on the texture used. After BSP
* traversal, you should call HWR_DrawVertexBuckets in order to send DrawPolygon
* calls for each texture in the buckets.
*/
/** Empty the vertex buckets to prepare for another BSP traversal. This function
* should be called before rendering any BSP node. */
void HWR_ResetVertexBuckets(void);
FVertexArray * HWR_GetVertexArrayForFlat(lumpnum_t lumpnum);
/** Get a pointer to the vertex array used for a given texture number. */
FVertexArray * HWR_GetVertexArrayForTexture(int texNum);
/** Send draw commands to the hardware driver to draw each of the buckets. */
void HWR_DrawVertexBuckets(void);
#endif //__HW_VERTBUCKETS_H__
This diff is collapsed.
...@@ -36,13 +36,11 @@ ...@@ -36,13 +36,11 @@
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#ifndef MINI_GL_COMPATIBILITY
#ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static #ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#include <GL/glext.h> #include <GL/glext.h>
#endif #endif
#endif #endif
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows #define _CREATE_DLL_ // necessary for Unix AND Windows
#include "../../doomdef.h" #include "../../doomdef.h"
......
...@@ -97,9 +97,7 @@ void *hwSym(const char *funcName,void *handle) ...@@ -97,9 +97,7 @@ void *hwSym(const char *funcName,void *handle)
GETFUNC(DrawMD2i); GETFUNC(DrawMD2i);
GETFUNC(SetTransform); GETFUNC(SetTransform);
GETFUNC(GetRenderVersion); GETFUNC(GetRenderVersion);
#ifdef SHUFFLE
GETFUNC(PostImgRedraw); GETFUNC(PostImgRedraw);
#endif //SHUFFLE
GETFUNC(StartScreenWipe); GETFUNC(StartScreenWipe);
GETFUNC(EndScreenWipe); GETFUNC(EndScreenWipe);
GETFUNC(DoScreenWipe); GETFUNC(DoScreenWipe);
......
...@@ -1752,9 +1752,7 @@ void I_StartupGraphics(void) ...@@ -1752,9 +1752,7 @@ void I_StartupGraphics(void)
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL); HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL); HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL); HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
#ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL); HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
......
...@@ -97,9 +97,7 @@ void *hwSym(const char *funcName,void *handle) ...@@ -97,9 +97,7 @@ void *hwSym(const char *funcName,void *handle)
GETFUNC(DrawMD2i); GETFUNC(DrawMD2i);
GETFUNC(SetTransform); GETFUNC(SetTransform);
GETFUNC(GetRenderVersion); GETFUNC(GetRenderVersion);
#ifdef SHUFFLE
GETFUNC(PostImgRedraw); GETFUNC(PostImgRedraw);
#endif //SHUFFLE
GETFUNC(StartScreenWipe); GETFUNC(StartScreenWipe);
GETFUNC(EndScreenWipe); GETFUNC(EndScreenWipe);
GETFUNC(DoScreenWipe); GETFUNC(DoScreenWipe);
......
...@@ -1969,9 +1969,7 @@ void I_StartupGraphics(void) ...@@ -1969,9 +1969,7 @@ void I_StartupGraphics(void)
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL); HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL); HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL); HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
#ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL); HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
......
...@@ -230,11 +230,9 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) ...@@ -230,11 +230,9 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
glXSwapIntervalSGIEXT = NULL; glXSwapIntervalSGIEXT = NULL;
#endif #endif
#ifndef KOS_GL_COMPATIBILITY
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions)) if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy); pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
else else
#endif
maximumAnisotropy = 0; maximumAnisotropy = 0;
SetupGLFunc13(); SetupGLFunc13();
...@@ -246,11 +244,7 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) ...@@ -246,11 +244,7 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
HWR_Startup(); HWR_Startup();
#ifdef KOS_GL_COMPATIBILITY
textureformatGL = GL_ARGB4444;
#else
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1; textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
#endif
return true; return true;
} }
......