Skip to content

Commit

Permalink
ConvexSubspace: Roughed out a basic algorithm for separating discorda…
Browse files Browse the repository at this point in the history
…nt line segments

Other than the expected z-fighting issues, the "extrasegs.wad" test
case is now rendered correctly.

There is still much to be done however...
  • Loading branch information
danij-deng committed Jun 5, 2013
1 parent 6209efd commit 41a82fa
Show file tree
Hide file tree
Showing 12 changed files with 358 additions and 189 deletions.
6 changes: 6 additions & 0 deletions doomsday/client/include/map/bsp/convexsubspace.h
Expand Up @@ -41,6 +41,12 @@ struct OrderedSegment
double fromAngle;
double toAngle;

bool operator == (OrderedSegment const &other) const
{
return de::fequal(fromAngle, other.fromAngle) &&
de::fequal(toAngle, other.toAngle);
}

#ifdef DENG_DEBUG
void debugPrint() const
{
Expand Down
20 changes: 14 additions & 6 deletions doomsday/client/include/map/bspleaf.h
Expand Up @@ -103,7 +103,7 @@ class BspLeaf : public de::MapElement
/**
* Provides access to the convex Polygon geometry assigned to the BSP leaf.
*
* @see hasPoly(), setPoly()
* @see hasPoly(), assignPoly()
*/
de::Polygon &poly();

Expand All @@ -115,13 +115,21 @@ class BspLeaf : public de::MapElement
* is accepted it is first conformance tested to ensure that it represents
* a valid, simple convex polygon.
*
* @param newPolygon New polygon to be assigned to the BSP leaf. Ownership
* of the polygon is given to the BspLeaf if it passes
* all conformance checks.
* @param polygon New polygon to be assigned to the BSP leaf. Ownership
* of the polygon is given to the BspLeaf if it passes all
* conformance checks.
*
* @see hasPoly(), poly()
*/
void setPoly(de::Polygon *newPolygon);
void assignPoly(de::Polygon *polygon);

/**
* Assign an additional Polygon geometry to the BSP leaf.
*
* @param polygon New polygon to be assigned to the BSP leaf. Ownership
* of the polygon is given to the BspLeaf.
*/
void assignExtraPoly(de::Polygon *polygon);

/**
* Provides a clockwise ordered list of all the line segments which comprise
Expand All @@ -132,7 +140,7 @@ class BspLeaf : public de::MapElement
/**
* Provides a list of all the line segments attributed to the BSP leaf.
*/
Segments const &segments() const;
Segments const &allSegments() const;

/**
* Returns @c true iff a sector is attributed to the BSP leaf. The only time
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/audio/s_environ.cpp
Expand Up @@ -251,7 +251,7 @@ static boolean calcBspLeafReverb(BspLeaf *bspLeaf)
float total = 0;
// The other reverb properties can be found out by taking a look at the
// materials of all surfaces in the BSP leaf.
foreach(Segment *segment, bspLeaf->segments())
foreach(Segment *segment, bspLeaf->allSegments())
{
if(!segment->hasLineSide() || !segment->lineSide().hasSections() ||
!segment->lineSide().middle().hasMaterial())
Expand Down

0 comments on commit 41a82fa

Please sign in to comment.