////////////////////////////////////////// class ViewManager { ViewManager() { m_iViewType = -1; m_fFov = PI/3.0; m_fSpecialScale = 1; SetViewType(2); } void SetViewType(int iViewType) { if (m_iViewType != iViewType) { m_iViewType = iViewType; if (m_iViewType == 2) { ortho(0, width, -height, 0, -10, 10); resetMatrix(); } else if (m_iViewType == 3) { float cameraZ = (height/2.0) / tan(PI * 60.0 / 360.0); perspective(-m_fFov, float(width)/m_fSpecialScale/float(height), 10, 5000); } else { print("Unknown view type: " + iViewType); } } } void SetSpecialScale(float fNewScale) { m_fSpecialScale = fNewScale; if (m_iViewType == 3) { m_iViewType = -1; SetViewType(3); } } int m_iViewType; float m_fFov; float m_fSpecialScale; }