Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions octa.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,25 @@ class cube
ushort material, tex;
ivec n;
int offset;

bool operator==(const cfkey &o) {
return orient == o.orient && tex == o.tex && n == o.n && offset == o.offset && material == o.material;
}
};

//need htcmp to be free functions to work with tools.h
//but nothing else needs it
friend bool htcmp(const cube::cfkey &x, const cube::cfkey &y);
friend uint hthash(const cube::cfkey &k);
friend std::hash<plink>; //for unordered_map
friend std::hash<cfkey>; //for unordered_map
};

template<>
struct std::hash<cube::cfkey> {
size_t operator()(const cube::cfkey &k) const {
return std::hash<ivec>{}(k.n)^k.offset^k.tex^k.orient^k.material;
}
};

/**
Expand Down