Fix culling lines too close to the camera position
This commit is contained in:
parent
2121047fa2
commit
2086f8ffa6
2 changed files with 11 additions and 8 deletions
|
|
@ -54,7 +54,7 @@ void HWVisibleSet::FindPVS(HWDrawInfo* di, int sliceIndex, int sliceCount)
|
|||
|
||||
VSMatrix m = di->VPUniforms.mProjectionMatrix;
|
||||
m.multMatrix(di->VPUniforms.mViewMatrix);
|
||||
ClipFrustum.Set(m);
|
||||
ClipFrustum.Set(m, Viewpoint.Pos);
|
||||
|
||||
CurrentMapSections = &di->CurrentMapSections;
|
||||
no_renderflags = TArrayView<uint8_t>(di->no_renderflags.data(), di->no_renderflags.size());
|
||||
|
|
@ -660,15 +660,18 @@ void HWVisibleSetThreads::WorkerMain(int sliceIndex)
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CameraFrustum::Set(const VSMatrix& worldToProjection)
|
||||
void CameraFrustum::Set(const VSMatrix& worldToProjection, const DVector3& viewpoint)
|
||||
{
|
||||
Planes[0] = LeftFrustum(worldToProjection);
|
||||
Planes[1] = TopFrustum(worldToProjection);
|
||||
Planes[2] = RightFrustum(worldToProjection);
|
||||
Planes[3] = BottomFrustum(worldToProjection);
|
||||
Planes[4] = NearFrustum(worldToProjection);
|
||||
Planes[0] = NearFrustum(worldToProjection);
|
||||
Planes[1] = LeftFrustum(worldToProjection);
|
||||
Planes[2] = TopFrustum(worldToProjection);
|
||||
Planes[3] = RightFrustum(worldToProjection);
|
||||
Planes[4] = BottomFrustum(worldToProjection);
|
||||
Planes[5] = FarFrustum(worldToProjection);
|
||||
|
||||
// Move back near plane to be slightly behind the camera position
|
||||
Planes[0].W = -(Planes[0].XYZ() | viewpoint.ToXZY() - 1.0);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
AbsPlaneNormals[i] = Planes[i].XYZ();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct HWDrawInfo;
|
|||
|
||||
struct CameraFrustum
|
||||
{
|
||||
void Set(const VSMatrix& worldToProjection);
|
||||
void Set(const VSMatrix& worldToProjection, const DVector3& viewpoint);
|
||||
|
||||
bool IsSphereVisible(const DVector3& point, double radius) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue