wavefront.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef WAVEFRONT_OBJ_H
  2. #define WAVEFRONT_OBJ_H
  3. /*
  4. wavefront.h : A very small code snippet to read a Wavefront OBJ file into memory.
  5. */
  6. /*!
  7. **
  8. ** Copyright (c) 2009 by John W. Ratcliff mailto:[email protected]
  9. **
  10. ** Portions of this source has been released with the PhysXViewer application, as well as
  11. ** Rocket, CreateDynamics, ODF, and as a number of sample code snippets.
  12. **
  13. ** If you find this code useful or you are feeling particularily generous I would
  14. ** ask that you please go to http://www.amillionpixels.us and make a donation
  15. ** to Troy DeMolay.
  16. **
  17. ** DeMolay is a youth group for young men between the ages of 12 and 21.
  18. ** It teaches strong moral principles, as well as leadership skills and
  19. ** public speaking. The donations page uses the 'pay for pixels' paradigm
  20. ** where, in this case, a pixel is only a single penny. Donations can be
  21. ** made for as small as $4 or as high as a $100 block. Each person who donates
  22. ** will get a link to their own site as well as acknowledgement on the
  23. ** donations blog located here http://www.amillionpixels.blogspot.com/
  24. **
  25. ** If you wish to contact me you can use the following methods:
  26. **
  27. ** Skype ID: jratcliff63367
  28. ** Yahoo: jratcliff63367
  29. ** AOL: jratcliff1961
  30. ** email: [email protected]
  31. **
  32. **
  33. ** The MIT license:
  34. **
  35. ** Permission is hereby granted, free of charge, to any person obtaining a copy
  36. ** of this software and associated documentation files (the "Software"), to deal
  37. ** in the Software without restriction, including without limitation the rights
  38. ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39. ** copies of the Software, and to permit persons to whom the Software is furnished
  40. ** to do so, subject to the following conditions:
  41. **
  42. ** The above copyright notice and this permission notice shall be included in all
  43. ** copies or substantial portions of the Software.
  44. ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45. ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46. ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47. ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  48. ** WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  49. ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  50. */
  51. #include "NvUserMemAlloc.h"
  52. class WavefrontObj
  53. {
  54. public:
  55. WavefrontObj(void);
  56. ~WavefrontObj(void);
  57. NxU32 loadObj(const char *fname, bool textured); // load a wavefront obj returns number of triangles that were loaded. Data is persists until the class is destructed.
  58. NxU32 mVertexCount;
  59. NxU32 mTriCount;
  60. NxU32 *mIndices;
  61. NxF32 *mVertices;
  62. NxF32 *mTexCoords;
  63. };
  64. #endif