void XYWnd::SetScale(float f)
{
m_fScale = f;
+ updateProjection();
updateModelview();
XYWnd_Update(*this);
}
Map_addValidCallback(g_map, DeferredDrawOnMapValidChangedCaller(m_deferredDraw));
+ updateProjection();
updateModelview();
AddSceneChangeCallback(ReferenceCaller<XYWnd, &XYWnd_Update>(*this));
{
m_projection[0] = 1.0f / static_cast<float>(m_nWidth / 2);
m_projection[5] = 1.0f / static_cast<float>(m_nHeight / 2);
- m_projection[10] = 1.0f / g_MaxWorldCoord;
+ m_projection[10] = 1.0f / (g_MaxWorldCoord * m_fScale);
m_projection[12] = 0.0f;
m_projection[13] = 0.0f;
m_view.Construct(m_projection, m_modelview, m_nWidth, m_nHeight);
}
+// note: modelview matrix must have a uniform scale, otherwise strange things happen when rendering the rotation manipulator.
void XYWnd::updateModelview()
{
int nDim1 = (m_viewType == YZ) ? 1 : 0;
// translation
m_modelview[12] = -m_vOrigin[nDim1] * m_fScale;
m_modelview[13] = -m_vOrigin[nDim2] * m_fScale;
- m_modelview[14] = static_cast<float>(g_MaxWorldCoord);
+ m_modelview[14] = g_MaxWorldCoord * m_fScale;
// axis base
switch(m_viewType)
m_modelview[8] = 0;
m_modelview[9] = 0;
- m_modelview[10] = -1.0;
+ m_modelview[10] = -m_fScale;
break;
case XZ:
m_modelview[0] = m_fScale;
m_modelview[4] = 0;
m_modelview[5] = 0;
- m_modelview[6] = 1.0;
+ m_modelview[6] = m_fScale;
m_modelview[8] = 0;
m_modelview[9] = m_fScale;
case YZ:
m_modelview[0] = 0;
m_modelview[1] = 0;
- m_modelview[2] = -1.0;
+ m_modelview[2] = -m_fScale;
m_modelview[4] = m_fScale;
m_modelview[5] = 0;