paysages : Start of "exploring" layer.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@550 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-04-16 14:57:14 +00:00 committed by ThunderK
parent 72d1791718
commit 3e14fedbca
12 changed files with 133 additions and 31 deletions

View file

@ -3,17 +3,20 @@ BUILDPATH=./build/${BUILDMODE}
all: all:
@+cd lib_paysages && make BUILDMODE=${BUILDMODE} @+cd lib_paysages && make BUILDMODE=${BUILDMODE}
@+cd exploring && make BUILDMODE=${BUILDMODE}
@+cd cli && make BUILDMODE=${BUILDMODE} @+cd cli && make BUILDMODE=${BUILDMODE}
@+cd gui_qt && qmake "BUILDMODE=${BUILDMODE}" && make @+cd gui_qt && qmake "BUILDMODE=${BUILDMODE}" && make
clean: clean:
cd lib_paysages && make clean BUILDMODE=${BUILDMODE} cd lib_paysages && make clean BUILDMODE=${BUILDMODE}
cd exploring && make clean BUILDMODE=${BUILDMODE}
cd cli && make clean BUILDMODE=${BUILDMODE} cd cli && make clean BUILDMODE=${BUILDMODE}
cd gui_qt && qmake "BUILDMODE=${BUILDMODE}" && make clean cd gui_qt && qmake "BUILDMODE=${BUILDMODE}" && make clean
rm -f ${BUILDPATH}/paysages-qt rm -f ${BUILDPATH}/paysages-qt
rm -f ${BUILDPATH}/paysages-cli rm -f ${BUILDPATH}/paysages-cli
rm -f ${BUILDPATH}/libpaysages_exploring.so
rm -f ${BUILDPATH}/libpaysages.so rm -f ${BUILDPATH}/libpaysages.so
release: release:
make BUILDMODE=release all make BUILDMODE=release all

9
exploring/Makefile Normal file
View file

@ -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

1
exploring/chunk.c Normal file
View file

@ -0,0 +1 @@
#include "chunk.h"

13
exploring/chunk.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef _PAYSAGES_EXPLORING_CHUNK_H_
#define _PAYSAGES_EXPLORING_CHUNK_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

50
exploring/main.c Normal file
View file

@ -0,0 +1,50 @@
#include "main.h"
#include <math.h>
#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()
{
}

22
exploring/main.h Normal file
View file

@ -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

1
exploring/sky.c Normal file
View file

@ -0,0 +1 @@
#include "sky.h"

13
exploring/sky.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef _PAYSAGES_EXPLORING_SKY_H_
#define _PAYSAGES_EXPLORING_SKY_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

1
exploring/terrain.c Normal file
View file

@ -0,0 +1 @@
#include "terrain.h"

13
exploring/terrain.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef _PAYSAGES_EXPLORING_TERRAIN_H_
#define _PAYSAGES_EXPLORING_TERRAIN_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -13,10 +13,10 @@ release:DEFINES += NDEBUG
release:QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable release:QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable
LIBS += -lGLU LIBS += -lGLU
unix:LIBS += -L$$DESTDIR -lpaysages unix:LIBS += -L$$DESTDIR -lpaysages -lpaysages_exploring
win32:LIBS += ../libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0 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) SOURCES += $$files(*.cpp)
TRANSLATIONS = ../i18n/paysages_fr.ts TRANSLATIONS = ../i18n/paysages_fr.ts

View file

@ -8,6 +8,7 @@
#include <QThread> #include <QThread>
#include "../lib_paysages/scenery.h" #include "../lib_paysages/scenery.h"
#include "../lib_paysages/tools/euclid.h" #include "../lib_paysages/tools/euclid.h"
#include "../exploring/main.h"
#include "explorerchunkterrain.h" #include "explorerchunkterrain.h"
#include "explorerchunksky.h" #include "explorerchunksky.h"
#include "tools.h" #include "tools.h"
@ -361,38 +362,13 @@ void WidgetExplorer::timerEvent(QTimerEvent*)
void WidgetExplorer::initializeGL() void WidgetExplorer::initializeGL()
{ {
glClearColor(0.0, 0.0, 0.0, 0.0); exploringInit();
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);
} }
void WidgetExplorer::resizeGL(int w, int h) void WidgetExplorer::resizeGL(int w, int h)
{ {
cameraSetRenderSize(&_current_camera, w, h); cameraSetRenderSize(&_current_camera, w, h);
exploringSetViewPort(w, h, &_current_camera);
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);
} }
void WidgetExplorer::paintGL() void WidgetExplorer::paintGL()