ogl3d.h
上传用户:lbr_007
上传日期:2019-05-31
资源大小:282k
文件大小:2k
- // ogl3d.h
- //
- #ifndef OGL3D_INCLUDE_H_
- #define OGL3D_INCLUDE_H_
- #include <glview.h>
- #include <dibsect.h>
- class OGL3D : public GLView3D {
- public:
- enum OGL3DDrawModes {
- DrawLines,
- DrawTriangles
- };
- private: // initialization
- void InitOGL3D(void)
- {
- m_model_built = 0;
- m_draw_mode = DrawTriangles;
- m_have_texture = 0;
- }
- protected: // data
- int m_model_built;
- int m_have_texture;
- OGL3DDrawModes m_draw_mode;
- DIBSection m_texture_dib;
- protected: // methods
- void GenTexture(DIBSection& dib);
- public:
- OGL3D(void);
- ~OGL3D(void);
- virtual void RenderPrimaryImage(void);
- void RenderSpecialEffects(void);
- void RenderEarthImage(void);
- void SetDrawingMode(OGL3DDrawModes mode){ m_draw_mode = mode;}
- OGL3DDrawModes GetDrawingMode(void)const{ return m_draw_mode;}
- void RebuildModel(void){ m_model_built = 0;}
- int HaveTexture(void)const{ return m_have_texture;}
- void SetTexture(DIBSection& dib);
- DIBSection * GetTextureDIB(void){ return &m_texture_dib;}
- void RenderFunction(void);
- void RenderPath(void);
- void RenderPlane(void);
- void RenderGlobe();
- void RenderCylinder();
- void RenderCone();
- void RenderRectangle();
- };
- class SolarSystem3D : public GLView3D {
- protected:
- DIBSection m_earth_texture;
- DIBSection m_jupiter_texture;
- DIBSection m_mars_texture;
- DIBSection m_saturn_texture;
- int m_model_built;
- OGL3D::OGL3DDrawModes m_draw_mode;
- protected:
- void RenderSun(void);
- void RenderMercury(void);
- void RenderVenus(void);
- void RenderEarth(void);
- void RenderMars(void);
- void RenderJupiter(void);
- void RenderSaturn(void);
- void RenderUranus(void);
- void RenderNeptune(void);
- void RenderPluto(void);
- void RenderTexturedSphere(DIBSection& dib, double radius);
- void RenderColoredSphere(COLORREF cr, double radius);
- void GenTexture(DIBSection& dib, DIBSection& texture_dib);
- public:
- SolarSystem3D(void);
- ~SolarSystem3D(void);
- virtual void RenderPrimaryImage(void);
- void RebuildModel(void){ m_model_built = 0;}
- void SetDrawingMode(OGL3D::OGL3DDrawModes mode){ m_draw_mode = mode;}
- OGL3D::OGL3DDrawModes GetDrawingMode(void)const{ return m_draw_mode;}
- int PickPlanet(int x, int y, CString& msg);
- };
- #endif