Added Wireframe and Lighting selector

master
egon.rath 2010-08-16 12:23:20 +00:00
parent 8e044d5640
commit 1df9489745
8 changed files with 60 additions and 586 deletions

View File

@ -21,11 +21,12 @@ CONFIG += warn_off
# Irrlicht
IRRLICHTBASE = /home/er/tmp/irrlicht/trunk
INCLUDEPATH += $$IRRLICHTBASE/include
LIBS += -L$$IRRLICHTBASE/source/Irrlicht \
LIBS += -L$$IRRLICHTBASE/lib/Linux \
-lIrrlicht \
-lX11 \
-lGL \
-lXxf86vm
-lXxf86vm \
-lXcursor
# Freetype
INCLUDEPATH += /usr/include/freetype2

View File

@ -7,11 +7,11 @@
void Engine::setupScene()
{
// Setup Light
ILightSceneNode *light = m_Scene->addLightSceneNode();
light->setID( SIID_LIGHT );
light->setLightType( ELT_DIRECTIONAL );
light->getLightData().AmbientColor = SColorf( 0.2f, 0.2f, 0.2f );
light->getLightData().DiffuseColor = SColorf( 0.8f, 0.8f, 0.8f );
m_SceneLight = m_Scene->addLightSceneNode();
m_SceneLight->setID( SIID_LIGHT );
m_SceneLight->setLightType( ELT_DIRECTIONAL );
m_SceneLight->getLightData().AmbientColor = SColorf( 0.2f, 0.2f, 0.2f );
m_SceneLight->getLightData().DiffuseColor = SColorf( 0.8f, 0.8f, 0.8f );
m_Scene->setAmbientLight( SColorf( 0.2f, 0.2f, 0.2f ));
// Setup Camera
@ -170,6 +170,27 @@ void Engine::loadMesh( const wstring &fileName )
Utility::dumpMeshInfoToConsole( m_LoadedMesh );
}
void Engine::setMeshDisplayMode( bool wireframe, bool lighting )
{
for( int materialIndex = 0; materialIndex < m_LoadedMesh->getMaterialCount(); materialIndex ++ )
{
// Set Wireframe display
m_LoadedMesh->getMaterial( materialIndex ).Wireframe = wireframe;
// Set Lighting
if( ! lighting )
{
m_LoadedMesh->getMaterial( materialIndex ).Lighting = false;
m_LoadedMesh->getMaterial( materialIndex ).EmissiveColor = SColor( 255, 255, 255, 255 );
}
else
{
m_LoadedMesh->getMaterial( materialIndex ).Lighting = true;
m_LoadedMesh->getMaterial( materialIndex ).EmissiveColor = SColor( 255, 0, 0, 0 );
}
}
}
void Engine::run()
{
u32 timePerFrame = ( u32 ) ( 1000.0f / 60 );

View File

@ -44,6 +44,7 @@ private:
IVideoDriver *m_Driver;
ISceneManager *m_Scene;
IAnimatedMeshSceneNode *m_LoadedMesh;
ILightSceneNode *m_SceneLight;
CGUITTFont *m_AxisFont;
CGUITTFace *m_AxisFontFace;
@ -68,6 +69,7 @@ public:
void run();
void loadMesh( const wstring &fileName );
void setMeshDisplayMode( bool wireframe = false, bool lighting = true );
};
#endif // ENGINE_H

236
Makefile
View File

@ -1,236 +0,0 @@
#############################################################################
# Makefile for building: build/B3View
# Generated by qmake (2.01a) (Qt 4.7.0) on: Fri Apr 23 09:51:28 2010
# Project: B3View.pro
# Template: app
# Command: /opt/qt47/bin/qmake -spec /opt/qt47/mkspecs/linux-g++ CONFIG+=debug -o Makefile B3View.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES =
CFLAGS = -pipe -g -w $(DEFINES)
CXXFLAGS = -pipe -g -w $(DEFINES)
INCPATH = -I/opt/qt47/mkspecs/linux-g++ -I. -I../irrlicht/trunk/include -I/usr/include/freetype2
LINK = g++
LFLAGS = -Wl,-rpath,/opt/qt47/lib
LIBS = $(SUBLIBS) -L/home/er/tmp/irrlicht/trunk/source/Irrlicht -lIrrlicht -lX11 -lGL -lXxf86vm -lfreetype
AR = ar cqs
RANLIB =
QMAKE = /opt/qt47/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = tmp/
####### Files
SOURCES = main.cpp \
Engine.cpp \
EventHandler.cpp \
UserInterface.cpp \
Debug.cpp \
View.cpp \
Utils.cpp \
extlib/CGUITTFont.cpp
OBJECTS = tmp/main.o \
tmp/Engine.o \
tmp/EventHandler.o \
tmp/UserInterface.o \
tmp/Debug.o \
tmp/View.o \
tmp/Utils.o \
tmp/CGUITTFont.o
DIST = /opt/qt47/mkspecs/common/g++.conf \
/opt/qt47/mkspecs/common/unix.conf \
/opt/qt47/mkspecs/common/linux.conf \
/opt/qt47/mkspecs/qconfig.pri \
/opt/qt47/mkspecs/features/qt_functions.prf \
/opt/qt47/mkspecs/features/qt_config.prf \
/opt/qt47/mkspecs/features/exclusive_builds.prf \
/opt/qt47/mkspecs/features/default_pre.prf \
/opt/qt47/mkspecs/features/debug.prf \
/opt/qt47/mkspecs/features/default_post.prf \
/opt/qt47/mkspecs/features/warn_off.prf \
/opt/qt47/mkspecs/features/resources.prf \
/opt/qt47/mkspecs/features/uic.prf \
/opt/qt47/mkspecs/features/yacc.prf \
/opt/qt47/mkspecs/features/lex.prf \
/opt/qt47/mkspecs/features/include_source_dir.prf \
B3View.pro
QMAKE_TARGET = B3View
DESTDIR = build/
TARGET = build/B3View
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
@$(CHK_DIR_EXISTS) build/ || $(MKDIR) build/
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: B3View.pro /opt/qt47/mkspecs/linux-g++/qmake.conf /opt/qt47/mkspecs/common/g++.conf \
/opt/qt47/mkspecs/common/unix.conf \
/opt/qt47/mkspecs/common/linux.conf \
/opt/qt47/mkspecs/qconfig.pri \
/opt/qt47/mkspecs/features/qt_functions.prf \
/opt/qt47/mkspecs/features/qt_config.prf \
/opt/qt47/mkspecs/features/exclusive_builds.prf \
/opt/qt47/mkspecs/features/default_pre.prf \
/opt/qt47/mkspecs/features/debug.prf \
/opt/qt47/mkspecs/features/default_post.prf \
/opt/qt47/mkspecs/features/warn_off.prf \
/opt/qt47/mkspecs/features/resources.prf \
/opt/qt47/mkspecs/features/uic.prf \
/opt/qt47/mkspecs/features/yacc.prf \
/opt/qt47/mkspecs/features/lex.prf \
/opt/qt47/mkspecs/features/include_source_dir.prf
$(QMAKE) -spec /opt/qt47/mkspecs/linux-g++ CONFIG+=debug -o Makefile B3View.pro
/opt/qt47/mkspecs/common/g++.conf:
/opt/qt47/mkspecs/common/unix.conf:
/opt/qt47/mkspecs/common/linux.conf:
/opt/qt47/mkspecs/qconfig.pri:
/opt/qt47/mkspecs/features/qt_functions.prf:
/opt/qt47/mkspecs/features/qt_config.prf:
/opt/qt47/mkspecs/features/exclusive_builds.prf:
/opt/qt47/mkspecs/features/default_pre.prf:
/opt/qt47/mkspecs/features/debug.prf:
/opt/qt47/mkspecs/features/default_post.prf:
/opt/qt47/mkspecs/features/warn_off.prf:
/opt/qt47/mkspecs/features/resources.prf:
/opt/qt47/mkspecs/features/uic.prf:
/opt/qt47/mkspecs/features/yacc.prf:
/opt/qt47/mkspecs/features/lex.prf:
/opt/qt47/mkspecs/features/include_source_dir.prf:
qmake: FORCE
@$(QMAKE) -spec /opt/qt47/mkspecs/linux-g++ CONFIG+=debug -o Makefile B3View.pro
dist:
@$(CHK_DIR_EXISTS) tmp/B3View1.0.0 || $(MKDIR) tmp/B3View1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) tmp/B3View1.0.0/ && (cd `dirname tmp/B3View1.0.0` && $(TAR) B3View1.0.0.tar B3View1.0.0 && $(COMPRESS) B3View1.0.0.tar) && $(MOVE) `dirname tmp/B3View1.0.0`/B3View1.0.0.tar.gz . && $(DEL_FILE) -r tmp/B3View1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
check:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
tmp/main.o: main.cpp Engine.h \
EventHandler.h \
Debug.h \
UserInterface.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/main.o main.cpp
tmp/Engine.o: Engine.cpp Engine.h \
EventHandler.h \
Debug.h \
UserInterface.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/Engine.o Engine.cpp
tmp/EventHandler.o: EventHandler.cpp EventHandler.h \
Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/EventHandler.o EventHandler.cpp
tmp/UserInterface.o: UserInterface.cpp UserInterface.h \
Debug.h \
Engine.h \
EventHandler.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/UserInterface.o UserInterface.cpp
tmp/Debug.o: Debug.cpp Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/Debug.o Debug.cpp
tmp/View.o: View.cpp View.h \
Debug.h \
Engine.h \
EventHandler.h \
UserInterface.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/View.o View.cpp
tmp/Utils.o: Utils.cpp Utils.h \
Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/Utils.o Utils.cpp
tmp/CGUITTFont.o: extlib/CGUITTFont.cpp extlib/CGUITTFont.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp/CGUITTFont.o extlib/CGUITTFont.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

View File

@ -1,170 +0,0 @@
#############################################################################
# Makefile for building: B3View
# Generated by qmake (2.01a) (Qt 4.6.0) on: Mi 21. Apr 16:30:29 2010
# Project: B3View.pro
# Template: app
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -w $(DEFINES)
CXXFLAGS = -g -w -frtti -fexceptions -mthreads $(DEFINES)
INCPATH = -I"..\..\..\..\libs\irrlicht-1.7.1\include" -I"c:\Qt\2009.05\qt\mkspecs\win32-g++"
LINK = g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows
LIBS = -Ld:/libs/irrlicht-1.7.1/lib/Win32-gcc -lIrrlicht
QMAKE = c:\qt\2009.05\qt\bin\qmake.exe
IDC = c:\Qt\2009.05\qt\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
####### Output directory
OBJECTS_DIR = tmp
####### Files
SOURCES = main.cpp \
Engine.cpp \
EventHandler.cpp \
UserInterface.cpp \
Debug.cpp \
View.cpp \
Utils.cpp
OBJECTS = tmp/main.o \
tmp/Engine.o \
tmp/EventHandler.o \
tmp/UserInterface.o \
tmp/Debug.o \
tmp/View.o \
tmp/Utils.o
DIST =
QMAKE_TARGET = B3View
DESTDIR = build\ #avoid trailing-slash linebreak
TARGET = B3View.exe
DESTDIR_TARGET = build\B3View.exe
####### Implicit rules
.SUFFIXES: .cpp .cc .cxx .c
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
first: all
all: Makefile.Debug $(DESTDIR_TARGET)
$(DESTDIR_TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)
qmake: FORCE
@$(QMAKE) -spec c:\Qt\2009.05\qt\mkspecs\win32-g++ -win32 -o Makefile.Debug B3View.pro
dist:
$(ZIP) B3View.zip $(SOURCES) $(DIST) B3View.pro c:\Qt\2009.05\qt\mkspecs\qconfig.pri c:\Qt\2009.05\qt\mkspecs\features\qt_functions.prf c:\Qt\2009.05\qt\mkspecs\features\qt_config.prf c:\Qt\2009.05\qt\mkspecs\features\exclusive_builds.prf c:\Qt\2009.05\qt\mkspecs\features\default_pre.prf c:\Qt\2009.05\qt\mkspecs\features\win32\default_pre.prf c:\Qt\2009.05\qt\mkspecs\features\debug.prf c:\Qt\2009.05\qt\mkspecs\features\debug_and_release.prf c:\Qt\2009.05\qt\mkspecs\features\default_post.prf c:\Qt\2009.05\qt\mkspecs\features\win32\default_post.prf c:\Qt\2009.05\qt\mkspecs\features\build_pass.prf c:\Qt\2009.05\qt\mkspecs\features\warn_off.prf c:\Qt\2009.05\qt\mkspecs\features\win32\rtti.prf c:\Qt\2009.05\qt\mkspecs\features\win32\exceptions.prf c:\Qt\2009.05\qt\mkspecs\features\win32\stl.prf c:\Qt\2009.05\qt\mkspecs\features\shared.prf c:\Qt\2009.05\qt\mkspecs\features\win32\windows.prf c:\Qt\2009.05\qt\mkspecs\features\win32\thread_off.prf c:\Qt\2009.05\qt\mkspecs\features\resources.prf c:\Qt\2009.05\qt\mkspecs\features\uic.prf c:\Qt\2009.05\qt\mkspecs\features\yacc.prf c:\Qt\2009.05\qt\mkspecs\features\lex.prf c:\Qt\2009.05\qt\mkspecs\features\include_source_dir.prf RESOURCES FORMS IMAGES YACCSOURCES YACCSOURCES LEXSOURCES
clean: compiler_clean
-$(DEL_FILE) tmp\main.o tmp\Engine.o tmp\EventHandler.o tmp\UserInterface.o tmp\Debug.o tmp\View.o tmp\Utils.o
distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Debug
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
tmp/main.o: main.cpp Engine.h \
EventHandler.h \
Debug.h \
UserInterface.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\main.o main.cpp
tmp/Engine.o: Engine.cpp Engine.h \
EventHandler.h \
Debug.h \
UserInterface.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\Engine.o Engine.cpp
tmp/EventHandler.o: EventHandler.cpp EventHandler.h \
Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\EventHandler.o EventHandler.cpp
tmp/UserInterface.o: UserInterface.cpp UserInterface.h \
Debug.h \
Engine.h \
EventHandler.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\UserInterface.o UserInterface.cpp
tmp/Debug.o: Debug.cpp Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\Debug.o Debug.cpp
tmp/View.o: View.cpp View.h \
Debug.h \
Engine.h \
EventHandler.h \
UserInterface.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\View.o View.cpp
tmp/Utils.o: Utils.cpp Utils.h \
Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\Utils.o Utils.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

View File

@ -1,170 +0,0 @@
#############################################################################
# Makefile for building: B3View
# Generated by qmake (2.01a) (Qt 4.6.0) on: Mi 21. Apr 16:30:29 2010
# Project: B3View.pro
# Template: app
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -O2 -w $(DEFINES)
CXXFLAGS = -O2 -w -frtti -fexceptions -mthreads $(DEFINES)
INCPATH = -I"..\..\..\..\libs\irrlicht-1.7.1\include" -I"c:\Qt\2009.05\qt\mkspecs\win32-g++"
LINK = g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows
LIBS = -Ld:/libs/irrlicht-1.7.1/lib/Win32-gcc -lIrrlicht
QMAKE = c:\qt\2009.05\qt\bin\qmake.exe
IDC = c:\Qt\2009.05\qt\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
####### Output directory
OBJECTS_DIR = tmp
####### Files
SOURCES = main.cpp \
Engine.cpp \
EventHandler.cpp \
UserInterface.cpp \
Debug.cpp \
View.cpp \
Utils.cpp
OBJECTS = tmp/main.o \
tmp/Engine.o \
tmp/EventHandler.o \
tmp/UserInterface.o \
tmp/Debug.o \
tmp/View.o \
tmp/Utils.o
DIST =
QMAKE_TARGET = B3View
DESTDIR = build\ #avoid trailing-slash linebreak
TARGET = B3View.exe
DESTDIR_TARGET = build\B3View.exe
####### Implicit rules
.SUFFIXES: .cpp .cc .cxx .c
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
first: all
all: Makefile.Release $(DESTDIR_TARGET)
$(DESTDIR_TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)
qmake: FORCE
@$(QMAKE) -spec c:\Qt\2009.05\qt\mkspecs\win32-g++ -win32 -o Makefile.Release B3View.pro
dist:
$(ZIP) B3View.zip $(SOURCES) $(DIST) B3View.pro c:\Qt\2009.05\qt\mkspecs\qconfig.pri c:\Qt\2009.05\qt\mkspecs\features\qt_functions.prf c:\Qt\2009.05\qt\mkspecs\features\qt_config.prf c:\Qt\2009.05\qt\mkspecs\features\exclusive_builds.prf c:\Qt\2009.05\qt\mkspecs\features\default_pre.prf c:\Qt\2009.05\qt\mkspecs\features\win32\default_pre.prf c:\Qt\2009.05\qt\mkspecs\features\release.prf c:\Qt\2009.05\qt\mkspecs\features\debug_and_release.prf c:\Qt\2009.05\qt\mkspecs\features\default_post.prf c:\Qt\2009.05\qt\mkspecs\features\win32\default_post.prf c:\Qt\2009.05\qt\mkspecs\features\build_pass.prf c:\Qt\2009.05\qt\mkspecs\features\warn_off.prf c:\Qt\2009.05\qt\mkspecs\features\win32\rtti.prf c:\Qt\2009.05\qt\mkspecs\features\win32\exceptions.prf c:\Qt\2009.05\qt\mkspecs\features\win32\stl.prf c:\Qt\2009.05\qt\mkspecs\features\shared.prf c:\Qt\2009.05\qt\mkspecs\features\win32\windows.prf c:\Qt\2009.05\qt\mkspecs\features\win32\thread_off.prf c:\Qt\2009.05\qt\mkspecs\features\resources.prf c:\Qt\2009.05\qt\mkspecs\features\uic.prf c:\Qt\2009.05\qt\mkspecs\features\yacc.prf c:\Qt\2009.05\qt\mkspecs\features\lex.prf c:\Qt\2009.05\qt\mkspecs\features\include_source_dir.prf RESOURCES FORMS IMAGES YACCSOURCES YACCSOURCES LEXSOURCES
clean: compiler_clean
-$(DEL_FILE) tmp\main.o tmp\Engine.o tmp\EventHandler.o tmp\UserInterface.o tmp\Debug.o tmp\View.o tmp\Utils.o
distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Release
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
tmp/main.o: main.cpp Engine.h \
EventHandler.h \
Debug.h \
UserInterface.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\main.o main.cpp
tmp/Engine.o: Engine.cpp Engine.h \
EventHandler.h \
Debug.h \
UserInterface.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\Engine.o Engine.cpp
tmp/EventHandler.o: EventHandler.cpp EventHandler.h \
Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\EventHandler.o EventHandler.cpp
tmp/UserInterface.o: UserInterface.cpp UserInterface.h \
Debug.h \
Engine.h \
EventHandler.h \
View.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\UserInterface.o UserInterface.cpp
tmp/Debug.o: Debug.cpp Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\Debug.o Debug.cpp
tmp/View.o: View.cpp View.h \
Debug.h \
Engine.h \
EventHandler.h \
UserInterface.h \
Utils.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\View.o View.cpp
tmp/Utils.o: Utils.cpp Utils.h \
Debug.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tmp\Utils.o Utils.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

View File

@ -6,12 +6,18 @@ void UserInterface::setupUserInterface()
// Menu
IGUIContextMenu *menu = m_Gui->addMenu();
menu->addItem( L"File", UIE_FILEMENU, true, true );
menu->addItem( L"View", UIE_VIEWMENU, true, true );
// File Menu
IGUIContextMenu *fileMenu = menu->getSubMenu( 0 );
fileMenu->addItem( L"Load", UIC_FILE_LOAD );
fileMenu->addItem( L"Quit", UIC_FILE_QUIT );
// View Menu
IGUIContextMenu *viewMenu = menu->getSubMenu( 1 );
viewMenu->addItem( L"Wireframe Mesh", UIC_VIEW_WIREFRAME, true, false, false, true );
viewMenu->addItem( L"Lighting",UIC_VIEW_LIGHTING, true, false, true, true );
// Playback Control Window
dimension2d<u32> windowSize = m_Engine->m_Driver->getScreenSize();
IGUIWindow *playbackWindow = m_Gui->addWindow(
@ -52,6 +58,16 @@ void UserInterface::handleMenuItemPressed( IGUIContextMenu *menu )
case UIC_FILE_QUIT:
m_Engine->m_RunEngine = false;
break;
case UIC_VIEW_WIREFRAME:
m_WireframeDisplay = m_WireframeDisplay ? false : true;
m_Engine->setMeshDisplayMode( m_WireframeDisplay, m_Lighting );
break;
case UIC_VIEW_LIGHTING:
m_Lighting = m_Lighting ? false : true;
m_Engine->setMeshDisplayMode( m_WireframeDisplay, m_Lighting );
break;
}
}
@ -61,6 +77,9 @@ UserInterface::UserInterface( Engine *engine )
m_Engine = engine;
m_Gui = engine->getGUIEnvironment();
m_WireframeDisplay = false;
m_Lighting = true;
setupUserInterface();
}
@ -91,9 +110,10 @@ bool UserInterface::OnEvent( const SEvent &event )
switch( ge->Caller->getID() )
{
case UIE_FILEMENU:
case UIE_VIEWMENU:
// call handler for all menu related actions
handleMenuItemPressed( static_cast<IGUIContextMenu *>( ge->Caller ));
break;
break;
case UIE_LOADFILEDIALOG:
if( ge->EventType == EGET_FILE_SELECTED )

View File

@ -26,13 +26,16 @@ enum UserInterfaceElements
UIE_LOADBUTTON = 1001,
UIE_LOADFILEDIALOG = 1002,
UIE_FILEMENU = 1003,
UIE_PLAYBACKSTARTSTOPBUTTON = 1004
UIE_PLAYBACKSTARTSTOPBUTTON = 1004,
UIE_VIEWMENU = 1005
};
enum UserInterfaceCommands
{
UIC_FILE_LOAD = 1000,
UIC_FILE_QUIT = 1001
UIC_FILE_QUIT = 1001,
UIC_VIEW_WIREFRAME = 2000,
UIC_VIEW_LIGHTING = 2001
};
class UserInterface : public IEventReceiver
@ -47,6 +50,9 @@ private:
void displayLoadFileDialog();
void handleMenuItemPressed( IGUIContextMenu *menu );
bool m_WireframeDisplay;
bool m_Lighting;
public:
UserInterface( Engine *device );
~UserInterface();