⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clothsimulationview.h

📁 本程序描述的是一个三维织物动感模拟系统。计算机生成真实感服装被列入计算机图形学亟需解决的三大问题之一。
💻 H
字号:
// ClothSimulationView.h : interface of the CClothSimulationView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MYSDOPENGLVIEW_H__75C5AAEC_37B0_4A8B_9132_9A0C663F6DDC__INCLUDED_)
#define AFX_MYSDOPENGLVIEW_H__75C5AAEC_37B0_4A8B_9132_9A0C663F6DDC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Skeleton.h"
#include "PhysEnv.h"
#define OGL_AXIS_DLIST		1		// 显示列表ID
#define ROTATE_SPEED		1.0		// 旋转速度
class CClothSimulationView : public CView
{
protected: // create from serialization only
	CClothSimulationView();
	DECLARE_DYNCREATE(CClothSimulationView)

// Attributes
public:
	CClothSimulationDoc* GetDocument();
	HDC m_hDC;
	HGLRC m_hRC;
	CPoint m_mousepos;
	float m_Base_Rot_X,m_Base_Rot_Y,m_Base_Rot_Z;
	float m_Grab_Rot_X,m_Grab_Rot_Y,m_Grab_Rot_Z;
	float m_Grab_Trans_X,m_Grab_Trans_Y,m_Grab_Trans_Z;
	BOOL m_DrawGeometry,m_SimRunning;
	int m_curVisual;
	float m_MorphPos;
	DWORD m_StartTime;
	DWORD m_FrameCnt;
	int		m_TimeIterations;
	BOOL	m_UseFixedTimeStep;
	float	m_MaxTimeStep;
	float	m_LastTime;

	CPhysEnv		m_PhysEnv;
// Operations
public:
	BOOL	SetupPixelFormat(HDC hdc);
	GLvoid	RenderScene(GLvoid);

	GLvoid	initializeGL(GLsizei width, GLsizei height);
	void	HandleKeyUp(UINT nChar);
	GLvoid  morphModel(t_Bone *curBone);
	GLvoid	LoadBoneTexture(t_Bone *curBone);
	void	NewSystem();
	void	LoadFile(CString file1,CString baseName,CString ext);
	void	SaveFile(CString file1,CString baseName);
	void	CreateClothPatch();
	void	RunSim();
	float	GetTime( void );
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CClothSimulationView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CClothSimulationView();

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	t_Bone	m_Skeleton,*m_CurBone;
	int		m_PickX, m_PickY;
	int		m_ScreenWidth;
	int		m_ScreenHeight;
// Generated message map functions
protected:
	//{{AFX_MSG(CClothSimulationView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnFileCreateclothpatch();
	afx_msg void OnFileOpen();
	afx_msg void OnFileSave();
	afx_msg void OnFileNewsystem();
	afx_msg void OnViewShowsprings();
	afx_msg void OnUpdateViewShowsprings(CCmdUI* pCmdUI);
	afx_msg void OnViewShowstructural();
	afx_msg void OnUpdateViewShowstructural(CCmdUI* pCmdUI);
	afx_msg void OnViewShowshear();
	afx_msg void OnUpdateViewShowshear(CCmdUI* pCmdUI);
	afx_msg void OnViewShowbend();
	afx_msg void OnUpdateViewShowbend(CCmdUI* pCmdUI);
	afx_msg void OnViewShowgeometry();
	afx_msg void OnUpdateViewShowgeometry(CCmdUI* pCmdUI);
	afx_msg void OnViewShowvertices();
	afx_msg void OnUpdateViewShowvertices(CCmdUI* pCmdUI);
	afx_msg void OnViewCollisionactive();
	afx_msg void OnUpdateViewCollisionactive(CCmdUI* pCmdUI);
	afx_msg void OnInteuler();
	afx_msg void OnUpdateInteuler(CCmdUI* pCmdUI);
	afx_msg void OnIntmidpoint();
	afx_msg void OnUpdateIntmidpoint(CCmdUI* pCmdUI);
	afx_msg void OnIntrk4();
	afx_msg void OnUpdateIntrk4(CCmdUI* pCmdUI);
	afx_msg void OnSimulationRunning();
	afx_msg void OnUpdateSimulationRunning(CCmdUI* pCmdUI);
	afx_msg void OnSimulationReset();
	afx_msg void OnSimulationSetsimproperties();
	afx_msg void OnSimulationSettimingproperties();
	afx_msg void OnSimulationSetvertexproperties();
	afx_msg void OnSimulationUsegravity();
	afx_msg void OnUpdateSimulationUsegravity(CCmdUI* pCmdUI);
	afx_msg void OnSimulationAddcollisionsphere();
	afx_msg void OnHelpWhichopengl();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in ClothSimulationView.cpp
inline CClothSimulationDoc* CClothSimulationView::GetDocument()
   { return (CClothSimulationDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYSDOPENGLVIEW_H__75C5AAEC_37B0_4A8B_9132_9A0C663F6DDC__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -