Input model as argument

This commit is contained in:
Thomas FORGIONE 2016-11-22 16:49:36 +01:00
parent 16e0e1ae00
commit 7f8e68fe96
1 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,8 @@
import sys
import ctypes
import pygame
import argparse
import os
from pygame.locals import *
from OpenGL.GL import *
@ -11,6 +13,7 @@ from OpenGL.GLUT import *
from conv3d.loadmodel import load_model
WINDOW_WIDTH = 1024
WINDOW_HEIGHT = 768
@ -26,7 +29,7 @@ def init_frame():
glLoadIdentity()
gluLookAt(5,5,5,0,0,0,0,1,0)
def main(args = {}):
def main(args):
pygame.init()
display = (WINDOW_WIDTH, WINDOW_HEIGHT)
@ -49,8 +52,7 @@ def main(args = {}):
running = True
model = load_model('./examples/cube.obj')
model.generate_face_normals()
model = load_model(args.input)
while running:
for event in pygame.event.get():
@ -70,4 +72,9 @@ def main(args = {}):
if __name__ == '__main__':
main()
parser = argparse.ArgumentParser()
parser.set_defaults(func=main)
parser.add_argument('-v', '--version', action='version', version='1.0')
parser.add_argument('-i', '--input', metavar='input', default=None, help='Input model')
args = parser.parse_args()
args.func(args)