Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Render()
- {
- if (player.model == null)
- {
- // player not loaded
- player.model = new Model();
- //player.model.LoadCube(0.5f);
- player.model.SetSize(0, 68, 0);
- //player.model.LoadModel(@"./Cube.obj");
- player.model.LoadModel(@"./Xemnas.obj");
- player.dir.yaw = 180;
- //player.model.LoadTri();
- System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss+ff") + "] <System>: Player Loaded");
- }
- if (World == null)
- {
- // world not loaded
- World = new Model();
- //World.LoadModel(@"C:\Users\James\Documents\Models\Room.obj");
- //World.LoadInvCube(10f);
- World.LoadModel(@"./br.obj");
- //World.LoadModel(@"./Xemnas.obj");
- System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss+ff") + "] <System>: World Loaded");
- }
- // code not yet implemented
- Vertex campos = player.GetCamPos();
- // draw world at coordinates
- Gl.glLoadIdentity();
- Glu.gluLookAt(
- -campos.X, (player.size) - player.pos.Y, -campos.Z, /* camera position */
- -player.pos.X, (player.size * 2 / 3) - player.pos.Y, -player.pos.Z, /* look at the origin */
- 0, 1, 0); /* positive Y up vector */
- World.draw();
- // draw NPC's (stress test)
- foreach (Player npc in npcs)
- {
- if (npc.model == null)
- {
- // load model
- npc.model = new Model();
- npc.model.SetSize(0, 68, 0);
- npc.model.LoadModel(@"./Xemnas.obj");
- }
- Gl.glLoadIdentity();
- Vertex tcam = npc.GetCamPos();
- Glu.gluLookAt(
- tcam.X - npc.pos.X, (npc.size), tcam.Z - npc.pos.Z, /* camera position */
- 0, (npc.size * 2 / 3) - 0, 0, /* look at the origin */
- 0, 1, 0); /* positive Y up vector */
- npc.model.draw();
- }
- // draw player model in center
- Gl.glLoadIdentity();
- Glu.gluLookAt(
- campos.X-player.pos.X, (player.size), campos.Z-player.pos.Z, /* camera position */
- 0, (player.size * 2 / 3) - 0, 0, /* look at the origin */
- 0, 1, 0); /* positive Y up vector */
- Gl.glRotated(player.dir.yaw, 0, 1, 0);
- player.model.draw();
- Gl.glFinish();
- }
Advertisement
Add Comment
Please, Sign In to add comment