goat3d
changeset 99:d7ab4f13f5af
Merge
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 21 May 2014 05:01:34 +0300 |
parents | 32dccb16678f b43d33f3ba69 |
children | fae6dc0fd462 |
files | goatview/src/goatview.cc goatview/src/goatview.h |
diffstat | 3 files changed, 33 insertions(+), 10 deletions(-) [+] |
line diff
1.1 --- a/goatview/Makefile Wed May 21 05:00:21 2014 +0300 1.2 +++ b/goatview/Makefile Wed May 21 05:01:34 2014 +0300 1.3 @@ -20,6 +20,13 @@ 1.4 qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL` 1.5 qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL` 1.6 1.7 +ifeq ($(compiler), clang) 1.8 + CXXFLAGS += -stdlib=libc++ 1.9 + warn += '-Wno-\#warnings' 1.10 +else 1.11 + warn += -Wno-cpp 1.12 +endif 1.13 + 1.14 ifeq ($(shell uname -s), Darwin) 1.15 libgl = -framework OpenGL -framework GLUT -lGLEW 1.16 libgoat = $(goat_root)/libgoat3d.dylib 1.17 @@ -32,14 +39,6 @@ 1.18 libgoat = $(goat_root)/libgoat3d.so.0.1 1.19 endif 1.20 1.21 -ifeq ($(CC), gcc) 1.22 - warn += -Wno-cpp 1.23 -endif 1.24 -ifneq ($(shell $(CC) --version | grep LLVM),) 1.25 - CXXFLAGS += -stdlib=libc++ 1.26 - warn += '-Wno-\#warnings' 1.27 -endif 1.28 - 1.29 $(bin): $(obj) $(libgoat) 1.30 $(CXX) -o $@ $(obj) $(LDFLAGS) 1.31 1.32 @@ -105,3 +104,12 @@ 1.33 run: $(bin) 1.34 ./$(bin) 1.35 endif 1.36 + 1.37 +ccver = $(shell $(CC) --version) 1.38 +ifneq (,$(findstring LLVM,$(ccver))) 1.39 + # clang/llvm 1.40 + compiler = clang 1.41 +else 1.42 + # other, assume gcc 1.43 + compiler = gcc 1.44 +endif
2.1 --- a/goatview/src/goatview.cc Wed May 21 05:00:21 2014 +0300 2.2 +++ b/goatview/src/goatview.cc Wed May 21 05:01:34 2014 +0300 2.3 @@ -76,7 +76,7 @@ 2.4 bool GoatView::load_scene(const char *fname) 2.5 { 2.6 if(scene) { 2.7 - goat3d_free(scene); 2.8 + close_scene(); 2.9 } 2.10 if(!(scene = goat3d_create()) || goat3d_load(scene, fname) == -1) { 2.11 QMessageBox::critical(this, "Error", "Failed to load scene file: " + QString(fname)); 2.12 @@ -159,6 +159,12 @@ 2.13 connect(act_open_anm, &QAction::triggered, this, &GoatView::open_anim); 2.14 menu_file->addAction(act_open_anm); 2.15 2.16 + QAction *act_close = new QAction("&Close", this); 2.17 + connect(act_close, &QAction::triggered, this, &GoatView::close_scene); 2.18 + menu_file->addAction(act_close); 2.19 + 2.20 + menu_file->addSeparator(); 2.21 + 2.22 QAction *act_quit = new QAction("&Quit", this); 2.23 act_quit->setShortcuts(QKeySequence::Quit); 2.24 connect(act_quit, &QAction::triggered, [&](){ qApp->quit(); }); 2.25 @@ -322,12 +328,20 @@ 2.26 statusBar()->showMessage("Successfully loaded scene: " + QString(fname.c_str())); 2.27 } 2.28 2.29 +void GoatView::close_scene() 2.30 +{ 2.31 + scene_model->clear_scene(); 2.32 + treeview->reset(); 2.33 + goat3d_free(scene); 2.34 + scene = 0; 2.35 +} 2.36 + 2.37 void GoatView::open_anim() 2.38 { 2.39 std::string fname = QFileDialog::getOpenFileName(this, "Open animation file", "", 2.40 "Goat3D Animation (*.goatanm);;All Files (*)").toStdString(); 2.41 if(fname.empty()) { 2.42 - statusBar()->showMessage("Abot: No file selected!"); 2.43 + statusBar()->showMessage("Abort: No file selected!"); 2.44 return; 2.45 } 2.46