Exemplo n.º 1
0
//-----------------------------------------------------------------------------
// Purpose: Handles the ID_VIEW_2DXY command when the active view is a 3D view.
//-----------------------------------------------------------------------------
void CChildFrame::OnView2dxy(void)
{
	SetViewType(VIEW2D_XY);
}
Exemplo n.º 2
0
bool CListener::OnLButtonDown( guint32 nFlags, gdouble x, gdouble y )
{
  SetViewType( g_pXYWndWrapper->GetViewType() );

  m_bLeftMBPressed = true;
  oldValid = true;

  vec3_t org, delta;

  g_pXYWndWrapper->SnapToGrid( (int)x, (int)y, org );

  switch( m_vt ) {
  case XY:
    old_x = org[0]; old_y = org[1]; org[2] = 64*1024;
    VectorSet( delta, 0, 0, -1 );
    break;
  case XZ:
    old_x = org[0]; old_y = org[2]; org[1] = 64*1024;
    VectorSet( delta, 0, -1, 0 );
    break;
  case YZ:
    old_x = org[1]; old_y = org[2]; org[0] = 64*1024;
    VectorSet( delta, -1, 0, 0 );
    break;
  }

	if( g_iEditMode == 0 ) {
		if( g_iActiveTarget < 0 )
			GetCurrentCam()->GetCam()->getPositionObj()->selectPointByRay( org[0], org[1], org[2], delta[0], delta[1], delta[2], true );
		else
			GetCurrentCam()->GetCam()->getActiveTarget(g_iActiveTarget)->selectPointByRay( org[0], org[1], org[2], delta[0], delta[1], delta[2], true );
	} else if( g_iEditMode == 1 ) {
		idVec3 *lastcoord;
		idCameraPosition *camera;

    if( g_iActiveTarget < 0 ) {
			camera = GetCurrentCam()->GetCam()->getPositionObj();
		} else {
			camera = GetCurrentCam()->GetCam()->getActiveTarget(g_iActiveTarget);
		}

		if( camera->numPoints() ) {
			lastcoord = camera->getPoint( camera->numPoints() -1 );
			switch( m_vt ) {
			case XY:
				camera->addPoint( org[0], org[1], lastcoord->z );
				break;
			case XZ:
				camera->addPoint( org[0], lastcoord->y, org[2] );
				break;
			case YZ:
				camera->addPoint( lastcoord->x, org[1], org[2] );
				break;
			}
		}	else {
			switch( m_vt ) {
			case XY:
				camera->addPoint( org[0], org[1], 0 );
				break;
			case XZ:
				camera->addPoint( org[0], 0, org[2] );
				break;
			case YZ:
				camera->addPoint( 0, org[1], org[2] );
				break;
			}
		}

		GetCurrentCam()->HasBeenModified();
	}

  g_FuncTable.m_pfnSysUpdateWindows( W_XY_OVERLAY | W_CAMERA );

  return true;

	//return false;
}