Skip to content

Commit

Permalink
DirectX12 shadowmap
Browse files Browse the repository at this point in the history
  • Loading branch information
moonwho101 committed Sep 18, 2023
1 parent 7120781 commit 45fb41a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/DungeonStompApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2443,15 +2443,12 @@ void DungeonStompApp::DrawDungeon(ID3D12GraphicsCommandList* cmdList, const std:

int texture_alias_number = texture_list_buffer[i];
int texture_number = TexMap[texture_alias_number].texture;

int normal_map_texture = TexMap[texture_alias_number].normalmaptextureid;


if (texture_alias_number == 104) {
TexMap[texture_alias_number].is_alpha_texture = 1;
}


draw = true;

if (isAlpha) {
Expand All @@ -2471,8 +2468,6 @@ void DungeonStompApp::DrawDungeon(ID3D12GraphicsCommandList* cmdList, const std:
}
}



if (normal_map_texture == -1 && normalMap) {
draw = false;
}
Expand All @@ -2481,11 +2476,8 @@ void DungeonStompApp::DrawDungeon(ID3D12GraphicsCommandList* cmdList, const std:
draw = false;
}



int oid = 0;


if (drawingSSAO || drawingShadowMap) {
oid = ObjectsToDraw[currentObject].objectId;

Expand All @@ -2512,11 +2504,20 @@ void DungeonStompApp::DrawDungeon(ID3D12GraphicsCommandList* cmdList, const std:
}
}



if (ObjectsToDraw[currentObject].castshaddow == 0) {
draw = false;
}

//Don't draw shadows facing away from shadow light
if (ObjectsToDraw[currentObject].objectId == 58 || ObjectsToDraw[currentObject].objectId == 57) {
if (ObjectsToDraw[currentObject].angle == 270.0f) {
draw = false;
}
if (ObjectsToDraw[currentObject].angle == 0.0f) {
draw = false;
}
}

}

if (currentObject >= playerGunObjectStart && currentObject < playerObjectStart && drawingShadowMap) {
Expand Down
3 changes: 3 additions & 0 deletions src/ProcessModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ void ObjectToD3DVertList(int ob_type, float angle, int oblist_index)
}


ObjectsToDraw[number_of_polys_per_frame].angle = angle;


//The object casts a shadow
if (oblist[oblist_index].castshadow == 0) {
ObjectsToDraw[number_of_polys_per_frame].castshaddow = 0;
Expand Down
1 change: 1 addition & 0 deletions src/world.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ typedef struct poly_sort
int texture;
int objectId = -1;
int castshaddow = 1;
float angle = -1;

} POLY_SORT;

Expand Down

0 comments on commit 45fb41a

Please sign in to comment.