Now we can know the position of each node/polygon/point of the animated model before it's even drawn on screen. We can also know the position of the points on screen (and the depth of those points). The dirty box of the models is now computed (in a debug fashion). Somehow, models head are still bugged but it's probably due to the fact that they are not animated (and not initialised). The debug display is left activated to let Endy see the results and implement a better zbuffer refresh system
94 lines
2.5 KiB
C++
94 lines
2.5 KiB
C++
// Residual - Virtual machine to run LucasArts' 3D adventure games
|
|
// Copyright (C) 2003 The ScummVM-Residual Team (www.scummvm.org)
|
|
//
|
|
// This library is free software; you can redistribute it and/or
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
// License as published by the Free Software Foundation; either
|
|
// version 2.1 of the License, or (at your option) any later version.
|
|
//
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#include "stdafx.h"
|
|
#include <SDL.h>
|
|
#include <SDL_video.h>
|
|
#include <SDL_opengl.h>
|
|
#include "bitmap.h"
|
|
#include "resource.h"
|
|
#include "debug.h"
|
|
#include "lua.h"
|
|
#include "registry.h"
|
|
#include "engine.h"
|
|
#include "mixer.h"
|
|
#ifndef _MSC_VER
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
static void saveRegistry() {
|
|
Registry::instance()->save();
|
|
}
|
|
|
|
int main(int /* argc */, char ** /* argv */) {
|
|
char GLDriver[1024];
|
|
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
|
return 1;
|
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
|
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
|
|
|
if (SDL_SetVideoMode(640, 480, 24, SDL_OPENGL) == 0)
|
|
error("Could not initialize video");
|
|
|
|
atexit(SDL_Quit);
|
|
atexit(saveRegistry);
|
|
sprintf(GLDriver, "Residual: %s/%s", glGetString(GL_VENDOR), glGetString(GL_RENDERER));
|
|
SDL_WM_SetCaption(GLDriver, "Residual");
|
|
|
|
Bitmap *splash_bm = ResourceLoader::instance()->loadBitmap("splash.bm");
|
|
|
|
SDL_Event event;
|
|
while (SDL_PollEvent(&event)) {
|
|
if (event.type == SDL_VIDEOEXPOSE) {
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
Bitmap::prepareGL();
|
|
splash_bm->draw();
|
|
SDL_GL_SwapBuffers();
|
|
}
|
|
}
|
|
|
|
Mixer::instance()->start();
|
|
|
|
lua_open();
|
|
|
|
lua_beginblock();
|
|
lua_iolibopen();
|
|
lua_strlibopen();
|
|
lua_mathlibopen();
|
|
lua_endblock();
|
|
|
|
lua_beginblock();
|
|
register_lua();
|
|
lua_endblock();
|
|
|
|
lua_beginblock();
|
|
bundle_dofile("_system.lua");
|
|
lua_endblock();
|
|
|
|
lua_beginblock();
|
|
lua_pushnil(); // resumeSave
|
|
lua_pushnumber(0); // bootParam
|
|
lua_call("BOOT");
|
|
lua_endblock();
|
|
|
|
Engine::instance()->mainLoop();
|
|
|
|
return 0;
|
|
}
|