Fix kart shadow vs kart animation (for the main player only)
This commit is contained in:
parent
32b2359f21
commit
f0e3ee8832
@ -2316,8 +2316,8 @@ void Kart::updateFlying()
|
||||
*/
|
||||
void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
||||
{
|
||||
|
||||
m_node = m_kart_model->attachModel(is_animated_model);
|
||||
bool always_animated = (type == RaceManager::KT_PLAYER && race_manager->getNumPlayers() == 1);
|
||||
m_node = m_kart_model->attachModel(is_animated_model, always_animated);
|
||||
|
||||
#ifdef DEBUG
|
||||
m_node->setName( (getIdent()+"(lod-node)").c_str() );
|
||||
|
@ -325,7 +325,7 @@ KartModel* KartModel::makeCopy()
|
||||
/** Attach the kart model and wheels to the scene node.
|
||||
* \return the node with the model attached
|
||||
*/
|
||||
scene::ISceneNode* KartModel::attachModel(bool animated_models)
|
||||
scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_animated)
|
||||
{
|
||||
assert(!m_is_master);
|
||||
|
||||
@ -342,10 +342,22 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models)
|
||||
// as animated mesh are not cheap to render use frustum box culling
|
||||
node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
|
||||
|
||||
lod_node->add(20, node, true);
|
||||
scene::ISceneNode* static_model = attachModel(false);
|
||||
lod_node->add(100, static_model, true);
|
||||
m_animated_node = static_cast<scene::IAnimatedMeshSceneNode*>(node);
|
||||
if (always_animated)
|
||||
{
|
||||
// give a huge LOD distance for the player's kart. the reason is that it should
|
||||
// use its animations for the shadow pass too, where the camera can be quite far
|
||||
lod_node->add(10000, node, true);
|
||||
scene::ISceneNode* static_model = attachModel(false, false);
|
||||
lod_node->add(10001, static_model, true);
|
||||
m_animated_node = static_cast<scene::IAnimatedMeshSceneNode*>(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
lod_node->add(20, node, true);
|
||||
scene::ISceneNode* static_model = attachModel(false, false);
|
||||
lod_node->add(100, static_model, true);
|
||||
m_animated_node = static_cast<scene::IAnimatedMeshSceneNode*>(node);
|
||||
}
|
||||
|
||||
attachHat();
|
||||
|
||||
@ -363,7 +375,7 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models)
|
||||
// Become the owner of the wheels
|
||||
for(unsigned int i=0; i<4; i++)
|
||||
{
|
||||
if(!m_wheel_model[i]) continue;
|
||||
if (!m_wheel_model[i] || !m_wheel_node[i]) continue;
|
||||
m_wheel_node[i]->setParent(lod_node);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public:
|
||||
float wheel_radius);
|
||||
void finishedRace();
|
||||
scene::ISceneNode*
|
||||
attachModel(bool animatedModels);
|
||||
attachModel(bool animatedModels, bool always_animated);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the animated mesh of this kart model. */
|
||||
scene::IAnimatedMesh*
|
||||
|
@ -330,7 +330,7 @@ void FeatureUnlockedCutScene::init()
|
||||
KartModel *kart_model =
|
||||
m_unlocked_stuff[n].m_unlocked_kart->getKartModelCopy();
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
m_unlocked_stuff[n].m_root_gift_node = kart_model->attachModel(true);
|
||||
m_unlocked_stuff[n].m_root_gift_node = kart_model->attachModel(true, false);
|
||||
kart_model->setAnimation(KartModel::AF_DEFAULT);
|
||||
float susp[4]={0,0,0,0};
|
||||
kart_model->update(0.0f, 0.0f, 0.0f, susp, 0.0f);
|
||||
|
@ -243,7 +243,7 @@ void GrandPrixLose::setKarts(std::vector<std::string> ident_arg)
|
||||
{
|
||||
KartModel* kart_model = kart->getKartModelCopy();
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false, false);
|
||||
|
||||
core::vector3df kart_pos(m_kart_x + n*DISTANCE_BETWEEN_KARTS,
|
||||
m_kart_y,
|
||||
|
@ -355,7 +355,7 @@ void GrandPrixWin::setKarts(const std::string idents_arg[3])
|
||||
|
||||
KartModel* kart_model = kp->getKartModelCopy();
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false, false);
|
||||
|
||||
m_kart_x[i] = KARTS_X + i*KARTS_DELTA_X;
|
||||
m_kart_y[i] = INITIAL_Y + KARTS_DELTA_Y;
|
||||
|
Loading…
Reference in New Issue
Block a user