Input model as argument
This commit is contained in:
parent
16e0e1ae00
commit
7f8e68fe96
|
@ -3,6 +3,8 @@
|
||||||
import sys
|
import sys
|
||||||
import ctypes
|
import ctypes
|
||||||
import pygame
|
import pygame
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
from OpenGL.GL import *
|
from OpenGL.GL import *
|
||||||
|
@ -11,6 +13,7 @@ from OpenGL.GLUT import *
|
||||||
|
|
||||||
from conv3d.loadmodel import load_model
|
from conv3d.loadmodel import load_model
|
||||||
|
|
||||||
|
|
||||||
WINDOW_WIDTH = 1024
|
WINDOW_WIDTH = 1024
|
||||||
WINDOW_HEIGHT = 768
|
WINDOW_HEIGHT = 768
|
||||||
|
|
||||||
|
@ -26,7 +29,7 @@ def init_frame():
|
||||||
glLoadIdentity()
|
glLoadIdentity()
|
||||||
gluLookAt(5,5,5,0,0,0,0,1,0)
|
gluLookAt(5,5,5,0,0,0,0,1,0)
|
||||||
|
|
||||||
def main(args = {}):
|
def main(args):
|
||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
display = (WINDOW_WIDTH, WINDOW_HEIGHT)
|
display = (WINDOW_WIDTH, WINDOW_HEIGHT)
|
||||||
|
@ -49,8 +52,7 @@ def main(args = {}):
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
|
|
||||||
model = load_model('./examples/cube.obj')
|
model = load_model(args.input)
|
||||||
model.generate_face_normals()
|
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
|
@ -70,4 +72,9 @@ def main(args = {}):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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)
|
||||||
|
|
Loading…
Reference in New Issue