Verbose output if option
This commit is contained in:
parent
c81dbc8715
commit
47044cb92a
18
viewer.py
18
viewer.py
|
@ -57,6 +57,12 @@ def main(args):
|
||||||
if args.from_up is not None:
|
if args.from_up is not None:
|
||||||
up_conversion = (args.from_up, args.to_up)
|
up_conversion = (args.from_up, args.to_up)
|
||||||
|
|
||||||
|
if args.verbose:
|
||||||
|
def log(*args, **kwargs):
|
||||||
|
print(*args, **kwargs)
|
||||||
|
else:
|
||||||
|
def log(*args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
camera = Camera(Vector(0,0,5), Vector(0,0,0))
|
camera = Camera(Vector(0,0,5), Vector(0,0,0))
|
||||||
controls = OrbitControls()
|
controls = OrbitControls()
|
||||||
|
@ -82,25 +88,25 @@ def main(args):
|
||||||
running = True
|
running = True
|
||||||
|
|
||||||
# Load and parse the model
|
# Load and parse the model
|
||||||
print('Loading model...', file=sys.stderr, end='')
|
log('Loading model...', file=sys.stderr, end='')
|
||||||
model = load_model(args.input, up_conversion)
|
model = load_model(args.input, up_conversion)
|
||||||
|
|
||||||
print(' done!\nInitializing OpenGL textures...', file=sys.stderr, end='')
|
log(' done!\nInitializing OpenGL textures...', file=sys.stderr, end='')
|
||||||
# Initializes OpenGL textures
|
# Initializes OpenGL textures
|
||||||
model.init_textures()
|
model.init_textures()
|
||||||
|
|
||||||
# Compute normals if not already computed
|
# Compute normals if not already computed
|
||||||
if len(model.normals) == 0:
|
if len(model.normals) == 0:
|
||||||
print(' done!\nComputing normals...', file=sys.stderr, end='')
|
log(' done!\nComputing normals...', file=sys.stderr, end='')
|
||||||
model.generate_vertex_normals()
|
model.generate_vertex_normals()
|
||||||
|
|
||||||
# Generate vbos for smooth rendering
|
# Generate vbos for smooth rendering
|
||||||
print(' done!\nGenerating vbos...', file=sys.stderr, end='')
|
log(' done!\nGenerating vbos...', file=sys.stderr, end='')
|
||||||
model.generate_vbos()
|
model.generate_vbos()
|
||||||
|
|
||||||
shader = DefaultShader()
|
shader = DefaultShader()
|
||||||
|
|
||||||
print(' Done!\nReady!', file=sys.stderr)
|
log(' Done!\nReady!', file=sys.stderr)
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
for event in pg.event.get():
|
for event in pg.event.get():
|
||||||
|
@ -166,6 +172,8 @@ if __name__ == '__main__':
|
||||||
help="Initial up vector")
|
help="Initial up vector")
|
||||||
parser.add_argument('-tu', '--to-up', metavar='fup', default=None,
|
parser.add_argument('-tu', '--to-up', metavar='fup', default=None,
|
||||||
help="Output up vector")
|
help="Output up vector")
|
||||||
|
parser.add_argument('-V', '--verbose', default=False, action='store_true',
|
||||||
|
help="Verbose output")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
args.func(args)
|
args.func(args)
|
||||||
|
|
Loading…
Reference in New Issue