Nanashi-soft○プログラマ専用○PSSuite開発○
ModelConverter.exe モデルデータのファイル名
ModelConverter.exe YORI_COLLADA.dae
using Sce.Pss.HighLevel.Model;
public class AppMain { private static GraphicsContext graphics; static BasicModel model; //追加 static BasicProgram program; //追加3. Initializeに初期化を追加
public static void Initialize () { model = new BasicModel("/Application/YORI_COLLADA.mdx", 0) ; //追加 program = new BasicProgram(); //追加4. Mainの最後に終了処理を追加
public static void Main (string[] args) { Initialize (); while (loop) { SystemEvents.CheckEvents (); Update (); Render (); } SampleDraw.Term(); model.Dispose() ; //追加 program.Dispose() ; //追加 graphics.Dispose() ; }5. Renderに描画を追加
public static void Render () { Matrix4 proj = Matrix4.Perspective(FMath.Radians( 60.0f ), graphics.Screen.AspectRatio, 1.0f, 1000000.0f); //追加 Matrix4 view = Matrix4.LookAt(new Vector3(0.0f, 0.0f, 170.0f), new Vector3(0.0f, 70.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f)); //追加 BasicParameters parameters = program.Parameters; //追加 parameters.SetProjectionMatrix(ref proj); //追加 parameters.SetViewMatrix(ref view); //追加 graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height); //追加 // Clear the screen graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f); graphics.Clear(); model.Update(); //追加 model.Draw(graphics, program); //追加 // Present the screen graphics.SwapBuffers(); }
graphics.Enable(EnableMode.DepthTest); //追加
Matrix4 proj = Matrix4.Perspective(FMath.Radians(60.0f), graphics.Screen.AspectRatio, 1.0f, 1000000.0f);↓
Matrix4 proj = Matrix4.Perspective(FMath.Radians(60.0f), 16.0f/9.0f, 1.0f, 1000000.0f);
graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);↓
//画面比率設定 if(16.0f/9.0f > (float)graphics.Screen.Width/(float)graphics.Screen.Height){ //横に合わせる gameWidth = graphics.Screen.Width; gameHeight = graphics.Screen.Width * 9/16; if(gameHeight % 2 == 1){ gameHeight++; } gameLeft = 0; gameTop = (graphics.Screen.Height - gameHeight) / 2; }else{ //縦に合わせる gameWidth = graphics.Screen.Height * 16/9; if(gameWidth % 2 == 1){ gameWidth++; } gameHeight = graphics.Screen.Height; gameLeft = (graphics.Screen.Width - gameWidth) / 2; gameTop = 0; }スマフォでよくあるタイプの,横854×縦480ピクセルのディスプレイの場合。計算方法によっては1ドットずれるので注意する必要があります
graphics.SetViewport(gameLeft, gameTop, gameWidth, gameHeight);