------------------------------------------------------------------------------- Fill tree view
| 685 | //------------------------------------------------------------------------------- |
| 686 | // Fill tree view |
| 687 | int CDisplay::FillDisplayList(void) { |
| 688 | LoadImageList(); |
| 689 | |
| 690 | // Initialize the tree view window. |
| 691 | // fill in the first entry |
| 692 | TVITEMEX tvi; |
| 693 | TVINSERTSTRUCT sNew; |
| 694 | tvi.pszText = (char*) "Model"; |
| 695 | tvi.cchTextMax = (int)strlen(tvi.pszText); |
| 696 | tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_STATE; |
| 697 | tvi.state = TVIS_EXPANDED; |
| 698 | tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_MODEL]; |
| 699 | tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_MODEL]; |
| 700 | tvi.lParam = (LPARAM)0; |
| 701 | |
| 702 | sNew.itemex = tvi; |
| 703 | sNew.hInsertAfter = TVI_ROOT; |
| 704 | sNew.hParent = 0; |
| 705 | |
| 706 | // add the root item to the tree |
| 707 | m_hRoot = (HTREEITEM)SendMessage(GetDlgItem(g_hDlg,IDC_TREE1), |
| 708 | TVM_INSERTITEM, |
| 709 | 0, |
| 710 | (LPARAM)(LPTVINSERTSTRUCT)&sNew); |
| 711 | |
| 712 | // add each loaded material to the tree |
| 713 | for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMaterials; ++i) |
| 714 | AddMaterialToDisplayList(m_hRoot,i); |
| 715 | |
| 716 | // add each mesh to the tree |
| 717 | for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes; ++i) |
| 718 | AddMeshToDisplayList(i,m_hRoot); |
| 719 | |
| 720 | // now add all loaded nodes recursively |
| 721 | AddNodeToDisplayList(0,0,g_pcAsset->pcScene->mRootNode,m_hRoot); |
| 722 | |
| 723 | // now expand all parent nodes in the tree |
| 724 | ExpandTree(); |
| 725 | |
| 726 | // everything reacts a little bit slowly if D3D is rendering, |
| 727 | // so give GDI a small hint to leave the couch and work ;-) |
| 728 | UpdateWindow(g_hDlg); |
| 729 | |
| 730 | return 1; |
| 731 | } |
| 732 | |
| 733 | //------------------------------------------------------------------------------- |
| 734 | // Main render loop |