def calc_project_square_pos(self, cf: VmdCameraFrame, global_vec: MVector3D): # モデル座標系 model_view = self.create_model_view(cf) # プロジェクション座標系 projection_view = self.create_projection_view(cf) # viewport viewport_rect = MRect(0, 0, 16, 9) # プロジェクション座標位置 project_vec = global_vec.project(model_view, projection_view, viewport_rect) # プロジェクション座標正規位置 project_square_vec = MVector3D() project_square_vec.setX(project_vec.x() / 16) if cf.length <= 0: project_square_vec.setY((-project_vec.y() + 9) / 9) else: project_square_vec.setY(project_vec.y() / 9) project_square_vec.setZ(project_vec.z()) return project_square_vec
def calc_project_vec(self, cf: VmdCameraFrame, global_vec: MVector3D): # モデル座標系 model_view = self.create_model_view(cf) # プロジェクション座標系 projection_view = self.create_projection_view(cf) # viewport viewport_rect = MRect(0, 0, 16, 9) # プロジェクション座標位置 project_vec = global_vec.project(model_view, projection_view, viewport_rect) return project_vec