diff --git a/Makefile b/Makefile index 44b7fde..2aa2966 100644 --- a/Makefile +++ b/Makefile @@ -3,17 +3,20 @@ BUILDPATH=./build/${BUILDMODE} all: @+cd lib_paysages && make BUILDMODE=${BUILDMODE} + @+cd exploring && make BUILDMODE=${BUILDMODE} @+cd cli && make BUILDMODE=${BUILDMODE} @+cd gui_qt && qmake "BUILDMODE=${BUILDMODE}" && make clean: cd lib_paysages && make clean BUILDMODE=${BUILDMODE} + cd exploring && make clean BUILDMODE=${BUILDMODE} cd cli && make clean BUILDMODE=${BUILDMODE} cd gui_qt && qmake "BUILDMODE=${BUILDMODE}" && make clean rm -f ${BUILDPATH}/paysages-qt rm -f ${BUILDPATH}/paysages-cli + rm -f ${BUILDPATH}/libpaysages_exploring.so rm -f ${BUILDPATH}/libpaysages.so - + release: make BUILDMODE=release all diff --git a/exploring/Makefile b/exploring/Makefile new file mode 100644 index 0000000..f7bfd5d --- /dev/null +++ b/exploring/Makefile @@ -0,0 +1,9 @@ +include ../common_pre.mk + +OBJPATH = ${BUILDPATH}/exploring +RESULT = ${BUILDPATH}/libpaysages_exploring.so +SOURCES += $(wildcard *.c) + +CC_LDFLAGS += -shared + +include ../common_post.mk diff --git a/exploring/chunk.c b/exploring/chunk.c new file mode 100644 index 0000000..3a07abc --- /dev/null +++ b/exploring/chunk.c @@ -0,0 +1 @@ +#include "chunk.h" diff --git a/exploring/chunk.h b/exploring/chunk.h new file mode 100644 index 0000000..b1368c6 --- /dev/null +++ b/exploring/chunk.h @@ -0,0 +1,13 @@ +#ifndef _PAYSAGES_EXPLORING_CHUNK_H_ +#define _PAYSAGES_EXPLORING_CHUNK_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/exploring/main.c b/exploring/main.c new file mode 100644 index 0000000..f73becf --- /dev/null +++ b/exploring/main.c @@ -0,0 +1,50 @@ +#include "main.h" + +#include +#include "GL/gl.h" + +void exploringInit() +{ + glClearColor(0.0, 0.0, 0.0, 0.0); + + glDisable(GL_LIGHTING); + + glFrontFace(GL_CCW); + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + + glDepthFunc(GL_LESS); + glDepthMask(1); + glEnable(GL_DEPTH_TEST); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glEnable(GL_LINE_SMOOTH); + glLineWidth(1.0); + + glDisable(GL_FOG); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +void exploringSetViewPort(int width, int height, CameraDefinition* camera) +{ + glViewport(0, 0, width, height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(camera->yfov * 180.0 / M_PI, camera->xratio, camera->znear, camera->zfar); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +void exploringRenderFrame(Renderer* renderer) +{ +} + +void exploringStartStandAlone() +{ +} + +void exploringInterruptStandAlone() +{ +} diff --git a/exploring/main.h b/exploring/main.h new file mode 100644 index 0000000..805c933 --- /dev/null +++ b/exploring/main.h @@ -0,0 +1,22 @@ +#ifndef _PAYSAGES_EXPLORING_MAIN_H_ +#define _PAYSAGES_EXPLORING_MAIN_H_ + +#include "../lib_paysages/renderer.h" +#include "../lib_paysages/camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void exploringInit(); +void exploringSetViewPort(int width, int height, CameraDefinition* camera); +void exploringRenderFrame(Renderer* renderer); + +void exploringStartStandAlone(); +void exploringInterruptStandAlone(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/exploring/sky.c b/exploring/sky.c new file mode 100644 index 0000000..81d6d22 --- /dev/null +++ b/exploring/sky.c @@ -0,0 +1 @@ +#include "sky.h" diff --git a/exploring/sky.h b/exploring/sky.h new file mode 100644 index 0000000..6f6d502 --- /dev/null +++ b/exploring/sky.h @@ -0,0 +1,13 @@ +#ifndef _PAYSAGES_EXPLORING_SKY_H_ +#define _PAYSAGES_EXPLORING_SKY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/exploring/terrain.c b/exploring/terrain.c new file mode 100644 index 0000000..a0f24cd --- /dev/null +++ b/exploring/terrain.c @@ -0,0 +1 @@ +#include "terrain.h" diff --git a/exploring/terrain.h b/exploring/terrain.h new file mode 100644 index 0000000..d76f35b --- /dev/null +++ b/exploring/terrain.h @@ -0,0 +1,13 @@ +#ifndef _PAYSAGES_EXPLORING_TERRAIN_H_ +#define _PAYSAGES_EXPLORING_TERRAIN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/gui_qt/paysages-qt.pro b/gui_qt/paysages-qt.pro index b6025aa..04bb83e 100644 --- a/gui_qt/paysages-qt.pro +++ b/gui_qt/paysages-qt.pro @@ -13,10 +13,10 @@ release:DEFINES += NDEBUG release:QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable LIBS += -lGLU -unix:LIBS += -L$$DESTDIR -lpaysages -win32:LIBS += ../libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0 +unix:LIBS += -L$$DESTDIR -lpaysages -lpaysages_exploring +win32:LIBS += ../libpaysages.a ../libpaysages_exploring.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0 -HEADERS += $$files(*.h) $$files(../lib_paysages/*.h) $$files(../lib_paysages/shared/*.h) +HEADERS += $$files(*.h) $$files(../lib_paysages/*.h) $$files(../lib_paysages/shared/*.h) $$files(../exploring/*.h) SOURCES += $$files(*.cpp) TRANSLATIONS = ../i18n/paysages_fr.ts diff --git a/gui_qt/widgetexplorer.cpp b/gui_qt/widgetexplorer.cpp index 813fcc4..d84f67b 100644 --- a/gui_qt/widgetexplorer.cpp +++ b/gui_qt/widgetexplorer.cpp @@ -8,6 +8,7 @@ #include #include "../lib_paysages/scenery.h" #include "../lib_paysages/tools/euclid.h" +#include "../exploring/main.h" #include "explorerchunkterrain.h" #include "explorerchunksky.h" #include "tools.h" @@ -361,38 +362,13 @@ void WidgetExplorer::timerEvent(QTimerEvent*) void WidgetExplorer::initializeGL() { - glClearColor(0.0, 0.0, 0.0, 0.0); - - glDisable(GL_LIGHTING); - - glFrontFace(GL_CCW); - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - - glDepthFunc(GL_LESS); - glDepthMask(true); - glEnable(GL_DEPTH_TEST); - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glEnable(GL_LINE_SMOOTH); - glLineWidth(1.0); - - glDisable(GL_FOG); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + exploringInit(); } void WidgetExplorer::resizeGL(int w, int h) { cameraSetRenderSize(&_current_camera, w, h); - - glViewport(0, 0, w, h); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(_current_camera.yfov * 180.0 / M_PI, _current_camera.xratio, _current_camera.znear, _current_camera.zfar); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + exploringSetViewPort(w, h, &_current_camera); } void WidgetExplorer::paintGL()