From c0b35fa429c68b49b2d6a5124aff6dcc31400b63 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Wed, 7 Sep 2011 19:21:28 +0200 Subject: Removed unused camera_position and camera_direction fields from Client. Moved ClientEnvironment::drawPostFx to ClientMap::renderPostFx -- this will make the camera management classes easier to write, as ClientMap already knows the camera position but ClientEnvironment doesn't and has to be told about it. This also eliminates the need for Client::getEnv(). Made the post effect color a content feature defined in content_mapnode.h. --- src/content_mapnode.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/content_mapnode.cpp') diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index 51f2f9736..89171755e 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -385,6 +385,7 @@ void content_mapnode_init() f->liquid_alternative_source = CONTENT_WATERSOURCE; f->liquid_viscosity = WATER_VISC; f->vertex_alpha = WATER_ALPHA; + f->post_effect_color = video::SColor(64, 100, 100, 200); if(f->special_material == NULL && g_texturesource) { // Flowing water material @@ -433,6 +434,7 @@ void content_mapnode_init() f->liquid_alternative_source = CONTENT_WATERSOURCE; f->liquid_viscosity = WATER_VISC; f->vertex_alpha = WATER_ALPHA; + f->post_effect_color = video::SColor(64, 100, 100, 200); if(f->special_material == NULL && g_texturesource) { // Flowing water material @@ -465,6 +467,7 @@ void content_mapnode_init() f->liquid_alternative_source = CONTENT_LAVASOURCE; f->liquid_viscosity = LAVA_VISC; f->damage_per_second = 4*2; + f->post_effect_color = video::SColor(192, 255, 64, 0); if(f->special_material == NULL && g_texturesource) { // Flowing lava material @@ -514,6 +517,7 @@ void content_mapnode_init() f->liquid_alternative_source = CONTENT_LAVASOURCE; f->liquid_viscosity = LAVA_VISC; f->damage_per_second = 4*2; + f->post_effect_color = video::SColor(192, 255, 64, 0); if(f->special_material == NULL && g_texturesource) { // Flowing lava material -- cgit v1.2.3 From ab42549b1e48ede22d96e9f4ac017bb5d1853724 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Mon, 19 Sep 2011 17:08:42 +0200 Subject: Wielded tool updates, leaves and glass work now --- src/camera.cpp | 26 +++++++++++--------------- src/camera.h | 7 ++++++- src/content_mapnode.cpp | 4 ++++ 3 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src/content_mapnode.cpp') diff --git a/src/camera.cpp b/src/camera.cpp index e7d506177..c5c40f5c5 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -54,7 +54,10 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control): m_view_bobbing_anim(0), m_view_bobbing_state(0), - m_view_bobbing_speed(0) + m_view_bobbing_speed(0), + + m_digging_anim(0), + m_digging_speed(0) { //dstream<<__FUNCTION_NAME<addEmptySceneNode(m_playernode); m_cameranode = smgr->addCameraSceneNode(smgr->getRootSceneNode()); m_cameranode->bindTargetAndRotation(true); - m_wieldnode = new ExtrudedSpriteSceneNode(smgr->getRootSceneNode(), smgr, -1, v3f(0, 120, 10), v3f(0, 0, 0), v3f(100, 100, 100)); - //m_wieldnode = new ExtrudedSpriteSceneNode(smgr->getRootSceneNode(), smgr, -1); + m_wieldnode = new ExtrudedSpriteSceneNode(m_headnode, smgr, -1, v3f(1.3, -1, 2), v3f(-20, -100, 20), v3f(1)); updateSettings(); } @@ -356,9 +358,10 @@ void Camera::wield(const InventoryItem* item) // A block-type material MaterialItem* mat_item = (MaterialItem*) item; content_t content = mat_item->getMaterial(); - if (content_features(content).solidness) + if (content_features(content).solidness || content_features(content).visual_solidness) { m_wieldnode->setCube(content_features(content).tiles); + m_wieldnode->setScale(v3f(0.9)); isCube = true; } } @@ -367,6 +370,7 @@ void Camera::wield(const InventoryItem* item) if (!isCube) { m_wieldnode->setSprite(item->getImageRaw()); + m_wieldnode->setScale(v3f(1.2)); } m_wieldnode->setVisible(true); @@ -458,17 +462,9 @@ void ExtrudedSpriteSceneNode::setCube(const TileSpec tiles[6]) for (int i = 0; i < 6; ++i) { // Get the tile texture and atlas transformation - u32 texture_id = tiles[i].texture.id; - video::ITexture* atlas = NULL; - v2f pos(0,0); - v2f size(1,1); - if (g_texturesource) - { - AtlasPointer ap = g_texturesource->getTexture(texture_id); - atlas = ap.atlas; - pos = ap.pos; - size = ap.size; - } + video::ITexture* atlas = tiles[i].texture.atlas; + v2f pos = tiles[i].texture.pos; + v2f size = tiles[i].texture.size; // Set material flags and texture video::SMaterial& material = m_meshnode->getMaterial(i); diff --git a/src/camera.h b/src/camera.h index ccc224e3c..f960e748e 100644 --- a/src/camera.h +++ b/src/camera.h @@ -166,6 +166,11 @@ private: s32 m_view_bobbing_state; // Speed of view bobbing animation f32 m_view_bobbing_speed; + + // Digging animation + s32 m_digging_anim; + // Speed of digging animation + s32 m_digging_speed; }; @@ -187,7 +192,7 @@ public: s32 id = -1, const v3f& position = v3f(0,0,0), const v3f& rotation = v3f(0,0,0), - const v3f& scale = v3f(0,0,0)); + const v3f& scale = v3f(1,1,1)); ~ExtrudedSpriteSceneNode(); void setSprite(video::ITexture* texture); diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index 89171755e..70f465130 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -236,6 +236,8 @@ void content_mapnode_init() if(new_style_leaves) { f->solidness = 0; // drawn separately, makes no faces + f->visual_solidness = 1; + f->setAllTextures("leaves.png"); f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png"); } else @@ -287,6 +289,8 @@ void content_mapnode_init() f->is_ground_content = true; f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->solidness = 0; // drawn separately, makes no faces + f->visual_solidness = 1; + f->setAllTextures("glass.png"); f->setInventoryTextureCube("glass.png", "glass.png", "glass.png"); setWoodLikeDiggingProperties(f->digging_properties, 0.15); -- cgit v1.2.3