Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

  1. local presentparams = {
  2. Windowed = true,
  3. SwapEffect = DX.D3DSWAPEFFECT_DISCARD,
  4. BackBufferFormat = DX.D3DFMT_A8R8G8B8,
  5. EnableAutoDepthStencil = true,
  6. AutoDepthStencilFormat = DX.D3DFMT_D16,
  7. BackBufferWidth = 800,
  8. BackBufferHeight = 600
  9. }
  10. local dev = Device(presentparams);
  11. //INIT the mesh
  12. local mesh = Mesh(dev);
  13. local perspective = Matrix();
  14. local view = Matrix();
  15. local world = Matrix();
  16. local eye = Vector3( 0.0, 3.0,-5.0 );
  17. local lookat = Vector3( 0.0, 0.0, 0.0 );
  18. local upVec = Vector3( 0.0, 1.0, 0.0 );
  19. view.CreateLookAtMatrix(eye,lookat,upVec);
  20. perspective.CreatePerspectiveFovMatrix(DX.D3DX_PI/4, 640.0/480, 1.0, 100.0)
  21. dev.SetTransform(DX.D3DTS_VIEW,view);
  22. dev.SetTransform(DX.D3DTS_PROJECTION,perspective);
  23. dev.SetRenderState(DX.D3DRS_ZENABLE,true);
  24. dev.SetRenderState(DX.D3DRS_AMBIENT,0xFFFFFFFF);
  25. //MAIN LOOP
  26. local rot = Vector3(0,0,0);
  27. while(DX.Update()) {
  28. dev.Clear(DX.D3DCLEAR_TARGET|DX.D3DCLEAR_ZBUFFER,0xFF0000FF);
  29. dev.BeginScene();
  30. rot.y += 0.1;
  31. world.RotateAngles(rot);
  32. dev.SetTransform(DX.D3DTS_WORLD,world);
  33. mesh.DrawSubset(0);
  34. //
  35. dev.EndScene();
  36. dev.Present();
  37. }