///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Intel Corporation 
// All rights reserved. 
//
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions are met: 
//
// * Redistributions of source code must retain the above copyright notice, 
// this list of conditions and the following disclaimer. 
// * Redistributions in binary form must reproduce the above copyright notice, 
// this list of conditions and the following disclaimer in the documentation 
// and/or other materials provided with the distribution. 
// * Neither name of Intel Corporation nor the names of its contributors 
// may be used to endorse or promote products derived from this software 
// without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR 
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////

// testView.h : interface of the CTestView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_TESTVIEW_H__2FEE7155_56D0_480E_930A_EFF83507A0FD__INCLUDED_)
#define AFX_TESTVIEW_H__2FEE7155_56D0_480E_930A_EFF83507A0FD__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CTestView : public CView
{
protected: // create from serialization only
	CTestView();
	DECLARE_DYNCREATE(CTestView)

// Attributes
public:
	CTestDoc* GetDocument();

private:
	int m_showRayTrace_;
	int m_showDuplicate_;
	int m_showNormals_;
	int m_showNormals2_;
	int m_showModelMatrix_;
	int m_showViewMatrix_;
	int m_showFill_;
	int m_showSideNormals_;
	int m_projectPlane_;
	int m_showIntersect_;
	int m_normalsToUse_;
	int m_showTimeCalcplanes_;

	int m_intersectInvalid_;

	int m_time_[10];

	CToolBar m_timerBar_;

	typedef enum { VERTEX_NORMALS, TRIANGLE_NORMALS };
	typedef enum { TOOL_ARROW, TOOL_GRAB } ToolType;
	ToolType m_toolType_;

	Render3DS m_render3DS_;
	CDC* m_pDC_;
	HGLRC m_hglrc_;

	CPoint m_prevMousePos_, m_currMousePos_;
	CRect m_winRect_;
	char* m_pMask_, *m_pMask2_;

	float m_pCenterOfMass_[3];
	float m_mass_;
	int m_showCenterOfMass_;

// Operations
public:
	void Draw(CDC*pDC);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTestView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = 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 ~CTestView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif
	void GetCurrentRay(float* pStart, float* pDir);;

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CTestView)
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnEditCopy();
	afx_msg void OnShowModelMatrix();
	afx_msg void OnShowViewMatrix();
	afx_msg void OnUpdateShowModelMatrix(CCmdUI* pCmdUI);
	afx_msg void OnProjectPlane();
	afx_msg void OnObjectDuplicate();
	afx_msg void OnShowNormals();
	afx_msg void OnUpdateShowNormals(CCmdUI* pCmdUI);
	afx_msg void OnUpdateObjectDuplicate(CCmdUI* pCmdUI);
	afx_msg void OnShowRaytrace();
	afx_msg void OnUpdateShowRaytrace(CCmdUI* pCmdUI);
	afx_msg void OnShowNormals2();
	afx_msg void OnUpdateShowNormals2(CCmdUI* pCmdUI);
	afx_msg void OnToggleFill();
	afx_msg void OnUpdateToggleFill(CCmdUI* pCmdUI);
	afx_msg void OnShowSideNormals();
	afx_msg void OnUpdateShowSideNormals(CCmdUI* pCmdUI);
	afx_msg void OnMutateModel();
	afx_msg void OnUpdateMutateModel(CCmdUI* pCmdUI);
	afx_msg void OnShowCenterOfMass();
	afx_msg void OnUpdateShowCenterOfMass(CCmdUI* pCmdUI);
	afx_msg void OnUpdateProjectPlane(CCmdUI* pCmdUI);
	afx_msg void OnUpdateToolGrab(CCmdUI* pCmdUI);
	afx_msg void OnToolGrab();
	afx_msg void OnToolArrow();
	afx_msg void OnUpdateToolArrow(CCmdUI* pCmdUI);
	afx_msg void OnShowIntersect();
	afx_msg void OnUpdateShowIntersect(CCmdUI* pCmdUI);
	afx_msg void OnUseVertexNormals();
	afx_msg void OnUpdateUseVertexNormals(CCmdUI* pCmdUI);
	afx_msg void OnUpdateUseTriangleNormals(CCmdUI* pCmdUI);
	afx_msg void OnUseTriangleNormals();
	afx_msg void OnShowTimeCalcplanes();
	afx_msg void OnUpdateShowTimeCalcplanes(CCmdUI* pCmdUI);
	afx_msg void OnUpdateShowViewMatrix(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in testView.cpp
inline CTestDoc* CTestView::GetDocument()
   { return (CTestDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TESTVIEW_H__2FEE7155_56D0_480E_930A_EFF83507A0FD__INCLUDED_)
