camera

カメラの操作に使用する。
シーンには複数のカメラを設定することができるが、cameraクラスはその内の一個のカメラを表す。


xshade
scene
camera

メソッド一覧

load カメラ設定をファイルから読み込む
memorize_as_camera 現在のカメラの視野からカメラオブジェクトを作成する
memorize_as_line_object 現在のカメラの視線から線形状を作成する
memorize_as_metacamera 現在のカメラの視野からメタカメラを作成する
memorize_as_spotlight 現在のカメラの視野からスポットライトを作成する
restore_from_default カメラを初期設定状態に戻す
restore_from_object 引数で与えられた形状をカメラ設定に適用する
rotate_eye 視点をY軸回転させる
save カメラ設定をファイルに保存する

プロパティ一覧

bank 傾き
camera_mode カメラのモード
camera_object カメラ形状オブジェクト
correction あおり補正
distant_camera 平行投影のオン/オフ
eye 視点の位置
film_rise フィルムライズ
film_shift フィルムシフト
film_swing フィルムスイング
film_tilt フィルムティルト
focus 被写界深度のフォーカス
focus_point 被写界深度の焦点の位置
lens_swing レンズスイング
lens_tilt レンズティルト
rise ライズ
scale スケール
shift シフト
target 注視点の位置
world_to_perspective_matrix ワールド座標系からカメラの透視座標系に変換するマトリクス
world_to_view_matrix ワールド座標系からカメラのビュー座標系に変換するマトリクス
zoom 焦点距離




メソッド詳細

load

カメラ設定をファイルから読み込む。
引数 :
  file_path
参照 :
  save

#カメラ設定を読み込む
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(True, '*.shdcmr|shdcmr')
xshade.scene().camera.load(file_path)

memorize_as_camera

現在のカメラの視野からカメラオブジェクトを作成する。

xshade.scene().camera.memorize_as_camera()

memorize_as_line_object

現在のカメラの視線から線形状を作成する。

xshade.scene().camera.memorize_as_line_object()

memorize_as_metacamera

現在のカメラの視野からメタカメラを作成する。

xshade.scene().camera.memorize_as_metacamera()

memorize_as_spotlight

現在のカメラの視野からスポットライトを作成する

xshade.scene().camera.memorize_as_spotlight()

restore_from_default

カメラを初期設定状態に戻す

xshade.scene().camera.restore_from_default()

restore_from_object

引数で与えられた形状をカメラ設定に適用する。
引数 :
  shapeオブジェクト : 線形状、スポットライト

#選択形状(線形状orスポットライト)をカメラ設定に適用する
obj = xshade.scene().active_shape()
xshade.scene().camera.restore_from_object(obj)

rotate_eye

視点をY軸回転させる。
型 :
  radian

#カメラをY軸で90度回転させる
rad = 3.141592 / 180 * 90
xshade.scene().camera.rotate_eye(rad) 

save

カメラ設定をファイルに保存する。
引数 :
  file_path
参照 :
  load

#カメラ設定を保存する
dialog = xshade.create_dialog_with_uuid()
file_path = dialog.ask_path(False, '*.shdcmr|shdcmr')
xshade.scene().camera.save(file_path)

プロパティ詳細

bank

傾き。

  • 取得
  • 設定

型 :
  radian : カメラウインドウではdegree(度単位)で表示される。

print xshade.scene().camera.bank

camera_mode

カメラのモード。

  • 取得
  • 設定

型 :
  int : 0 : 通常、1 : 上面図、2 : フリー

print xshade.scene().camera.camera_mode

camera_object

カメラ形状オブジェクト。

  • 取得
  • 設定

メタカメラ以外でカメラウインドで現在選択されているカメラオブジェクト。

#選択されているカメラオブジェクトの名称を出力する
print xshade.scene().camera.camera_object.name

correction

あおり補正。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.correction

distant_camera

平行投影のオン/オフ。

  • 取得
  • 設定

型 :
  bool

print xshade.scene().camera.distant_camera

eye

視点の位置。

  • 取得
  • 設定

型 :
  vec3

print xshade.scene().camera.eye

film_rise

フィルムライズ。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.film_rise

film_shift

フィルムシフト。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.film_shift

film_swing

フィルムスイング。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.film_swing

film_tilt

フィルムティルト。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.film_tilt

focus

被写界深度のフォーカス。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.focus

focus_point

被写界深度の焦点の位置。

  • 取得
  • 設定

型 :
  vec3

print xshade.scene().camera.focus_point

lens_swing

レンズスイング。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.lens_swing

lens_tilt

レンズティルト。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.lens_tilt

rise

ライズ。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.rise

scale

スケール。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.scale

shift

シフト。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.shift

target

注視点の位置。

  • 取得
  • 設定

型 :
  vec3

print xshade.scene().camera.target

world_to_perspective_matrix

ワールド座標系からカメラの透視座標系に変換するマトリクス。

  • 取得
  • 設定

型 :
  mat4
カメラの位置や向き、傾きを考慮してワールド座標系を回転、移動、正規化させるマトリクス視点が原点に一致し、視線の向きがZ軸となる。
視野内の座標について、縦横を-1.0から1.0 、奥行きを0.0から1.0の範囲に収まるよう正規化するこの範囲外の座標は視野外となるため、クリッピングはこの座標系で行う。

print xshade.scene().camera.world_to_perspective_matrix

world_to_view_matrix

ワールド座標系からカメラのビュー座標系に変換するマトリクス。

  • 取得
  • 設定

型 :
  mat4
カメラの位置や向き、傾きを考慮してワールド座標系を回転、移動させるマトリクス視点が原点に一致し、視線の向きがZ軸となる。
透視変換はかからない。

print xshade.scene().camera.world_to_view_matrix

zoom

焦点距離。

  • 取得
  • 設定

型 :
  float

print xshade.scene().camera.zoom