return m_env.getMap().getNodeMetadata(p);
}
-v3f Client::getPlayerPosition(v3f *eye_position)
+LocalPlayer* Client::getLocalPlayer()
{
- //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
- LocalPlayer *player = m_env.getLocalPlayer();
- assert(player != NULL);
- if (eye_position)
- *eye_position = player->getEyePosition();
- return player->getPosition();
+ return m_env.getLocalPlayer();
}
+ void Client::setPlayerWield(scene::ISceneNode *wield)
+ {
+ //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
+ LocalPlayer *player = m_env.getLocalPlayer();
+ assert(player != NULL);
+ player->wield = wield;
+ }
+
void Client::setPlayerControl(PlayerControl &control)
{
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
f32 camera_yaw = 0; // "right/left"
f32 camera_pitch = 0; // "up/down"
- v3f tool_wield_position(0.6, -0.6, 1.0);
+ /*
+ Tool
+ */
+
- tool_wield = smgr->addMeshSceneNode(mesh, camera);
++ v3f tool_wield_position(0.06*BS, 1.619*BS, 0.1*BS);
+ v3f tool_wield_rotation(-25, 180, -25);
+ float tool_wield_animation = 0.0;
+ scene::IMeshSceneNode *tool_wield;
+ {
+ scene::SMesh *mesh = new scene::SMesh();
+ scene::IMeshBuffer *buf = new scene::SMeshBuffer();
+ video::SColor c(255,255,255,255);
+ video::S3DVertex vertices[4] =
+ {
+ video::S3DVertex(-0.5,0,0, 0,0,0, c, 0,1),
+ video::S3DVertex(0.5,0,0, 0,0,0, c, 1,1),
+ video::S3DVertex(0.5,0.5,0, 0,0,0, c, 1,0),
+ video::S3DVertex(-0.5,0.5,0, 0,0,0, c, 0,0),
+ };
+ u16 indices[] = {0,1,2,2,3,0};
+ buf->append(vertices, 4, indices, 6);
+ // Set material
+ buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
+ buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
+ buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ // Add to mesh
+ mesh->addMeshBuffer(buf);
+ buf->drop();
+
++ tool_wield = smgr->addMeshSceneNode(mesh, camera.getPlayerNode());
+ mesh->drop();
+ }
+ tool_wield->setVisible(false);
+ tool_wield->setPosition(tool_wield_position);
+ tool_wield->setRotation(tool_wield_rotation);
+
+ client.setPlayerWield(tool_wield);
+
/*
Clouds
*/