wip(assembler): round L34 -- passage mouth profile audit and standard capture set
Adds a density-field floor/wall profile audit along passages near mouths (0.125 m spacing; L23 terraced negative control detected) and a reusable 12-view passage capture set (80 deg FOV, eye height, LOD0, skirts off, capped clip planes). The old blurry mouth shot was camera framing; the L33 entry ledges were tile skirts. Owner world hashes unchanged; 24/24 passage rows, 30/30 determinism, 16/16 invariants; cost within noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
This commit is contained in:
1 parent
b7a47bef95
commit
49e29fcd36
24 files changed
+1863
-3
No files matched your search
@@ -14,8 +14,11 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
@@ -39,6 +42,7 @@ namespace
|
||||
float MaximumHeight=-std::numeric_limits<float>::infinity();
|
||||
std::vector<FVertex> Vertices;
|
||||
std::vector<std::uint32_t> Indices;
|
||||
std::vector<std::uint32_t> SurfaceIndices;
|
||||
struct FTileRange
|
||||
{
|
||||
std::array<std::int32_t,4> Key{};
|
||||
@@ -198,6 +202,8 @@ namespace
|
||||
for(const auto& Tile:Scene.Tiles)Desired.insert(Tile.Key);
|
||||
std::vector<std::uint32_t> VisibleIndices;
|
||||
VisibleIndices.reserve(Scene.Indices.size());
|
||||
Scene.SurfaceIndices.reserve(Scene.Indices.size()-
|
||||
static_cast<std::size_t>(Scene.SkirtTriangles)*3);
|
||||
for(const auto& Tile:Scene.Tiles)
|
||||
{
|
||||
const std::uint8_t VisibleMask=ComputeVisibleSkirtFaceMask(Tile.Key,Desired);
|
||||
@@ -212,6 +218,9 @@ namespace
|
||||
const std::size_t Index=Tile.IndexBegin+static_cast<std::size_t>(Triangle)*3;
|
||||
VisibleIndices.insert(VisibleIndices.end(),Scene.Indices.begin()+Index,
|
||||
Scene.Indices.begin()+Index+3);
|
||||
if(FaceMask==0)
|
||||
Scene.SurfaceIndices.insert(Scene.SurfaceIndices.end(),
|
||||
Scene.Indices.begin()+Index,Scene.Indices.begin()+Index+3);
|
||||
}
|
||||
}
|
||||
Scene.Indices=std::move(VisibleIndices);
|
||||
@@ -219,6 +228,272 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
struct FClipCapResult
|
||||
{
|
||||
std::uint64_t Intersections=0,Loops=0,OpenContours=0,Triangles=0;
|
||||
std::uint64_t DegreeOneNodes=0,BranchNodes=0;
|
||||
std::uint64_t ClosedOpenContours=0;
|
||||
double OpenGapMetres=0.0,NearestOpenGapMetres=0.0;
|
||||
};
|
||||
|
||||
FClipCapResult AddClipPlaneCaps(FScene& Scene,const std::array<double,4>& InputPlane)
|
||||
{
|
||||
FClipCapResult Result;
|
||||
const double NormalLength=std::hypot(InputPlane[0],InputPlane[1],InputPlane[2]);
|
||||
if(!(NormalLength>0.0))return Result;
|
||||
const std::array<double,3> N={InputPlane[0]/NormalLength,
|
||||
InputPlane[1]/NormalLength,InputPlane[2]/NormalLength};
|
||||
const double D=InputPlane[3]/NormalLength;
|
||||
const std::array<double,3> Reference=std::abs(N[2])<0.85
|
||||
?std::array<double,3>{0.0,0.0,1.0}:std::array<double,3>{0.0,1.0,0.0};
|
||||
const auto Cross=[](const std::array<double,3>& A,const std::array<double,3>& B)
|
||||
{
|
||||
return std::array<double,3>{A[1]*B[2]-A[2]*B[1],
|
||||
A[2]*B[0]-A[0]*B[2],A[0]*B[1]-A[1]*B[0]};
|
||||
};
|
||||
const auto Normalize=[](const std::array<double,3>& A)
|
||||
{
|
||||
const double Length=std::hypot(A[0],A[1],A[2]);
|
||||
return Length>0.0?std::array<double,3>{A[0]/Length,A[1]/Length,A[2]/Length}
|
||||
:std::array<double,3>{1.0,0.0,0.0};
|
||||
};
|
||||
const auto Dot=[](const std::array<double,3>& A,const std::array<double,3>& B)
|
||||
{return A[0]*B[0]+A[1]*B[1]+A[2]*B[2];};
|
||||
const std::array<double,3> U=Normalize(Cross(N,Reference));
|
||||
const std::array<double,3> V=Normalize(Cross(N,U));
|
||||
const std::array<double,3> Origin={-D*N[0],-D*N[1],-D*N[2]};
|
||||
using FPointKey=std::pair<std::int64_t,std::int64_t>;
|
||||
std::map<FPointKey,std::size_t> NodeForPoint;
|
||||
std::vector<std::array<double,2>> PlanePoints;
|
||||
std::vector<std::array<double,3>> WorldPoints;
|
||||
std::set<std::pair<std::size_t,std::size_t>> Segments;
|
||||
const auto AddPoint=[&](const std::array<double,3>& Point)
|
||||
{
|
||||
const std::array<double,3> Relative={Point[0]-Origin[0],
|
||||
Point[1]-Origin[1],Point[2]-Origin[2]};
|
||||
const std::array<double,2> PlanePoint={Dot(Relative,U),Dot(Relative,V)};
|
||||
constexpr double Quantization=1000.0;
|
||||
const FPointKey Key{static_cast<std::int64_t>(std::llround(PlanePoint[0]*Quantization)),
|
||||
static_cast<std::int64_t>(std::llround(PlanePoint[1]*Quantization))};
|
||||
const auto Found=NodeForPoint.find(Key);
|
||||
if(Found!=NodeForPoint.end())return Found->second;
|
||||
const std::size_t Index=PlanePoints.size();
|
||||
NodeForPoint.emplace(Key,Index);PlanePoints.push_back(PlanePoint);
|
||||
WorldPoints.push_back(Point);return Index;
|
||||
};
|
||||
for(std::size_t Triangle=0;Triangle+2<Scene.Indices.size();Triangle+=3)
|
||||
{
|
||||
std::array<std::array<double,3>,3> Points{};
|
||||
std::array<double,3> Distances{};
|
||||
for(std::size_t Vertex=0;Vertex<3;++Vertex)
|
||||
{
|
||||
const auto& Source=Scene.Vertices[Scene.Indices[Triangle+Vertex]];
|
||||
Points[Vertex]={Source.WorldPosition[0],Source.WorldPosition[1],Source.WorldPosition[2]};
|
||||
Distances[Vertex]=Dot(N,Points[Vertex])+D;
|
||||
}
|
||||
std::array<std::array<double,3>,3> Hits{};std::size_t HitCount=0;
|
||||
for(std::size_t Edge=0;Edge<3;++Edge)
|
||||
{
|
||||
const std::size_t A=Edge,B=(Edge+1)%3;
|
||||
const double DA=Distances[A],DB=Distances[B];
|
||||
if(std::abs(DA)<=1.0e-9)
|
||||
{
|
||||
bool Duplicate=false;
|
||||
for(std::size_t I=0;I<HitCount;++I)
|
||||
Duplicate=Duplicate||std::hypot(Hits[I][0]-Points[A][0],
|
||||
Hits[I][1]-Points[A][1],Hits[I][2]-Points[A][2])<1.0e-7;
|
||||
if(!Duplicate&&HitCount<Hits.size())Hits[HitCount++]=Points[A];
|
||||
}
|
||||
if((DA< -1.0e-9&&DB>1.0e-9)||(DA>1.0e-9&&DB< -1.0e-9))
|
||||
{
|
||||
const double T=DA/(DA-DB);
|
||||
const std::array<double,3> Hit={
|
||||
std::lerp(Points[A][0],Points[B][0],T),
|
||||
std::lerp(Points[A][1],Points[B][1],T),
|
||||
std::lerp(Points[A][2],Points[B][2],T)};
|
||||
bool Duplicate=false;
|
||||
for(std::size_t I=0;I<HitCount;++I)
|
||||
Duplicate=Duplicate||std::hypot(Hits[I][0]-Hit[0],
|
||||
Hits[I][1]-Hit[1],Hits[I][2]-Hit[2])<1.0e-7;
|
||||
if(!Duplicate&&HitCount<Hits.size())Hits[HitCount++]=Hit;
|
||||
}
|
||||
}
|
||||
if(HitCount!=2)continue;
|
||||
const std::size_t A=AddPoint(Hits[0]),B=AddPoint(Hits[1]);
|
||||
if(A==B)continue;
|
||||
Segments.emplace(std::min(A,B),std::max(A,B));
|
||||
}
|
||||
Result.Intersections=Segments.size();
|
||||
if(Segments.empty())return Result;
|
||||
std::vector<std::vector<std::size_t>> Adjacency(PlanePoints.size());
|
||||
for(const auto& [A,B]:Segments)
|
||||
{Adjacency[A].push_back(B);Adjacency[B].push_back(A);}
|
||||
std::vector<std::size_t> DegreeOne;
|
||||
for(std::size_t Node=0;Node<Adjacency.size();++Node)
|
||||
{
|
||||
const auto& Neighbours=Adjacency[Node];
|
||||
if(Neighbours.size()==1){++Result.DegreeOneNodes;DegreeOne.push_back(Node);}
|
||||
else if(Neighbours.size()>2)++Result.BranchNodes;
|
||||
}
|
||||
struct FEndpointPair {double Distance=0.0;std::size_t A=0,B=0;};
|
||||
std::vector<FEndpointPair> EndpointPairs;
|
||||
for(std::size_t I=0;I<DegreeOne.size();++I)
|
||||
for(std::size_t J=I+1;J<DegreeOne.size();++J)
|
||||
{
|
||||
const std::size_t A=DegreeOne[I],B=DegreeOne[J];
|
||||
EndpointPairs.push_back({std::hypot(PlanePoints[A][0]-PlanePoints[B][0],
|
||||
PlanePoints[A][1]-PlanePoints[B][1]),A,B});
|
||||
}
|
||||
std::sort(EndpointPairs.begin(),EndpointPairs.end(),[](const auto& A,const auto& B)
|
||||
{return A.Distance<B.Distance;});
|
||||
if(!EndpointPairs.empty())Result.NearestOpenGapMetres=EndpointPairs.front().Distance;
|
||||
std::set<std::size_t> PairedEndpoints;
|
||||
for(const FEndpointPair& Pair:EndpointPairs)
|
||||
{
|
||||
if(Pair.Distance>1.0)break;
|
||||
if(PairedEndpoints.contains(Pair.A)||PairedEndpoints.contains(Pair.B))continue;
|
||||
const auto ClosingEdge=std::minmax(Pair.A,Pair.B);
|
||||
if(!Segments.emplace(ClosingEdge.first,ClosingEdge.second).second)continue;
|
||||
Adjacency[Pair.A].push_back(Pair.B);Adjacency[Pair.B].push_back(Pair.A);
|
||||
PairedEndpoints.insert(Pair.A);PairedEndpoints.insert(Pair.B);
|
||||
Result.OpenGapMetres=std::max(Result.OpenGapMetres,Pair.Distance);
|
||||
++Result.ClosedOpenContours;
|
||||
}
|
||||
std::vector<std::map<std::size_t,std::size_t>> Continuation(Adjacency.size());
|
||||
for(std::size_t Node=0;Node<Adjacency.size();++Node)
|
||||
{
|
||||
const auto& Neighbours=Adjacency[Node];
|
||||
if(Neighbours.size()==2)
|
||||
{
|
||||
Continuation[Node][Neighbours[0]]=Neighbours[1];
|
||||
Continuation[Node][Neighbours[1]]=Neighbours[0];
|
||||
continue;
|
||||
}
|
||||
if(Neighbours.size()<3)continue;
|
||||
struct FTurnPair {double Dot=1.0;std::size_t A=0,B=0;};
|
||||
std::vector<FTurnPair> Pairs;
|
||||
for(std::size_t I=0;I<Neighbours.size();++I)
|
||||
for(std::size_t J=I+1;J<Neighbours.size();++J)
|
||||
{
|
||||
const auto& A=PlanePoints[Neighbours[I]];
|
||||
const auto& B=PlanePoints[Neighbours[J]];
|
||||
const double AX=A[0]-PlanePoints[Node][0];
|
||||
const double AY=A[1]-PlanePoints[Node][1];
|
||||
const double BX=B[0]-PlanePoints[Node][0];
|
||||
const double BY=B[1]-PlanePoints[Node][1];
|
||||
const double LengthA=std::hypot(AX,AY),LengthB=std::hypot(BX,BY);
|
||||
if(LengthA<=1.0e-9||LengthB<=1.0e-9)continue;
|
||||
Pairs.push_back({(AX*BX+AY*BY)/(LengthA*LengthB),
|
||||
Neighbours[I],Neighbours[J]});
|
||||
}
|
||||
std::sort(Pairs.begin(),Pairs.end(),[](const auto& A,const auto& B)
|
||||
{return A.Dot<B.Dot;});
|
||||
std::set<std::size_t> Paired;
|
||||
for(const FTurnPair& Pair:Pairs)
|
||||
{
|
||||
if(Pair.Dot>0.25||Paired.contains(Pair.A)||Paired.contains(Pair.B))continue;
|
||||
Continuation[Node][Pair.A]=Pair.B;Continuation[Node][Pair.B]=Pair.A;
|
||||
Paired.insert(Pair.A);Paired.insert(Pair.B);
|
||||
}
|
||||
}
|
||||
std::set<std::pair<std::size_t,std::size_t>> UsedSegments;
|
||||
std::vector<std::vector<std::size_t>> Loops;
|
||||
for(const auto& Segment:Segments)
|
||||
{
|
||||
if(UsedSegments.contains(Segment))continue;
|
||||
std::vector<std::size_t> Loop{Segment.first};
|
||||
std::size_t Previous=Segment.first,Current=Segment.second;
|
||||
UsedSegments.insert(Segment);bool Closed=false,Branched=false;
|
||||
for(std::size_t Guard=0;Guard<=Segments.size();++Guard)
|
||||
{
|
||||
if(Current==Loop.front()){Closed=true;break;}
|
||||
Loop.push_back(Current);
|
||||
const auto ContinuationIt=Continuation[Current].find(Previous);
|
||||
if(ContinuationIt==Continuation[Current].end())
|
||||
{Branched=true;break;}
|
||||
const std::size_t Next=ContinuationIt->second;
|
||||
const auto NextEdge=std::minmax(Current,Next);
|
||||
if(UsedSegments.contains(NextEdge))
|
||||
{Branched=true;break;}
|
||||
UsedSegments.insert(NextEdge);Previous=Current;Current=Next;
|
||||
}
|
||||
if(Closed&&Loop.size()>=3)Loops.push_back(std::move(Loop));
|
||||
else if(Branched||!Closed)++Result.OpenContours;
|
||||
}
|
||||
Result.Loops=Loops.size();
|
||||
if(Loops.empty())return Result;
|
||||
|
||||
struct FPlaneEdge {std::array<double,2> A{},B{};};
|
||||
std::vector<FPlaneEdge> Edges;
|
||||
std::vector<double> Ys;
|
||||
for(const auto& Loop:Loops)
|
||||
for(std::size_t I=0;I<Loop.size();++I)
|
||||
{
|
||||
const auto& A=PlanePoints[Loop[I]];
|
||||
const auto& B=PlanePoints[Loop[(I+1)%Loop.size()]];
|
||||
if(std::hypot(A[0]-B[0],A[1]-B[1])<1.0e-6)continue;
|
||||
Edges.push_back({A,B});Ys.push_back(A[1]);Ys.push_back(B[1]);
|
||||
}
|
||||
std::sort(Ys.begin(),Ys.end());
|
||||
Ys.erase(std::unique(Ys.begin(),Ys.end(),[](double A,double B)
|
||||
{return std::abs(A-B)<1.0e-6;}),Ys.end());
|
||||
const auto AppendTriangle=[&](const std::array<double,2>& A,
|
||||
const std::array<double,2>& B,const std::array<double,2>& C)
|
||||
{
|
||||
const std::array<std::array<double,2>,3> PlaneVertices={A,B,C};
|
||||
const std::uint32_t Base=static_cast<std::uint32_t>(Scene.Vertices.size());
|
||||
for(const auto& PlaneVertex:PlaneVertices)
|
||||
{
|
||||
FVertex Vertex{};
|
||||
for(std::size_t Axis=0;Axis<3;++Axis)
|
||||
{
|
||||
const double World=Origin[Axis]+U[Axis]*PlaneVertex[0]
|
||||
+V[Axis]*PlaneVertex[1]+N[Axis]*0.001;
|
||||
Vertex.Position[Axis]=static_cast<float>(World);
|
||||
Vertex.WorldPosition[Axis]=static_cast<float>(World);
|
||||
Vertex.Normal[Axis]=static_cast<float>(-N[Axis]);
|
||||
}
|
||||
Vertex.Height=Vertex.Position[2];
|
||||
Scene.Vertices.push_back(Vertex);
|
||||
}
|
||||
Scene.Indices.insert(Scene.Indices.end(),{Base,Base+1,Base+2});
|
||||
++Result.Triangles;
|
||||
};
|
||||
for(std::size_t Slab=0;Slab+1<Ys.size();++Slab)
|
||||
{
|
||||
const double Y0=Ys[Slab],Y1=Ys[Slab+1];
|
||||
if(Y1-Y0<1.0e-7)continue;
|
||||
const double Mid=(Y0+Y1)*0.5;
|
||||
struct FCrossing {double X=0.0;const FPlaneEdge* Edge=nullptr;};
|
||||
std::vector<FCrossing> Crossings;
|
||||
for(const FPlaneEdge& Edge:Edges)
|
||||
{
|
||||
const double Low=std::min(Edge.A[1],Edge.B[1]);
|
||||
const double High=std::max(Edge.A[1],Edge.B[1]);
|
||||
if(Mid<=Low||Mid>=High)continue;
|
||||
const double T=(Mid-Edge.A[1])/(Edge.B[1]-Edge.A[1]);
|
||||
Crossings.push_back({std::lerp(Edge.A[0],Edge.B[0],T),&Edge});
|
||||
}
|
||||
std::sort(Crossings.begin(),Crossings.end(),[](const auto& A,const auto& B)
|
||||
{return A.X<B.X;});
|
||||
const auto XAt=[](const FPlaneEdge& Edge,double Y)
|
||||
{return std::lerp(Edge.A[0],Edge.B[0],(Y-Edge.A[1])/(Edge.B[1]-Edge.A[1]));};
|
||||
for(std::size_t I=0;I+1<Crossings.size();I+=2)
|
||||
{
|
||||
const FPlaneEdge& Left=*Crossings[I].Edge;
|
||||
const FPlaneEdge& Right=*Crossings[I+1].Edge;
|
||||
const std::array<double,2> A={XAt(Left,Y0),Y0};
|
||||
const std::array<double,2> B={XAt(Right,Y0),Y0};
|
||||
const std::array<double,2> C={XAt(Right,Y1),Y1};
|
||||
const std::array<double,2> E={XAt(Left,Y1),Y1};
|
||||
if(std::abs(A[0]-B[0])+std::abs(E[0]-C[0])<1.0e-7)continue;
|
||||
AppendTriangle(A,B,C);AppendTriangle(A,C,E);
|
||||
}
|
||||
}
|
||||
Scene.DrawnTriangles=Scene.Indices.size()/3;
|
||||
return Result;
|
||||
}
|
||||
|
||||
EGLDisplay MakeDisplay()
|
||||
{
|
||||
using TGetPlatformDisplay=EGLDisplay(*)(EGLenum,void*,const EGLint*);
|
||||
@@ -537,7 +812,7 @@ int main(int argc,char** argv)
|
||||
{
|
||||
if(argc<3)
|
||||
{
|
||||
std::fprintf(stderr,"Usage: %s scene.vfmesh output.png [--size=WIDTHxHEIGHT] [--fov-deg=90] [--height-range-m=N] [--height-center-m=N] [--camera-m=X,Y,Z] [--yaw-deg=N] [--pitch-deg=N] [--shade=readable|normal] [--height-tint=on|off] [--headlamp=on|off] [--light-direction=X,Y,Z] [--tile-edges=on|off] [--tile-edge-width-m=N] [--clip-plane=NX,NY,NZ,D]\n",argv[0]);
|
||||
std::fprintf(stderr,"Usage: %s scene.vfmesh output.png [--size=WIDTHxHEIGHT] [--fov-deg=90] [--height-range-m=N] [--height-center-m=N] [--camera-m=X,Y,Z] [--yaw-deg=N] [--pitch-deg=N] [--shade=readable|normal] [--height-tint=on|off] [--headlamp=on|off] [--light-direction=X,Y,Z] [--tile-edges=on|off] [--tile-skirts=on|off] [--tile-edge-width-m=N] [--clip-plane=NX,NY,NZ,D] [--focus-region=X,Y,Z,R]\n",argv[0]);
|
||||
return 2;
|
||||
}
|
||||
int Width=2560,Height=1440;double Fov=90.0,HeightRangeMeters=64.0;
|
||||
@@ -545,8 +820,10 @@ int main(int argc,char** argv)
|
||||
bool HasYaw=false,HasPitch=false;double Yaw=0.0,Pitch=0.0;
|
||||
bool HasCamera=false;std::array<double,3> Camera{};
|
||||
bool HasLightDirection=false;std::array<double,3> LightDirection{};
|
||||
bool ReadableMode=true,HeightTint=true,TileEdges=false,Headlamp=false;double TileEdgeWidthMeters=0.15;
|
||||
bool ReadableMode=true,HeightTint=true,TileEdges=false,TileSkirts=true,Headlamp=false;
|
||||
double TileEdgeWidthMeters=0.15;
|
||||
bool ClipPlaneEnabled=false;std::array<double,4> ClipPlane{};
|
||||
bool FocusRegionEnabled=false;std::array<double,3> FocusCenter{};double FocusRadius=0.0;
|
||||
for(int I=3;I<argc;++I)
|
||||
{
|
||||
const std::string_view Arg(argv[I]);
|
||||
@@ -586,6 +863,17 @@ int main(int argc,char** argv)
|
||||
{std::fprintf(stderr,"Invalid camera position\n");return 2;}
|
||||
HasCamera=true;
|
||||
}
|
||||
else if(Arg.starts_with("--focus-region="))
|
||||
{
|
||||
const std::string Value(Arg.substr(15));
|
||||
if(std::sscanf(Value.c_str(),"%lf,%lf,%lf,%lf",&FocusCenter[0],&FocusCenter[1],
|
||||
&FocusCenter[2],&FocusRadius)!=4
|
||||
||!std::isfinite(FocusCenter[0])||!std::isfinite(FocusCenter[1])
|
||||
||!std::isfinite(FocusCenter[2])||!std::isfinite(FocusRadius)
|
||||
||FocusRadius<=0.0)
|
||||
{std::fprintf(stderr,"Invalid focus region\n");return 2;}
|
||||
FocusRegionEnabled=true;
|
||||
}
|
||||
else if(Arg.starts_with("--yaw-deg=")||Arg.starts_with("--pitch-deg="))
|
||||
{
|
||||
const bool IsYaw=Arg.starts_with("--yaw-deg=");
|
||||
@@ -635,6 +923,13 @@ int main(int argc,char** argv)
|
||||
else if(Mode=="off")TileEdges=false;
|
||||
else {std::fprintf(stderr,"Invalid tile-edge mode\n");return 2;}
|
||||
}
|
||||
else if(Arg.starts_with("--tile-skirts="))
|
||||
{
|
||||
const std::string_view Mode=Arg.substr(14);
|
||||
if(Mode=="on")TileSkirts=true;
|
||||
else if(Mode=="off")TileSkirts=false;
|
||||
else {std::fprintf(stderr,"Invalid tile-skirt mode\n");return 2;}
|
||||
}
|
||||
else if(Arg.starts_with("--tile-edge-width-m="))
|
||||
{
|
||||
char* End=nullptr;const std::string Value(Arg.substr(20));
|
||||
@@ -663,6 +958,74 @@ int main(int argc,char** argv)
|
||||
if(HasYaw)Scene.YawDegrees=Yaw;
|
||||
if(HasPitch)Scene.PitchDegrees=Pitch;
|
||||
if(!HasHeightCenter)HeightCenterMeters=Scene.CameraMeters[2];
|
||||
const std::size_t CapIndexBegin=Scene.Indices.size();
|
||||
FClipCapResult ClipCap;
|
||||
if(ClipPlaneEnabled)
|
||||
{
|
||||
ClipCap=AddClipPlaneCaps(Scene,ClipPlane);
|
||||
const bool Capped=ClipCap.Loops>0&&ClipCap.Triangles>0;
|
||||
std::printf("[OffscreenClipCap] segments=%llu loops=%llu open_contours=%llu closed_open_contours=%llu degree_one=%llu branch_nodes=%llu open_gap_m=%.3f nearest_open_gap_m=%.3f cap_triangles=%llu status=%s\n",
|
||||
static_cast<unsigned long long>(ClipCap.Intersections),
|
||||
static_cast<unsigned long long>(ClipCap.Loops),
|
||||
static_cast<unsigned long long>(ClipCap.OpenContours),
|
||||
static_cast<unsigned long long>(ClipCap.ClosedOpenContours),
|
||||
static_cast<unsigned long long>(ClipCap.DegreeOneNodes),
|
||||
static_cast<unsigned long long>(ClipCap.BranchNodes),
|
||||
ClipCap.OpenGapMetres,ClipCap.NearestOpenGapMetres,
|
||||
static_cast<unsigned long long>(ClipCap.Triangles),Capped?"PASS":"FAIL");
|
||||
if(!Capped)return 3;
|
||||
}
|
||||
if(!TileSkirts)
|
||||
{
|
||||
const std::size_t SurfaceTriangleCount=Scene.SurfaceIndices.size()/3;
|
||||
std::vector<std::uint32_t> SurfaceAndCaps=std::move(Scene.SurfaceIndices);
|
||||
// Caps were appended after the original mesh indices. Keep them while dropping
|
||||
// the LOD seam skirts, which are useful for streamed play but obscure close captures.
|
||||
if(ClipPlaneEnabled&&Scene.Indices.size()>CapIndexBegin)
|
||||
SurfaceAndCaps.insert(SurfaceAndCaps.end(),Scene.Indices.begin()+CapIndexBegin,
|
||||
Scene.Indices.end());
|
||||
Scene.Indices=std::move(SurfaceAndCaps);
|
||||
Scene.DrawnTriangles=Scene.Indices.size()/3;
|
||||
std::printf("[OffscreenMeshDisplay] tile_skirts=off kept_surface_triangles=%llu "
|
||||
"cap_triangles=%llu status=PASS\n",
|
||||
static_cast<unsigned long long>(SurfaceTriangleCount),
|
||||
static_cast<unsigned long long>(Scene.Indices.size()/3-
|
||||
SurfaceTriangleCount));
|
||||
}
|
||||
if(FocusRegionEnabled)
|
||||
{
|
||||
std::vector<std::uint32_t> FocusedIndices;
|
||||
FocusedIndices.reserve(Scene.Indices.size());
|
||||
const double RadiusSquared=FocusRadius*FocusRadius;
|
||||
for(std::size_t Triangle=0;Triangle+2<Scene.Indices.size();Triangle+=3)
|
||||
{
|
||||
std::array<double,3> Center{};
|
||||
for(std::size_t Corner=0;Corner<3;++Corner)
|
||||
{
|
||||
const auto& Vertex=Scene.Vertices[Scene.Indices[Triangle+Corner]];
|
||||
for(std::size_t Axis=0;Axis<3;++Axis)
|
||||
Center[Axis]+=Vertex.WorldPosition[Axis]/3.0;
|
||||
}
|
||||
const double DX=Center[0]-FocusCenter[0],DY=Center[1]-FocusCenter[1],
|
||||
DZ=Center[2]-FocusCenter[2];
|
||||
if(DX*DX+DY*DY+DZ*DZ>RadiusSquared)continue;
|
||||
FocusedIndices.insert(FocusedIndices.end(),Scene.Indices.begin()+Triangle,
|
||||
Scene.Indices.begin()+Triangle+3);
|
||||
}
|
||||
if(FocusedIndices.empty())
|
||||
std::printf("[OffscreenFocusRegion] center_m=(%.3f,%.3f,%.3f) radius_m=%.3f "
|
||||
"triangles=0 status=EMPTY_FALLBACK full_scene_triangles=%llu\n",
|
||||
FocusCenter[0],FocusCenter[1],FocusCenter[2],FocusRadius,
|
||||
static_cast<unsigned long long>(Scene.DrawnTriangles));
|
||||
else
|
||||
{
|
||||
Scene.Indices=std::move(FocusedIndices);
|
||||
Scene.DrawnTriangles=Scene.Indices.size()/3;
|
||||
std::printf("[OffscreenFocusRegion] center_m=(%.3f,%.3f,%.3f) radius_m=%.3f "
|
||||
"triangles=%llu status=PASS\n",FocusCenter[0],FocusCenter[1],FocusCenter[2],
|
||||
FocusRadius,static_cast<unsigned long long>(Scene.DrawnTriangles));
|
||||
}
|
||||
}
|
||||
std::printf("[OffscreenScene] voxels_per_meter=%.6f camera_m=(%.3f,%.3f,%.3f) yaw=%.2f pitch=%.2f height_m=%.3f..%.3f height_center_m=%.3f shade=%s height_tint=%s tile_edges=%s vertices=%zu triangles=%llu\n",
|
||||
1000000.0/Scene.VoxelSizeMicrons,Scene.CameraMeters[0],Scene.CameraMeters[1],Scene.CameraMeters[2],
|
||||
Scene.YawDegrees,Scene.PitchDegrees,Scene.MinimumHeight,Scene.MaximumHeight,
|
||||
|
||||
Reference in new issue
Block a user