- replaced calls to glgenlists and family as these gl calls are deprecated in newer opengl (and really did not do anything for us)
This commit is contained in:
parent
0fac755a5e
commit
b6a4e33e7d
|
@ -1680,8 +1680,8 @@ void Game::renderWorker() {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
if(renderer.getCustom3dMenuList() != NULL) {
|
if(renderer.getCustom3dMenu() != NULL) {
|
||||||
renderer.setCustom3dMenuList(NULL);
|
renderer.setCustom3dMenu(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1924,7 +1924,7 @@ void Game::mouseDownLeft(int x, int y) {
|
||||||
MainMenu *newMenu = new MainMenu(program); // open keyboard shortcuts setup screen
|
MainMenu *newMenu = new MainMenu(program); // open keyboard shortcuts setup screen
|
||||||
currentUIState = newMenu;
|
currentUIState = newMenu;
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
renderer.setCustom3dMenuList(&statelist3dMenu);
|
renderer.setCustom3dMenu(newMenu);
|
||||||
//currentUIState->load();
|
//currentUIState->load();
|
||||||
currentUIState->init();
|
currentUIState->init();
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ private:
|
||||||
int saveGamePopupMenuIndex;
|
int saveGamePopupMenuIndex;
|
||||||
int loadGamePopupMenuIndex;
|
int loadGamePopupMenuIndex;
|
||||||
int keyboardSetupPopupMenuIndex;
|
int keyboardSetupPopupMenuIndex;
|
||||||
GLuint statelist3dMenu;
|
//GLuint statelist3dMenu;
|
||||||
ProgramState *currentUIState;
|
ProgramState *currentUIState;
|
||||||
|
|
||||||
bool masterserverMode;
|
bool masterserverMode;
|
||||||
|
|
|
@ -183,13 +183,15 @@ Renderer::Renderer() : BaseRenderer() {
|
||||||
shadowMapHandle=0;
|
shadowMapHandle=0;
|
||||||
shadowMapHandleValid=false;
|
shadowMapHandleValid=false;
|
||||||
|
|
||||||
list3d=0;
|
//list3d=0;
|
||||||
list3dValid=false;
|
//list3dValid=false;
|
||||||
list2d=0;
|
//list2d=0;
|
||||||
list2dValid=false;
|
//list2dValid=false;
|
||||||
list3dMenu=0;
|
//list3dMenu=0;
|
||||||
list3dMenuValid=false;
|
//list3dMenuValid=false;
|
||||||
customlist3dMenu=NULL;
|
//customlist3dMenu=NULL;
|
||||||
|
mm3d = NULL;
|
||||||
|
custom_mm3d = NULL;
|
||||||
|
|
||||||
this->program = NULL;
|
this->program = NULL;
|
||||||
|
|
||||||
|
@ -533,7 +535,9 @@ void Renderer::initMenu(const MainMenu *mm) {
|
||||||
void Renderer::reset3d() {
|
void Renderer::reset3d() {
|
||||||
assertGl();
|
assertGl();
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
||||||
glCallList(list3d);
|
//glCallList(list3d);
|
||||||
|
render3dSetup();
|
||||||
|
|
||||||
pointCount= 0;
|
pointCount= 0;
|
||||||
triangleCount= 0;
|
triangleCount= 0;
|
||||||
assertGl();
|
assertGl();
|
||||||
|
@ -542,18 +546,21 @@ void Renderer::reset3d() {
|
||||||
void Renderer::reset2d() {
|
void Renderer::reset2d() {
|
||||||
assertGl();
|
assertGl();
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
|
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
|
||||||
glCallList(list2d);
|
//glCallList(list2d);
|
||||||
|
render2dMenuSetup();
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::reset3dMenu() {
|
void Renderer::reset3dMenu() {
|
||||||
assertGl();
|
assertGl();
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
|
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
|
||||||
if(this->customlist3dMenu != NULL) {
|
if(this->custom_mm3d != NULL) {
|
||||||
glCallList(*this->customlist3dMenu);
|
render3dMenuSetup(this->custom_mm3d);
|
||||||
|
//glCallList(*this->customlist3dMenu);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glCallList(list3dMenu);
|
render3dMenuSetup(this->mm3d);
|
||||||
|
//glCallList(list3dMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertGl();
|
assertGl();
|
||||||
|
@ -591,10 +598,10 @@ void Renderer::end() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete 2d list
|
//delete 2d list
|
||||||
if(list2dValid == true) {
|
//if(list2dValid == true) {
|
||||||
glDeleteLists(list2d, 1);
|
// glDeleteLists(list2d, 1);
|
||||||
list2dValid=false;
|
// list2dValid=false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
Renderer::rendererEnded = true;
|
Renderer::rendererEnded = true;
|
||||||
}
|
}
|
||||||
|
@ -621,10 +628,10 @@ void Renderer::endScenario() {
|
||||||
shadowMapHandleValid=false;
|
shadowMapHandleValid=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list3dValid == true) {
|
//if(list3dValid == true) {
|
||||||
glDeleteLists(list3d, 1);
|
// glDeleteLists(list3d, 1);
|
||||||
list3dValid=false;
|
// list3dValid=false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
//worldToScreenPosCache.clear();
|
//worldToScreenPosCache.clear();
|
||||||
ReleaseSurfaceVBOs();
|
ReleaseSurfaceVBOs();
|
||||||
|
@ -664,10 +671,10 @@ void Renderer::endGame(bool isFinalEnd) {
|
||||||
shadowMapHandleValid=false;
|
shadowMapHandleValid=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list3dValid == true) {
|
//if(list3dValid == true) {
|
||||||
glDeleteLists(list3d, 1);
|
// glDeleteLists(list3d, 1);
|
||||||
list3dValid=false;
|
// list3dValid=false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
//worldToScreenPosCache.clear();
|
//worldToScreenPosCache.clear();
|
||||||
ReleaseSurfaceVBOs();
|
ReleaseSurfaceVBOs();
|
||||||
|
@ -695,12 +702,12 @@ void Renderer::endMenu() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->customlist3dMenu != NULL) {
|
//if(this->customlist3dMenu != NULL) {
|
||||||
glDeleteLists(*this->customlist3dMenu,1);
|
// glDeleteLists(*this->customlist3dMenu,1);
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
glDeleteLists(list3dMenu, 1);
|
// glDeleteLists(list3dMenu, 1);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::reloadResources() {
|
void Renderer::reloadResources() {
|
||||||
|
@ -6973,113 +6980,117 @@ void Renderer::init3dList() {
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
const Metrics &metrics= Metrics::getInstance();
|
render3dSetup();
|
||||||
|
//const Metrics &metrics= Metrics::getInstance();
|
||||||
|
|
||||||
assertGl();
|
//assertGl();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
list3d= glGenLists(1);
|
//list3d= glGenLists(1);
|
||||||
assertGl();
|
//assertGl();
|
||||||
list3dValid=true;
|
//list3dValid=true;
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
glNewList(list3d, GL_COMPILE_AND_EXECUTE);
|
//glNewList(list3d, GL_COMPILE_AND_EXECUTE);
|
||||||
//need to execute, because if not gluPerspective takes no effect and gluLoadMatrix is wrong
|
//need to execute, because if not gluPerspective takes no effect and gluLoadMatrix is wrong
|
||||||
|
//render3dSetup();
|
||||||
|
//glEndList();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
//misc
|
|
||||||
glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH());
|
|
||||||
glClearColor(fowColor.x, fowColor.y, fowColor.z, fowColor.w);
|
|
||||||
glFrontFace(GL_CW);
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
loadProjectionMatrix();
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
//texture state
|
|
||||||
glActiveTexture(shadowTexUnit);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
|
|
||||||
glActiveTexture(fowTexUnit);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
|
|
||||||
glActiveTexture(baseTexUnit);
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
//material state
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, defSpecularColor.ptr());
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, defAmbientColor.ptr());
|
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, defDiffuseColor.ptr());
|
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
|
||||||
glColor4fv(defColor.ptr());
|
|
||||||
|
|
||||||
//blend state
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
//alpha test state
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
glAlphaFunc(GL_GREATER, 0.f);
|
|
||||||
|
|
||||||
//depth test state
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glDepthMask(GL_TRUE);
|
|
||||||
glDepthFunc(GL_LESS);
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
//lighting state
|
|
||||||
glEnable(GL_LIGHTING);
|
|
||||||
glEnable(GL_LIGHT0);
|
|
||||||
|
|
||||||
//matrix mode
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
|
|
||||||
//stencil test
|
|
||||||
glDisable(GL_STENCIL_TEST);
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
//fog
|
|
||||||
const Tileset *tileset= NULL;
|
|
||||||
if(game != NULL && game->getWorld() != NULL) {
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
tileset = game->getWorld()->getTileset();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
if(tileset != NULL && tileset->getFog()) {
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
glEnable(GL_FOG);
|
|
||||||
if(tileset->getFogMode()==fmExp) {
|
|
||||||
glFogi(GL_FOG_MODE, GL_EXP);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
glFogi(GL_FOG_MODE, GL_EXP2);
|
|
||||||
}
|
|
||||||
|
|
||||||
glFogf(GL_FOG_DENSITY, tileset->getFogDensity());
|
|
||||||
glFogfv(GL_FOG_COLOR, tileset->getFogColor().ptr());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
assertGl();
|
//assertGl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::render3dSetup() {
|
||||||
|
const Metrics &metrics= Metrics::getInstance();
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
//misc
|
||||||
|
glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH());
|
||||||
|
glClearColor(fowColor.x, fowColor.y, fowColor.z, fowColor.w);
|
||||||
|
glFrontFace(GL_CW);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
loadProjectionMatrix();
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
//texture state
|
||||||
|
glActiveTexture(shadowTexUnit);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
|
glActiveTexture(fowTexUnit);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
|
glActiveTexture(baseTexUnit);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
//material state
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, defSpecularColor.ptr());
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, defAmbientColor.ptr());
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, defDiffuseColor.ptr());
|
||||||
|
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||||
|
glColor4fv(defColor.ptr());
|
||||||
|
|
||||||
|
//blend state
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
//alpha test state
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glAlphaFunc(GL_GREATER, 0.f);
|
||||||
|
|
||||||
|
//depth test state
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glDepthMask(GL_TRUE);
|
||||||
|
glDepthFunc(GL_LESS);
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
//lighting state
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glEnable(GL_LIGHT0);
|
||||||
|
|
||||||
|
//matrix mode
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
|
//stencil test
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
//fog
|
||||||
|
const Tileset *tileset= NULL;
|
||||||
|
if(game != NULL && game->getWorld() != NULL) {
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
tileset = game->getWorld()->getTileset();
|
||||||
|
}
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
if(tileset != NULL && tileset->getFog()) {
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
glEnable(GL_FOG);
|
||||||
|
if(tileset->getFogMode()==fmExp) {
|
||||||
|
glFogi(GL_FOG_MODE, GL_EXP);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glFogi(GL_FOG_MODE, GL_EXP2);
|
||||||
|
}
|
||||||
|
|
||||||
|
glFogf(GL_FOG_DENSITY, tileset->getFogDensity());
|
||||||
|
glFogfv(GL_FOG_COLOR, tileset->getFogColor().ptr());
|
||||||
|
}
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::init2dList() {
|
void Renderer::init2dList() {
|
||||||
|
@ -7087,47 +7098,48 @@ void Renderer::init2dList() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //this list sets the state for the 2d rendering
|
||||||
|
// list2d= glGenLists(1);
|
||||||
|
// assertGl();
|
||||||
|
// list2dValid=true;
|
||||||
|
//
|
||||||
|
// glNewList(list2d, GL_COMPILE);
|
||||||
|
// render2dMenuSetup();
|
||||||
|
// glEndList();
|
||||||
|
//
|
||||||
|
// assertGl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::render2dMenuSetup() {
|
||||||
const Metrics &metrics= Metrics::getInstance();
|
const Metrics &metrics= Metrics::getInstance();
|
||||||
|
//projection
|
||||||
|
glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH());
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, metrics.getVirtualW(), 0, metrics.getVirtualH(), 0, 1);
|
||||||
|
|
||||||
//this list sets the state for the 2d rendering
|
//modelview
|
||||||
list2d= glGenLists(1);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
assertGl();
|
glLoadIdentity();
|
||||||
list2dValid=true;
|
|
||||||
|
|
||||||
glNewList(list2d, GL_COMPILE);
|
//disable everything
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
glDisable(GL_FOG);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
glFrontFace(GL_CCW);
|
||||||
|
glActiveTexture(baseTexUnit);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
//projection
|
//blend func
|
||||||
glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH());
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
|
||||||
glOrtho(0, metrics.getVirtualW(), 0, metrics.getVirtualH(), 0, 1);
|
|
||||||
|
|
||||||
//modelview
|
//color
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
//disable everything
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glDisable(GL_LIGHTING);
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glDisable(GL_STENCIL_TEST);
|
|
||||||
glDisable(GL_FOG);
|
|
||||||
glDisable(GL_CULL_FACE);
|
|
||||||
glFrontFace(GL_CCW);
|
|
||||||
glActiveTexture(baseTexUnit);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
//blend func
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
//color
|
|
||||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
|
||||||
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
assertGl();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::init3dListMenu(const MainMenu *mm) {
|
void Renderer::init3dListMenu(const MainMenu *mm) {
|
||||||
|
@ -7135,6 +7147,8 @@ void Renderer::init3dListMenu(const MainMenu *mm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->mm3d = mm;
|
||||||
|
/*
|
||||||
assertGl();
|
assertGl();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
@ -7229,9 +7243,75 @@ void Renderer::init3dListMenu(const MainMenu *mm) {
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
assertGl();
|
assertGl();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::render3dMenuSetup(const MainMenu *mm) {
|
||||||
|
const Metrics &metrics= Metrics::getInstance();
|
||||||
|
const MenuBackground *mb = NULL;
|
||||||
|
if(mm != NULL) {
|
||||||
|
mb = mm->getConstMenuBackground();
|
||||||
|
}
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
//misc
|
||||||
|
glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH());
|
||||||
|
glClearColor(0.4f, 0.4f, 0.4f, 1.f);
|
||||||
|
glFrontFace(GL_CW);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
gluPerspective(perspFov, metrics.getAspectRatio(), perspNearPlane, 1000000);
|
||||||
|
|
||||||
|
//texture state
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
|
//material state
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, defSpecularColor.ptr());
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, defAmbientColor.ptr());
|
||||||
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, defDiffuseColor.ptr());
|
||||||
|
glColor4fv(defColor.ptr());
|
||||||
|
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||||
|
|
||||||
|
//blend state
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
//alpha test state
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glAlphaFunc(GL_GREATER, 0.f);
|
||||||
|
|
||||||
|
//depth test state
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glDepthMask(GL_TRUE);
|
||||||
|
glDepthFunc(GL_LESS);
|
||||||
|
|
||||||
|
//lighting state
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
|
//matrix mode
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
|
//stencil test
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
//fog
|
||||||
|
if(mb != NULL && mb->getFog()) {
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
glEnable(GL_FOG);
|
||||||
|
glFogi(GL_FOG_MODE, GL_EXP2);
|
||||||
|
glFogf(GL_FOG_DENSITY, mb->getFogDensity());
|
||||||
|
}
|
||||||
|
|
||||||
|
//assert
|
||||||
|
assertGl();
|
||||||
|
|
||||||
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
}
|
||||||
// ==================== misc ====================
|
// ==================== misc ====================
|
||||||
|
|
||||||
void Renderer::loadProjectionMatrix() {
|
void Renderer::loadProjectionMatrix() {
|
||||||
|
|
|
@ -275,13 +275,15 @@ private:
|
||||||
ParticleManager *particleManager[rsCount];
|
ParticleManager *particleManager[rsCount];
|
||||||
|
|
||||||
//state lists
|
//state lists
|
||||||
GLuint list3d;
|
//GLuint list3d;
|
||||||
bool list3dValid;
|
//bool list3dValid;
|
||||||
GLuint list2d;
|
//GLuint list2d;
|
||||||
bool list2dValid;
|
//bool list2dValid;
|
||||||
GLuint list3dMenu;
|
//GLuint list3dMenu;
|
||||||
bool list3dMenuValid;
|
//bool list3dMenuValid;
|
||||||
GLuint *customlist3dMenu;
|
//GLuint *customlist3dMenu;
|
||||||
|
const MainMenu *mm3d;
|
||||||
|
const MainMenu *custom_mm3d;
|
||||||
|
|
||||||
//shadows
|
//shadows
|
||||||
GLuint shadowMapHandle;
|
GLuint shadowMapHandle;
|
||||||
|
@ -586,8 +588,10 @@ public:
|
||||||
static Texture2D * preloadTexture(string logoFilename);
|
static Texture2D * preloadTexture(string logoFilename);
|
||||||
inline int getCachedSurfaceDataSize() const { return mapSurfaceData.size(); }
|
inline int getCachedSurfaceDataSize() const { return mapSurfaceData.size(); }
|
||||||
|
|
||||||
void setCustom3dMenuList(GLuint *customlist3dMenu) { this->customlist3dMenu = customlist3dMenu; }
|
//void setCustom3dMenuList(GLuint *customlist3dMenu) { this->customlist3dMenu = customlist3dMenu; }
|
||||||
inline GLuint * getCustom3dMenuList() const { return this->customlist3dMenu; }
|
//inline GLuint * getCustom3dMenuList() const { return this->customlist3dMenu; }
|
||||||
|
void setCustom3dMenu(const MainMenu *mm) { this->custom_mm3d = mm; }
|
||||||
|
const MainMenu * getCustom3dMenu() { return this->custom_mm3d; }
|
||||||
|
|
||||||
void init3dListMenu(const MainMenu *mm);
|
void init3dListMenu(const MainMenu *mm);
|
||||||
|
|
||||||
|
@ -637,6 +641,9 @@ private:
|
||||||
static Texture2D::Filter strToTextureFilter(const string &s);
|
static Texture2D::Filter strToTextureFilter(const string &s);
|
||||||
void cleanupScreenshotThread();
|
void cleanupScreenshotThread();
|
||||||
|
|
||||||
|
void render2dMenuSetup();
|
||||||
|
void render3dSetup();
|
||||||
|
void render3dMenuSetup(const MainMenu *mm);
|
||||||
};
|
};
|
||||||
|
|
||||||
}} //end namespace
|
}} //end namespace
|
||||||
|
|
Loading…
Reference in New Issue
Block a user