create BMap project and copy-paste previous mesh convertion code

This commit is contained in:
2023-09-21 13:47:30 +08:00
parent f07ff1f246
commit 5671d7d7e6
12 changed files with 595 additions and 11 deletions

View File

@ -83,9 +83,13 @@ def GetTmplOperDiv(sname: str, svars: tuple[str]) -> str:
def GetTmplOperEqual(sname: str, svars: tuple[str]) -> str:
return f"""\tbool operator==(const {sname}& rhs) const {{
\t\treturn ({' && '.join(map(lambda x: f'{x} == rhs.{x}', svars))});
\t}}
\tbool operator!=(const {sname}& rhs) const {{
\t\treturn !(*this == rhs);
\t}}"""
def GetTmplOperSpaceship(sname: str, svars: tuple[str]) -> str:
sp: str = '\n\t\t'
return f"""\tauto operator<=>(const {sname}& rhs) const {{
\t\t{sp.join(map(lambda x: f'if (auto cmp = {x} <=> rhs.{x}; cmp != 0) return cmp;', svars[:-1]))}
\t\treturn {svars[-1]} <=> rhs.{svars[-1]};
\t}}"""
def GetTmplLength(sname: str, svars: tuple[str]) -> str: