Repository navigation
Expand file tree
/
Copy pathTreeBillboardPolicyProbe.cpp
More file actions
34 lines (34 loc) · 2.53 KB
/
Copy pathTreeBillboardPolicyProbe.cpp
File metadata and controls
34 lines (34 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "TreeBillboardPolicy.h"
#include <cstdio>
#include <cstdlib>
#include <initializer_list>
using namespace TreeBillboardPolicy;
void Check(bool value,const char* message){if(!value){std::fprintf(stderr,"FAIL: %s\n",message);std::exit(1);}}
int main(){
for(uint32_t index:{0xbeu,0xc4u,0xc8u,0xcdu,0xd1u,0xd5u})
Check(Primitive(0x80000000|index,0x88a48991,1,1,4,6),"verified conifer silhouette cards");
Check(Primitive(0x80000004,0xf1d55304,1,1,22,69),"verified polygon-cut tree silhouette");
Check(Primitive(0x80000021,0xf508b8f3,1,1,4,6),"verified tree atlas quad");
Check(!Primitive(0x80000004,0xf1d55304,1,0,22,69),"non-billboard geometry remains");
Check(!Primitive(0x80000004,0xf1d55304,1,1,500,1500),"3D tree geometry remains even with same atlas");
Check(!Primitive(0x80000004,0xf1d55304,3,1,22,69),"particle sprites remain");
Check(!Primitive(0x80000005,0xf1d55304,1,1,4,6),"unknown material in same library remains");
Check(!Primitive(0x800000c4,0x12345678,1,1,4,6),"other atlas and library remain");
Check(!Primitive(0x800000c4,0x88a48991,1,3,4,6),"other axis-lock effect remains");
Check(MainView(0x5000,0x5000,true,false,true,15),"main tracked/native stereo geometry eligible");
Check(!MainView(0x6000,0x5000,true,false,true,15),"other cameras remain");
Check(!MainView(0x5000,0x5000,true,true,true,15),"mirror remains");
Check(!MainView(0x5000,0x5000,true,false,false,15),"non-main targets remain");
Check(!MainView(0x5000,0x5000,false,false,true,15),"mono context remains");
Check(!MainView(0x5000,0x5000,true,false,true,6),"shadow pass remains");
using namespace HeadMeshPolicy;
Selection body{0x2000,{0x3000,0x4000},2};
Entry entries[]{{0x10,0x3002,0x2007,0x11},{0x20,0x3002,0x6007,0x22},
{0x30,0x5002,0x7007,0x33},{0x40,0x4002,0x2007,0x44},{0x50,0x8002,0x9007,0x55}};
Entry keptEntries[5]{};uint32_t buffers[]{1,2,3,4,5},keptBuffers[5]{};unsigned kept{};
auto remove=[&](const Entry& e){return Matches(body,e)||((e.primitive&~15u)==0x5000);};
Check(CopyEntries(entries,5,keptEntries,buffers,keptBuffers,kept,remove)&&kept==2,"mixed body/tree batch compacted once");
Check(keptEntries[0].sort==0x22&&keptEntries[1].sort==0x55&&keptBuffers[0]==2&&keptBuffers[1]==5,"NPC, held weapon and constants retain native order");
Check(entries[2].instance==0x30&&entries[3].sort==0x44&&buffers[3]==4,"native arrays untouched");
puts("PASS: identified tree billboards only; 3D meshes, other materials, view/pass scope and mixed entry/buffer ordering preserved.");
}