luse.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Filename: luse.h
  2. // Created by: drose (13Jan99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef LUSE_H
  19. #define LUSE_H
  20. ////////////////////////////////////////////////////////////////////
  21. //
  22. // This file defines a number of vector-based classes that are
  23. // designed for specific uses. These all inherit from
  24. // LVecBase[234][fd], which is the base of all linear algebra vectors.
  25. //
  26. // LPoint[234][fd]
  27. //
  28. // This should be used to represent a specific point in space. It
  29. // inherits most properties from LVecBase.
  30. //
  31. // LVector[234][fd]
  32. //
  33. // This should be used to represent a vector, or a distance between
  34. // two points in space.
  35. //
  36. // The distinction between LPoint and LVector is worth emphasizing.
  37. // They differ in some subtle typing behavior (vector - vector =
  38. // vector, point + vector = point, point - point = vector) and also in
  39. // the way they are transformed when multiplied by a matrix (a point
  40. // gets the translation component of the matrix, while the vector does
  41. // not). Also, vector has length() and normalize() functions defined
  42. // for it, while point does not.
  43. //
  44. // LPoint and LVector should be used whenever the concept of "point"
  45. // or "vector" applies. If neither applies--for instance, if you are
  46. // storing a plane equation or some such nonsense--use the base class,
  47. // LVecBase.
  48. //
  49. // This file also typedefs the following:
  50. //
  51. // Vertex[fd]
  52. // Normal[fd]
  53. // TexCoord[fd]
  54. // Color[fd]
  55. // RGBColor[fd]
  56. //
  57. // These classes are typedefs of LPoint or LVector, as appropriate,
  58. // and are intended to store a specific kind of rendering attribute.
  59. // (Color is a four-component color; RGBColor is three-component.)
  60. //
  61. ////////////////////////////////////////////////////////////////////
  62. #include <pandabase.h>
  63. #include "lvec2_ops.h"
  64. #include "lvec3_ops.h"
  65. #include "lvec4_ops.h"
  66. #include "lmat_ops.h"
  67. #include "lmatrix.h"
  68. #include "lquaternion.h"
  69. #include "lrotation.h"
  70. #include "lorientation.h"
  71. #include "lcast_to.h"
  72. //ensure FLOATTYPE is set to float for macros are used outside of LINMATH
  73. #include "fltnames.h"
  74. // This macro defines the cast-to-another-numeric-type operator for
  75. // all of the things defined in this package. It works by virtue of
  76. // there being an appropriate lcast_to() template function defined for
  77. // each class.
  78. #define LCAST(numeric_type, object) lcast_to((numeric_type *)0, object)
  79. // Now we define some handy typedefs for these classes.
  80. typedef LPoint3f Vertexf;
  81. typedef LVector3f Normalf;
  82. typedef LPoint2f TexCoordf;
  83. typedef LVecBase4f Colorf;
  84. typedef LVecBase3f RGBColorf;
  85. typedef LPoint3d Vertexd;
  86. typedef LVector3d Normald;
  87. typedef LPoint2d TexCoordd;
  88. typedef LVecBase4d Colord;
  89. typedef LVecBase3d RGBColord;
  90. #endif