@@ -28,14 +28,16 @@ namespace paxs {
2828
2929 // モデルデータをロード
3030 s3d::Model sekishitsu_model;
31+ s3d::Texture sky;
3132
3233 s3d::MSRenderTexture renderTexture{
33- s3d::Size{500 , 300 }/* s3d::Scene::Size()*/ ,
34+ s3d::Size{800 , 500 }/* s3d::Scene::Size()*/ ,
3435 s3d::TextureFormat::R8G8B8A8_Unorm_SRGB,
3536 s3d::HasDepth::Yes };
3637
3738 s3d::DebugCamera3D camera{
38- s3d::Size{500 ,300 }/* s3d::Graphics3D::GetRenderTargetSize()*/ ,
39+ // s3d::Size{500,300},
40+ s3d::Graphics3D::GetRenderTargetSize (),
3941 40.0 / 180.0 * 3.1416 ,
4042 s3d::Vec3{ 0 , 3 , -16 } };
4143
@@ -47,7 +49,7 @@ namespace paxs {
4749
4850 // モデルデータをロード
4951 sekishitsu_model = s3d::Model{ U" ./../../../../../Data/3DModel/KofunOBJ/Model/Sekishitsu/KamoKitaKofun/KamoKitaKofun.obj" };
50-
52+ sky = s3d::Texture (s3d::Image{ U" ./../../../../../Data/360DegreePhoto/Stone2.jpg " }. mirror ());
5153 // モデルに付随するテクスチャをアセット管理に登録
5254 s3d::Model::RegisterDiffuseTextures (sekishitsu_model, s3d::TextureDesc::MippedSRGB);
5355
@@ -63,11 +65,38 @@ namespace paxs {
6365 ++rot;
6466 if (rot >= 360 ) rot = 0 ;
6567 // const s3d::ScopedRenderStates3D renderStates{ s3d::BlendState::OpaqueAlphaToCoverage, s3d::RasterizerState::SolidCullNone };
66- sekishitsu_model.draw (s3d::Vec3{ 0 , 0 , 0 }, s3d::Quaternion::RotateY (rot / 180.0 * 3.1416 ));
68+ // sekishitsu_model.draw(s3d::Vec3{ 0, 0, 0 }, s3d::Quaternion::RotateY(rot / 180.0 * 3.1416));
69+
70+ {
71+ // 太陽光の影響を与えないようにする
72+ s3d::Graphics3D::SetGlobalAmbientColor (s3d::ColorF{ 1.0 });
73+ s3d::Graphics3D::SetSunColor (s3d::ColorF{ 0.0 });
74+
75+ // カリングを無効にする
76+ const s3d::ScopedRenderStates3D rs{ s3d::RasterizerState::SolidCullNone };
77+
78+ static double x = 0.0 ;
79+ static double y = 0.0 ;
80+ if (s3d::KeyLeft.pressed ()) x += 1.0 ;
81+ if (s3d::KeyRight.pressed ()) x -= 1.0 ;
82+ if (s3d::KeyDown.pressed ()) y -= 1.0 ;
83+ if (s3d::KeyUp.pressed ()) y += 1.0 ;
84+ if (x < 0.0 ) x += 360.0 ;
85+ if (y < 0.0 ) y += 360.0 ;
86+ if (x >= 360.0 ) x -= 360.0 ;
87+ if (y >= 360.0 ) y -= 360.0 ;
88+ s3d::Sphere{ 0 , 2 , /* -14.2*/ -15.5 , 2 }.draw (
89+ // s3d::Quaternion::RotateY(rot / 180.0 * 3.1416) *
90+ // s3d::Quaternion::RotateX(rot / 180.0 * 3.1416)
91+ s3d::Quaternion::RotateY (x / 180.0 * 3.1416 ) *
92+ s3d::Quaternion::RotateX (y / 180.0 * 3.1416 )
93+ , sky);
94+ }
95+
6796 // RenderTexture を 2D シーンに描画
6897 s3d::Graphics3D::Flush ();
6998 renderTexture.resolve ();
70- renderTexture.draw ();
99+ renderTexture.draw (200 , 200 );
71100 }
72101
73102 };
0 commit comments