Skip to content

Commit

Permalink
xrRender: R4: Fix for tessellation LOD setting
Browse files Browse the repository at this point in the history
  • Loading branch information
vTurbine committed Jun 1, 2023
1 parent 36370cc commit fc6ad72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Layers/xrRender/R_Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ class ECORE_API CBackend
, tree(*this)
, hemi(*this)
#if defined(USE_DX11)
, LOD(*this)
, constants(*this)
, StateManager(*this)
#endif
Expand Down
8 changes: 6 additions & 2 deletions src/Layers/xrRenderPC_R4/R_Backend_LOD.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#include "stdafx.h"
#include "r_backend_lod.h"

R_LOD::R_LOD() { unmap(); }
R_LOD::R_LOD(CBackend& cmd_list_in) : cmd_list(cmd_list_in)
{
unmap();
}

void R_LOD::set_LOD(float LOD)
{
if (c_LOD)
{
float factor = clampr<float>(ceil(LOD * LOD * LOD * LOD * LOD * 8.0f), 1, 7);
RCache.set_c(c_LOD, factor);
cmd_list.set_c(c_LOD, factor);
}
}
4 changes: 3 additions & 1 deletion src/Layers/xrRenderPC_R4/R_Backend_LOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ class R_LOD
R_constant* c_LOD;

public:
R_LOD();
explicit R_LOD(CBackend& cmd_list_in);

void unmap() { c_LOD = 0; }
void set_LOD(R_constant* C) { c_LOD = C; }
void set_LOD(float LOD);

CBackend& cmd_list;
};

#endif // #ifndef R_BACKEND_LOD_H_INCLUDED

0 comments on commit fc6ad72

Please sign in to comment.