mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 13:23:59 +02:00
Fading out at death works again
This commit is contained in:
@@ -312,7 +312,7 @@ namespace Shared {
|
|||||||
assert(false);
|
assert(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
meshCallbackTeamColor.setTeamTexture(customTexture);
|
meshCallback.setTeamTexture(customTexture);
|
||||||
|
|
||||||
if (wireframe) {
|
if (wireframe) {
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
@@ -371,7 +371,7 @@ namespace Shared {
|
|||||||
|
|
||||||
void Renderer::renderTheModel(Model *model, float f) {
|
void Renderer::renderTheModel(Model *model, float f) {
|
||||||
if (model != NULL) {
|
if (model != NULL) {
|
||||||
modelRenderer->begin(true, true, !wireframe, false, &meshCallbackTeamColor);
|
modelRenderer->begin(true, true, !wireframe, false, &meshCallback);
|
||||||
model->updateInterpolationData(f, true);
|
model->updateInterpolationData(f, true);
|
||||||
modelRenderer->render(model);
|
modelRenderer->render(model);
|
||||||
|
|
||||||
|
@@ -38,10 +38,9 @@ using Shared::Graphics::Texture2D;
|
|||||||
using Shared::Graphics::ParticleRenderer;
|
using Shared::Graphics::ParticleRenderer;
|
||||||
using Shared::Graphics::ParticleManager;
|
using Shared::Graphics::ParticleManager;
|
||||||
using Shared::Graphics::ParticleSystem;
|
using Shared::Graphics::ParticleSystem;
|
||||||
using Shared::Graphics::Gl::MeshCallbackTeamColor;
|
using Shared::Graphics::Gl::MeshCallback;
|
||||||
//#include "model_renderer.h"
|
//#include "model_renderer.h"
|
||||||
|
|
||||||
using Shared::Graphics::MeshCallback;
|
|
||||||
using Shared::Graphics::Mesh;
|
using Shared::Graphics::Mesh;
|
||||||
using Shared::Graphics::Texture;
|
using Shared::Graphics::Texture;
|
||||||
|
|
||||||
@@ -97,7 +96,7 @@ namespace Shared {
|
|||||||
Texture2D *customTextureOrange;
|
Texture2D *customTextureOrange;
|
||||||
Texture2D *customTextureMagenta;
|
Texture2D *customTextureMagenta;
|
||||||
Texture2D *customTextureTransparent;
|
Texture2D *customTextureTransparent;
|
||||||
MeshCallbackTeamColor meshCallbackTeamColor;
|
MeshCallback meshCallback;
|
||||||
|
|
||||||
float red;
|
float red;
|
||||||
float green;
|
float green;
|
||||||
|
@@ -6279,339 +6279,262 @@ namespace Glest {
|
|||||||
|
|
||||||
//printf("In game checking keypress for key [%d] camera left [%d]\n",key.keysym.sym,configKeys.getSDLKey("CameraModeLeft"));
|
//printf("In game checking keypress for key [%d] camera left [%d]\n",key.keysym.sym,configKeys.getSDLKey("CameraModeLeft"));
|
||||||
|
|
||||||
if (isKeyPressed
|
if (isKeyPressed(configKeys.getSDLKey("RenderInGamePerformance"), key, false) == true) {
|
||||||
(configKeys.getSDLKey("RenderInGamePerformance"), key,
|
|
||||||
false) == true) {
|
|
||||||
renderInGamePerformance = !renderInGamePerformance;
|
renderInGamePerformance = !renderInGamePerformance;
|
||||||
|
|
||||||
Config::getInstance().setBool("PerformanceWarningEnabled",
|
Config::getInstance().setBool("PerformanceWarningEnabled",
|
||||||
renderInGamePerformance, true);
|
renderInGamePerformance, true);
|
||||||
}
|
}
|
||||||
//if(key == configKeys.getCharKey("RenderNetworkStatus")) {
|
//if(key == configKeys.getCharKey("RenderNetworkStatus")) {
|
||||||
else
|
else if (isKeyPressed(configKeys.getSDLKey("RenderNetworkStatus"), key, false) == true) {
|
||||||
if (isKeyPressed
|
renderNetworkStatus = !renderNetworkStatus;
|
||||||
(configKeys.getSDLKey("RenderNetworkStatus"), key,
|
}
|
||||||
false) == true) {
|
|
||||||
renderNetworkStatus = !renderNetworkStatus;
|
|
||||||
}
|
|
||||||
//else if(key == configKeys.getCharKey("ShowFullConsole")) {
|
//else if(key == configKeys.getCharKey("ShowFullConsole")) {
|
||||||
else
|
else if (isKeyPressed(configKeys.getSDLKey("ShowFullConsole"), key, false) == true) {
|
||||||
if (isKeyPressed
|
showFullConsole = true;
|
||||||
(configKeys.getSDLKey("ShowFullConsole"), key,
|
} else if (isKeyPressed(configKeys.getSDLKey("SetMarker"), key, setMarkerKeyAllowsModifier) == true) {
|
||||||
false) == true) {
|
setMarker = true;
|
||||||
showFullConsole = true;
|
printf("%d\n", key.keysym.scancode);
|
||||||
} else
|
}
|
||||||
if (isKeyPressed
|
else if (isKeyPressed(configKeys.getSDLKey("TogglePhotoMode"), key, false) == true) {
|
||||||
(configKeys.getSDLKey("SetMarker"), key,
|
photoModeEnabled = !photoModeEnabled;
|
||||||
setMarkerKeyAllowsModifier) == true) {
|
if (photoModeEnabled == true &&
|
||||||
setMarker = true;
|
this->gameSettings.isNetworkGame() == false) {
|
||||||
printf("%d\n", key.keysym.scancode);
|
gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT);
|
||||||
|
} else if (photoModeEnabled == false) {
|
||||||
|
gameCamera.setMaxHeight(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//Toggle Healthbars
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("ToggleHealthbars"), key, false) == true) {
|
||||||
|
switch (healthbarMode) {
|
||||||
|
case hbvUndefined:
|
||||||
|
healthbarMode = hbvOff;
|
||||||
|
console.addLine(lang.getString("Healthbar2") + ": " +
|
||||||
|
lang.getString("HealthbarsOff"));
|
||||||
|
break;
|
||||||
|
case hbvOff:
|
||||||
|
healthbarMode = hbvAlways;
|
||||||
|
console.addLine(lang.getString("Healthbar2") + ": " +
|
||||||
|
lang.getString("HealthbarsAlways"));
|
||||||
|
break;
|
||||||
|
case hbvAlways:
|
||||||
|
healthbarMode = hbvIfNeeded;
|
||||||
|
console.addLine(lang.getString("Healthbar2") + ": " +
|
||||||
|
lang.getString("HealthbarsIfNeeded"));
|
||||||
|
break;
|
||||||
|
case hbvIfNeeded:
|
||||||
|
healthbarMode = hbvSelected;
|
||||||
|
console.addLine(lang.getString("Healthbar2") + ": " +
|
||||||
|
lang.getString("HealthbarsSelected"));
|
||||||
|
break;
|
||||||
|
case hbvSelected:
|
||||||
|
healthbarMode = hbvSelected | hbvIfNeeded;
|
||||||
|
console.addLine(lang.getString("Healthbar2") + ": " +
|
||||||
|
lang.getString("HealthbarsSelectedOrNeeded"));
|
||||||
|
break;
|
||||||
|
case (hbvSelected | hbvIfNeeded):
|
||||||
|
healthbarMode = hbvUndefined;
|
||||||
|
console.addLine(lang.getString("Healthbar2") + ": " +
|
||||||
|
lang.getString("HealthbarsFactionDefault"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf
|
||||||
|
("In [%s::%s Line: %d] Toggle Healthbars Hotkey - Invalid Value. Setting to default.\n",
|
||||||
|
extractFileFromDirectoryPath(__FILE__).c_str(),
|
||||||
|
__FUNCTION__, __LINE__);
|
||||||
|
healthbarMode = hbvUndefined;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Toggle music
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("ToggleMusic"), key, false) == true) {
|
||||||
|
if (this->masterserverMode == false) {
|
||||||
|
Config & config = Config::getInstance();
|
||||||
|
StrSound *gameMusic =
|
||||||
|
world.getThisFaction()->getType()->getMusic();
|
||||||
|
if (gameMusic != NULL) {
|
||||||
|
float
|
||||||
|
configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
|
||||||
|
float currentVolume = gameMusic->getVolume();
|
||||||
|
if (currentVolume > 0) {
|
||||||
|
gameMusic->setVolume(0);
|
||||||
|
console.addLine(lang.getString("GameMusic") +
|
||||||
|
" " + lang.getString("Off"));
|
||||||
|
} else {
|
||||||
|
//If the config says zero, use the default music volume
|
||||||
|
gameMusic->setVolume(configVolume ? configVolume : 0.9);
|
||||||
|
console.addLine(lang.getString("GameMusic"));
|
||||||
}
|
}
|
||||||
//else if(key == configKeys.getCharKey("TogglePhotoMode")) {
|
}
|
||||||
else
|
}
|
||||||
if (isKeyPressed
|
}
|
||||||
(configKeys.getSDLKey("TogglePhotoMode"), key,
|
//move camera left
|
||||||
false) == true) {
|
else if (isKeyPressed(configKeys.getSDLKey("CameraModeLeft"), key, false) == true) {
|
||||||
photoModeEnabled = !photoModeEnabled;
|
gameCamera.setMoveX(-1);
|
||||||
if (photoModeEnabled == true &&
|
camLeftButtonDown = true;
|
||||||
this->gameSettings.isNetworkGame() == false) {
|
}
|
||||||
gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT);
|
//move camera right
|
||||||
} else if (photoModeEnabled == false) {
|
else if (isKeyPressed(configKeys.getSDLKey("CameraModeRight"), key, false) == true) {
|
||||||
gameCamera.setMaxHeight(-1);
|
gameCamera.setMoveX(1);
|
||||||
}
|
camRightButtonDown = true;
|
||||||
|
}
|
||||||
|
//move camera up
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("CameraModeUp"), key, false) == true) {
|
||||||
|
gameCamera.setMoveZ(1);
|
||||||
|
camUpButtonDown = true;
|
||||||
|
}
|
||||||
|
//move camera down
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("CameraModeDown"), key, false) == true) {
|
||||||
|
gameCamera.setMoveZ(-1);
|
||||||
|
camDownButtonDown = true;
|
||||||
|
}
|
||||||
|
//change camera mode
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("FreeCameraMode"), key, false) == true) {
|
||||||
|
if (gameCamera.getState() == GameCamera::sFree) {
|
||||||
|
gameCamera.setState(GameCamera::sGame);
|
||||||
|
string
|
||||||
|
stateString =
|
||||||
|
gameCamera.getState() ==
|
||||||
|
GameCamera::
|
||||||
|
sGame ? lang.getString("GameCamera") :
|
||||||
|
lang.getString("FreeCamera");
|
||||||
|
console.addLine(lang.getString("CameraModeSet") + " " +
|
||||||
|
stateString);
|
||||||
|
} else if (gameCamera.getState() == GameCamera::sGame) {
|
||||||
|
gameCamera.setState(GameCamera::sFree);
|
||||||
|
string
|
||||||
|
stateString =
|
||||||
|
gameCamera.getState() ==
|
||||||
|
GameCamera::
|
||||||
|
sGame ? lang.getString("GameCamera") :
|
||||||
|
lang.getString("FreeCamera");
|
||||||
|
console.addLine(lang.getString("CameraModeSet") + " " +
|
||||||
|
stateString);
|
||||||
|
}
|
||||||
|
//else ignore!
|
||||||
|
}
|
||||||
|
//reset camera mode to normal
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("ResetCameraMode"), key, false) == true) {
|
||||||
|
if (currentCameraFollowUnit != NULL) {
|
||||||
|
currentCameraFollowUnit = NULL;
|
||||||
|
}
|
||||||
|
gameCamera.setState(GameCamera::sGame);
|
||||||
|
}
|
||||||
|
//pause
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("PauseGame"), key, false) == true) {
|
||||||
|
//printf("Toggle pause paused = %d\n",paused);
|
||||||
|
//setPaused(!paused);
|
||||||
|
|
||||||
}
|
bool allowAdminMenuItems = false;
|
||||||
//Toggle Healthbars
|
NetworkManager & networkManager = NetworkManager::getInstance();
|
||||||
else
|
NetworkRole role = networkManager.getNetworkRole();
|
||||||
if (isKeyPressed
|
if (role == nrServer) {
|
||||||
(configKeys.getSDLKey("ToggleHealthbars"), key,
|
allowAdminMenuItems = true;
|
||||||
false) == true) {
|
} else if (role == nrClient) {
|
||||||
switch (healthbarMode) {
|
ClientInterface *clientInterface =
|
||||||
case hbvUndefined:
|
dynamic_cast <
|
||||||
healthbarMode = hbvOff;
|
ClientInterface *>(networkManager.getClientInterface());
|
||||||
console.addLine(lang.getString("Healthbar2") + ": " +
|
|
||||||
lang.getString("HealthbarsOff"));
|
|
||||||
break;
|
|
||||||
case hbvOff:
|
|
||||||
healthbarMode = hbvAlways;
|
|
||||||
console.addLine(lang.getString("Healthbar2") + ": " +
|
|
||||||
lang.getString("HealthbarsAlways"));
|
|
||||||
break;
|
|
||||||
case hbvAlways:
|
|
||||||
healthbarMode = hbvIfNeeded;
|
|
||||||
console.addLine(lang.getString("Healthbar2") + ": " +
|
|
||||||
lang.getString("HealthbarsIfNeeded"));
|
|
||||||
break;
|
|
||||||
case hbvIfNeeded:
|
|
||||||
healthbarMode = hbvSelected;
|
|
||||||
console.addLine(lang.getString("Healthbar2") + ": " +
|
|
||||||
lang.getString("HealthbarsSelected"));
|
|
||||||
break;
|
|
||||||
case hbvSelected:
|
|
||||||
healthbarMode = hbvSelected | hbvIfNeeded;
|
|
||||||
console.addLine(lang.getString("Healthbar2") + ": " +
|
|
||||||
lang.getString("HealthbarsSelectedOrNeeded"));
|
|
||||||
break;
|
|
||||||
case (hbvSelected | hbvIfNeeded):
|
|
||||||
healthbarMode = hbvUndefined;
|
|
||||||
console.addLine(lang.getString("Healthbar2") + ": " +
|
|
||||||
lang.getString("HealthbarsFactionDefault"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf
|
|
||||||
("In [%s::%s Line: %d] Toggle Healthbars Hotkey - Invalid Value. Setting to default.\n",
|
|
||||||
extractFileFromDirectoryPath(__FILE__).c_str(),
|
|
||||||
__FUNCTION__, __LINE__);
|
|
||||||
healthbarMode = hbvUndefined;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Toggle music
|
|
||||||
//else if(key == configKeys.getCharKey("ToggleMusic")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("ToggleMusic"), key, false) == true) {
|
|
||||||
|
|
||||||
if (this->masterserverMode == false) {
|
if (clientInterface != NULL &&
|
||||||
Config & config = Config::getInstance();
|
gameSettings.getMasterserver_admin() ==
|
||||||
StrSound *gameMusic =
|
clientInterface->getSessionKey()) {
|
||||||
world.getThisFaction()->getType()->getMusic();
|
allowAdminMenuItems = true;
|
||||||
if (gameMusic != NULL) {
|
}
|
||||||
float
|
}
|
||||||
configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
|
|
||||||
float currentVolume = gameMusic->getVolume();
|
|
||||||
if (currentVolume > 0) {
|
|
||||||
gameMusic->setVolume(0);
|
|
||||||
console.addLine(lang.getString("GameMusic") +
|
|
||||||
" " + lang.getString("Off"));
|
|
||||||
} else {
|
|
||||||
//If the config says zero, use the default music volume
|
|
||||||
gameMusic->setVolume(configVolume ? configVolume : 0.9);
|
|
||||||
console.addLine(lang.getString("GameMusic"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//move camera left
|
|
||||||
//else if(key == configKeys.getCharKey("CameraModeLeft")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraModeLeft"), key, false) == true) {
|
|
||||||
gameCamera.setMoveX(-1);
|
|
||||||
camLeftButtonDown = true;
|
|
||||||
}
|
|
||||||
//move camera right
|
|
||||||
//else if(key == configKeys.getCharKey("CameraModeRight")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraModeRight"), key,
|
|
||||||
false) == true) {
|
|
||||||
gameCamera.setMoveX(1);
|
|
||||||
camRightButtonDown = true;
|
|
||||||
}
|
|
||||||
//move camera up
|
|
||||||
//else if(key == configKeys.getCharKey("CameraModeUp")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraModeUp"), key, false) == true) {
|
|
||||||
gameCamera.setMoveZ(1);
|
|
||||||
camUpButtonDown = true;
|
|
||||||
}
|
|
||||||
//move camera down
|
|
||||||
//else if(key == configKeys.getCharKey("CameraModeDown")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraModeDown"), key, false) == true) {
|
|
||||||
gameCamera.setMoveZ(-1);
|
|
||||||
camDownButtonDown = true;
|
|
||||||
}
|
|
||||||
//change camera mode
|
|
||||||
//else if(key == configKeys.getCharKey("FreeCameraMode")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("FreeCameraMode"), key, false) == true) {
|
|
||||||
if (gameCamera.getState() == GameCamera::sFree) {
|
|
||||||
gameCamera.setState(GameCamera::sGame);
|
|
||||||
string
|
|
||||||
stateString =
|
|
||||||
gameCamera.getState() ==
|
|
||||||
GameCamera::
|
|
||||||
sGame ? lang.getString("GameCamera") :
|
|
||||||
lang.getString("FreeCamera");
|
|
||||||
console.addLine(lang.getString("CameraModeSet") + " " +
|
|
||||||
stateString);
|
|
||||||
} else if (gameCamera.getState() == GameCamera::sGame) {
|
|
||||||
gameCamera.setState(GameCamera::sFree);
|
|
||||||
string
|
|
||||||
stateString =
|
|
||||||
gameCamera.getState() ==
|
|
||||||
GameCamera::
|
|
||||||
sGame ? lang.getString("GameCamera") :
|
|
||||||
lang.getString("FreeCamera");
|
|
||||||
console.addLine(lang.getString("CameraModeSet") + " " +
|
|
||||||
stateString);
|
|
||||||
}
|
|
||||||
//else ignore!
|
|
||||||
}
|
|
||||||
//reset camera mode to normal
|
|
||||||
//else if(key == configKeys.getCharKey("ResetCameraMode")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("ResetCameraMode"), key,
|
|
||||||
false) == true) {
|
|
||||||
if (currentCameraFollowUnit != NULL) {
|
|
||||||
currentCameraFollowUnit = NULL;
|
|
||||||
}
|
|
||||||
gameCamera.setState(GameCamera::sGame);
|
|
||||||
}
|
|
||||||
//pause
|
|
||||||
//else if(key == configKeys.getCharKey("PauseGame")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("PauseGame"), key, false) == true) {
|
|
||||||
//printf("Toggle pause paused = %d\n",paused);
|
|
||||||
//setPaused(!paused);
|
|
||||||
|
|
||||||
bool allowAdminMenuItems = false;
|
if (allowAdminMenuItems) {
|
||||||
NetworkManager & networkManager = NetworkManager::getInstance();
|
if (getPaused() == false) {
|
||||||
NetworkRole role = networkManager.getNetworkRole();
|
commander.tryPauseGame(false, false);
|
||||||
if (role == nrServer) {
|
} else {
|
||||||
allowAdminMenuItems = true;
|
commander.tryResumeGame(false, false);
|
||||||
} else if (role == nrClient) {
|
}
|
||||||
ClientInterface *clientInterface =
|
}
|
||||||
dynamic_cast <
|
} else if (isKeyPressed(configKeys.getSDLKey("ExtraTeamColorMarker"), key, false) == true) {
|
||||||
ClientInterface *>(networkManager.getClientInterface());
|
//printf("Toggle ExtraTeamColorMarker\n");
|
||||||
|
toggleTeamColorMarker();
|
||||||
|
}
|
||||||
|
//switch display color
|
||||||
|
else if (isKeyPressed (configKeys.getSDLKey("ChangeFontColor"), key, false) == true) {
|
||||||
|
gui.switchToNextDisplayColor();
|
||||||
|
}
|
||||||
|
//increment speed
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("GameSpeedIncrease"), key, false) == true) {
|
||||||
|
bool
|
||||||
|
speedChangesAllowed =
|
||||||
|
!NetworkManager::
|
||||||
|
getInstance().isNetworkGameWithConnectedClients();
|
||||||
|
if (speedChangesAllowed) {
|
||||||
|
incSpeed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//decrement speed
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("GameSpeedDecrease"), key, false) == true) {
|
||||||
|
bool
|
||||||
|
speedChangesAllowed =
|
||||||
|
!NetworkManager::
|
||||||
|
getInstance().isNetworkGameWithConnectedClients();
|
||||||
|
if (speedChangesAllowed) {
|
||||||
|
decSpeed();
|
||||||
|
}
|
||||||
|
} else if (isKeyPressed(configKeys.getSDLKey("BookmarkAdd"), key, false) == true) {
|
||||||
|
startMarkCell();
|
||||||
|
} else if (isKeyPressed(configKeys.getSDLKey("BookmarkRemove"), key, false) == true) {
|
||||||
|
isUnMarkCellEnabled = true;
|
||||||
|
} else if (isKeyPressed(configKeys.getSDLKey("CameraFollowSelectedUnit"), key, false) == true) {
|
||||||
|
startCameraFollowUnit();
|
||||||
|
}
|
||||||
|
//exit
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("ExitKey"), key, false) == true) {
|
||||||
|
popupMenu.setEnabled(!popupMenu.getEnabled());
|
||||||
|
popupMenu.setVisible(popupMenu.getEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
if (clientInterface != NULL &&
|
//hotkeys
|
||||||
gameSettings.getMasterserver_admin() ==
|
if (SystemFlags::
|
||||||
clientInterface->getSessionKey()) {
|
getSystemSettingType(SystemFlags::debugSystem).enabled)
|
||||||
allowAdminMenuItems = true;
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,
|
||||||
}
|
"In [%s::%s Line: %d] gameCamera.getState() = %d\n",
|
||||||
}
|
extractFileFromDirectoryPath(__FILE__).
|
||||||
|
c_str(), __FUNCTION__, __LINE__,
|
||||||
|
gameCamera.getState());
|
||||||
|
|
||||||
if (allowAdminMenuItems) {
|
if (gameCamera.getState() != GameCamera::sFree) {
|
||||||
if (getPaused() == false) {
|
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).
|
||||||
commander.tryPauseGame(false, false);
|
enabled)
|
||||||
} else {
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,
|
||||||
commander.tryResumeGame(false, false);
|
"In [%s::%s Line: %d] key = %d\n",
|
||||||
}
|
extractFileFromDirectoryPath
|
||||||
}
|
(__FILE__).c_str(), __FUNCTION__,
|
||||||
} else
|
__LINE__, key);
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("ExtraTeamColorMarker"), key,
|
|
||||||
false) == true) {
|
|
||||||
//printf("Toggle ExtraTeamColorMarker\n");
|
|
||||||
toggleTeamColorMarker();
|
|
||||||
}
|
|
||||||
//switch display color
|
|
||||||
//else if(key == configKeys.getCharKey("ChangeFontColor")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("ChangeFontColor"), key,
|
|
||||||
false) == true) {
|
|
||||||
gui.switchToNextDisplayColor();
|
|
||||||
}
|
|
||||||
//increment speed
|
|
||||||
//else if(key == configKeys.getCharKey("GameSpeedIncrease")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("GameSpeedIncrease"), key,
|
|
||||||
false) == true) {
|
|
||||||
bool
|
|
||||||
speedChangesAllowed =
|
|
||||||
!NetworkManager::
|
|
||||||
getInstance().isNetworkGameWithConnectedClients();
|
|
||||||
if (speedChangesAllowed) {
|
|
||||||
incSpeed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//decrement speed
|
|
||||||
//else if(key == configKeys.getCharKey("GameSpeedDecrease")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("GameSpeedDecrease"), key,
|
|
||||||
false) == true) {
|
|
||||||
bool
|
|
||||||
speedChangesAllowed =
|
|
||||||
!NetworkManager::
|
|
||||||
getInstance().isNetworkGameWithConnectedClients();
|
|
||||||
if (speedChangesAllowed) {
|
|
||||||
decSpeed();
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("BookmarkAdd"), key, false) == true) {
|
|
||||||
startMarkCell();
|
|
||||||
} else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("BookmarkRemove"), key, false) == true) {
|
|
||||||
isUnMarkCellEnabled = true;
|
|
||||||
} else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraFollowSelectedUnit"), key,
|
|
||||||
false) == true) {
|
|
||||||
startCameraFollowUnit();
|
|
||||||
}
|
|
||||||
//exit
|
|
||||||
else
|
|
||||||
if (isKeyPressed(configKeys.getSDLKey("ExitKey"), key, false)
|
|
||||||
== true) {
|
|
||||||
popupMenu.setEnabled(!popupMenu.getEnabled());
|
|
||||||
popupMenu.setVisible(popupMenu.getEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
//hotkeys
|
gui.hotKey(key);
|
||||||
if (SystemFlags::
|
} else {
|
||||||
getSystemSettingType(SystemFlags::debugSystem).enabled)
|
//rotate camera leftt
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,
|
//if(key == configKeys.getCharKey("CameraRotateLeft")) {
|
||||||
"In [%s::%s Line: %d] gameCamera.getState() = %d\n",
|
if (isKeyPressed(configKeys.getSDLKey("CameraRotateLeft"), key) == true) {
|
||||||
extractFileFromDirectoryPath(__FILE__).
|
gameCamera.setRotate(-1);
|
||||||
c_str(), __FUNCTION__, __LINE__,
|
}
|
||||||
gameCamera.getState());
|
//rotate camera right
|
||||||
|
//else if(key == configKeys.getCharKey("CameraRotateRight")){
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("CameraRotateRight"), key) == true) {
|
||||||
|
gameCamera.setRotate(1);
|
||||||
|
}
|
||||||
|
//camera up
|
||||||
|
//else if(key == configKeys.getCharKey("CameraRotateUp")) {
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("CameraRotateUp"), key) == true) {
|
||||||
|
gameCamera.setMoveY(1);
|
||||||
|
}
|
||||||
|
//camera down
|
||||||
|
else if (isKeyPressed(configKeys.getSDLKey("CameraRotateDown"), key) == true) {
|
||||||
|
gameCamera.setMoveY(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (gameCamera.getState() != GameCamera::sFree) {
|
if (isKeyPressed(configKeys.getSDLKey("SaveGame"), key) == true) {
|
||||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).
|
saveGame();
|
||||||
enabled)
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,
|
|
||||||
"In [%s::%s Line: %d] key = %d\n",
|
|
||||||
extractFileFromDirectoryPath
|
|
||||||
(__FILE__).c_str(), __FUNCTION__,
|
|
||||||
__LINE__, key);
|
|
||||||
|
|
||||||
gui.hotKey(key);
|
|
||||||
} else {
|
|
||||||
//rotate camera leftt
|
|
||||||
//if(key == configKeys.getCharKey("CameraRotateLeft")) {
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraRotateLeft"), key) == true) {
|
|
||||||
gameCamera.setRotate(-1);
|
|
||||||
}
|
|
||||||
//rotate camera right
|
|
||||||
//else if(key == configKeys.getCharKey("CameraRotateRight")){
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraRotateRight"), key) == true) {
|
|
||||||
gameCamera.setRotate(1);
|
|
||||||
}
|
|
||||||
//camera up
|
|
||||||
//else if(key == configKeys.getCharKey("CameraRotateUp")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraRotateUp"), key) == true) {
|
|
||||||
gameCamera.setMoveY(1);
|
|
||||||
}
|
|
||||||
//camera down
|
|
||||||
//else if(key == configKeys.getCharKey("CameraRotateDown")) {
|
|
||||||
else
|
|
||||||
if (isKeyPressed
|
|
||||||
(configKeys.getSDLKey("CameraRotateDown"), key) == true) {
|
|
||||||
gameCamera.setMoveY(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isKeyPressed(configKeys.getSDLKey("SaveGame"), key) == true) {
|
|
||||||
saveGame();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (const exception & ex) {
|
} catch (const exception & ex) {
|
||||||
char szBuf[8096] = "";
|
char szBuf[8096] = "";
|
||||||
|
@@ -5160,7 +5160,7 @@ namespace Glest {
|
|||||||
|
|
||||||
//Unit *unit=NULL;
|
//Unit *unit=NULL;
|
||||||
//const World *world= game->getWorld();
|
//const World *world= game->getWorld();
|
||||||
MeshCallbackTeamColor meshCallbackTeamColor;
|
MeshCallback meshCallback;
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
assertGl();
|
assertGl();
|
||||||
@@ -5183,7 +5183,7 @@ namespace Glest {
|
|||||||
if ((airUnits == false && unit->getType()->getField() == fAir) || (airUnits == true && unit->getType()->getField() != fAir)) {
|
if ((airUnits == false && unit->getType()->getField() == fAir) || (airUnits == true && unit->getType()->getField() != fAir)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
meshCallbackTeamColor.setTeamTexture(unit->getFaction()->getTexture());
|
meshCallback.setTeamTexture(unit->getFaction()->getTexture());
|
||||||
|
|
||||||
if (modelRenderStarted == false) {
|
if (modelRenderStarted == false) {
|
||||||
modelRenderStarted = true;
|
modelRenderStarted = true;
|
||||||
@@ -5204,7 +5204,7 @@ namespace Glest {
|
|||||||
}
|
}
|
||||||
glActiveTexture(baseTexUnit);
|
glActiveTexture(baseTexUnit);
|
||||||
|
|
||||||
modelRenderer->begin(true, true, true, false, &meshCallbackTeamColor);
|
modelRenderer->begin(true, true, true, false, &meshCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
@@ -5243,7 +5243,7 @@ namespace Glest {
|
|||||||
model->updateInterpolationData(unit->getAnimProgressAsFloat(), unit->isAlive() && !unit->isAnimProgressBound());
|
model->updateInterpolationData(unit->getAnimProgressAsFloat(), unit->isAlive() && !unit->isAnimProgressBound());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
modelRenderer->render(model, alpha);
|
modelRenderer->render(model, 0, alpha);
|
||||||
triangleCount += model->getTriangleCount();
|
triangleCount += model->getTriangleCount();
|
||||||
pointCount += model->getVertexCount();
|
pointCount += model->getVertexCount();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,6 @@
|
|||||||
#ifndef _SHARED_GRAPHICS_GL_MODELRENDERERGL_H_
|
#ifndef _SHARED_GRAPHICS_GL_MODELRENDERERGL_H_
|
||||||
#define _SHARED_GRAPHICS_GL_MODELRENDERERGL_H_
|
#define _SHARED_GRAPHICS_GL_MODELRENDERERGL_H_
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include "model_renderer.h"
|
#include "model_renderer.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
@@ -24,6 +23,23 @@ using ::Shared::Graphics::Gl::Texture2DGl;
|
|||||||
namespace Shared {
|
namespace Shared {
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
namespace Gl {
|
namespace Gl {
|
||||||
|
class MeshCallback {
|
||||||
|
private:
|
||||||
|
const Texture *teamTexture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
MeshCallback() {
|
||||||
|
teamTexture = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTeamTexture(const Texture *teamTexture) {
|
||||||
|
this->teamTexture = teamTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
void execute(const Mesh *mesh, float alpha);
|
||||||
|
|
||||||
|
static bool noTeamColors;
|
||||||
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class ModelRendererGl
|
// class ModelRendererGl
|
||||||
@@ -55,24 +71,6 @@ namespace Shared {
|
|||||||
void renderMesh(Mesh *mesh, int renderMode = rmNormal, float alpha = 1.0f);
|
void renderMesh(Mesh *mesh, int renderMode = rmNormal, float alpha = 1.0f);
|
||||||
void renderMeshNormals(Mesh *mesh);
|
void renderMeshNormals(Mesh *mesh);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MeshCallbackTeamColor : public MeshCallback {
|
|
||||||
private:
|
|
||||||
const Texture *teamTexture;
|
|
||||||
|
|
||||||
public:
|
|
||||||
MeshCallbackTeamColor() : MeshCallback() {
|
|
||||||
teamTexture = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTeamTexture(const Texture *teamTexture) {
|
|
||||||
this->teamTexture = teamTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void execute(const Mesh *mesh);
|
|
||||||
|
|
||||||
static bool noTeamColors;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//end namespace
|
}//end namespace
|
||||||
|
@@ -18,30 +18,18 @@
|
|||||||
|
|
||||||
namespace Shared {
|
namespace Shared {
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
namespace Gl {
|
||||||
|
class MeshCallback;
|
||||||
|
}
|
||||||
|
|
||||||
enum RenderMode {
|
enum RenderMode {
|
||||||
rmNormal,
|
rmNormal,
|
||||||
rmSelection,
|
rmSelection,
|
||||||
|
|
||||||
renderModeCount
|
renderModeCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Texture;
|
class Texture;
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// class MeshCallback
|
|
||||||
//
|
|
||||||
/// This gets called before rendering mesh
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
class MeshCallback {
|
|
||||||
public:
|
|
||||||
virtual ~MeshCallback() {
|
|
||||||
};
|
|
||||||
virtual void execute(const Mesh *mesh) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class ModelRenderer
|
// class ModelRenderer
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -52,7 +40,7 @@ namespace Shared {
|
|||||||
bool renderTextures;
|
bool renderTextures;
|
||||||
bool renderColors;
|
bool renderColors;
|
||||||
bool colorPickingMode;
|
bool colorPickingMode;
|
||||||
MeshCallback *meshCallback;
|
Gl::MeshCallback *meshCallback;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModelRenderer() {
|
ModelRenderer() {
|
||||||
@@ -67,7 +55,7 @@ namespace Shared {
|
|||||||
virtual ~ModelRenderer() {
|
virtual ~ModelRenderer() {
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, bool colorPickingMode, MeshCallback *meshCallback = NULL) = 0;
|
virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, bool colorPickingMode, Gl::MeshCallback *meshCallback = NULL) = 0;
|
||||||
virtual void end() = 0;
|
virtual void end() = 0;
|
||||||
virtual void render(Model *model, int renderMode = rmNormal, float alpha = 1.0f) = 0;
|
virtual void render(Model *model, int renderMode = rmNormal, float alpha = 1.0f) = 0;
|
||||||
virtual void renderNormalsOnly(Model *model) = 0;
|
virtual void renderNormalsOnly(Model *model) = 0;
|
||||||
|
@@ -22,12 +22,12 @@ using namespace Shared::Platform;
|
|||||||
namespace Shared {
|
namespace Shared {
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
namespace Gl {
|
namespace Gl {
|
||||||
bool MeshCallbackTeamColor::noTeamColors = false;
|
bool MeshCallback::noTeamColors = false;
|
||||||
|
|
||||||
void MeshCallbackTeamColor::execute(const Mesh *mesh) {
|
void MeshCallback::execute(const Mesh *mesh, float alpha) {
|
||||||
//team color
|
//team color
|
||||||
uint8 opacity = mesh->getFactionColorOpacity();
|
uint8 opacity = mesh->getFactionColorOpacity();
|
||||||
if (!mesh->getCustomTexture() || opacity == 0 || teamTexture == NULL || MeshCallbackTeamColor::noTeamColors) {
|
if (!mesh->getCustomTexture() || opacity == 0 || teamTexture == NULL || MeshCallback::noTeamColors) {
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
@@ -44,7 +44,7 @@ namespace Shared {
|
|||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
|
||||||
//set alpha to 1
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
||||||
@@ -56,10 +56,10 @@ namespace Shared {
|
|||||||
GLuint handle = static_cast<const Texture2DGl*>(teamTexture)->getHandle();
|
GLuint handle = static_cast<const Texture2DGl*>(teamTexture)->getHandle();
|
||||||
glBindTexture(GL_TEXTURE_2D, handle);
|
glBindTexture(GL_TEXTURE_2D, handle);
|
||||||
float color[4];
|
float color[4];
|
||||||
color[0] = 1.0f; // Red
|
color[0] = 1.0f; // Red
|
||||||
color[1] = 1.0f; // Green
|
color[1] = 1.0f; // Green
|
||||||
color[2] = 1.0f; // Blue
|
color[2] = 1.0f; // Blue
|
||||||
color[3] = opacity * 0.00392156862f; // Alpha
|
color[3] = opacity * 0.00392156862f; // Alpha
|
||||||
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);
|
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);
|
||||||
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||||
@@ -72,14 +72,33 @@ namespace Shared {
|
|||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
|
||||||
|
|
||||||
//set alpha to 1
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, GL_CONSTANT);
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, GL_CONSTANT);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA);
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA);
|
||||||
|
|
||||||
|
if (alpha < 1.f - FLT_EPSILON) {
|
||||||
|
glActiveTexture(GL_TEXTURE2);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glMultiTexCoord2f(GL_TEXTURE1, 0.f, 0.f);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, handle);
|
||||||
|
color[3] = alpha;
|
||||||
|
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);
|
||||||
|
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
|
||||||
|
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_CONSTANT);
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
}
|
}
|
||||||
@@ -248,7 +267,7 @@ namespace Shared {
|
|||||||
if (this->colorPickingMode == false) {
|
if (this->colorPickingMode == false) {
|
||||||
//set color
|
//set color
|
||||||
if (renderColors) {
|
if (renderColors) {
|
||||||
Vec4f color(mesh->getDiffuseColor(), mesh->getOpacity() * alpha);
|
Vec4f color(mesh->getDiffuseColor(), mesh->getOpacity());
|
||||||
glColor4fv(color.ptr());
|
glColor4fv(color.ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +291,7 @@ namespace Shared {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (meshCallback != NULL) {
|
if (meshCallback != NULL) {
|
||||||
meshCallback->execute(mesh);
|
meshCallback->execute(mesh, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user