mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Change globvis to be picked up from the r_light values in softpoly
This commit is contained in:
parent
2583c94444
commit
e1506df8a6
12 changed files with 16 additions and 3 deletions
|
@ -137,6 +137,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.SetColormap(front->ColorMap);
|
args.SetColormap(front->ColorMap);
|
||||||
args.SetTexture(tex, decal->Translation, true);
|
args.SetTexture(tex, decal->Translation, true);
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_WallVisibility;
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
|
|
|
@ -73,6 +73,8 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_SpriteVisibility;
|
||||||
|
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
|
|
|
@ -107,6 +107,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
|
||||||
UVTransform xform(ceiling ? fakeFloor->top.model->planes[sector_t::ceiling].xform : fakeFloor->top.model->planes[sector_t::floor].xform, tex);
|
UVTransform xform(ceiling ? fakeFloor->top.model->planes[sector_t::ceiling].xform : fakeFloor->top.model->planes[sector_t::floor].xform, tex);
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_TiltVisibility * 48.0f;
|
||||||
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
||||||
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
|
@ -300,6 +301,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
UVTransform transform(ceiling ? frontsector->planes[sector_t::ceiling].xform : frontsector->planes[sector_t::floor].xform, tex);
|
UVTransform transform(ceiling ? frontsector->planes[sector_t::ceiling].xform : frontsector->planes[sector_t::floor].xform, tex);
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_TiltVisibility * 48.0f;
|
||||||
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
||||||
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "polyrenderer/scene/poly_scene.h"
|
#include "polyrenderer/scene/poly_scene.h"
|
||||||
#include "polyrenderer/poly_renderer.h"
|
#include "polyrenderer/poly_renderer.h"
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
|
#include "swrenderer/scene/r_light.h"
|
||||||
|
|
||||||
CVAR(Bool, r_debug_cull, 0, 0)
|
CVAR(Bool, r_debug_cull, 0, 0)
|
||||||
EXTERN_CVAR(Int, r_portal_recursions)
|
EXTERN_CVAR(Int, r_portal_recursions)
|
||||||
|
@ -240,6 +241,7 @@ void RenderPolyScene::RenderPortals(int portalDepth)
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.objectToClip = &WorldToClip;
|
args.objectToClip = &WorldToClip;
|
||||||
args.mode = TriangleDrawMode::Fan;
|
args.mode = TriangleDrawMode::Fan;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_WallVisibility;
|
||||||
args.uniforms.color = 0;
|
args.uniforms.color = 0;
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
|
|
|
@ -55,6 +55,7 @@ void PolySkyDome::Render(const TriMatrix &worldToClip)
|
||||||
int rc = mRows + 1;
|
int rc = mRows + 1;
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_WallVisibility;
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.uniforms.subsectorDepth = RenderPolyScene::SkySubsectorDepth;
|
args.uniforms.subsectorDepth = RenderPolyScene::SkySubsectorDepth;
|
||||||
|
|
|
@ -138,6 +138,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
|
||||||
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_SpriteVisibility;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -247,6 +247,7 @@ void RenderPolyWall::Render(const TriMatrix &worldToClip, const Vec4f &clipPlane
|
||||||
}
|
}
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_WallVisibility;
|
||||||
args.uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f);
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.uniforms.subsectorDepth = SubsectorDepth;
|
args.uniforms.subsectorDepth = SubsectorDepth;
|
||||||
|
|
|
@ -100,6 +100,7 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
|
||||||
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
args.uniforms.globvis = (float)swrenderer::r_WallVisibility;
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
|
|
|
@ -230,6 +230,7 @@ struct TriUniforms
|
||||||
uint16_t fade_green;
|
uint16_t fade_green;
|
||||||
uint16_t fade_blue;
|
uint16_t fade_blue;
|
||||||
uint16_t desaturate;
|
uint16_t desaturate;
|
||||||
|
float globvis;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
enum Flags
|
enum Flags
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,6 @@ namespace swrenderer
|
||||||
double r_FloorVisibility;
|
double r_FloorVisibility;
|
||||||
float r_TiltVisibility;
|
float r_TiltVisibility;
|
||||||
double r_SpriteVisibility;
|
double r_SpriteVisibility;
|
||||||
double r_ParticleVisibility;
|
|
||||||
|
|
||||||
int fixedlightlev;
|
int fixedlightlev;
|
||||||
FSWColormap *fixedcolormap;
|
FSWColormap *fixedcolormap;
|
||||||
|
|
|
@ -613,7 +613,6 @@ void DrawTriangleCodegen::CalculateGradients()
|
||||||
}
|
}
|
||||||
|
|
||||||
shade = (64.0f - (SSAFloat(light * 255 / 256) + 12.0f) * 32.0f / 128.0f) / 32.0f;
|
shade = (64.0f - (SSAFloat(light * 255 / 256) + 12.0f) * 32.0f / 128.0f) / 32.0f;
|
||||||
globVis = SSAFloat(1706.0f / 32.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTriangleCodegen::LoadArgs(SSAValue args, SSAValue thread_data)
|
void DrawTriangleCodegen::LoadArgs(SSAValue args, SSAValue thread_data)
|
||||||
|
@ -671,7 +670,9 @@ void DrawTriangleCodegen::LoadUniforms(SSAValue uniforms)
|
||||||
SSAShort fade_green = uniforms[0][11].load(true);
|
SSAShort fade_green = uniforms[0][11].load(true);
|
||||||
SSAShort fade_blue = uniforms[0][12].load(true);
|
SSAShort fade_blue = uniforms[0][12].load(true);
|
||||||
SSAShort desaturate = uniforms[0][13].load(true);
|
SSAShort desaturate = uniforms[0][13].load(true);
|
||||||
SSAInt flags = uniforms[0][14].load(true);
|
globVis = uniforms[0][14].load(true);
|
||||||
|
globVis = globVis * SSAFloat(1.0f / 32.0f);
|
||||||
|
SSAInt flags = uniforms[0][15].load(true);
|
||||||
shade_constants.light = SSAVec4i(light_blue.zext_int(), light_green.zext_int(), light_red.zext_int(), light_alpha.zext_int());
|
shade_constants.light = SSAVec4i(light_blue.zext_int(), light_green.zext_int(), light_red.zext_int(), light_alpha.zext_int());
|
||||||
shade_constants.fade = SSAVec4i(fade_blue.zext_int(), fade_green.zext_int(), fade_red.zext_int(), fade_alpha.zext_int());
|
shade_constants.fade = SSAVec4i(fade_blue.zext_int(), fade_green.zext_int(), fade_red.zext_int(), fade_alpha.zext_int());
|
||||||
shade_constants.desaturate = desaturate.zext_int();
|
shade_constants.desaturate = desaturate.zext_int();
|
||||||
|
|
|
@ -360,6 +360,7 @@ llvm::Type *LLVMDrawers::GetTriUniformsStruct(llvm::LLVMContext &context)
|
||||||
elements.push_back(llvm::Type::getInt16Ty(context)); // uint16_t fade_green;
|
elements.push_back(llvm::Type::getInt16Ty(context)); // uint16_t fade_green;
|
||||||
elements.push_back(llvm::Type::getInt16Ty(context)); // uint16_t fade_blue;
|
elements.push_back(llvm::Type::getInt16Ty(context)); // uint16_t fade_blue;
|
||||||
elements.push_back(llvm::Type::getInt16Ty(context)); // uint16_t desaturate;
|
elements.push_back(llvm::Type::getInt16Ty(context)); // uint16_t desaturate;
|
||||||
|
elements.push_back(llvm::Type::getFloatTy(context)); // float globvis;
|
||||||
elements.push_back(llvm::Type::getInt32Ty(context)); // uint32_t flags;
|
elements.push_back(llvm::Type::getInt32Ty(context)); // uint32_t flags;
|
||||||
elements.push_back(GetTriMatrixStruct(context)); // TriMatrix objectToClip
|
elements.push_back(GetTriMatrixStruct(context)); // TriMatrix objectToClip
|
||||||
TriUniformsStruct = llvm::StructType::create(context, elements, "TriUniforms", false)->getPointerTo();
|
TriUniformsStruct = llvm::StructType::create(context, elements, "TriUniforms", false)->getPointerTo();
|
||||||
|
|
Loading…
Reference in a new issue