mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 07:11:49 +00:00
WINTERMUTE: ModelX -> XModel
This commit is contained in:
parent
f92492f4a1
commit
d9abf0bd1f
@ -124,7 +124,7 @@ AdActor3DX::~AdActor3DX() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::update() {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ bool AdActor3DX::update() {
|
||||
|
||||
AdGame *adGame = (AdGame *)_gameRef;
|
||||
|
||||
if (_state == STATE_READY && _stateAnimChannel >= 0 && _modelX) {
|
||||
if (_state == STATE_READY && _stateAnimChannel >= 0 && _xmodel) {
|
||||
_stateAnimChannel = -1;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ bool AdActor3DX::update() {
|
||||
|
||||
// kill talking anim
|
||||
if (_talkAnimChannel > 0)
|
||||
_modelX->stopAnim(_talkAnimChannel, _defaultStopTransTime);
|
||||
_xmodel->stopAnim(_talkAnimChannel, _defaultStopTransTime);
|
||||
}
|
||||
|
||||
// update state
|
||||
@ -161,9 +161,9 @@ bool AdActor3DX::update() {
|
||||
// disabled in original code
|
||||
} else if (_directTurnMode != DIRECT_TURN_NONE) {
|
||||
if (!_directTurnAnim.empty()) {
|
||||
_modelX->playAnim(0, _directTurnAnim, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _directTurnAnim, _defaultTransTime, false, _defaultStopTransTime);
|
||||
} else {
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,14 +215,14 @@ bool AdActor3DX::update() {
|
||||
|
||||
if (canWalk) {
|
||||
if (!_directWalkAnim.empty()) {
|
||||
_modelX->playAnim(0, _directWalkAnim, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _directWalkAnim, _defaultTransTime, false, _defaultStopTransTime);
|
||||
} else {
|
||||
_modelX->playAnim(0, _walkAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _walkAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
|
||||
_posVector = newPos;
|
||||
} else {
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -231,9 +231,9 @@ bool AdActor3DX::update() {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case STATE_TURNING:
|
||||
if (_turningLeft) {
|
||||
_modelX->playAnim(0, _turnLeftAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _turnLeftAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
} else {
|
||||
_modelX->playAnim(0, _turnRightAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _turnRightAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
|
||||
if (turnToStep(_angVelocity)) {
|
||||
@ -245,7 +245,7 @@ bool AdActor3DX::update() {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case STATE_SEARCHING_PATH:
|
||||
// keep asking scene for the path
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
|
||||
if (adGame->_scene->_2DPathfinding) {
|
||||
if (adGame->_scene->getPath(BasePoint(_posX, _posY), *_targetPoint2D, _path2D, this)) {
|
||||
@ -260,7 +260,7 @@ bool AdActor3DX::update() {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case STATE_WAITING_PATH:
|
||||
// wait until the scene finished the path
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
if (adGame->_scene->_2DPathfinding) {
|
||||
if (_path2D->_ready) {
|
||||
followPath2D();
|
||||
@ -280,7 +280,7 @@ bool AdActor3DX::update() {
|
||||
getNextStep3D();
|
||||
}
|
||||
|
||||
_modelX->playAnim(0, _walkAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _walkAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
break;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -293,7 +293,7 @@ bool AdActor3DX::update() {
|
||||
|
||||
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) ||
|
||||
(!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
|
||||
if (_tempSkelAnim == nullptr || !_modelX->isAnimPending(0, _tempSkelAnim) || timeIsUp) {
|
||||
if (_tempSkelAnim == nullptr || !_xmodel->isAnimPending(0, _tempSkelAnim) || timeIsUp) {
|
||||
if (timeIsUp) {
|
||||
_sentence->finish();
|
||||
_tempSkelAnim = nullptr;
|
||||
@ -301,23 +301,23 @@ bool AdActor3DX::update() {
|
||||
_nextState = STATE_READY;
|
||||
|
||||
if (_talkAnimChannel > 0)
|
||||
_modelX->stopAnim(_talkAnimChannel, _defaultStopTransTime);
|
||||
_xmodel->stopAnim(_talkAnimChannel, _defaultStopTransTime);
|
||||
} else {
|
||||
_tempSkelAnim = _sentence->getNextStance();
|
||||
if (_tempSkelAnim)
|
||||
_modelX->playAnim(0, _tempSkelAnim, _defaultTransTime, true, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _tempSkelAnim, _defaultTransTime, true, _defaultStopTransTime);
|
||||
else {
|
||||
if (_modelX->getAnimationSetByName(_talkAnimName))
|
||||
_modelX->playAnim(_talkAnimChannel, _talkAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
if (_xmodel->getAnimationSetByName(_talkAnimName))
|
||||
_xmodel->playAnim(_talkAnimChannel, _talkAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
else
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
|
||||
((AdGame *)_gameRef)->addSentence(_sentence);
|
||||
}
|
||||
} else {
|
||||
if (_tempSkelAnim) {
|
||||
_modelX->playAnim(0, _tempSkelAnim, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _tempSkelAnim, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
|
||||
((AdGame *)_gameRef)->addSentence(_sentence);
|
||||
@ -327,13 +327,13 @@ bool AdActor3DX::update() {
|
||||
|
||||
case STATE_PLAYING_ANIM:
|
||||
if (_stateAnimChannel != 0) {
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
}
|
||||
break;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
case STATE_READY:
|
||||
_modelX->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
_xmodel->playAnim(0, _idleAnimName, _defaultTransTime, false, _defaultStopTransTime);
|
||||
break;
|
||||
|
||||
case STATE_IDLE:
|
||||
@ -345,7 +345,7 @@ bool AdActor3DX::update() {
|
||||
} // switch(_state)
|
||||
|
||||
// finished playing animation?
|
||||
if (_state == STATE_PLAYING_ANIM && !_modelX->isAnimPending(_stateAnimChannel)) {
|
||||
if (_state == STATE_PLAYING_ANIM && !_xmodel->isAnimPending(_stateAnimChannel)) {
|
||||
_state = _nextState;
|
||||
_nextState = STATE_READY;
|
||||
}
|
||||
@ -363,8 +363,8 @@ bool AdActor3DX::update() {
|
||||
afterMove();
|
||||
}
|
||||
|
||||
if (_modelX) {
|
||||
_modelX->update();
|
||||
if (_xmodel) {
|
||||
_xmodel->update();
|
||||
|
||||
if (_shadowModel) {
|
||||
_shadowModel->update();
|
||||
@ -379,7 +379,7 @@ bool AdActor3DX::update() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::display() {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -402,16 +402,16 @@ bool AdActor3DX::display() {
|
||||
|
||||
_gameRef->_renderer3D->setSpriteBlendMode(_blendMode);
|
||||
_gameRef->_renderer3D->setWorldTransform(_worldMatrix);
|
||||
_modelX->_lastWorldMat = _worldMatrix;
|
||||
_xmodel->_lastWorldMat = _worldMatrix;
|
||||
|
||||
bool res = _modelX->render();
|
||||
bool res = _xmodel->render();
|
||||
|
||||
if (_registrable) {
|
||||
_gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, _modelX,
|
||||
_modelX->_boundingRect.left,
|
||||
_modelX->_boundingRect.top,
|
||||
_modelX->_boundingRect.right - _modelX->_boundingRect.left,
|
||||
_modelX->_boundingRect.bottom - _modelX->_boundingRect.top,
|
||||
_gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, _xmodel,
|
||||
_xmodel->_boundingRect.left,
|
||||
_xmodel->_boundingRect.top,
|
||||
_xmodel->_boundingRect.right - _xmodel->_boundingRect.left,
|
||||
_xmodel->_boundingRect.bottom - _xmodel->_boundingRect.top,
|
||||
true));
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ bool AdActor3DX::display() {
|
||||
// not sure what to do about it right now
|
||||
// accessibility
|
||||
// if (_gameRef->_accessMgr->GetActiveObject() == this) {
|
||||
// _gameRef->_accessMgr->SetHintRect(&_modelX->m_BoundingRect);
|
||||
// _gameRef->_accessMgr->SetHintRect(&_xmodel->m_BoundingRect);
|
||||
// }
|
||||
|
||||
return res;
|
||||
@ -439,7 +439,7 @@ bool AdActor3DX::display() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::renderModel() {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -449,14 +449,14 @@ bool AdActor3DX::renderModel() {
|
||||
if (_shadowModel) {
|
||||
res = _shadowModel->render();
|
||||
} else {
|
||||
res = _modelX->render();
|
||||
res = _xmodel->render();
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_modelX->_lastWorldMat = _worldMatrix;
|
||||
_xmodel->_lastWorldMat = _worldMatrix;
|
||||
|
||||
displayAttachments(false);
|
||||
return res;
|
||||
@ -464,7 +464,7 @@ bool AdActor3DX::renderModel() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::displayShadowVolume() {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -478,11 +478,11 @@ bool AdActor3DX::displayShadowVolume() {
|
||||
|
||||
getShadowVolume()->reset();
|
||||
|
||||
ModelX *shadowModel;
|
||||
XModel *shadowModel;
|
||||
if (_shadowModel) {
|
||||
shadowModel = _shadowModel;
|
||||
} else {
|
||||
shadowModel = _modelX;
|
||||
shadowModel = _xmodel;
|
||||
}
|
||||
|
||||
shadowModel->updateShadowVol(getShadowVolume(), _worldMatrix, lightVector, extrusionDepth);
|
||||
@ -495,7 +495,7 @@ bool AdActor3DX::displayShadowVolume() {
|
||||
continue;
|
||||
}
|
||||
|
||||
Math::Matrix4 *boneMat = _modelX->getBoneMatrix(at->getParentBone().c_str());
|
||||
Math::Matrix4 *boneMat = _xmodel->getBoneMatrix(at->getParentBone().c_str());
|
||||
if (!boneMat) {
|
||||
continue;
|
||||
}
|
||||
@ -526,7 +526,7 @@ bool AdActor3DX::updateAttachments() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::displayAttachments(bool registerObjects) {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -540,7 +540,7 @@ bool AdActor3DX::displayAttachments(bool registerObjects) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Math::Matrix4 *boneMat = _modelX->getBoneMatrix(at->getParentBone().c_str());
|
||||
Math::Matrix4 *boneMat = _xmodel->getBoneMatrix(at->getParentBone().c_str());
|
||||
if (!boneMat) {
|
||||
continue;
|
||||
}
|
||||
@ -922,8 +922,8 @@ bool AdActor3DX::loadBuffer(byte *buffer, bool complete) {
|
||||
buffer = params;
|
||||
}
|
||||
|
||||
delete _modelX;
|
||||
_modelX = nullptr;
|
||||
delete _xmodel;
|
||||
_xmodel = nullptr;
|
||||
delete _shadowModel;
|
||||
_shadowModel = nullptr;
|
||||
|
||||
@ -1059,27 +1059,27 @@ bool AdActor3DX::loadBuffer(byte *buffer, bool complete) {
|
||||
}
|
||||
|
||||
case TOKEN_MODEL:
|
||||
if (!_modelX) {
|
||||
_modelX = new ModelX(_gameRef, this);
|
||||
if (!_xmodel) {
|
||||
_xmodel = new XModel(_gameRef, this);
|
||||
|
||||
if (!_modelX || !_modelX->loadFromFile((char *)params)) {
|
||||
delete _modelX;
|
||||
_modelX = nullptr;
|
||||
if (!_xmodel || !_xmodel->loadFromFile((char *)params)) {
|
||||
delete _xmodel;
|
||||
_xmodel = nullptr;
|
||||
cmd = PARSERR_GENERIC;
|
||||
}
|
||||
} else {
|
||||
if (!_modelX->mergeFromFile((char *)params)) {
|
||||
if (!_xmodel->mergeFromFile((char *)params)) {
|
||||
cmd = PARSERR_GENERIC;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_SHADOW_MODEL:
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
delete _shadowModel;
|
||||
_shadowModel = new ModelX(_gameRef, this);
|
||||
_shadowModel = new XModel(_gameRef, this);
|
||||
|
||||
if (!_shadowModel || !_shadowModel->loadFromFile((char *)params, _modelX)) {
|
||||
if (!_shadowModel || !_shadowModel->loadFromFile((char *)params, _xmodel)) {
|
||||
delete _shadowModel;
|
||||
_shadowModel = nullptr;
|
||||
cmd = PARSERR_GENERIC;
|
||||
@ -1112,15 +1112,15 @@ bool AdActor3DX::loadBuffer(byte *buffer, bool complete) {
|
||||
break;
|
||||
|
||||
case TOKEN_ANIMATION:
|
||||
if (_modelX) {
|
||||
_modelX->parseAnim(params);
|
||||
if (_xmodel) {
|
||||
_xmodel->parseAnim(params);
|
||||
} else {
|
||||
_gameRef->LOG(0, "Error: a MODEL= line must precede any animation definitions (file: %s)", getFilename());
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_EFFECT:
|
||||
if (_modelX)
|
||||
if (_xmodel)
|
||||
parseEffect(params);
|
||||
else
|
||||
_gameRef->LOG(0, "Error: a MODEL= line must precede any effect definitions (file: %s)", getFilename());
|
||||
@ -1184,7 +1184,7 @@ bool AdActor3DX::loadBuffer(byte *buffer, bool complete) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
_gameRef->LOG(0, "Error: No model has been loaded for 3D actor");
|
||||
return false;
|
||||
}
|
||||
@ -1249,11 +1249,11 @@ bool AdActor3DX::playAnim3DX(const char *name, bool setState) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::playAnim3DX(int channel, const char *name, bool setState) {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = _modelX->playAnim(channel, name, _defaultTransTime, true, _defaultStopTransTime);
|
||||
bool res = _xmodel->playAnim(channel, name, _defaultTransTime, true, _defaultStopTransTime);
|
||||
if (res && setState) {
|
||||
_state = STATE_PLAYING_ANIM;
|
||||
_stateAnimChannel = channel;
|
||||
@ -1269,10 +1269,10 @@ void AdActor3DX::talk(const char *text, const char *sound, uint32 duration, cons
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int32 AdActor3DX::getHeight() {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return 0;
|
||||
} else {
|
||||
return _posY - _modelX->_boundingRect.top - 5;
|
||||
return _posY - _xmodel->_boundingRect.top - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1303,8 +1303,8 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
stack->correctParams(1);
|
||||
int transTime = stack->pop()->getInt(_defaultStopTransTime);
|
||||
bool ret = false;
|
||||
if (_modelX) {
|
||||
ret = _modelX->stopAnim(0, transTime);
|
||||
if (_xmodel) {
|
||||
ret = _xmodel->stopAnim(0, transTime);
|
||||
}
|
||||
stack->pushBool(ret);
|
||||
return true;
|
||||
@ -1318,8 +1318,8 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
int channel = stack->pop()->getInt();
|
||||
int transTime = stack->pop()->getInt();
|
||||
bool ret = false;
|
||||
if (_modelX) {
|
||||
ret = _modelX->stopAnim(channel, transTime);
|
||||
if (_xmodel) {
|
||||
ret = _xmodel->stopAnim(channel, transTime);
|
||||
}
|
||||
|
||||
stack->pushBool(ret);
|
||||
@ -1360,8 +1360,8 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
animName = val->getString();
|
||||
}
|
||||
|
||||
if (_modelX) {
|
||||
stack->pushBool(_modelX->isAnimPending(0, animName));
|
||||
if (_xmodel) {
|
||||
stack->pushBool(_xmodel->isAnimPending(0, animName));
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
}
|
||||
@ -1383,8 +1383,8 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
animName = val->getString();
|
||||
}
|
||||
|
||||
if (_modelX) {
|
||||
stack->pushBool(_modelX->isAnimPending(channel, animName));
|
||||
if (_xmodel) {
|
||||
stack->pushBool(_xmodel->isAnimPending(channel, animName));
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
}
|
||||
@ -1404,10 +1404,10 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
const char *attachName = stack->pop()->getString();
|
||||
const char *boneName = stack->pop()->getString();
|
||||
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
stack->pushBool(false);
|
||||
} else {
|
||||
if (!_modelX->getBoneMatrix(boneName)) {
|
||||
if (!_xmodel->getBoneMatrix(boneName)) {
|
||||
script->runtimeError("Bone '%s' cannot be found", boneName);
|
||||
stack->pushBool(false);
|
||||
} else {
|
||||
@ -1448,7 +1448,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
stack->correctParams(1);
|
||||
const char *attachmentName = stack->pop()->getString();
|
||||
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
stack->pushBool(false);
|
||||
} else {
|
||||
bool isFound = false;
|
||||
@ -1472,7 +1472,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
stack->correctParams(1);
|
||||
const char *attachmentName = stack->pop()->getString();
|
||||
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
stack->pushNULL();
|
||||
} else {
|
||||
bool isFound = false;
|
||||
@ -1796,7 +1796,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
const char *materialName = stack->pop()->getString();
|
||||
const char *textureFilename = stack->pop()->getString();
|
||||
|
||||
if (_modelX && _modelX->setMaterialSprite(materialName, textureFilename)) {
|
||||
if (_xmodel && _xmodel->setMaterialSprite(materialName, textureFilename)) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -1813,7 +1813,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
const char *materialName = stack->pop()->getString();
|
||||
const char *theoraFilename = stack->pop()->getString();
|
||||
|
||||
if (_modelX && _modelX->setMaterialTheora(materialName, theoraFilename)) {
|
||||
if (_xmodel && _xmodel->setMaterialTheora(materialName, theoraFilename)) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -1830,7 +1830,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
/*const char *effectFilename =*/ stack->pop()->getString();
|
||||
|
||||
warning("AdActor3DX::scCallMethod D3DX effects are not supported");
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -1847,7 +1847,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
stack->pop();
|
||||
|
||||
warning("AdActor3DX::scCallMethod D3DX effects are not supported");
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -1865,7 +1865,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
/*ScValue *val =*/ stack->pop();
|
||||
|
||||
warning("AdActor3DX::scCallMethod D3DX effects are not supported");
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -1886,7 +1886,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
/*float w =*/ stack->pop()->getFloat();
|
||||
|
||||
warning("AdActor3DX::scCallMethod D3DX effects are not supported");
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -1904,7 +1904,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
|
||||
/*uint32 color =*/ stack->pop()->getInt();
|
||||
|
||||
warning("AdActor3DX::scCallMethod D3DX effects are not supported");
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
stack->pushBool(true);
|
||||
} else {
|
||||
stack->pushBool(false);
|
||||
@ -2300,8 +2300,8 @@ bool AdActor3DX::persist(BasePersistenceManager *persistMgr) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::invalidateDeviceObjects() {
|
||||
if (_modelX)
|
||||
_modelX->invalidateDeviceObjects();
|
||||
if (_xmodel)
|
||||
_xmodel->invalidateDeviceObjects();
|
||||
if (_shadowModel)
|
||||
_shadowModel->invalidateDeviceObjects();
|
||||
|
||||
@ -2314,8 +2314,8 @@ bool AdActor3DX::invalidateDeviceObjects() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::restoreDeviceObjects() {
|
||||
if (_modelX) {
|
||||
_modelX->restoreDeviceObjects();
|
||||
if (_xmodel) {
|
||||
_xmodel->restoreDeviceObjects();
|
||||
}
|
||||
|
||||
if (_shadowModel) {
|
||||
@ -2331,11 +2331,11 @@ bool AdActor3DX::restoreDeviceObjects() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::mergeAnimations(const char *filename) {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = _modelX->mergeFromFile(filename);
|
||||
bool res = _xmodel->mergeFromFile(filename);
|
||||
if (!res) {
|
||||
_gameRef->LOG(res, "Error: MergeAnims failed for file '%s'", filename);
|
||||
return res;
|
||||
@ -2374,7 +2374,7 @@ bool AdActor3DX::mergeAnimations2(const char *filename) {
|
||||
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) {
|
||||
switch (cmd) {
|
||||
case TOKEN_ANIMATION:
|
||||
if (!_modelX->parseAnim(params)) {
|
||||
if (!_xmodel->parseAnim(params)) {
|
||||
cmd = PARSERR_GENERIC;
|
||||
}
|
||||
}
|
||||
@ -2395,8 +2395,8 @@ bool AdActor3DX::mergeAnimations2(const char *filename) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdActor3DX::unloadAnimation(const char *animName) {
|
||||
if (_modelX) {
|
||||
return _modelX->unloadAnimation(animName);
|
||||
if (_xmodel) {
|
||||
return _xmodel->unloadAnimation(animName);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -52,21 +52,21 @@ AdAttach3DX::~AdAttach3DX(void) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdAttach3DX::init(const char *modelFile, const char *name, const char *parentBone) {
|
||||
delete _modelX;
|
||||
_modelX = nullptr;
|
||||
delete _xmodel;
|
||||
_xmodel = nullptr;
|
||||
|
||||
_parentBone = parentBone;
|
||||
setName(name);
|
||||
|
||||
_modelX = new ModelX(_gameRef, _owner);
|
||||
if (!_modelX) {
|
||||
_xmodel = new XModel(_gameRef, _owner);
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = _modelX->loadFromFile(modelFile);
|
||||
bool res = _xmodel->loadFromFile(modelFile);
|
||||
if (!res) {
|
||||
delete _modelX;
|
||||
_modelX = nullptr;
|
||||
delete _xmodel;
|
||||
_xmodel = nullptr;
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -75,8 +75,8 @@ bool AdAttach3DX::init(const char *modelFile, const char *name, const char *pare
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdAttach3DX::update() {
|
||||
AdObject3D::update();
|
||||
if (_modelX) {
|
||||
return _modelX->update();
|
||||
if (_xmodel) {
|
||||
return _xmodel->update();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -87,15 +87,15 @@ bool AdAttach3DX::displayAttachable(const Math::Matrix4 &viewMat, bool registerO
|
||||
Math::Matrix4 finalMat = _owner->_worldMatrix * viewMat * _worldMatrix;
|
||||
_gameRef->_renderer3D->setWorldTransform(finalMat);
|
||||
|
||||
if (_modelX) {
|
||||
_modelX->render();
|
||||
if (_xmodel) {
|
||||
_xmodel->render();
|
||||
|
||||
if (registerObjects && _owner && _owner->_registrable) {
|
||||
_gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, _owner, _modelX,
|
||||
_modelX->_boundingRect.left,
|
||||
_modelX->_boundingRect.top,
|
||||
_modelX->_boundingRect.right - _modelX->_boundingRect.left,
|
||||
_modelX->_boundingRect.bottom - _modelX->_boundingRect.top,
|
||||
_gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, _owner, _xmodel,
|
||||
_xmodel->_boundingRect.left,
|
||||
_xmodel->_boundingRect.top,
|
||||
_xmodel->_boundingRect.right - _xmodel->_boundingRect.left,
|
||||
_xmodel->_boundingRect.bottom - _xmodel->_boundingRect.top,
|
||||
true));
|
||||
}
|
||||
}
|
||||
@ -107,10 +107,10 @@ bool AdAttach3DX::displayAttachable(const Math::Matrix4 &viewMat, bool registerO
|
||||
bool AdAttach3DX::displayShadowVol(const Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth, bool update) {
|
||||
Math::Matrix4 finalMat = modelMat * _worldMatrix;
|
||||
|
||||
if (_modelX) {
|
||||
if (_xmodel) {
|
||||
if (update) {
|
||||
getShadowVolume()->reset();
|
||||
_modelX->updateShadowVol(getShadowVolume(), finalMat, light, extrusionDepth);
|
||||
_xmodel->updateShadowVol(getShadowVolume(), finalMat, light, extrusionDepth);
|
||||
}
|
||||
|
||||
_gameRef->_renderer3D->setWorldTransform(finalMat);
|
||||
@ -135,7 +135,7 @@ bool AdAttach3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt
|
||||
if (strcmp(name, "PlayAnim") == 0 || strcmp(name, "PlayAnimAsync") == 0) {
|
||||
stack->correctParams(1);
|
||||
Common::String animName = stack->pop()->getString();
|
||||
if (!_modelX || !_modelX->playAnim(0, animName, 0, true)) {
|
||||
if (!_xmodel || !_xmodel->playAnim(0, animName, 0, true)) {
|
||||
stack->pushBool(false);
|
||||
} else {
|
||||
if (strcmp(name, "PlayAnimAsync") != 0)
|
||||
@ -151,8 +151,8 @@ bool AdAttach3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt
|
||||
else if (strcmp(name, "StopAnim") == 0) {
|
||||
stack->correctParams(0);
|
||||
bool ret = false;
|
||||
if (_modelX) {
|
||||
ret = _modelX->stopAnim(0);
|
||||
if (_xmodel) {
|
||||
ret = _xmodel->stopAnim(0);
|
||||
}
|
||||
|
||||
stack->pushBool(ret);
|
||||
@ -166,8 +166,8 @@ bool AdAttach3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt
|
||||
stack->correctParams(1);
|
||||
int channel = stack->pop()->getInt();
|
||||
bool ret = false;
|
||||
if (_modelX) {
|
||||
ret = _modelX->stopAnim(channel, 0);
|
||||
if (_xmodel) {
|
||||
ret = _xmodel->stopAnim(channel, 0);
|
||||
}
|
||||
|
||||
stack->pushBool(ret);
|
||||
@ -182,7 +182,7 @@ bool AdAttach3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt
|
||||
int channel = stack->pop()->getInt();
|
||||
const char *animName = stack->pop()->getString();
|
||||
|
||||
if (!_modelX || !_modelX->playAnim(channel, animName, 0, true)) {
|
||||
if (!_xmodel || !_xmodel->playAnim(channel, animName, 0, true)) {
|
||||
stack->pushBool(false);
|
||||
} else {
|
||||
if (strcmp(name, "PlayAnimChannelAsync") != 0) {
|
||||
@ -236,8 +236,8 @@ bool AdAttach3DX::persist(BasePersistenceManager *persistMgr) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdAttach3DX::invalidateDeviceObjects() {
|
||||
if (_modelX) {
|
||||
_modelX->invalidateDeviceObjects();
|
||||
if (_xmodel) {
|
||||
_xmodel->invalidateDeviceObjects();
|
||||
}
|
||||
|
||||
if (_shadowModel) {
|
||||
@ -249,8 +249,8 @@ bool AdAttach3DX::invalidateDeviceObjects() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdAttach3DX::restoreDeviceObjects() {
|
||||
if (_modelX) {
|
||||
_modelX->restoreDeviceObjects();
|
||||
if (_xmodel) {
|
||||
_xmodel->restoreDeviceObjects();
|
||||
}
|
||||
|
||||
if (_shadowModel) {
|
||||
|
@ -590,7 +590,7 @@ ShadowVolume *AdObject3D::getShadowVolume() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdObject3D::getBonePosition2D(const char *boneName, int32 *x, int32 *y) {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ bool AdObject3D::getBonePosition2D(const char *boneName, int32 *x, int32 *y) {
|
||||
if (!adGame->_scene || !adGame->_scene->_sceneGeometry)
|
||||
return false;
|
||||
|
||||
Math::Matrix4 *boneMat = _modelX->getBoneMatrix(boneName);
|
||||
Math::Matrix4 *boneMat = _xmodel->getBoneMatrix(boneName);
|
||||
|
||||
if (!boneMat) {
|
||||
return false;
|
||||
@ -617,11 +617,11 @@ bool AdObject3D::getBonePosition2D(const char *boneName, int32 *x, int32 *y) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool AdObject3D::getBonePosition3D(const char *boneName, Math::Vector3d *pos, Math::Vector3d *offset) {
|
||||
if (!_modelX) {
|
||||
if (!_xmodel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Math::Matrix4 *boneMat = _modelX->getBoneMatrix(boneName);
|
||||
Math::Matrix4 *boneMat = _xmodel->getBoneMatrix(boneName);
|
||||
if (!boneMat) {
|
||||
return false;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) {
|
||||
_owner = nullptr;
|
||||
_frame = nullptr;
|
||||
#ifdef ENABLE_WME3D
|
||||
_modelX = nullptr;
|
||||
_xmodel = nullptr;
|
||||
#endif
|
||||
_region = nullptr;
|
||||
_zoomX = 100;
|
||||
@ -59,7 +59,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame
|
||||
_zoomY = zoomY;
|
||||
_precise = precise;
|
||||
#ifdef ENABLE_WME3D
|
||||
_modelX = nullptr;
|
||||
_xmodel = nullptr;
|
||||
#endif
|
||||
_region = nullptr;
|
||||
_offsetX = _offsetY = 0;
|
||||
@ -68,9 +68,9 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifdef ENABLE_WME3D
|
||||
BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, ModelX *model, int x, int y, int width, int height, bool precise) : BaseClass(inGame) {
|
||||
BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, XModel *model, int x, int y, int width, int height, bool precise) : BaseClass(inGame) {
|
||||
_owner = owner;
|
||||
_modelX = model;
|
||||
_xmodel = model;
|
||||
_rect.setRect(x, y, x + width, y + height);
|
||||
_zoomX = 100;
|
||||
_zoomY = 100;
|
||||
@ -93,7 +93,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *
|
||||
_precise = true;
|
||||
_frame = nullptr;
|
||||
#ifdef ENABLE_WME3D
|
||||
_modelX = nullptr;
|
||||
_xmodel = nullptr;
|
||||
#endif
|
||||
clipRect();
|
||||
_offsetX = offsetX;
|
||||
@ -105,7 +105,7 @@ BaseActiveRect::~BaseActiveRect() {
|
||||
_owner = nullptr;
|
||||
_frame = nullptr;
|
||||
#ifdef ENABLE_WME3D
|
||||
_modelX = nullptr;
|
||||
_xmodel = nullptr;
|
||||
#endif
|
||||
_region = nullptr;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class BaseRegion;
|
||||
class BaseSubFrame;
|
||||
class BaseObject;
|
||||
#ifdef ENABLE_WME3D
|
||||
class ModelX;
|
||||
class XModel;
|
||||
#endif
|
||||
class BaseActiveRect: BaseClass {
|
||||
public:
|
||||
@ -46,7 +46,7 @@ public:
|
||||
float _zoomY;
|
||||
BaseSubFrame *_frame;
|
||||
#ifdef ENABLE_WME3D
|
||||
ModelX *_modelX;
|
||||
XModel *_xmodel;
|
||||
#endif
|
||||
BaseObject *_owner;
|
||||
BaseRegion *_region;
|
||||
@ -57,7 +57,7 @@ public:
|
||||
BaseActiveRect(BaseGame *inGameOwner, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX = 100, float zoomY = 100, bool precise = true);
|
||||
BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *region, int offsetX, int offsetY);
|
||||
#ifdef ENABLE_WME3D
|
||||
BaseActiveRect(BaseGame *inGame, BaseObject *owner, ModelX *model, int x, int y, int width, int height, bool precise = true);
|
||||
BaseActiveRect(BaseGame *inGame, BaseObject *owner, XModel *model, int x, int y, int width, int height, bool precise = true);
|
||||
#endif
|
||||
~BaseActiveRect() override;
|
||||
|
||||
|
@ -98,7 +98,7 @@ BaseObject::BaseObject(BaseGame *inGame) : BaseScriptHolder(inGame) {
|
||||
_saveState = true;
|
||||
|
||||
#ifdef ENABLE_WME3D
|
||||
_modelX = nullptr;
|
||||
_xmodel = nullptr;
|
||||
_shadowModel = nullptr;
|
||||
_posVector = Math::Vector3d(0.0f, 0.0f, 0.0f);
|
||||
_angle = 0.0f;
|
||||
@ -154,8 +154,8 @@ bool BaseObject::cleanup() {
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WME3D
|
||||
delete _modelX;
|
||||
_modelX = nullptr;
|
||||
delete _xmodel;
|
||||
_xmodel = nullptr;
|
||||
delete _shadowModel;
|
||||
_shadowModel = nullptr;
|
||||
|
||||
@ -1109,7 +1109,7 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) {
|
||||
#ifdef ENABLE_WME3D
|
||||
if (BaseEngine::instance().getFlags() & GF_3D) {
|
||||
persistMgr->transferAngle(TMEMBER(_angle));
|
||||
persistMgr->transferPtr(TMEMBER(_modelX));
|
||||
persistMgr->transferPtr(TMEMBER(_xmodel));
|
||||
persistMgr->transferPtr(TMEMBER(_shadowModel));
|
||||
persistMgr->transferVector3d(TMEMBER(_posVector));
|
||||
persistMgr->transferMatrix4(TMEMBER(_worldMatrix));
|
||||
@ -1400,8 +1400,8 @@ bool BaseObject::renderModel() {
|
||||
|
||||
_gameRef->_renderer3D->setWorldTransform(objectMat);
|
||||
|
||||
if (_modelX)
|
||||
return _modelX->render();
|
||||
if (_xmodel)
|
||||
return _xmodel->render();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class ScStack;
|
||||
class ScScript;
|
||||
|
||||
#ifdef ENABLE_WME3D
|
||||
class ModelX;
|
||||
class XModel;
|
||||
#endif
|
||||
|
||||
class BaseObject : public BaseScriptHolder {
|
||||
@ -149,8 +149,8 @@ public:
|
||||
|
||||
#ifdef ENABLE_WME3D
|
||||
Math::Angle _angle;
|
||||
ModelX *_modelX;
|
||||
ModelX *_shadowModel;
|
||||
XModel *_xmodel;
|
||||
XModel *_shadowModel;
|
||||
Math::Matrix4 _worldMatrix;
|
||||
Math::Vector3d _posVector;
|
||||
bool getMatrix(Math::Matrix4 *modelMatrix, Math::Vector3d *posVect = nullptr);
|
||||
|
@ -213,8 +213,8 @@ BaseObject *BaseRenderer::getObjectAt(int x, int y) {
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WME3D
|
||||
if (_rectList[i]->_modelX) {
|
||||
if (!_rectList[i]->_modelX->isTransparentAt(x, y)) {
|
||||
if (_rectList[i]->_xmodel) {
|
||||
if (!_rectList[i]->_xmodel->isTransparentAt(x, y)) {
|
||||
return _rectList[i]->_owner;
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ void BaseRenderOpenGL3DShader::setAmbientLight() {
|
||||
value.z() = b / 255.0f;
|
||||
value.w() = a / 255.0f;
|
||||
|
||||
_modelXShader->use();
|
||||
_modelXShader->setUniform("ambientLight", value);
|
||||
_xmodelShader->use();
|
||||
_xmodelShader->setUniform("ambientLight", value);
|
||||
}
|
||||
|
||||
int BaseRenderOpenGL3DShader::maximumLightsCount() {
|
||||
@ -120,15 +120,15 @@ int BaseRenderOpenGL3DShader::maximumLightsCount() {
|
||||
}
|
||||
|
||||
void BaseRenderOpenGL3DShader::enableLight(int index) {
|
||||
_modelXShader->use();
|
||||
_xmodelShader->use();
|
||||
Common::String uniform = Common::String::format("lights[%i].enabled", index);
|
||||
_modelXShader->setUniform1f(uniform.c_str(), 1.0f);
|
||||
_xmodelShader->setUniform1f(uniform.c_str(), 1.0f);
|
||||
}
|
||||
|
||||
void BaseRenderOpenGL3DShader::disableLight(int index) {
|
||||
_modelXShader->use();
|
||||
_xmodelShader->use();
|
||||
Common::String uniform = Common::String::format("lights[%i].enabled", index);
|
||||
_modelXShader->setUniform1f(uniform.c_str(), -1.0f);
|
||||
_xmodelShader->setUniform1f(uniform.c_str(), -1.0f);
|
||||
}
|
||||
|
||||
void BaseRenderOpenGL3DShader::setLightParameters(int index, const Math::Vector3d &position,
|
||||
@ -150,16 +150,16 @@ void BaseRenderOpenGL3DShader::setLightParameters(int index, const Math::Vector3
|
||||
direction4d.w() = -1.0f;
|
||||
}
|
||||
|
||||
_modelXShader->use();
|
||||
_xmodelShader->use();
|
||||
|
||||
Common::String uniform = Common::String::format("lights[%i]._position", index);
|
||||
_modelXShader->setUniform(uniform.c_str(), position4d);
|
||||
_xmodelShader->setUniform(uniform.c_str(), position4d);
|
||||
|
||||
uniform = Common::String::format("lights[%i]._direction", index);
|
||||
_modelXShader->setUniform(uniform.c_str(), direction4d);
|
||||
_xmodelShader->setUniform(uniform.c_str(), direction4d);
|
||||
|
||||
uniform = Common::String::format("lights[%i]._color", index);
|
||||
_modelXShader->setUniform(uniform.c_str(), diffuse);
|
||||
_xmodelShader->setUniform(uniform.c_str(), diffuse);
|
||||
}
|
||||
|
||||
void BaseRenderOpenGL3DShader::enableCulling() {
|
||||
@ -191,8 +191,8 @@ bool BaseRenderOpenGL3DShader::enableShadows() {
|
||||
|
||||
Math::Matrix4 lightProjection = Math::makeFrustumMatrix(left + deltaX, right + deltaX, bottom + deltaY, top + deltaY, nearPlane, farPlane);
|
||||
|
||||
_flatShadowModelXShader->use();
|
||||
_flatShadowModelXShader->setUniform("projMatrix", lightProjection);
|
||||
_flatShadowXModelShader->use();
|
||||
_flatShadowXModelShader->setUniform("projMatrix", lightProjection);
|
||||
|
||||
glGenTextures(1, &_flatShadowRenderTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, _flatShadowRenderTexture);
|
||||
@ -272,12 +272,12 @@ void BaseRenderOpenGL3DShader::displayShadow(BaseObject *object, const Math::Vec
|
||||
translation.transpose();
|
||||
lightViewMatrix = translation * lightViewMatrix;
|
||||
|
||||
_flatShadowModelXShader->use();
|
||||
_flatShadowModelXShader->setUniform("viewMatrix", lightViewMatrix);
|
||||
_flatShadowXModelShader->use();
|
||||
_flatShadowXModelShader->setUniform("viewMatrix", lightViewMatrix);
|
||||
|
||||
Math::Matrix4 tmp = object->_worldMatrix;
|
||||
tmp.transpose();
|
||||
_flatShadowModelXShader->setUniform("modelMatrix", tmp);
|
||||
_flatShadowXModelShader->setUniform("modelMatrix", tmp);
|
||||
|
||||
byte a = RGBCOLGetA(object->_shadowColor);
|
||||
byte r = RGBCOLGetR(object->_shadowColor);
|
||||
@ -288,7 +288,7 @@ void BaseRenderOpenGL3DShader::displayShadow(BaseObject *object, const Math::Vec
|
||||
_flatShadowColor.y() = g / 255.0f;
|
||||
_flatShadowColor.z() = b / 255.0f;
|
||||
_flatShadowColor.w() = a / 255.0f;
|
||||
_flatShadowModelXShader->setUniform("shadowColor", _flatShadowColor);
|
||||
_flatShadowXModelShader->setUniform("shadowColor", _flatShadowColor);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _flatShadowFrameBuffer);
|
||||
|
||||
@ -299,7 +299,7 @@ void BaseRenderOpenGL3DShader::displayShadow(BaseObject *object, const Math::Vec
|
||||
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
object->_modelX->renderFlatShadowModel();
|
||||
object->_xmodel->renderFlatShadowModel();
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
@ -477,9 +477,9 @@ void BaseRenderOpenGL3DShader::setWorldTransform(const Math::Matrix4 &transform)
|
||||
newInvertedTranspose.inverse();
|
||||
newInvertedTranspose.transpose();
|
||||
|
||||
_modelXShader->use();
|
||||
_modelXShader->setUniform("modelMatrix", tmp);
|
||||
_modelXShader->setUniform("normalMatrix", newInvertedTranspose);
|
||||
_xmodelShader->use();
|
||||
_xmodelShader->setUniform("modelMatrix", tmp);
|
||||
_xmodelShader->setUniform("normalMatrix", newInvertedTranspose);
|
||||
|
||||
_shadowVolumeShader->use();
|
||||
_shadowVolumeShader->setUniform("modelMatrix", tmp);
|
||||
@ -519,8 +519,8 @@ bool BaseRenderOpenGL3DShader::initRenderer(int width, int height, bool windowed
|
||||
_transformStack.push_back(Math::Matrix4());
|
||||
_transformStack.back().setToIdentity();
|
||||
|
||||
static const char *modelXAttributes[] = {"position", "texcoord", "normal", nullptr};
|
||||
_modelXShader = OpenGL::Shader::fromFiles("wme_modelx", modelXAttributes);
|
||||
static const char *XModelAttributes[] = {"position", "texcoord", "normal", nullptr};
|
||||
_xmodelShader = OpenGL::Shader::fromFiles("wme_XModel", XModelAttributes);
|
||||
|
||||
setDefaultAmbientLightColor();
|
||||
|
||||
@ -567,8 +567,8 @@ bool BaseRenderOpenGL3DShader::initRenderer(int width, int height, bool windowed
|
||||
_lineShader = OpenGL::Shader::fromFiles("wme_line", lineAttributes);
|
||||
_lineShader->enableVertexAttribute("position", _lineVBO, 2, GL_FLOAT, false, 8, 0);
|
||||
|
||||
static const char *flatShadowModelXAttributes[] = { "position", nullptr };
|
||||
_flatShadowModelXShader = OpenGL::Shader::fromFiles("wme_flat_shadow_modelx", flatShadowModelXAttributes);
|
||||
static const char *flatShadowXModelAttributes[] = { "position", nullptr };
|
||||
_flatShadowXModelShader = OpenGL::Shader::fromFiles("wme_flat_shadow_XModel", flatShadowXModelAttributes);
|
||||
|
||||
_active = true;
|
||||
// setup a proper state
|
||||
@ -665,11 +665,11 @@ bool BaseRenderOpenGL3DShader::setup3D(Camera3D *camera, bool force) {
|
||||
setProjection();
|
||||
}
|
||||
|
||||
_modelXShader->use();
|
||||
_modelXShader->setUniform("viewMatrix", _lastViewMatrix);
|
||||
_modelXShader->setUniform("projMatrix", _projectionMatrix3d);
|
||||
_xmodelShader->use();
|
||||
_xmodelShader->setUniform("viewMatrix", _lastViewMatrix);
|
||||
_xmodelShader->setUniform("projMatrix", _projectionMatrix3d);
|
||||
// this is 8 / 255, since 8 is the value used by wme (as a DWORD)
|
||||
_modelXShader->setUniform1f("alphaRef", 0.031f);
|
||||
_xmodelShader->setUniform1f("alphaRef", 0.031f);
|
||||
|
||||
_geometryShader->use();
|
||||
_geometryShader->setUniform("viewMatrix", _lastViewMatrix);
|
||||
@ -847,7 +847,7 @@ Mesh3DS *BaseRenderOpenGL3DShader::createMesh3DS() {
|
||||
}
|
||||
|
||||
MeshX *BaseRenderOpenGL3DShader::createMeshX() {
|
||||
return new MeshXOpenGLShader(_gameRef, _modelXShader, _flatShadowModelXShader);
|
||||
return new MeshXOpenGLShader(_gameRef, _xmodelShader, _flatShadowXModelShader);
|
||||
}
|
||||
|
||||
ShadowVolume *BaseRenderOpenGL3DShader::createShadowVolume() {
|
||||
|
@ -148,12 +148,12 @@ private:
|
||||
GLuint _flatShadowDepthBuffer;
|
||||
OpenGL::Shader *_spriteShader;
|
||||
OpenGL::Shader *_fadeShader;
|
||||
OpenGL::Shader *_modelXShader;
|
||||
OpenGL::Shader *_xmodelShader;
|
||||
OpenGL::Shader *_geometryShader;
|
||||
OpenGL::Shader *_shadowVolumeShader;
|
||||
OpenGL::Shader *_shadowMaskShader;
|
||||
OpenGL::Shader *_lineShader;
|
||||
OpenGL::Shader *_flatShadowModelXShader;
|
||||
OpenGL::Shader *_flatShadowXModelShader;
|
||||
OpenGL::Shader *_flatShadowMaskShader;
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ MeshXOpenGL::~MeshXOpenGL() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool MeshXOpenGL::render(ModelX *model) {
|
||||
bool MeshXOpenGL::render(XModel *model) {
|
||||
if (_vertexData == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
MeshXOpenGL(BaseGame *inGame);
|
||||
~MeshXOpenGL() override;
|
||||
|
||||
bool render(ModelX *model) override;
|
||||
bool render(XModel *model) override;
|
||||
bool renderFlatShadowModel() override;
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool MeshXOpenGLShader::loadFromX(const Common::String &filename, XFileLexer &le
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool MeshXOpenGLShader::render(ModelX *model) {
|
||||
bool MeshXOpenGLShader::render(XModel *model) {
|
||||
if (_vertexData == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
~MeshXOpenGLShader() override;
|
||||
|
||||
bool loadFromX(const Common::String &filename, XFileLexer &lexer, Common::Array<MaterialReference> &materialReferences) override;
|
||||
bool render(ModelX *model) override;
|
||||
bool render(XModel *model) override;
|
||||
bool renderFlatShadowModel() override;
|
||||
bool update(FrameNode *parentFrame) override;
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace Wintermute {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ActiveAnimation::ActiveAnimation(BaseGame *inGame, ModelX *model) : BaseClass(inGame) {
|
||||
ActiveAnimation::ActiveAnimation(BaseGame *inGame, XModel *model) : BaseClass(inGame) {
|
||||
_model = model;
|
||||
|
||||
_animation = nullptr;
|
||||
|
@ -37,7 +37,7 @@ class BasePersistenceManager;
|
||||
|
||||
class ActiveAnimation : public BaseClass {
|
||||
public:
|
||||
ActiveAnimation(BaseGame *inGame, ModelX *model);
|
||||
ActiveAnimation(BaseGame *inGame, XModel *model);
|
||||
virtual ~ActiveAnimation();
|
||||
|
||||
bool start(AnimationSet *animation, bool looping = false);
|
||||
@ -61,7 +61,7 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
ModelX *_model;
|
||||
XModel *_model;
|
||||
int32 _currentFrame;
|
||||
uint32 _startTime;
|
||||
bool _looping;
|
||||
|
@ -32,7 +32,7 @@
|
||||
namespace Wintermute {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AnimationChannel::AnimationChannel(BaseGame *inGame, ModelX *model) : BaseClass(inGame) {
|
||||
AnimationChannel::AnimationChannel(BaseGame *inGame, XModel *model) : BaseClass(inGame) {
|
||||
_anim[0] = _anim[1] = nullptr;
|
||||
|
||||
_transitioning = false;
|
||||
|
@ -36,7 +36,7 @@ namespace Wintermute {
|
||||
|
||||
class AnimationChannel : public BaseClass {
|
||||
public:
|
||||
AnimationChannel(BaseGame *inGame, ModelX *model);
|
||||
AnimationChannel(BaseGame *inGame, XModel *model);
|
||||
virtual ~AnimationChannel();
|
||||
|
||||
bool playAnim(AnimationSet *animSet, uint32 transitionTime = 0, uint32 stopTransitionTime = 0);
|
||||
@ -51,7 +51,7 @@ public:
|
||||
bool unloadAnim(AnimationSet *animSet);
|
||||
|
||||
private:
|
||||
ModelX *_model;
|
||||
XModel *_model;
|
||||
ActiveAnimation *_anim[2];
|
||||
bool _transitioning;
|
||||
uint32 _transitionStart;
|
||||
|
@ -34,7 +34,7 @@
|
||||
namespace Wintermute {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AnimationSet::AnimationSet(BaseGame *inGame, ModelX *model) : BaseNamedObject(inGame) {
|
||||
AnimationSet::AnimationSet(BaseGame *inGame, XModel *model) : BaseNamedObject(inGame) {
|
||||
_frameTime = -1;
|
||||
_totalTime = 0;
|
||||
_looping = false;
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace Wintermute {
|
||||
|
||||
class ModelX;
|
||||
class XModel;
|
||||
class XFileLexer;
|
||||
|
||||
class AnimationSet : public BaseNamedObject {
|
||||
@ -73,7 +73,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
AnimationSet(BaseGame *inGame, ModelX *model);
|
||||
AnimationSet(BaseGame *inGame, XModel *model);
|
||||
virtual ~AnimationSet();
|
||||
|
||||
bool loadFromX(XFileLexer &lexer, const Common::String &filename);
|
||||
@ -96,7 +96,7 @@ protected:
|
||||
|
||||
int _frameTime;
|
||||
uint32 _totalTime;
|
||||
ModelX *_model;
|
||||
XModel *_model;
|
||||
};
|
||||
|
||||
} // namespace Wintermute
|
||||
|
@ -97,7 +97,7 @@ void FrameNode::setTransformation(int slot, Math::Vector3d pos, Math::Vector3d s
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool FrameNode::loadFromX(const Common::String &filename, XFileLexer &lexer, ModelX *model, Common::Array<MaterialReference> &materialReferences) {
|
||||
bool FrameNode::loadFromX(const Common::String &filename, XFileLexer &lexer, XModel *model, Common::Array<MaterialReference> &materialReferences) {
|
||||
_gameRef->miniUpdate();
|
||||
|
||||
bool ret = true;
|
||||
@ -165,7 +165,7 @@ bool FrameNode::loadFromX(const Common::String &filename, XFileLexer &lexer, Mod
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool FrameNode::loadFromXAsRoot(const Common::String &filename, XFileLexer &lexer, ModelX *model, Common::Array<MaterialReference> &materialReferences) {
|
||||
bool FrameNode::loadFromXAsRoot(const Common::String &filename, XFileLexer &lexer, XModel *model, Common::Array<MaterialReference> &materialReferences) {
|
||||
// technically, there is no root node in a .X file
|
||||
// so we just start parsing it here
|
||||
lexer.advanceToNextToken();
|
||||
@ -361,7 +361,7 @@ bool FrameNode::updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, c
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool FrameNode::render(ModelX *model) {
|
||||
bool FrameNode::render(XModel *model) {
|
||||
bool res = true;
|
||||
|
||||
// render meshes
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
namespace Wintermute {
|
||||
|
||||
class ModelX;
|
||||
class XModel;
|
||||
class BaseSprite;
|
||||
class XFileLexer;
|
||||
|
||||
@ -51,12 +51,12 @@ public:
|
||||
bool updateMatrices(Math::Matrix4 &parentMat);
|
||||
bool updateMeshes();
|
||||
bool resetMatrices();
|
||||
bool render(ModelX *model);
|
||||
bool render(XModel *model);
|
||||
bool renderFlatShadowModel();
|
||||
bool updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth);
|
||||
|
||||
bool loadFromX(const Common::String &filename, XFileLexer &lexer, ModelX *model, Common::Array<MaterialReference> &materialReferences);
|
||||
bool loadFromXAsRoot(const Common::String &filename, XFileLexer &lexer, ModelX *model, Common::Array<MaterialReference> &materialReferences);
|
||||
bool loadFromX(const Common::String &filename, XFileLexer &lexer, XModel *model, Common::Array<MaterialReference> &materialReferences);
|
||||
bool loadFromXAsRoot(const Common::String &filename, XFileLexer &lexer, XModel *model, Common::Array<MaterialReference> &materialReferences);
|
||||
bool findBones(FrameNode *rootFrame);
|
||||
FrameNode *findFrame(const char *frameName);
|
||||
Math::Matrix4 *getCombinedMatrix();
|
||||
|
@ -40,7 +40,7 @@ namespace Wintermute {
|
||||
class BaseSprite;
|
||||
class FrameNode;
|
||||
class Material;
|
||||
class ModelX;
|
||||
class XModel;
|
||||
class ShadowVolume;
|
||||
class VideoTheoraPlayer;
|
||||
class XFileLexer;
|
||||
@ -60,7 +60,7 @@ public:
|
||||
virtual bool loadFromX(const Common::String &filename, XFileLexer &lexer, Common::Array<MaterialReference> &materialReferences);
|
||||
bool findBones(FrameNode *rootFrame);
|
||||
virtual bool update(FrameNode *parentFrame);
|
||||
virtual bool render(ModelX *model) = 0;
|
||||
virtual bool render(XModel *model) = 0;
|
||||
virtual bool renderFlatShadowModel() = 0;
|
||||
bool updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth);
|
||||
|
||||
|
@ -146,10 +146,10 @@ static XFileLexer createXFileLexer(byte *&buffer, uint32 fileSize) {
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_PERSISTENT(ModelX, false)
|
||||
IMPLEMENT_PERSISTENT(XModel, false)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ModelX::ModelX(BaseGame *inGame, BaseObject *owner) : BaseObject(inGame) {
|
||||
XModel::XModel(BaseGame *inGame, BaseObject *owner) : BaseObject(inGame) {
|
||||
_owner = owner;
|
||||
|
||||
_rootFrame = nullptr;
|
||||
@ -172,12 +172,12 @@ ModelX::ModelX(BaseGame *inGame, BaseObject *owner) : BaseObject(inGame) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ModelX::~ModelX() {
|
||||
XModel::~XModel() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ModelX::cleanup(bool complete) {
|
||||
void XModel::cleanup(bool complete) {
|
||||
// empty animation channels
|
||||
for (int i = 0; i < X_NUM_ANIMATION_CHANNELS; i++) {
|
||||
delete _channels[i];
|
||||
@ -218,7 +218,7 @@ void ModelX::cleanup(bool complete) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::loadFromFile(const Common::String &filename, ModelX *parentModel) {
|
||||
bool XModel::loadFromFile(const Common::String &filename, XModel *parentModel) {
|
||||
cleanup(false);
|
||||
|
||||
_parentModel = parentModel;
|
||||
@ -245,7 +245,7 @@ bool ModelX::loadFromFile(const Common::String &filename, ModelX *parentModel) {
|
||||
return res;
|
||||
}
|
||||
|
||||
bool ModelX::mergeFromFile(const Common::String &filename) {
|
||||
bool XModel::mergeFromFile(const Common::String &filename) {
|
||||
if (!_rootFrame) {
|
||||
return false;
|
||||
}
|
||||
@ -280,7 +280,7 @@ bool ModelX::mergeFromFile(const Common::String &filename) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::loadAnimationSet(XFileLexer &lexer, const Common::String &filename) {
|
||||
bool XModel::loadAnimationSet(XFileLexer &lexer, const Common::String &filename) {
|
||||
bool res = true;
|
||||
|
||||
AnimationSet *animSet = new AnimationSet(_gameRef, this);
|
||||
@ -296,7 +296,7 @@ bool ModelX::loadAnimationSet(XFileLexer &lexer, const Common::String &filename)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::loadAnimation(const Common::String &filename, AnimationSet *parentAnimSet) {
|
||||
bool XModel::loadAnimation(const Common::String &filename, AnimationSet *parentAnimSet) {
|
||||
// not sure if we need this here (not completely implemented anyways and also not called)
|
||||
// are there animation objects in .X outside of an animation set?
|
||||
|
||||
@ -322,7 +322,7 @@ bool ModelX::loadAnimation(const Common::String &filename, AnimationSet *parentA
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::findBones(bool animOnly, ModelX *parentModel) {
|
||||
bool XModel::findBones(bool animOnly, XModel *parentModel) {
|
||||
FrameNode *rootFrame;
|
||||
if (parentModel == nullptr)
|
||||
rootFrame = _rootFrame;
|
||||
@ -340,7 +340,7 @@ bool ModelX::findBones(bool animOnly, ModelX *parentModel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ModelX::parseFrameDuringMerge(XFileLexer &lexer, const Common::String &filename) {
|
||||
void XModel::parseFrameDuringMerge(XFileLexer &lexer, const Common::String &filename) {
|
||||
while (!lexer.eof()) {
|
||||
if (lexer.tokenIsIdentifier("Frame")) {
|
||||
lexer.advanceToNextToken();
|
||||
@ -357,7 +357,7 @@ void ModelX::parseFrameDuringMerge(XFileLexer &lexer, const Common::String &file
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::update() {
|
||||
bool XModel::update() {
|
||||
// reset all bones to default position
|
||||
reset();
|
||||
|
||||
@ -379,7 +379,7 @@ bool ModelX::update() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::playAnim(int channel, const Common::String &name, uint32 transitionTime, bool forceReset, uint32 stopTransitionTime) {
|
||||
bool XModel::playAnim(int channel, const Common::String &name, uint32 transitionTime, bool forceReset, uint32 stopTransitionTime) {
|
||||
if (channel < 0 || channel >= X_NUM_ANIMATION_CHANNELS) {
|
||||
return false;
|
||||
}
|
||||
@ -408,7 +408,7 @@ bool ModelX::playAnim(int channel, const Common::String &name, uint32 transition
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::stopAnim(int channel, uint32 transitionTime) {
|
||||
bool XModel::stopAnim(int channel, uint32 transitionTime) {
|
||||
if (channel < 0 || channel >= X_NUM_ANIMATION_CHANNELS) {
|
||||
return false;
|
||||
}
|
||||
@ -417,7 +417,7 @@ bool ModelX::stopAnim(int channel, uint32 transitionTime) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::stopAnim(uint32 transitionTime) {
|
||||
bool XModel::stopAnim(uint32 transitionTime) {
|
||||
const int NUM_SKEL_ANI_CHANNELS = 10;
|
||||
|
||||
for (int channel = 0; channel < NUM_SKEL_ANI_CHANNELS; channel++) {
|
||||
@ -428,7 +428,7 @@ bool ModelX::stopAnim(uint32 transitionTime) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::reset() {
|
||||
bool XModel::reset() {
|
||||
if (_rootFrame) {
|
||||
_rootFrame->resetMatrices();
|
||||
}
|
||||
@ -437,7 +437,7 @@ bool ModelX::reset() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::isAnimPending(int channel, const char *animName) {
|
||||
bool XModel::isAnimPending(int channel, const char *animName) {
|
||||
if (!animName) {
|
||||
if (_channels[channel]->isPlaying()) {
|
||||
return true;
|
||||
@ -451,7 +451,7 @@ bool ModelX::isAnimPending(int channel, const char *animName) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::isAnimPending(char *animName) {
|
||||
bool XModel::isAnimPending(char *animName) {
|
||||
for (int channel = 0; channel < X_NUM_ANIMATION_CHANNELS; channel++) {
|
||||
if (isAnimPending(channel, animName)) {
|
||||
return true;
|
||||
@ -461,7 +461,7 @@ bool ModelX::isAnimPending(char *animName) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth) {
|
||||
bool XModel::updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth) {
|
||||
if (_rootFrame) {
|
||||
return _rootFrame->updateShadowVol(shadow, modelMat, light, extrusionDepth);
|
||||
} else {
|
||||
@ -470,7 +470,7 @@ bool ModelX::updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, cons
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::render() {
|
||||
bool XModel::render() {
|
||||
if (_rootFrame) {
|
||||
// set culling
|
||||
if(_owner && !_owner->_drawBackfaces) {
|
||||
@ -506,7 +506,7 @@ bool ModelX::render() {
|
||||
}
|
||||
}
|
||||
|
||||
bool ModelX::renderFlatShadowModel() {
|
||||
bool XModel::renderFlatShadowModel() {
|
||||
if (_rootFrame) {
|
||||
if(_owner && !_owner->_drawBackfaces) {
|
||||
_gameRef->_renderer3D->enableCulling();
|
||||
@ -521,7 +521,7 @@ bool ModelX::renderFlatShadowModel() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Math::Matrix4 *ModelX::getBoneMatrix(const char *boneName) {
|
||||
Math::Matrix4 *XModel::getBoneMatrix(const char *boneName) {
|
||||
FrameNode *bone = _rootFrame->findFrame(boneName);
|
||||
|
||||
if (bone) {
|
||||
@ -532,12 +532,12 @@ Math::Matrix4 *ModelX::getBoneMatrix(const char *boneName) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
FrameNode *ModelX::getRootFrame() {
|
||||
FrameNode *XModel::getRootFrame() {
|
||||
return _rootFrame;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::isTransparentAt(int x, int y) {
|
||||
bool XModel::isTransparentAt(int x, int y) {
|
||||
if (!_rootFrame) {
|
||||
return false;
|
||||
}
|
||||
@ -556,7 +556,7 @@ bool ModelX::isTransparentAt(int x, int y) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ModelX::updateBoundingRect() {
|
||||
void XModel::updateBoundingRect() {
|
||||
_BBoxStart = Math::Vector3d(0, 0, 0);
|
||||
_BBoxStart = Math::Vector3d(0, 0, 0);
|
||||
|
||||
@ -607,7 +607,7 @@ void ModelX::updateBoundingRect() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ModelX::updateRect(Rect32 *rc, int32 x, int32 y) {
|
||||
void XModel::updateRect(Rect32 *rc, int32 x, int32 y) {
|
||||
rc->left = MIN(rc->left, x);
|
||||
rc->right = MAX(rc->right, x);
|
||||
rc->top = MIN(rc->top, y);
|
||||
@ -615,7 +615,7 @@ void ModelX::updateRect(Rect32 *rc, int32 x, int32 y) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AnimationSet *ModelX::getAnimationSetByName(const Common::String &name) {
|
||||
AnimationSet *XModel::getAnimationSetByName(const Common::String &name) {
|
||||
for (uint32 i = 0; i < _animationSets.size(); i++) {
|
||||
if (name.equalsIgnoreCase(_animationSets[i]->_name)) {
|
||||
return _animationSets[i];
|
||||
@ -632,7 +632,7 @@ TOKEN_DEF_START
|
||||
TOKEN_DEF(FRAME)
|
||||
TOKEN_DEF_END
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::parseAnim(byte *buffer) {
|
||||
bool XModel::parseAnim(byte *buffer) {
|
||||
TOKEN_TABLE_START(commands)
|
||||
TOKEN_TABLE(NAME)
|
||||
TOKEN_TABLE(LOOPING)
|
||||
@ -696,7 +696,7 @@ bool ModelX::parseAnim(byte *buffer) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::parseEvent(AnimationSet *anim, byte *buffer) {
|
||||
bool XModel::parseEvent(AnimationSet *anim, byte *buffer) {
|
||||
TOKEN_TABLE_START(commands)
|
||||
TOKEN_TABLE(NAME)
|
||||
TOKEN_TABLE(FRAME)
|
||||
@ -738,7 +738,7 @@ bool ModelX::parseEvent(AnimationSet *anim, byte *buffer) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::setMaterialSprite(const char *materialName, const char *spriteFilename) {
|
||||
bool XModel::setMaterialSprite(const char *materialName, const char *spriteFilename) {
|
||||
if (!materialName || !spriteFilename) {
|
||||
return false;
|
||||
}
|
||||
@ -753,7 +753,7 @@ bool ModelX::setMaterialSprite(const char *materialName, const char *spriteFilen
|
||||
return false;
|
||||
}
|
||||
|
||||
ModelXMatSprite *matSprite = nullptr;
|
||||
XModelMatSprite *matSprite = nullptr;
|
||||
for (uint32 i = 0; i < _matSprites.size(); i++) {
|
||||
if (scumm_stricmp(_matSprites[i]->_matName, materialName) == 0) {
|
||||
matSprite = _matSprites[i];
|
||||
@ -763,7 +763,7 @@ bool ModelX::setMaterialSprite(const char *materialName, const char *spriteFilen
|
||||
if (matSprite) {
|
||||
matSprite->setSprite(sprite);
|
||||
} else {
|
||||
matSprite = new ModelXMatSprite(materialName, sprite);
|
||||
matSprite = new XModelMatSprite(materialName, sprite);
|
||||
_matSprites.add(matSprite);
|
||||
}
|
||||
|
||||
@ -773,7 +773,7 @@ bool ModelX::setMaterialSprite(const char *materialName, const char *spriteFilen
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::setMaterialTheora(const char *materialName, const char *theoraFilename) {
|
||||
bool XModel::setMaterialTheora(const char *materialName, const char *theoraFilename) {
|
||||
if (!materialName || !theoraFilename) {
|
||||
return false;
|
||||
}
|
||||
@ -791,7 +791,7 @@ bool ModelX::setMaterialTheora(const char *materialName, const char *theoraFilen
|
||||
|
||||
theora->play(VID_PLAY_POS, 0, 0, false, false, true);
|
||||
|
||||
ModelXMatSprite *matSprite = nullptr;
|
||||
XModelMatSprite *matSprite = nullptr;
|
||||
for (uint32 i = 0; i < _matSprites.size(); i++) {
|
||||
if (scumm_stricmp(_matSprites[i]->_matName, materialName) == 0) {
|
||||
matSprite = _matSprites[i];
|
||||
@ -802,7 +802,7 @@ bool ModelX::setMaterialTheora(const char *materialName, const char *theoraFilen
|
||||
if (matSprite) {
|
||||
matSprite->setTheora(theora);
|
||||
} else {
|
||||
matSprite = new ModelXMatSprite(materialName, theora);
|
||||
matSprite = new XModelMatSprite(materialName, theora);
|
||||
_matSprites.add(matSprite);
|
||||
}
|
||||
_rootFrame->setMaterialTheora(matSprite->_matName, matSprite->_theora);
|
||||
@ -811,7 +811,7 @@ bool ModelX::setMaterialTheora(const char *materialName, const char *theoraFilen
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::initializeSimple() {
|
||||
bool XModel::initializeSimple() {
|
||||
if (!_rootFrame) {
|
||||
return false;
|
||||
}
|
||||
@ -834,7 +834,7 @@ bool ModelX::initializeSimple() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::persist(BasePersistenceManager *persistMgr) {
|
||||
bool XModel::persist(BasePersistenceManager *persistMgr) {
|
||||
BaseObject::persist(persistMgr);
|
||||
|
||||
persistMgr->transferVector3d(TMEMBER(_BBoxStart));
|
||||
@ -924,7 +924,7 @@ bool ModelX::persist(BasePersistenceManager *persistMgr) {
|
||||
if (persistMgr->getIsSaving()) {
|
||||
_matSprites[i]->persist(persistMgr);
|
||||
} else {
|
||||
ModelXMatSprite *MatSprite = new ModelXMatSprite();
|
||||
XModelMatSprite *MatSprite = new XModelMatSprite();
|
||||
MatSprite->persist(persistMgr);
|
||||
_matSprites.add(MatSprite);
|
||||
}
|
||||
@ -937,7 +937,7 @@ bool ModelX::persist(BasePersistenceManager *persistMgr) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::invalidateDeviceObjects() {
|
||||
bool XModel::invalidateDeviceObjects() {
|
||||
if (_rootFrame) {
|
||||
return _rootFrame->invalidateDeviceObjects();
|
||||
} else {
|
||||
@ -946,7 +946,7 @@ bool ModelX::invalidateDeviceObjects() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::restoreDeviceObjects() {
|
||||
bool XModel::restoreDeviceObjects() {
|
||||
if (_rootFrame) {
|
||||
return _rootFrame->restoreDeviceObjects();
|
||||
} else {
|
||||
@ -955,7 +955,7 @@ bool ModelX::restoreDeviceObjects() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ModelX::unloadAnimation(const char *animName) {
|
||||
bool XModel::unloadAnimation(const char *animName) {
|
||||
bool found = false;
|
||||
for (uint32 i = 0; i < _animationSets.size(); i++) {
|
||||
if (scumm_stricmp(animName, _animationSets[i]->_name) == 0) {
|
||||
|
@ -54,26 +54,26 @@ struct MaterialReference {
|
||||
|
||||
#define X_NUM_ANIMATION_CHANNELS 10
|
||||
|
||||
class ModelX : public BaseObject {
|
||||
class XModel : public BaseObject {
|
||||
private:
|
||||
// the D3DX effect stuff is missing here
|
||||
// at the moment I am not aware of whether this is used
|
||||
// in Alpha Polaris or any other WME game
|
||||
// if it is, then this would mean a decent amount of work
|
||||
// since we would need to parse and emulate D3DX effects in OpenGL
|
||||
class ModelXMatSprite {
|
||||
class XModelMatSprite {
|
||||
public:
|
||||
char *_matName;
|
||||
BaseSprite *_sprite;
|
||||
VideoTheoraPlayer *_theora;
|
||||
|
||||
ModelXMatSprite() {
|
||||
XModelMatSprite() {
|
||||
_matName = nullptr;
|
||||
_sprite = nullptr;
|
||||
_theora = nullptr;
|
||||
}
|
||||
|
||||
ModelXMatSprite(const char *matName, BaseSprite *sprite) {
|
||||
XModelMatSprite(const char *matName, BaseSprite *sprite) {
|
||||
_theora = nullptr;
|
||||
_matName = nullptr;
|
||||
uint32 size = strlen(matName);
|
||||
@ -83,7 +83,7 @@ private:
|
||||
_sprite = sprite;
|
||||
}
|
||||
|
||||
ModelXMatSprite(const char *matName, VideoTheoraPlayer *theora) {
|
||||
XModelMatSprite(const char *matName, VideoTheoraPlayer *theora) {
|
||||
_sprite = nullptr;
|
||||
_matName = nullptr;
|
||||
uint32 size = strlen(matName);
|
||||
@ -93,7 +93,7 @@ private:
|
||||
_theora = theora;
|
||||
}
|
||||
|
||||
~ModelXMatSprite() {
|
||||
~XModelMatSprite() {
|
||||
delete[] _matName;
|
||||
delete _sprite;
|
||||
delete _theora;
|
||||
@ -134,14 +134,14 @@ public:
|
||||
// so should be fine for our purposes
|
||||
const static int kDefaultTicksPerSecond = 4800;
|
||||
|
||||
DECLARE_PERSISTENT(ModelX, BaseObject)
|
||||
DECLARE_PERSISTENT(XModel, BaseObject)
|
||||
|
||||
ModelX(BaseGame *inGame, BaseObject *owner);
|
||||
virtual ~ModelX();
|
||||
XModel(BaseGame *inGame, BaseObject *owner);
|
||||
virtual ~XModel();
|
||||
|
||||
ModelX *_parentModel;
|
||||
XModel *_parentModel;
|
||||
|
||||
bool loadFromFile(const Common::String &filename, ModelX *parentModel = nullptr);
|
||||
bool loadFromFile(const Common::String &filename, XModel *parentModel = nullptr);
|
||||
bool mergeFromFile(const Common::String &filename);
|
||||
|
||||
bool update() override;
|
||||
@ -189,7 +189,7 @@ public:
|
||||
|
||||
private:
|
||||
void cleanup(bool complete = true);
|
||||
bool findBones(bool animOnly = false, ModelX *parentModel = nullptr);
|
||||
bool findBones(bool animOnly = false, XModel *parentModel = nullptr);
|
||||
|
||||
void parseFrameDuringMerge(XFileLexer &lexer, const Common::String &filename);
|
||||
|
||||
@ -212,7 +212,7 @@ protected:
|
||||
|
||||
FrameNode *_rootFrame;
|
||||
|
||||
BaseArray<ModelXMatSprite *> _matSprites;
|
||||
BaseArray<XModelMatSprite *> _matSprites;
|
||||
};
|
||||
|
||||
} // namespace Wintermute
|
||||
|
@ -124,7 +124,7 @@ bool SaveLoad::initAfterLoad() {
|
||||
SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", nullptr);
|
||||
SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", nullptr);
|
||||
#ifdef ENABLE_WME3D
|
||||
SystemClassRegistry::getInstance()->enumInstances(afterLoadModelX, "ModelX", nullptr);
|
||||
SystemClassRegistry::getInstance()->enumInstances(afterLoadXModel, "XModel", nullptr);
|
||||
#endif
|
||||
SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", nullptr);
|
||||
// AdGame:
|
||||
@ -161,8 +161,8 @@ void SaveLoad::afterLoadFont(void *font, void *data) {
|
||||
|
||||
#ifdef ENABLE_WME3D
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SaveLoad::afterLoadModelX(void *model, void *data) {
|
||||
((ModelX *)model)->initializeSimple();
|
||||
void SaveLoad::afterLoadXModel(void *model, void *data) {
|
||||
((XModel *)model)->initializeSimple();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
static void afterLoadSound(void *sound, void *data);
|
||||
static void afterLoadFont(void *font, void *data);
|
||||
#ifdef ENABLE_WME3D
|
||||
static void afterLoadModelX(void *model, void *data);
|
||||
static void afterLoadXModel(void *model, void *data);
|
||||
#endif
|
||||
static void afterLoadScript(void *script, void *data);
|
||||
};
|
||||
|
@ -193,7 +193,7 @@ void SystemClassRegistry::register3DClasses() {
|
||||
REGISTER_CLASS(AdPath3D, false)
|
||||
REGISTER_CLASS(AdPathPoint3D, false)
|
||||
REGISTER_CLASS(AdSceneGeometry, false)
|
||||
REGISTER_CLASS(ModelX, false)
|
||||
REGISTER_CLASS(XModel, false)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user