set options using flags
This commit is contained in:
17
main.py
17
main.py
@ -6,13 +6,13 @@ from math import cos, sin
|
||||
from typing import cast
|
||||
import dearpygui.dearpygui as dpg # pyright: ignore[reportMissingTypeStubs]
|
||||
|
||||
RENDER_VERTICES = False
|
||||
RENDER_VERTICES = True
|
||||
RENDER_EDGES = True
|
||||
BEST_EFFORT_PARSE = True
|
||||
|
||||
CANVAS_SIZE = 500
|
||||
TIMESTEP = 0.01
|
||||
CAMERA_DISTANCE = 3.0
|
||||
CAMERA_DISTANCE = 2.5
|
||||
|
||||
VERTEX_SIZE = 5.0
|
||||
VERTEX_COLOR = (27, 188, 104)
|
||||
@ -147,9 +147,22 @@ def parse_obj_file(path: str) -> tuple[Vertex3Set, IndexedFaceSet]:
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
_ = parser.add_argument("objfile", type=str, help=".obj file to render")
|
||||
_ = parser.add_argument("--vertices", action="store_true", help="render vertices")
|
||||
_ = parser.add_argument("--edges", action="store_true", help="render edges")
|
||||
_ = parser.add_argument(
|
||||
"--strict", action="store_true", help="require complete parsing of .obj file"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args.objfile = cast(str, args.objfile)
|
||||
|
||||
global RENDER_VERTICES
|
||||
global RENDER_EDGES
|
||||
global BEST_EFFORT_PARSE
|
||||
|
||||
RENDER_VERTICES = bool(args.vertices)
|
||||
RENDER_EDGES = bool(args.edges)
|
||||
BEST_EFFORT_PARSE = not bool(args.strict)
|
||||
|
||||
dpg.create_context()
|
||||
|
||||
with dpg.theme() as canvas_theme, dpg.theme_component():
|
||||
|
||||
Reference in New Issue
Block a user