Fix tree rendering and authored collision, add FPS display and packaging safeguards
This commit is contained in:
@@ -29,6 +29,8 @@ int main(int argc,char** argv) {
|
||||
if(!ava2_test::EnterTestRunDir()) return ava2_test::kSkip;
|
||||
const auto stdlib=fs::absolute(argv[1]);
|
||||
const auto model=fs::absolute("ymir work/pc/warrior/warrior_assasin1.gr2");
|
||||
const auto gateModel=fs::absolute("ymir work/zone/a/building/a1-middledam-01.gr2");
|
||||
const auto gateAttribute=fs::absolute("ymir work/zone/a/building/a1-middledam-01.mdatr");
|
||||
const auto animation=fs::absolute("ymir work/pc/warrior/general/wait.gr2");
|
||||
const std::array<fs::path,3> variantAnimations={animation,fs::absolute("ymir work/pc/warrior/general/walk.gr2"),fs::absolute("ymir work/pc/warrior/general/run.gr2")};
|
||||
if(!fs::exists(model) || !fs::exists(animation) || !fs::exists(variantAnimations[1]) || !fs::exists(variantAnimations[2])) return ava2_test::kSkip;
|
||||
@@ -243,6 +245,48 @@ int main(int argc,char** argv) {
|
||||
const float obstacleStart[3]={center[0]-5000,center[1],center[2]},after[3]={center[0]+5000,center[1],center[2]};
|
||||
const float aboveBox[3]={center[0],center[1]+box.halfExtents[1]+10,center[2]};
|
||||
require(obstacles.CheckFlyingCollision(obstacleStart,center) && !obstacles.CheckFlyingCollision(aboveBox,aboveBox),"real OBB endpoint/height check");
|
||||
require(obstacles.CheckMovementCollision(obstacleStart,center,1),"movement passed through a solid box");
|
||||
require(!obstacles.CheckMovementCollision(aboveBox,aboveBox,1),"overhead movement blocked by flattened box");
|
||||
const float belowBox[3]={center[0],center[1]-box.halfExtents[1]-40,center[2]};
|
||||
require(!obstacles.CheckMovementCollision(belowBox,belowBox,30),"movement below a box blocked by its footprint");
|
||||
ActorInstance overheadWalker;overheadWalker.SetPosition(center[0]-100,center[1]+box.halfExtents[1]+50,center[2]);overheadWalker.SetSpeed(100);
|
||||
overheadWalker.MoveInDirection(90,1,nullptr,&obstacles);
|
||||
require(std::abs(overheadWalker.GetX()-center[0])<0.01f,"actor could not walk above an object footprint");
|
||||
if(fs::exists(gateModel) && fs::exists(gateAttribute)) {
|
||||
fs::copy_file(gateModel,root/"gate.gr2");fs::copy_file(gateAttribute,root/"gate.mdatr");
|
||||
MapObjectManager gates;
|
||||
require(gates.AddObject("gate.gr2",66907.429688f,19664.039063f,72199.484375f,30),"reported town gate fixture");
|
||||
const auto& gate=gates.GetObjects().front();
|
||||
require(gate.has_authored_planes && gate.collision_planes.size()==6,"town gate authored collision planes missing");
|
||||
const float entrance[3]={66041.5f,19725.5f,71337.5f},advance[3]={66048.5f,19725.5f,71348.9f};
|
||||
require(gates.CheckCollision(advance[0],advance[2],30),"reported gate no longer reproduces old solid footprint");
|
||||
require(!gates.CheckMovementCollision(entrance,advance,30),"authored planes still seal reported gate opening");
|
||||
ActorInstance gateWalker;gateWalker.SetPosition(entrance[0],entrance[1]-30,entrance[2]);gateWalker.SetSpeed(100);
|
||||
gateWalker.MoveInDirection(31.55f,0.15f,nullptr,&gates);
|
||||
require(std::hypot(gateWalker.GetX()-entrance[0],gateWalker.GetZ()-entrance[2])>14,"actor still stuck at reported gate opening");
|
||||
gateWalker.SetPosition(entrance[0],entrance[1]-30,entrance[2]);
|
||||
for(int step=0;step<200;++step)gateWalker.MoveInDirection(31.55f,0.1f,nullptr,&gates);
|
||||
require(std::hypot(gateWalker.GetX()-entrance[0],gateWalker.GetZ()-entrance[2])>1999,"actor blocked while crossing entire gate opening");
|
||||
for(const auto& plane:gate.collision_planes) {
|
||||
float nearWall[3],intoWall[3];
|
||||
for(int k=0;k<3;++k){nearWall[k]=plane.center[k]+plane.normal[k]*40;intoWall[k]=plane.center[k]+plane.normal[k]*20;}
|
||||
require(gates.CheckMovementCollision(nearWall,intoWall,30),"authored gate wall lost collision");
|
||||
require(!plane.Intersects(intoWall,nearWall,30,true),"authored plane prevents escaping overlap");
|
||||
}
|
||||
std::cout<<"Reported town gate opening and all 6 walls verified\n";
|
||||
}
|
||||
{
|
||||
// A real empty attribute file intentionally disables dummy collisions;
|
||||
// a truncated attribute must retain the existing solid fallback.
|
||||
const char emptyAttribute[22]="AttributeData";
|
||||
std::ofstream(root/"obstacle.mdatr",std::ios::binary).write(emptyAttribute,22);
|
||||
MapObjectManager emptyObstacles;require(emptyObstacles.AddObject("obstacle.gr2",500,50,0,30),"empty attribute fixture");
|
||||
require(emptyObstacles.GetObjects().front().has_authored_planes && !emptyObstacles.CheckMovementCollision(obstacleStart,center,30),"empty authored attribute replaced by solid dummy");
|
||||
std::ofstream(root/"obstacle.mdatr",std::ios::binary).write(emptyAttribute,18);
|
||||
MapObjectManager brokenObstacles;require(brokenObstacles.AddObject("obstacle.gr2",500,50,0,30),"broken attribute fixture");
|
||||
require(!brokenObstacles.GetObjects().front().has_authored_planes && brokenObstacles.CheckMovementCollision(obstacleStart,center,30),"truncated attribute removed solid collision");
|
||||
fs::remove(root/"obstacle.mdatr");
|
||||
}
|
||||
require(!obstacles.CheckFlyingCollision(obstacleStart,after),"OBB changed to continuous sweep instead of source endpoints");
|
||||
auto collisionData=std::make_shared<FlyingData>();collisionData->initial_velocity=100;collisionData->range=10000;collisionData->hit_on_background=true;
|
||||
FlyingInstance obstacleFlight(collisionData,center,after);unsigned obstacleHits=0;FlyCollisionCallbacks collisionCallbacks;
|
||||
|
||||
Reference in New Issue
Block a user