diff --git a/desmume/src/driver.cpp b/desmume/src/driver.cpp index 9c98c41ef..d8c13deff 100644 --- a/desmume/src/driver.cpp +++ b/desmume/src/driver.cpp @@ -23,6 +23,7 @@ #include "driver.h" #include "rasterize.h" #include "gfx3d.h" +#include "texcache.h" #ifdef HAVE_WX @@ -55,14 +56,17 @@ public: void NewFrame() { listPolys->SetItemCount(viewer3d_state.polylist.count); + labelFrameCounter->SetLabel(wxString::Format("%s: %d",_("Frame"),viewer3d_state.frameNumber)); labelUserPolycount->SetLabel(wxString::Format("%s: %d",_("User Polys"),viewer3d_state.polylist.count)); labelFinalPolycount->SetLabel(wxString::Format("%s: %d",_("Final Polys"),viewer3d_state.polylist.count)); - tree->DeleteAllItems(); - wxTreeItemId root = tree->AddRoot(""); - for(int i=0;iAppendItem(root,"hai kirin"); - } + //tree->DeleteAllItems(); + //tree->Freeze(); + //wxTreeItemId root = tree->AddRoot(""); + //for(int i=0;iAppendItem(root,"hai kirin"); + //} + //tree->Thaw(); } virtual wxString OnGetItemText(const wxListCtrl* list, long item, long column) const @@ -70,6 +74,12 @@ public: return "hi"; } + virtual void OnListPolysSelected( wxListEvent& event ) + { + panelTexture->Refresh(false); + engine._debug_drawClippedUserPoly = GetSelectedListviewItem(listPolys); + } + void RedrawPanel(wxClientDC* dc) { //------------ @@ -114,6 +124,48 @@ public: wxPaintDC dc(wxDynamicCast(event.GetEventObject(), wxWindow)); RedrawPanel(&dc); } + + int GetSelectedListviewItem(wxListCtrl* list) + { + return list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + } + + virtual void OnPaintPanelTexture( wxPaintEvent& event ) + { + wxPaintDC dc(wxDynamicCast(event.GetEventObject(), wxWindow)); + dc.SetBackground(*wxBLACK_BRUSH); dc.Clear(); + + int selection = GetSelectedListviewItem(listPolys); + if(selection < 0) return; + if(selection>=viewer3d_state.polylist.count) return; + + POLY& poly = viewer3d_state.polylist.list[selection]; + + TexCacheItem* texkey = TexCache_SetTexture(TexFormat_32bpp,poly.texParam,poly.texPalette); + const u32 w = texkey->sizeX; + const u32 h = texkey->sizeY; + u8* const bmpdata = new u8[w*h*4]; + for(int i=0;idecoded[i*4]; + bmpdata[i*3+1] = texkey->decoded[i*4+1]; + bmpdata[i*3+2] = texkey->decoded[i*4+2]; + } + for(int i=0;idecoded[i*4+3]; + + + wxImage image(w,h,false); + image.InitAlpha(); + image.SetData(bmpdata,true); + image.SetAlpha(bmpdata+w*h*3,true); + wxBitmap bitmap(image); + double xscale = (double)panelTexture->GetSize().x / w; + double yscale = (double)panelTexture->GetSize().y / h; + + dc.SetUserScale(xscale,yscale); + dc.DrawBitmap(bitmap,0,0); + delete[] bmpdata; + } }; class VIEW3D_Driver_WX : public VIEW3D_Driver diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 1c83938a6..e52ba1502 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -44,6 +44,7 @@ #include "NDSSystem.h" #include "readwrite.h" #include "FIFO.h" +#include "movie.h" //only for currframecounter which really ought to be moved into the core emu.... #include /* @@ -1978,6 +1979,7 @@ static void gfx3d_doFlush() if(driver->view3d->IsRunning()) { + viewer3d_state.frameNumber = currFrameCounter; viewer3d_state.state = gfx3d.state; viewer3d_state.polylist = *gfx3d.polylist; viewer3d_state.vertlist = *gfx3d.vertlist; diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index a693e40a1..96a67f990 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -346,6 +346,7 @@ struct GFX3D_State struct Viewer3d_State { + int frameNumber; GFX3D_State state; VERTLIST vertlist; POLYLIST polylist; diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index cbf416405..1b29db04d 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -346,8 +346,10 @@ class RasterizerUnit public: int SLI_MASK, SLI_VALUE; + bool _debug_thisPoly; RasterizerUnit() + : _debug_thisPoly(false) { } @@ -739,15 +741,77 @@ public: //runs several scanlines, until an edge is finished template - void runscanlines(edge_fx_fl *left, edge_fx_fl *right) + void runscanlines(edge_fx_fl *left, edge_fx_fl *right,bool horizontal) { + //oh lord, hack city for edge drawing + //do not overstep either of the edges int Height = min(left->Height,right->Height); + bool first=true; + static int runctr=0; + runctr++; while(Height--) { - if(!SLI || (left->Y & SLI_MASK) == SLI_VALUE) - drawscanline(left,right); + bool draw = (!SLI || (left->Y & SLI_MASK) == SLI_VALUE); + if(draw) drawscanline(left,right); + const int xl = left->X; + const int xr = right->X; + const int y = left->Y; left->Step(); right->Step(); + + if(!RENDERER && _debug_thisPoly) + { + //debug drawing + bool top = (horizontal&&first); + bool bottom = (!Height&&horizontal); + if(Height || top || bottom) + { + if(draw) + { + int nxl = left->X; + int nxr = right->X; + if(top) { + int xs = min(xl,xr); + int xe = max(xl,xr); + for(int x=xs;x<=xe;x++) { + int adr = (y*engine->width)+x; + engine->screenColor[adr].r = 63; + engine->screenColor[adr].g = 0; + engine->screenColor[adr].b = 0; + } + } else if(bottom) { + int xs = min(xl,xr); + int xe = max(xl,xr); + for(int x=xs;x<=xe;x++) { + int adr = (y*engine->width)+x; + engine->screenColor[adr].r = 63; + engine->screenColor[adr].g = 0; + engine->screenColor[adr].b = 0; + } + } else + { + int xs = min(xl,nxl); + int xe = max(xl,nxl); + for(int x=xs;x<=xe;x++) { + int adr = (y*engine->width)+x; + engine->screenColor[adr].r = 63; + engine->screenColor[adr].g = 0; + engine->screenColor[adr].b = 0; + } + xs = min(xr,nxr); + xe = max(xr,nxr); + for(int x=xs;x<=xe;x++) { + int adr = (y*engine->width)+x; + engine->screenColor[adr].r = 63; + engine->screenColor[adr].g = 0; + engine->screenColor[adr].b = 0; + } + } + + } + } + first = false; + } } } @@ -789,6 +853,7 @@ public: //This function can handle any convex N-gon up to octagons //verts must be clockwise. //I didnt reference anything for this algorithm but it seems like I've seen it somewhere before. + //Maybe it is like crow's algorithm template void shape_engine(int type, bool backwards) { @@ -826,8 +891,9 @@ public: //handle a failure in the edge setup due to nutty polys if(failure) return; - - runscanlines(&left,&right); + + bool horizontal = left.Y == right.Y; + runscanlines(&left,&right,horizontal); //if we ran out of an edge, step to the next one if(right.Height == 0) { @@ -862,6 +928,7 @@ public: //iterate over polys for(int i=0;iclippedPolyCounter;i++) { + if(!RENDERER) _debug_thisPoly = (i==engine->_debug_drawClippedUserPoly); if(!engine->polyVisible[i]) continue; GFX3D_Clipper::TClippedPoly &clippedPoly = engine->clippedPolys[i]; @@ -1150,6 +1217,7 @@ void SoftRasterizerEngine::updateFloatColors() } SoftRasterizerEngine::SoftRasterizerEngine() + : _debug_drawClippedUserPoly(-1) { this->clippedPolys = clipper.clippedPolys = new GFX3D_Clipper::TClippedPoly[POLYLIST_SIZE*2]; } @@ -1368,6 +1436,9 @@ void SoftRasterizerEngine::setupTextures(const bool skipBackfacing) polyAttr.setup(poly->polyAttr); //make sure all the textures we'll need are cached + //(otherwise on a multithreaded system there will be multiple writers-- + //this SHOULD be read-only, although some day the texcache may collect statistics or something + //and then it won't be safe. if(needInitTexture || lastTextureFormat != poly->texParam || lastTexturePalette != poly->texPalette) { lastTexKey = TexCache_SetTexture(TexFormat_15bpp,poly->texParam,poly->texPalette); diff --git a/desmume/src/rasterize.h b/desmume/src/rasterize.h index dffef9874..8d47241d5 100644 --- a/desmume/src/rasterize.h +++ b/desmume/src/rasterize.h @@ -57,6 +57,9 @@ class TexCacheItem; class SoftRasterizerEngine { public: + //debug: + int _debug_drawClippedUserPoly; + SoftRasterizerEngine(); void initFramebuffer(const int width, const int height, const bool clearImage); diff --git a/desmume/src/wxdlg/desmume.pjd b/desmume/src/wxdlg/desmume.pjd index 09c225c6d..92c5ed021 100644 --- a/desmume/src/wxdlg/desmume.pjd +++ b/desmume/src/wxdlg/desmume.pjd @@ -21,7 +21,7 @@ 0 0 0 - 0 + 1 "<All platforms>" "2.8.10" "Standard" @@ -379,7 +379,7 @@ 0 "<Any platform>" - "wxCheckBox: ID_MATERIALINTERPOLATE" + "wxCheckBox: ID_CheckMaterialInterpolate" "dialog-control-document" "" "checkbox" @@ -389,7 +389,7 @@ 0 "wbCheckBoxProxy" "wxEVT_COMMAND_CHECKBOX_CLICKED|OnMaterialInterpolateClick|NONE||wxdlg3dViewer" - "ID_MATERIALINTERPOLATE" + "ID_CheckMaterialInterpolate" 10004 "" "wxCheckBox" @@ -560,10 +560,153 @@ 0 0 0 + + "wxWindow: ID_PanelTexture" + "dialog-control-document" + "" + "foreign" + 0 + 1 + 0 + 0 + "wbForeignCtrlProxy" + "wxEVT_PAINT|OnPaintPanelTexture|NONE||wxdlg3dViewer" + "wxEVT_ERASE_BACKGROUND|OnDoNotEraseBackground|NONE||wxdlg3dViewer" + "ID_PanelTexture" + 10001 + "" + "wxWindow" + "wxWindow" + 1 + 0 + "" + "" + "panelTexture" + 1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + 64 + 64 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + "" + + + "wxStaticText: wxID_STATIC" + "dialog-control-document" + "" + "statictext" + 0 + 1 + 0 + 0 + "wbStaticTextProxy" + "wxID_STATIC" + 5105 + "" + "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" + "" + "3dviewer is unstable. +dont use it." + -1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + - "wxWindow: ID_VIEWPORT" + "wxWindow: ID_PanelViewport" "dialog-control-document" "" "foreign" @@ -573,8 +716,8 @@ 0 "wbForeignCtrlProxy" "wxEVT_PAINT|OnPanelPaint|NONE||wxdlg3dViewer" - "wxEVT_ERASE_BACKGROUND|OnPanelEraseBackground|NONE||wxdlg3dViewer" - "ID_VIEWPORT" + "wxEVT_ERASE_BACKGROUND|OnDoNotEraseBackground|NONE||wxdlg3dViewer" + "ID_PanelViewport" 10002 "" "wxWindow" @@ -938,6 +1081,76 @@ 0 0 "<Any platform>" + + "wxStaticText: wxID_STATIC" + "dialog-control-document" + "" + "statictext" + 0 + 1 + 0 + 0 + "wbStaticTextProxy" + "wxID_STATIC" + 5105 + "" + "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" + "labelFrameCounter" + "Frame: 9999999" + -1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + "wxStaticText: wxID_STATIC" "dialog-control-document" @@ -958,7 +1171,7 @@ "" "" "labelUserPolycount" - "User Polys" + "User Polys: 999999" -1 "" "" @@ -1136,7 +1349,7 @@ 0 - "wxDesmumeListCtrl: ID_DESMUMELISTCTRL1" + "wxDesmumeListCtrl: ID_ListPolys" "dialog-control-document" "" "listctrl" @@ -1145,7 +1358,8 @@ 0 0 "wbListCtrlProxy" - "ID_DESMUMELISTCTRL1" + "wxEVT_COMMAND_LIST_ITEM_SELECTED|OnListPolysSelected|NONE||wxdlg3dViewer" + "ID_ListPolys" 10009 "" "wxDesmumeListCtrl" @@ -1219,7 +1433,7 @@ "" - "wxTreeCtrl: ID_TREECTRL" + "wxTreeCtrl: ID_Tree" "dialog-control-document" "" "treectrl" @@ -1228,7 +1442,7 @@ 0 0 "wbTreeCtrlProxy" - "ID_TREECTRL" + "ID_Tree" 10003 "" "wxTreeCtrl" diff --git a/desmume/src/wxdlg/wxdlg3dViewer.cpp b/desmume/src/wxdlg/wxdlg3dViewer.cpp index 5adf398eb..29d4dce00 100644 --- a/desmume/src/wxdlg/wxdlg3dViewer.cpp +++ b/desmume/src/wxdlg/wxdlg3dViewer.cpp @@ -48,7 +48,9 @@ BEGIN_EVENT_TABLE( wxdlg3dViewer, wxDialog ) ////@begin wxdlg3dViewer event table entries EVT_CLOSE( wxdlg3dViewer::OnCloseWindow ) - EVT_CHECKBOX( ID_MATERIALINTERPOLATE, wxdlg3dViewer::OnMaterialInterpolateClick ) + EVT_CHECKBOX( ID_CheckMaterialInterpolate, wxdlg3dViewer::OnMaterialInterpolateClick ) + + EVT_LIST_ITEM_SELECTED( ID_ListPolys, wxdlg3dViewer::OnListPolysSelected ) ////@end wxdlg3dViewer event table entries @@ -113,7 +115,9 @@ void wxdlg3dViewer::Init() { ////@begin wxdlg3dViewer member initialisation checkMaterialInterpolate = NULL; + panelTexture = NULL; panelViewport = NULL; + labelFrameCounter = NULL; labelUserPolycount = NULL; labelFinalPolycount = NULL; listPolys = NULL; @@ -146,7 +150,7 @@ void wxdlg3dViewer::CreateControls() wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - checkMaterialInterpolate = new wxCheckBox( itemDialog1, ID_MATERIALINTERPOLATE, _("Material clip interpolation"), wxDefaultPosition, wxDefaultSize, 0 ); + checkMaterialInterpolate = new wxCheckBox( itemDialog1, ID_CheckMaterialInterpolate, _("Material clip interpolation"), wxDefaultPosition, wxDefaultSize, 0 ); checkMaterialInterpolate->SetValue(false); itemStaticBoxSizer4->Add(checkMaterialInterpolate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); @@ -159,55 +163,66 @@ void wxdlg3dViewer::CreateControls() wxFlexGridSizer* itemFlexGridSizer8 = new wxFlexGridSizer(0, 2, 0, 0); itemBoxSizer3->Add(itemFlexGridSizer8, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - panelViewport = new wxWindow( itemDialog1, ID_VIEWPORT, wxDefaultPosition, wxSize(256, 192), wxSIMPLE_BORDER ); + panelTexture = new wxWindow( itemDialog1, ID_PanelTexture, wxDefaultPosition, wxSize(64, 64), wxSIMPLE_BORDER ); + itemFlexGridSizer8->Add(panelTexture, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("3dviewer is unstable.\ndont use it."), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer8->Add(itemStaticText10, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + panelViewport = new wxWindow( itemDialog1, ID_PanelViewport, wxDefaultPosition, wxSize(256, 192), wxSIMPLE_BORDER ); itemFlexGridSizer2->Add(panelViewport, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxFlexGridSizer* itemFlexGridSizer10 = new wxFlexGridSizer(3, 1, 0, 0); - itemFlexGridSizer10->AddGrowableRow(1); - itemFlexGridSizer2->Add(itemFlexGridSizer10, 1, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + wxFlexGridSizer* itemFlexGridSizer12 = new wxFlexGridSizer(3, 1, 0, 0); + itemFlexGridSizer12->AddGrowableRow(1); + itemFlexGridSizer2->Add(itemFlexGridSizer12, 1, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); - wxStaticBox* itemStaticBoxSizer11Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Choose One")); - wxStaticBoxSizer* itemStaticBoxSizer11 = new wxStaticBoxSizer(itemStaticBoxSizer11Static, wxVERTICAL); - itemFlexGridSizer10->Add(itemStaticBoxSizer11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM|wxALL, 5); + wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Choose One")); + wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxVERTICAL); + itemFlexGridSizer12->Add(itemStaticBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM|wxALL, 5); - wxRadioButton* itemRadioButton12 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON, _("Final Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton12->SetValue(true); - itemStaticBoxSizer11->Add(itemRadioButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxRadioButton* itemRadioButton14 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON, _("Final Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); + itemRadioButton14->SetValue(true); + itemStaticBoxSizer13->Add(itemRadioButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxRadioButton* itemRadioButton13 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON1, _("User Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton13->SetValue(false); - itemRadioButton13->Enable(false); - itemStaticBoxSizer11->Add(itemRadioButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxRadioButton* itemRadioButton15 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON1, _("User Polylist"), wxDefaultPosition, wxDefaultSize, 0 ); + itemRadioButton15->SetValue(false); + itemRadioButton15->Enable(false); + itemStaticBoxSizer13->Add(itemRadioButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxRadioButton* itemRadioButton14 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON2, _("Display List"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton14->SetValue(false); - itemRadioButton14->Enable(false); - itemStaticBoxSizer11->Add(itemRadioButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxRadioButton* itemRadioButton16 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON2, _("Display List"), wxDefaultPosition, wxDefaultSize, 0 ); + itemRadioButton16->SetValue(false); + itemRadioButton16->Enable(false); + itemStaticBoxSizer13->Add(itemRadioButton16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - itemFlexGridSizer10->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemFlexGridSizer12->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Statistics")); - wxStaticBoxSizer* itemStaticBoxSizer16 = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxVERTICAL); - itemFlexGridSizer10->Add(itemStaticBoxSizer16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); + wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Statistics")); + wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(itemStaticBoxSizer18Static, wxVERTICAL); + itemFlexGridSizer12->Add(itemStaticBoxSizer18, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); - labelUserPolycount = new wxStaticText( itemDialog1, wxID_STATIC, _("User Polys"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer16->Add(labelUserPolycount, 0, wxALIGN_LEFT|wxALL, 1); + labelFrameCounter = new wxStaticText( itemDialog1, wxID_STATIC, _("Frame: 9999999"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer18->Add(labelFrameCounter, 0, wxALIGN_LEFT|wxALL, 1); + + labelUserPolycount = new wxStaticText( itemDialog1, wxID_STATIC, _("User Polys: 999999"), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer18->Add(labelUserPolycount, 0, wxALIGN_LEFT|wxALL, 1); labelFinalPolycount = new wxStaticText( itemDialog1, wxID_STATIC, _("Final Polys: "), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer16->Add(labelFinalPolycount, 0, wxALIGN_LEFT|wxALL, 1); + itemStaticBoxSizer18->Add(labelFinalPolycount, 0, wxALIGN_LEFT|wxALL, 1); - wxStaticLine* itemStaticLine19 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemFlexGridSizer2->Add(itemStaticLine19, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); + wxStaticLine* itemStaticLine22 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemFlexGridSizer2->Add(itemStaticLine22, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); - listPolys = new wxDesmumeListCtrl( itemDialog1, ID_DESMUMELISTCTRL1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_VIRTUAL ); + listPolys = new wxDesmumeListCtrl( itemDialog1, ID_ListPolys, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_VIRTUAL ); itemFlexGridSizer2->Add(listPolys, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); - tree = new wxTreeCtrl( itemDialog1, ID_TREECTRL, wxDefaultPosition, wxSize(99, 99), wxTR_HAS_BUTTONS |wxTR_HIDE_ROOT|wxTR_ROW_LINES|wxTR_SINGLE ); + tree = new wxTreeCtrl( itemDialog1, ID_Tree, wxDefaultPosition, wxSize(99, 99), wxTR_HAS_BUTTONS |wxTR_HIDE_ROOT|wxTR_ROW_LINES|wxTR_SINGLE ); itemFlexGridSizer2->Add(tree, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); // Connect events and objects - panelViewport->Connect(ID_VIEWPORT, wxEVT_PAINT, wxPaintEventHandler(wxdlg3dViewer::OnPanelPaint), NULL, this); - panelViewport->Connect(ID_VIEWPORT, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxdlg3dViewer::OnPanelEraseBackground), NULL, this); + panelTexture->Connect(ID_PanelTexture, wxEVT_PAINT, wxPaintEventHandler(wxdlg3dViewer::OnPaintPanelTexture), NULL, this); + panelTexture->Connect(ID_PanelTexture, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxdlg3dViewer::OnDoNotEraseBackground), NULL, this); + panelViewport->Connect(ID_PanelViewport, wxEVT_PAINT, wxPaintEventHandler(wxdlg3dViewer::OnPanelPaint), NULL, this); + panelViewport->Connect(ID_PanelViewport, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxdlg3dViewer::OnDoNotEraseBackground), NULL, this); ////@end wxdlg3dViewer content construction } @@ -285,7 +300,7 @@ void wxdlg3dViewer::OnPanelPaint( wxPaintEvent& event ) * wxEVT_ERASE_BACKGROUND event handler for ID_PANEL */ -void wxdlg3dViewer::OnPanelEraseBackground( wxEraseEvent& event ) +void wxdlg3dViewer::OnDoNotEraseBackground( wxEraseEvent& event ) { //blank to block background clearing } @@ -374,3 +389,27 @@ void wxDesmumeListCtrl::CreateControls() } +/* + * wxEVT_COMMAND_LIST_ITEM_SELECTED event handler for ID_LISTPOLYS + */ + +void wxdlg3dViewer::OnListPolysSelected( wxListEvent& event ) +{ +////@begin wxEVT_COMMAND_LIST_ITEM_SELECTED event handler for ID_LISTPOLYS in wxdlg3dViewer. + // Before editing this code, remove the block markers. + event.Skip(); +////@end wxEVT_COMMAND_LIST_ITEM_SELECTED event handler for ID_LISTPOLYS in wxdlg3dViewer. +} + + +/* + * wxEVT_PAINT event handler for ID_PanelTexture + */ + +void wxdlg3dViewer::OnPaintPanelTexture( wxPaintEvent& event ) +{ +////@begin wxEVT_PAINT event handler for ID_PanelTexture in wxdlg3dViewer. + // Before editing this code, remove the block markers. + wxPaintDC dc(wxDynamicCast(event.GetEventObject(), wxWindow)); +////@end wxEVT_PAINT event handler for ID_PanelTexture in wxdlg3dViewer. +} diff --git a/desmume/src/wxdlg/wxdlg3dViewer.h b/desmume/src/wxdlg/wxdlg3dViewer.h index dd7155d0c..a4657efbe 100644 --- a/desmume/src/wxdlg/wxdlg3dViewer.h +++ b/desmume/src/wxdlg/wxdlg3dViewer.h @@ -48,21 +48,22 @@ class wxTreeCtrl; ////@begin control identifiers #define ID_X 10000 -#define ID_MATERIALINTERPOLATE 10004 +#define ID_CheckMaterialInterpolate 10004 #define ID_CHECKBOX1 10008 -#define ID_VIEWPORT 10002 +#define ID_PanelTexture 10001 +#define ID_PanelViewport 10002 #define ID_RADIOBUTTON 10005 #define ID_RADIOBUTTON1 10006 #define ID_RADIOBUTTON2 10007 -#define ID_DESMUMELISTCTRL1 10009 -#define ID_TREECTRL 10003 +#define ID_ListPolys 10009 +#define ID_Tree 10003 #define SYMBOL_WXDLG3DVIEWER_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxDIALOG_NO_PARENT|wxCLOSE_BOX|wxTAB_TRAVERSAL #define SYMBOL_WXDLG3DVIEWER_TITLE _("3D Viewer") #define SYMBOL_WXDLG3DVIEWER_IDNAME ID_X #define SYMBOL_WXDLG3DVIEWER_SIZE wxSize(399, 300) #define SYMBOL_WXDLG3DVIEWER_POSITION wxDefaultPosition #define SYMBOL_WXDESMUMELISTCTRL_STYLE wxLC_REPORT|wxLC_VIRTUAL -#define SYMBOL_WXDESMUMELISTCTRL_IDNAME ID_DESMUMELISTCTRL1 +#define SYMBOL_WXDESMUMELISTCTRL_IDNAME ID_ListPolys #define SYMBOL_WXDESMUMELISTCTRL_SIZE wxDefaultSize #define SYMBOL_WXDESMUMELISTCTRL_POSITION wxDefaultPosition ////@end control identifiers @@ -103,16 +104,22 @@ public: ////@begin wxdlg3dViewer event handler declarations /// wxEVT_CLOSE_WINDOW event handler for ID_X - void OnCloseWindow( wxCloseEvent& event ); + virtual void OnCloseWindow( wxCloseEvent& event ); - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_MATERIALINTERPOLATE - void OnMaterialInterpolateClick( wxCommandEvent& event ); + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CheckMaterialInterpolate + virtual void OnMaterialInterpolateClick( wxCommandEvent& event ); - /// wxEVT_PAINT event handler for ID_VIEWPORT - void OnPanelPaint( wxPaintEvent& event ); + /// wxEVT_PAINT event handler for ID_PanelTexture + virtual void OnPaintPanelTexture( wxPaintEvent& event ); - /// wxEVT_ERASE_BACKGROUND event handler for ID_VIEWPORT - void OnPanelEraseBackground( wxEraseEvent& event ); + /// wxEVT_ERASE_BACKGROUND event handler for ID_PanelTexture + virtual void OnDoNotEraseBackground( wxEraseEvent& event ); + + /// wxEVT_PAINT event handler for ID_PanelViewport + virtual void OnPanelPaint( wxPaintEvent& event ); + + /// wxEVT_COMMAND_LIST_ITEM_SELECTED event handler for ID_ListPolys + virtual void OnListPolysSelected( wxListEvent& event ); ////@end wxdlg3dViewer event handler declarations @@ -130,7 +137,9 @@ public: ////@begin wxdlg3dViewer member variables wxCheckBox* checkMaterialInterpolate; + wxWindow* panelTexture; wxWindow* panelViewport; + wxStaticText* labelFrameCounter; wxStaticText* labelUserPolycount; wxStaticText* labelFinalPolycount; wxDesmumeListCtrl* listPolys;