OSDN Git Service

半透明のメッシュをキャラクターより後に描画するように変更
authorh2so5 <h2so5@git.sourceforge.jp>
Thu, 4 Oct 2012 02:17:15 +0000 (11:17 +0900)
committerh2so5 <h2so5@git.sourceforge.jp>
Thu, 4 Oct 2012 02:17:15 +0000 (11:17 +0900)
UIListの項目数が多いと描画が重くなる問題を修正
modelディレクトリを再帰的に検索するように変更

client/3d/Stage.cpp
client/3d/Stage.hpp
client/3d/gameloop.cpp
client/InputManager.cpp
client/ResourceManager.cpp
client/stdafx.h
client/ui/UIList.cpp
client/version.hpp

index 1ad1c6a..c3eda92 100644 (file)
@@ -26,6 +26,14 @@ Stage::Stage(const tstring& model_name) :
     if (start_points_.empty()) {
         start_points_.push_back(VGet(0, 0, 0));
     }
+
+       int handle = map_handle_.handle();
+       int frame_num = MV1GetMeshNum(handle);
+       for (int i = 0; i < frame_num; i++) {
+               if (MV1GetMeshSemiTransState(handle, i) == TRUE) {
+                       draw_after_meshes_.insert(i);
+               }
+       }
        /*
     auto warp_points_array = map_handle_.property().get_child("stage.warp_points", ptree());
     for (auto it = warp_points_array.begin(); it != warp_points_array.end(); ++it) {
@@ -67,8 +75,15 @@ void Stage::Draw()
 {
        MMO_PROFILE_FUNCTION;
 
+       int handle = map_handle_.handle();
+       int frame_num = MV1GetMeshNum(handle);
+       for (int i = 0; i < frame_num; i++) {
+               if (draw_after_meshes_.find(i) == draw_after_meshes_.end()) {
+                       MV1DrawMesh(handle, i);
+               }
+       }
+
     MV1DrawModel(skymap_handle_.handle());
-    MV1DrawModel(map_handle_.handle());
 
        /*
        BOOST_FOREACH(auto warp_handle,warpobj_array_)
@@ -78,6 +93,19 @@ void Stage::Draw()
        */
 }
 
+void Stage::DrawAfter()
+{
+       MMO_PROFILE_FUNCTION;
+
+       int handle = map_handle_.handle();
+       int frame_num = MV1GetMeshNum(handle);
+       for (int i = 0; i < frame_num; i++) {
+               if (draw_after_meshes_.find(i) != draw_after_meshes_.end()) {
+                       MV1DrawMesh(handle, i);
+               }
+       }
+}
+
 float Stage::GetFloorY(const VECTOR& v1, const VECTOR& v2) const
 {
        MMO_PROFILE_FUNCTION;
index 22fab3f..fd3341e 100644 (file)
@@ -16,6 +16,7 @@ class Stage {
         Stage(const tstring& model_path);
         ~Stage();
         void Draw();
+        void DrawAfter();
 
         float GetFloorY(const VECTOR& v1, const VECTOR& v2) const;
         bool GetFloorY(const VECTOR& v1, const VECTOR& v2, float* y) const;
@@ -45,6 +46,9 @@ class Stage {
         ModelHandle map_handle_;
         float map_scale_;
                float min_height_;
+
+               std::unordered_set<int> draw_after_meshes_;
+
         ModelHandle skymap_handle_;
                ModelHandle warpobj_handle_;
                std::vector<ModelHandle> warpobj_array_;
index 973be0f..209f9ff 100644 (file)
@@ -85,11 +85,13 @@ int GameLoop::Draw()
     FixCameraPosition();
 
     stage_->Draw();
-    //myself_->Draw();
+
     for (auto it = charmgr_->GetAll().begin(); it != charmgr_->GetAll().end(); ++it) {
         auto character = *it;
         character.second->Draw();
-    }
+       }
+
+    stage_->DrawAfter();
 
     return 0;
 }
index 326abcc..aafd789 100644 (file)
Binary files a/client/InputManager.cpp and b/client/InputManager.cpp differ
index d13dbc0..19aeb88 100644 (file)
Binary files a/client/ResourceManager.cpp and b/client/ResourceManager.cpp differ
index b45033c..44d62ba 100644 (file)
@@ -41,6 +41,7 @@
 #include <vector>
 #include <list>
 #include <map>
+#include <unordered_set>
 #include <deque>
 #include <queue>
 #include <array>
index a03001f..75cc097 100644 (file)
@@ -267,8 +267,12 @@ void UIList::Draw()
     SetDrawArea(absolute_x(), absolute_y(),
             absolute_x() + absolute_width(), absolute_y() + absolute_height());
     if (item_start_ >= 0) {
+               int index = 0;
         BOOST_FOREACH (UIBasePtr& item_ptr, items_) {
-            item_ptr->Draw();
+                       if (index >= item_start_ && index <=  item_end_) {
+                               item_ptr->Draw();
+                       }
+                       index++;
         }
     }
     SetDrawAreaFull();
index d76f644..0f8ac0d 100644 (file)
@@ -9,7 +9,7 @@
 
 #define MMO_VERSION_MAJOR 0
 #define MMO_VERSION_MINOR 3
-#define MMO_VERSION_REVISION 10
+#define MMO_VERSION_REVISION 11
 
 #define MMO_PROTOCOL_VERSION 2