]> git.lizzy.rs Git - minetest.git/blobdiff - src/camera.cpp
FormSpec: Add StaticTextSpec and superimpose over item image buttons
[minetest.git] / src / camera.cpp
index 46df0575ccc9b7faa9b80143d4cf532b946af2f7..94bbe9880386f9c16fc42d4ec85e371abc1d7aba 100644 (file)
@@ -79,7 +79,7 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
 
        m_camera_mode(CAMERA_MODE_FIRST)
 {
-       //dstream<<__FUNCTION_NAME<<std::endl;
+       //dstream<<FUNCTION_NAME<<std::endl;
 
        // note: making the camera node a child of the player node
        // would lead to unexpected behaviour, so we don't do that.
@@ -92,10 +92,9 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
        // all other 3D scene nodes and before the GUI.
        m_wieldmgr = smgr->createNewSceneManager();
        m_wieldmgr->addCameraSceneNode();
-       m_wieldnode = new WieldMeshSceneNode(m_wieldmgr->getRootSceneNode(), m_wieldmgr, -1, true);
+       m_wieldnode = new WieldMeshSceneNode(m_wieldmgr->getRootSceneNode(), m_wieldmgr, -1, false);
        m_wieldnode->setItem(ItemStack(), m_gamedef);
        m_wieldnode->drop(); // m_wieldmgr grabbed it
-       m_wieldlightnode = m_wieldmgr->addLightSceneNode(NULL, v3f(0.0, 50.0, 0.0));
 
        /* TODO: Add a callback function so these can be updated when a setting
         *       changes.  At this point in time it doesn't matter (e.g. /set
@@ -451,11 +450,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
        m_wieldnode->setPosition(wield_position);
        m_wieldnode->setRotation(wield_rotation);
 
-       // Shine light upon the wield mesh
-       video::SColor black(255,0,0,0);
-       m_wieldmgr->setAmbientLight(player->light_color.getInterpolated(black, 0.7));
-       m_wieldlightnode->getLightData().DiffuseColor = player->light_color.getInterpolated(black, 0.3);
-       m_wieldlightnode->setPosition(v3f(30+5*sin(2*player->getYaw()*M_PI/180), -50, 0));
+       m_wieldnode->setColor(player->light_color);
 
        // Render distance feedback loop
        updateViewingRange(frametime, busytime);
@@ -465,7 +460,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
        // start (or continue) the view bobbing animation.
        v3f speed = player->getSpeed();
        const bool movement_XZ = hypot(speed.X, speed.Z) > BS;
-       const bool movement_Y = abs(speed.Y) > BS;
+       const bool movement_Y = fabs(speed.Y) > BS;
 
        const bool walking = movement_XZ && player->touching_ground;
        const bool swimming = (movement_XZ || player->swimming_vertical) && player->in_liquid;
@@ -499,7 +494,7 @@ void Camera::updateViewingRange(f32 frametime_in, f32 busytime_in)
                return;
        m_frametime_counter = 0.2; // Same as ClientMap::updateDrawList interval
 
-       /*dstream<<__FUNCTION_NAME
+       /*dstream<<FUNCTION_NAME
                        <<": Collected "<<m_added_frames<<" frames, total of "
                        <<m_added_busytime<<"s."<<std::endl;
 
@@ -651,7 +646,7 @@ void Camera::drawWieldedTool(irr::core::matrix4* translation)
        scene::ICameraSceneNode* cam = m_wieldmgr->getActiveCamera();
        cam->setAspectRatio(m_cameranode->getAspectRatio());
        cam->setFOV(72.0*M_PI/180.0);
-       cam->setNearValue(0.1);
+       cam->setNearValue(10);
        cam->setFarValue(1000);
        if (translation != NULL)
        {