background

背景の操作に使用する。
背景マッピングレイヤの情報の取得、設定をするには background_layer クラスを参照する。


xshade
scene
background

メソッド一覧

append_background_layer 背景レイヤを追加する
background_layer 指定された番号の背景レイヤの参照を返す
calculate_background_color 背景の色を計算する
load 背景設定をファイルから読み込む
move_down_background_layer 指定インデックスの背景レイヤを指定階層分繰り下げる
move_up_background_layer 指定インデックスの背景レイヤを指定階層分繰り上げる
save 背景設定をファイルに保存する

プロパティ一覧

active_layer 選択されているレイヤの番号
lighting_intensity_factor 光源としての明るさの係数
lower_base_color 下半球の基本色
number_of_background_layers 背景レイヤの数
upper_base_color 上半球の基本色




メソッド詳細

append_background_layer

背景レイヤを追加する。
戻り値 :
  background_layerオブジェクト
参照 :
  background_layer

xshade.scene().background.append_background_layer()

background_layer

指定された番号の背景レイヤの参照を返す。
戻り値 :
  background_layerオブジェクト
引数 :
  int : 背景レイヤの番号 : 存在しないレイヤを指定した場合は例外が投げられる
参照 :
  number_of_background_layers 背景レイヤの数
  background_layer

#0番のbackground_layerオブジェクトの合成モードを出力する
print xshade.scene().background.background_layer(0).blend_mode 

calculate_background_color

指定の視線方向の先の背景色を計算する。
戻り値 :
  rgb
引数 :
  vec3 : 背景半球の中心からの視線方向。Y方向が正のとき上半球、負のとき下半球。

print xshade.scene().background.calculate_background_color([0.5, 1.0, 0.2])

load

背景設定をファイルから読み込む。
引数 :
  file_path : ファイル名
参照 :
  save

#背景設定にsample.shdbgrを読み込む
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(True, '*.shdbgr|shdbgr')
xshade.scene().background.load(file_path)

move_down_background_layer

指定インデックスの背景レイヤを指定階層分繰り下げる 。
引数 :
  int : 移動量
引数 :
  int : 背景レイヤのインデックス
参照 :
  move_up_background_layer

#インデックス2(内部インデックスは1)の背景レイヤを3階層分繰り下げる
xshade.scene().background.move_down_background_layer(3,1)


move_up_background_layer

指定インデックスの背景レイヤを指定階層分繰り上げる 。
引数 :
  int : 移動量
引数 :
  int : 背景レイヤのインデックス
参照 :
  move_down_background_layer

#インデックス2(内部インデックスは1)の背景レイヤを3階層分繰り上げる
xshade.scene().background.move_up_background_layer(3,1)

save

背景設定をファイルに保存する。
引数 :
  file_path : ファイル名
参照 :
  load

#背景設定をsample.shdbgrに保存する
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(False, '*.shdbgr|shdbgr')
xshade.scene().background.save(file_path)

プロパティ詳細

active_layer

選択されているレイヤの番号。

  • 取得
  • 設定

型 :
  int

print xshade.scene().background.active_layer

lighting_intensity_factor

光源としての明るさの係数。

  • 取得
  • 設定

型 :
  float

print xshade.scene().background.lighting_intensity_factor

lower_base_color

下半球の基本色。

  • 取得
  • 設定

型 :
  rgb

print xshade.scene().background.lower_base_color

number_of_background_layers

背景レイヤの数。

  • 取得
  • 設定

型 :
  int

print xshade.scene().background.number_of_background_layers

upper_base_color

上半球の基本色。

  • 取得
  • 設定

型 :
  rgb

print xshade.scene().background.upper_base_color