Impostor.h
上传用户:ghyvgy
上传日期:2009-05-26
资源大小:547k
文件大小:2k
源码类别:

其他游戏

开发平台:

Python

  1. /*
  2. s_p_oneil@hotmail.com
  3. Copyright (c) 2000, Sean O'Neil
  4. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions are met:
  7. * Redistributions of source code must retain the above copyright notice,
  8.   this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright notice,
  10.   this list of conditions and the following disclaimer in the documentation
  11.   and/or other materials provided with the distribution.
  12. * Neither the name of this project nor the names of its contributors
  13.   may be used to endorse or promote products derived from this software
  14.   without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  19. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef __Impostor_h__
  28. #define __Impostor_h__
  29. #include "Texture.h"
  30. class CImpostor : public C3DObject
  31. {
  32. protected:
  33. CVector m_vDimension; // The dimensions of the 3D bounding box for the object being represented
  34. CDoubleVector m_vCamera; // The camera position when the impostor was last generated
  35. CTexture m_tImpostor; // The impostor texture map
  36. int m_nResolution; // The chosen resolution for the impostor texture map
  37. CVector m_vUp; // The up vector used to generate the impostor texture
  38. CVector m_vOffset; // The offset from the original position to draw the billboard
  39. float m_fMinx, m_fMiny, m_fMaxx, m_fMaxy; // The dimensions of the 2D bounding box for the impostor billboard
  40. public:
  41. CImpostor() : C3DObject() {}
  42. float CalculateError(C3DObject *pCamera);
  43. bool IsInView(C3DObject *pCamera);
  44. void InitImpostorRender(C3DObject *pCamera);
  45. void FinishImpostorRender();
  46. void Draw(C3DObject *pCamera);
  47. };
  48. #endif // __Impostor_h__