MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / EBNode_DetermineMaxSizeForEdge

Function EBNode_DetermineMaxSizeForEdge

editor/ebnode.cpp:785–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785float EBNode_DetermineMaxSizeForEdge(int spnt, int sroom, int epnt, int eroom) {
786 bn_list *snlist;
787 snlist = BNode_GetBNListPtr(sroom);
788 bn_list *enlist;
789 enlist = BNode_GetBNListPtr(eroom);
790
791 float size = 0.0f;
792 fvi_info hit_info;
793 fvi_query fq;
794 int fate;
795
796 // shoot a ray from the light position to the current vertex
797 fq.flags = FQ_IGNORE_RENDER_THROUGH_PORTALS;
798 fq.thisobjnum = -1;
799 fq.ignore_obj_list = NULL;
800
801 do {
802 fq.p0 = &snlist->nodes[spnt].pos;
803 fq.p1 = &enlist->nodes[epnt].pos;
804 fq.startroom = (sroom > Highest_room_index && sroom <= Highest_room_index + 8)
805 ? GetTerrainRoomFromPos(&snlist->nodes[spnt].pos)
806 : sroom;
807 fq.rad = size;
808
809 fate = fvi_FindIntersection(&fq, &hit_info);
810
811 if (fate == HIT_NONE) {
812 fq.p0 = &enlist->nodes[epnt].pos;
813 fq.p1 = &snlist->nodes[spnt].pos;
814 fq.startroom = (eroom > Highest_room_index && eroom <= Highest_room_index + 8)
815 ? GetTerrainRoomFromPos(&enlist->nodes[epnt].pos)
816 : eroom;
817 fq.rad = size;
818
819 fate = fvi_FindIntersection(&fq, &hit_info);
820 }
821
822 if (fate == HIT_NONE) {
823 size += 1.0f;
824 }
825 } while (fate == HIT_NONE && size < MAX_BNODE_SIZE + 1.0f);
826
827 return (size - 1.0f);
828}
829
830void EBNode_AutoEdgeNode(int spnt, int sroom) {
831 BNode_verified = false;

Callers 2

EBNode_AddEdgeFunction · 0.85
EBNode_ComputeEdgeCostsFunction · 0.85

Calls 3

BNode_GetBNListPtrFunction · 0.85
GetTerrainRoomFromPosFunction · 0.85
fvi_FindIntersectionFunction · 0.85

Tested by

no test coverage detected