29 |
#include "Model/MdlAnimatedModel.h" |
#include "Model/MdlAnimatedModel.h" |
30 |
#include "Model/MdlModel.h" |
#include "Model/MdlModel.h" |
31 |
|
|
32 |
|
#include "Map/MapLoader.h" |
33 |
#include "Map/MapDisplay.h" |
#include "Map/MapDisplay.h" |
34 |
|
|
35 |
#include "GameEngine/HgGame.h" |
#include "GameEngine/HgGame.h" |
68 |
|
|
69 |
- (void) newGame |
- (void) newGame |
70 |
{ |
{ |
71 |
_camera = [[Camera alloc] initWithFovy: 60 |
_camera = [[Camera alloc] initWithFovy: 50 |
72 |
aspect: 1.0 |
aspect: 1024.0f / 768.0f |
73 |
zNear: 0.01 |
zNear: 5.0 //better |
74 |
zFar: 10000.0 |
zFar: 750.0 |
75 |
eye: MakeCoord (0.0,0.0,100.0) |
eye: MakeCoord (0.0, 197.0, 0.0) |
76 |
center: MakeCoord (0.0,0.0,0.0) |
center: MakeCoord (0.0, 197.0, 30.0) |
77 |
up: MakeCoord (0.0,1.0,0.0) ]; |
up: MakeCoord (0.0, 1.0, 0.0)]; |
|
|
|
78 |
|
|
79 |
/* Model */ |
/* Model */ |
80 |
MdlModel *model = [[MdlModel alloc] initWithName: @"bateau.md3" |
MdlModel *model |
81 |
withTexName: nil |
= [[MdlModel alloc] initWithName: @"Resources/Model/bateau.md3" |
82 |
withConfigName: @"bateau.cfg"]; |
withTexName: nil |
83 |
|
withConfigName: @"Resources/Model/bateau.cfg"]; |
84 |
_anim = [[MdlAnimatedModel alloc] initWithModel: model |
_anim = [[MdlAnimatedModel alloc] initWithModel: model |
85 |
animation: @"DEFAULT"]; |
animation: @"DEFAULT"]; |
86 |
RELEASE (model); |
RELEASE (model); |
87 |
|
|
88 |
/* map */ |
/* map */ |
89 |
// _map = [[MapDisplay alloc] initWithMapImageName: @"carte.tiff" |
_map = [MapLoader loadMap: @"Resources/Map/map1.map"]; |
|
// colorsImageName: @"degrades.tiff" |
|
|
// shadowsImageName: nil |
|
|
// texturesImageName: nil]; |
|
90 |
|
|
91 |
/* game */ |
/* game */ |
92 |
_game = [[HgGame alloc] initWithName: @"Jeu"]; |
_game = [[HgGame alloc] initWithName: @"Jeu"]; |
100 |
|
|
101 |
- (void) _display |
- (void) _display |
102 |
{ |
{ |
103 |
NSAssert (_camera && _anim && _game, |
NSAssert (_camera && _anim && _map && _game && _player1, |
104 |
@"Game not started"); |
@"Game not started"); |
105 |
|
|
106 |
glMatrixMode (GL_PROJECTION); |
glMatrixMode (GL_PROJECTION); |
122 |
(GLdouble)[_camera up].y, |
(GLdouble)[_camera up].y, |
123 |
(GLdouble)[_camera up].z); |
(GLdouble)[_camera up].z); |
124 |
|
|
125 |
// [_map displayWithCamera: _camera |
[_map displayWithCamera: _camera |
126 |
// numberOfRay: 80 |
numberOfRay: 80 |
127 |
// lastStep: 5.0]; |
lastStep: 5.0]; |
128 |
|
|
129 |
Frustum * _frustum = [[Frustum alloc] initWithCurrentGlState]; |
Frustum * _frustum = [[Frustum alloc] initWithCurrentGlState]; |
130 |
|
|