Beispiel #1
0
/// 影つけ用の深度マップを焼き付ける画像を初期化
static int create_depthmap_buffer()
{
	int saved1 = GetDrawValidFloatTypeGraphCreateFlag();
	int saved2 = GetCreateDrawValidGraphChannelNum();
	int saved3 = GetCreateGraphColorBitDepth();

	SetDrawValidFloatTypeGraphCreateFlag(TRUE);
	SetCreateDrawValidGraphChannelNum(1);
	SetCreateGraphColorBitDepth(16);

	int id = MakeScreen(8192, 8192, FALSE);

	SetDrawValidFloatTypeGraphCreateFlag(saved1);
	SetCreateDrawValidGraphChannelNum(saved2);
	SetCreateGraphColorBitDepth(saved3);

	return id;
}
// ステージの初期化処理
void Stage_Initialize( void )
{
	// ステージモデルの読み込み
	stg.ModelHandle = MV1LoadModel( "ColTestStage.mqo" ) ;

	// モデル全体のコリジョン情報のセットアップ
	MV1SetupCollInfo( stg.ModelHandle, -1 ) ;


	// 作成する画像のフォーマットを不動小数点型で1チャンネル、16ビットにする
	SetDrawValidFloatTypeGraphCreateFlag( TRUE ) ;
	SetCreateDrawValidGraphChannelNum( 1 ) ;
	SetCreateGraphColorBitDepth( 16 ) ;

	// 影用深度記録画像の作成
	DepthBufferGraphHandle = MakeScreen( 4096, 4096, FALSE ) ;

	// 設定を元に戻す
	SetDrawValidFloatTypeGraphCreateFlag( FALSE ) ;
	SetCreateDrawValidGraphChannelNum( 4 ) ;
	SetCreateGraphColorBitDepth( 32 ) ;

	// 深度記録画像描画用の頂点シェーダーを読み込む
	Skin4_DepthShadow_Step1_VertexShader = LoadVertexShader( "SkinMesh4_DepthShadow_Step1VS.vso" ) ;
	Normal_DepthShadow_Step1_VertexShader = LoadVertexShader( "NormalMesh_DepthShadow_Step1VS.vso" ) ;

	// 深度記録画像描画用のピクセルシェーダーを読み込む
	DepthShadow_Step1_PixelShader = LoadPixelShader( "DepthShadow_Step1PS.pso" ) ;

	// 深度記録画像を使ったディレクショナルライト一つの描画用頂点シェーダーを読み込む
	Skin4_DirLight_DepthShadow_Step2_VertexShader = LoadVertexShader( "SkinMesh4_DirLight_DepthShadow_Step2VS.vso" ) ;
	Normal_DirLight_DepthShadow_Step2_VertexShader = LoadVertexShader( "NormalMesh_DirLight_DepthShadow_Step2VS.vso" ) ;

	// 深度記録画像を使ったディレクショナルライト一つの描画用ピクセルシェーダーを読み込む
	DirLight_DepthShadow_Step2_PixelShader = LoadPixelShader( "DirLight_DepthShadow_Step2PS.pso" ) ;
}