Geometry.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //========================================================================
  2. // Geometry.cpp : Collection of code for 3D math and 3D shapes
  3. //
  4. //
  5. // Part of the GameCode4 Application
  6. //
  7. // GameCode4 is the sample application that encapsulates much of the source code
  8. // discussed in "Game Coding Complete - 4th Edition" by Mike McShaffry and David
  9. // "Rez" Graham, published by Charles River Media.
  10. // ISBN-10: 1133776574 | ISBN-13: 978-1133776574
  11. //
  12. // If this source code has found it's way to you, and you think it has helped you
  13. // in any way, do the authors a favor and buy a new copy of the book - there are
  14. // detailed explanations in it that compliment this code well. Buy a copy at Amazon.com
  15. // by clicking here:
  16. // http://www.amazon.com/gp/product/1133776574/ref=olp_product_details?ie=UTF8&me=&seller=
  17. //
  18. // There's a companion web site at http://www.mcshaffry.com/GameCode/
  19. //
  20. // The source code is managed and maintained through Google Code:
  21. // http://code.google.com/p/gamecode4/
  22. //
  23. // (c) Copyright 2012 Michael L. McShaffry and David Graham
  24. //
  25. // This program is free software; you can redistribute it and/or
  26. // modify it under the terms of the GNU Lesser GPL v3
  27. // as published by the Free Software Foundation.
  28. //
  29. // This program is distributed in the hope that it will be useful,
  30. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  32. // http://www.gnu.org/licenses/lgpl-3.0.txt for more details.
  33. //
  34. // You should have received a copy of the GNU Lesser GPL v3
  35. // along with this program; if not, write to the Free Software
  36. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  37. //
  38. //========================================================================
  39. #include "../Unix/GameCodeStd.h"
  40. #include "Geometry.h"
  41. Frustum::Frustum()
  42. {
  43. m_Fov = GCC_PI/4.0f; // default field of view is 90 degrees
  44. m_Aspect = 1.0f; // default aspect ratio is 1:1
  45. m_Near = 1.0f; // default near clip plane is 1m away from the camera
  46. m_Far = 100.0f; // default far clip plane is 100m away from the camera
  47. }
  48. //
  49. // Frustum::Inside - Chapter 14, page 477
  50. //
  51. bool Frustum::Inside(const glm::vec3 &point) const
  52. {
  53. // TODO - implement
  54. return false;
  55. }
  56. //
  57. // Frustum::Inside - Chapter 14, page 477
  58. //
  59. bool Frustum::Inside(const glm::vec3 &point, const float radius) const
  60. {
  61. // TODO - implement
  62. return false;
  63. }
  64. //
  65. // Frustum::Init - Chapter 14, page 477
  66. //
  67. void Frustum::Init(const float fov, const float aspect, const float nearClip, const float farClip)
  68. {
  69. m_Fov = fov;
  70. m_Aspect = aspect;
  71. m_Near = nearClip;
  72. m_Far = farClip;
  73. // TODO - generate frustum mesh so we can render for debugging
  74. }
  75. //
  76. // Frustum::Render - not described in the 4th edition
  77. //
  78. void Frustum::Render()
  79. {
  80. // TODO - implement
  81. }