CaptureWorld.htm 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>CaptureWorld</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. None.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. CaptureWorld 'captures' the properties (position, rotation, scale, alpha etc) of each entity in the 3D world. <br />
  21. <br />
  22. This is then used in conjunction with the <a class=small href=../3d_commands/RenderWorld.htm>RenderWorld</a> tween parameter in order to render an interpolated frame between the captured state of each entity and the current state of each entity. See the <a class=small href=../3d_commands/RenderWorld.htm>RenderWorld</a> docs for a full explanation of render tweening.
  23. <br>
  24. <br>
  25. See also: <a class=small href=RenderWorld.htm>RenderWorld</a>.
  26. </td>
  27. </tr>
  28. </table>
  29. <h1><a href=../3d_examples/CaptureWorld.bb>Example</a></h1>
  30. <table>
  31. <tr>
  32. <td>
  33. ; CaptureWorld and RenderWorld with tween. <br />
  34. <br />
  35. ; Left/Right arrow keys change tween. Escape quits. <br />
  36. <br />
  37. Const width = 640, height = 480 <br />
  38. Const KEY_ESC = 1, KEY_LEFT = 203, KEY_RIGHT = 205 <br />
  39. <br />
  40. Graphics3D 640, 480 <br />
  41. AmbientLight 50, 50, 50 <br />
  42. <br />
  43. c1 = CreateCone( ) <br />
  44. PositionEntity c1, -5, 0, 0 ; on the left side of the screen <br />
  45. ScaleEntity c1, 1, 3, 1 <br />
  46. EntityColor c1, 255, 0, 0 <br />
  47. <br />
  48. cam = CreateCamera() <br />
  49. PositionEntity cam, 0, 0, -50 <br />
  50. CameraZoom cam, 4 <br />
  51. <br />
  52. lt = CreateLight() : TurnEntity lt, 30, 40, 0 <br />
  53. <br />
  54. <br />
  55. c2 = CopyEntity( c1 ) <br />
  56. <br />
  57. CaptureWorld ; with c1 and c2 identically placed <br />
  58. <br />
  59. MoveEntity c2, 8, 0, 0 ; to the right side of the screen <br />
  60. TurnEntity c2, 0, 0, 90 ; and tilted <br />
  61. <br />
  62. tw# = 100 ; 100 * tween <br />
  63. <br />
  64. ; Interpolate between the pre-CaptureWorld ( tween = 0 ) <br />
  65. ; arrangement and the current one ( tween = 1 ). <br />
  66. <br />
  67. While Not KeyDown( KEY_ESC ) <br />
  68. <br />
  69. If KeyDown( KEY_LEFT ) Then tw = tw - 1 <br />
  70. If KeyDown( KEY_RIGHT ) Then tw = tw + 1 <br />
  71. RenderWorld tw / 100 <br />
  72. Text 250, 100, "tween = " + ( tw / 100 ) <br />
  73. Flip <br />
  74. <br />
  75. Wend <br />
  76. <br />
  77. End
  78. </td>
  79. </tr>
  80. </table>
  81. <br>
  82. <a target=_top href=../index.htm>Index</a><br>
  83. <br>
  84. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CaptureWorld&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  85. </html>