Komak57

Untitled

Jan 31st, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.73 KB | None | 0 0
  1.         public void Render()
  2.         {
  3.             if (player.model == null)
  4.             {
  5.                 // player not loaded
  6.                 player.model = new Model();
  7.                 //player.model.LoadCube(0.5f);
  8.                 player.model.SetSize(0, 68, 0);
  9.                 //player.model.LoadModel(@"./Cube.obj");
  10.                 player.model.LoadModel(@"./Xemnas.obj");
  11.                 player.dir.yaw = 180;
  12.                 //player.model.LoadTri();
  13.                 System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss+ff") + "] <System>: Player Loaded");
  14.             }
  15.             if (World == null)
  16.             {
  17.                 // world not loaded
  18.                 World = new Model();
  19.                 //World.LoadModel(@"C:\Users\James\Documents\Models\Room.obj");
  20.                 //World.LoadInvCube(10f);
  21.                 World.LoadModel(@"./br.obj");
  22.                 //World.LoadModel(@"./Xemnas.obj");
  23.                 System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss+ff") + "] <System>: World Loaded");
  24.             }
  25.  
  26.             // code not yet implemented
  27.             Vertex campos = player.GetCamPos();
  28.  
  29.  
  30.             // draw world at coordinates
  31.             Gl.glLoadIdentity();
  32.  
  33.             Glu.gluLookAt(
  34.                -campos.X, (player.size) - player.pos.Y, -campos.Z, /* camera position */
  35.                 -player.pos.X, (player.size * 2 / 3) - player.pos.Y, -player.pos.Z, /* look at the origin */
  36.                0, 1, 0); /* positive Y up vector */
  37.             World.draw();
  38.  
  39.             // draw NPC's (stress test)
  40.             foreach (Player npc in npcs)
  41.             {
  42.                 if (npc.model == null)
  43.                 {
  44.                     // load model
  45.                     npc.model = new Model();
  46.                     npc.model.SetSize(0, 68, 0);
  47.                     npc.model.LoadModel(@"./Xemnas.obj");
  48.                 }
  49.                 Gl.glLoadIdentity();
  50.                 Vertex tcam = npc.GetCamPos();
  51.                 Glu.gluLookAt(
  52.                    tcam.X - npc.pos.X, (npc.size), tcam.Z - npc.pos.Z, /* camera position */
  53.                     0, (npc.size * 2 / 3) - 0, 0, /* look at the origin */
  54.                    0, 1, 0); /* positive Y up vector */
  55.                 npc.model.draw();
  56.             }
  57.  
  58.             // draw player model in center
  59.             Gl.glLoadIdentity();
  60.  
  61.             Glu.gluLookAt(
  62.                campos.X-player.pos.X, (player.size), campos.Z-player.pos.Z, /* camera position */
  63.                 0, (player.size * 2 / 3) - 0, 0, /* look at the origin */
  64.                0, 1, 0); /* positive Y up vector */
  65.  
  66.  
  67.             Gl.glRotated(player.dir.yaw, 0, 1, 0);
  68.             player.model.draw();
  69.  
  70.             Gl.glFinish();
  71.         }
Advertisement
Add Comment
Please, Sign In to add comment