Shadowmap size limit
This commit is contained in:
parent
69f355eae4
commit
2ebab9358d
6
src/k3.c
6
src/k3.c
@ -2150,7 +2150,7 @@ void k3PassIrregular(struct k3Offscreen *mainview, mat4 mainproj, mat4 maincam)
|
||||
#endif
|
||||
|
||||
// Constructs shadowmap atlas, saves `offscr` for own use
|
||||
void k3PassShadowmap(mat4 projection, mat4 cam, struct k3Offscreen *offscr) {
|
||||
void k3PassShadowmap(mat4 projection, mat4 cam, struct k3Offscreen *offscr, float cellSizeLimit) {
|
||||
glm_mat4_copy(projection, ProjMat);
|
||||
glm_mat4_copy(cam, CamMat);
|
||||
|
||||
@ -2194,6 +2194,10 @@ void k3PassShadowmap(mat4 projection, mat4 cam, struct k3Offscreen *offscr) {
|
||||
uint16_t sz = k3TexSzX(offscr->depth);
|
||||
float cellSz = (float) sz / cellsPerDimension;
|
||||
|
||||
if(cellSizeLimit > 0) {
|
||||
cellSz = fminf(cellSizeLimit, cellSz);
|
||||
}
|
||||
|
||||
k3BeginOffscreen(offscr);
|
||||
size_t i = 0;
|
||||
for(size_t li = 0; li < LightCount; li++) {
|
||||
|
||||
2
src/k3.h
2
src/k3.h
@ -185,7 +185,7 @@ void k3BatchClear();
|
||||
void k3PassForward(mat4 projection, mat4 cam);
|
||||
void k3PassDepthOnly(mat4 projection, mat4 cam, int clear, int cull);
|
||||
|
||||
void k3PassShadowmap(mat4 projection, mat4 cam, struct k3Offscreen *offscr);
|
||||
void k3PassShadowmap(mat4 projection, mat4 cam, struct k3Offscreen *offscr, float cellSizeLimit);
|
||||
|
||||
struct k3Offscreen;
|
||||
struct k3Offscreen *k3OffscreenCreateMultisampled(struct k3Tex *diffuse, struct k3Tex *depth, uint8_t samples);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user