当前位置: 首页>>代码示例>>C++>>正文


C++ CModelerDoc::GetCountOfSelectedSurfaces方法代码示例

本文整理汇总了C++中CModelerDoc::GetCountOfSelectedSurfaces方法的典型用法代码示例。如果您正苦于以下问题:C++ CModelerDoc::GetCountOfSelectedSurfaces方法的具体用法?C++ CModelerDoc::GetCountOfSelectedSurfaces怎么用?C++ CModelerDoc::GetCountOfSelectedSurfaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CModelerDoc的用法示例。


在下文中一共展示了CModelerDoc::GetCountOfSelectedSurfaces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoDataExchange

void CDlgInfoPgRendering::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
  
  CModelerDoc* pDoc = theApp.GetDocument();
  if( pDoc == NULL) return;

  // if dialog is recieving data
  if( (!pDX->m_bSaveAndValidate) && IsWindow(m_colorDiffuse.m_hWnd) )
  {
    enum SurfaceShadingType sstFirstShading = SST_INVALID;
    enum SurfaceTranslucencyType sttFirstTranslucency = STT_INVALID;
    BOOL bSameShading = TRUE;
    BOOL bSameTranslucency = TRUE;
    BOOL bSameDiffuse = TRUE;
    BOOL bSameReflections = TRUE;
    BOOL bSameSpecular = TRUE;
    BOOL bSameBump = TRUE;
    COLOR colFirstDiffuse;
    COLOR colFirstReflections;
    COLOR colFirstSpecular;
    COLOR colFirstBump;
    CTString strFirstName = "Invalid name";

    ULONG ulFlagsOn = MAX_ULONG;
    ULONG ulFlagsOff = MAX_ULONG;

    INDEX ctSelectedSurfaces = pDoc->GetCountOfSelectedSurfaces();

    BOOL bSelectionExists = ctSelectedSurfaces != 0;
    BOOL bFirstSelected = TRUE;
    ModelMipInfo &mmi = pDoc->m_emEditModel.edm_md.md_MipInfos[ pDoc->m_iCurrentMip];
    for( INDEX iSurface=0; iSurface<mmi.mmpi_MappingSurfaces.Count(); iSurface++)
    {
      MappingSurface &ms = mmi.mmpi_MappingSurfaces[ iSurface];
      // skip non selected surfaces
      if( !(ms.ms_ulRenderingFlags&SRF_SELECTED)) continue;
      strFirstName = ms.ms_Name;
      ULONG ulRenderFlags = ms.ms_ulRenderingFlags;
      ulFlagsOn &= ulRenderFlags;
      ulFlagsOff &= ~ulRenderFlags;
      
      if( sstFirstShading == SST_INVALID) sstFirstShading = ms.ms_sstShadingType;
      if( sttFirstTranslucency == STT_INVALID) sttFirstTranslucency = ms.ms_sttTranslucencyType;

      if( bFirstSelected)
      {
        bFirstSelected = FALSE;
        colFirstDiffuse = ms.ms_colDiffuse;
        colFirstReflections = ms.ms_colReflections;
        colFirstSpecular = ms.ms_colSpecular;
        colFirstBump = ms.ms_colBump;
      }
      else
      {
        if( ms.ms_colDiffuse != colFirstDiffuse) bSameDiffuse = FALSE;
        if( ms.ms_colReflections != colFirstReflections) bSameReflections = FALSE;
        if( ms.ms_colSpecular != colFirstSpecular) bSameSpecular = FALSE;
        if( ms.ms_colBump != colFirstBump) bSameBump = FALSE;
      }
      
      if( sstFirstShading != ms.ms_sstShadingType) bSameShading = FALSE;
      if( sttFirstTranslucency != ms.ms_sttTranslucencyType) bSameTranslucency = FALSE;
    }
	  
    if( bSameDiffuse) m_colorDiffuse.SetColor( colFirstDiffuse);
    else m_colorDiffuse.SetMixedColor();
    if( bSameReflections) m_colorReflections.SetColor( colFirstReflections);
    else m_colorReflections.SetMixedColor();
    if( bSameSpecular) m_colorSpecular.SetColor( colFirstSpecular);
    else m_colorSpecular.SetMixedColor();
    if( bSameBump) m_colorBump.SetColor( colFirstBump);
    else m_colorBump.SetMixedColor();

    CTString strText;
    if( ctSelectedSurfaces == 0) strText = "No surfaces selected";
    else if( ctSelectedSurfaces > 1) strText.PrintF( "%d surfaces selected", ctSelectedSurfaces);
    else strText.PrintF( "Surface: %s", strFirstName);
    m_strSurfaceName = strText;

    strText.PrintF( "Mip: %d", pDoc->m_iCurrentMip);
    m_strMipModel = strText;

// apply flags to controls
#define SET_TRI_STATE_TO_CTRL( ctrl, flag)\
  if((ulFlagsOn & flag) && !(ulFlagsOff & flag)) ctrl.SetCheck( 1);\
  else if(!(ulFlagsOn & flag) && (ulFlagsOff & flag)) ctrl.SetCheck( 0);\
  else ctrl.SetCheck( 2);

    SET_TRI_STATE_TO_CTRL( m_IsBump,        SRF_BUMP);
    SET_TRI_STATE_TO_CTRL( m_IsDetail,      SRF_DETAIL);
    SET_TRI_STATE_TO_CTRL( m_IsDiffuse,     SRF_DIFFUSE);
    SET_TRI_STATE_TO_CTRL( m_IsReflections, SRF_REFLECTIONS);
    SET_TRI_STATE_TO_CTRL( m_IsSpecular,    SRF_SPECULAR);
    SET_TRI_STATE_TO_CTRL( m_IsInvisible,   SRF_INVISIBLE);
    SET_TRI_STATE_TO_CTRL( m_IsDoubleSided, SRF_DOUBLESIDED);

    if( !bSameShading) m_comboShading.SetCurSel( -1);
    else
    {
//.........这里部分代码省略.........
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:101,代码来源:DlgInfoPgRendering.cpp


注:本文中的CModelerDoc::GetCountOfSelectedSurfaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。