KisaragiLibrary
 
読み取り中…
検索中…
一致する文字列を見つけられません
Kisaragi_Lib::RenderSystem クラス

描画処理を行うシステム [詳解]

#include <View.hpp>

公開メンバ関数

void Rendering ()
 

非公開メンバ関数

void Drawing (ViewComponentBase *_view)
 

詳解

描画処理を行うシステム

関数詳解

◆ Drawing()

void Kisaragi_Lib::RenderSystem::Drawing ( ViewComponentBase * _view)
private
23 {
24 auto cam = _view->GetInput();
25
26 //TODO camレイヤー対応
27 LayerFacade& layerFacade = GetLayerFacade();
28
29 auto layers = layerFacade.Layers();
30
31
32 for (auto& layerName : layerFacade.LayerName())
33 {
34 if (cam->FindExcludedLayer(layers[layerName]))
35 {
36 //除外レイヤーなら飛ばす.
37 continue;
38 }
39
40 for (auto& imgMap : layers[layerName]->Queue())
41 {
42 auto img = imgMap.second;
43
44
45 //TODO 逆行列を使う都合上回転を扱って移動すると逆回転の平行移動をしてしまうため修正求む.
46 Matrix2D camMat = cam->GetCamMatrix();
47 Matrix2D objMat = img->GameObj()->transform;
48 Matrix2D viewMat = _view->GameObj()->transform;
49
50
51 //Point2D<double> viewPoint = _view->GameObj()->transform.position; //viewの中心
52 //Point2D<double> camPoint = camMat.Position(); //camの中心
53 //Point2D<double> objPoint = objMat.Position(); //objの中心
54
55 //Vector2D<double> o_c_distance = Vector2D<double>::PointToVector(objPoint, camPoint); //obj -> cam の距離ベクトル
56 //o_c_distance = o_c_distance - (o_c_distance * Scale2D<double>(camMat.Scale().x, camMat.Scale().y)); //距離を拡大倍.
57
58 //Vector2D<double> c_v_distance = Vector2D<double>::PointToVector(camPoint, viewPoint); //c -> v の距離ベクトル
59
60 //auto rota = Math::DegreeToRadian(objMat.Rotation()); //自身の回転を保存する.
61 //Scale2D<double> scale = objMat.Scale(); //自身のサイズを保存する.
62
63
64 //親の回転もここで打ち消す.
65 //objMat *= Matrix2D::CreateInverseRotaMatrix(rota) //自身の回転を打ち消す
66 // * Matrix2D::CreateInverseScaleMatrix(scale) //拡大打消し
67 // * Matrix2D::CreateMoveMatrix(c_v_distance.x, c_v_distance.y) //cam->view
68 // * Matrix2D::CreateMoveMatrix(o_c_distance.x, o_c_distance.y) //ズーム分距離を調整する.
69 // * Matrix2D::CreateRotaMatrix(rota) //回転を戻す
70 // * Matrix2D::CreateScaleMatrix(scale) //拡大を戻す
71 // * Matrix2D::CreateRotaMatrix(camMat.Rotation()) //cam rota
72 // * Matrix2D::CreateScaleMatrix(camMat.Scale().x, camMat.Scale().y);
73 ////TODO * viewmat
74
75 //img->Draw(objMat);
76
77 // 新版
78
79 Matrix2D drawMat{ IDENTITY_MATRIX };
80
81
82 //view * cma * obj だと、実行順序でバグるため省略不可能.
83 //左 : 子 <- <- 右 : 親
84 drawMat *=
85 viewMat.CreateScaleMatrix() * viewMat.CreateRotaMatrix() * viewMat.CreateMoveMatrix()
86 * camMat.CreateScaleMatrix() * camMat.CreateRotaMatrix() * camMat.CreateMoveMatrix()
87 * objMat;
88
89 //描画処理.
90 img->Draw(drawMat);
91 }
92
93 }
94
95
96 }
vector< string > LayerName()
レイヤー名を取得する
Definition ImgComponent.cpp:91
map< string, Layer * > Layers()
Definition ImgComponent.hpp:321
LayerFacade & GetLayerFacade()
Definition ImgComponent.cpp:30
@ IDENTITY_MATRIX
Definition Matrix2D.hpp:19

参照元 Rendering().

◆ Rendering()

void Kisaragi_Lib::RenderSystem::Rendering ( )
99 {
100 ClearDrawScreen(); //画面をクリアする
101
102 for (auto& view : (std::vector<ViewComponentBase*>)viewContainer)
103 {
104 //描画前処理.
105 view->BeginRender();
106
107 //描画
108 Drawing(view);
109
110 //描画処理(Collision用)
112
113 //描画後処理.
114 view->EndRender();
115 }
116
117
118 ScreenFlip(); //裏画面の内容を表画面に反映
119
120 }
static void Render(ViewComponentBase *_view)
Definition BoxCollisionFacade.cpp:17
void Drawing(ViewComponentBase *_view)
Definition View.cpp:22
static OrderedMap< string, ViewComponentBase * > viewContainer
Definition View.cpp:9

このクラス詳解は次のファイルから抽出されました: