[Gcblue-commits] gcb_wx/src/graphics tc3DViewer.cpp,1.1,1.2 tc3DWindow.cpp,1.4,1.5 tcButton.cpp,1.11
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-10-07 22:02:03
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12439/src/graphics Modified Files: tc3DViewer.cpp tc3DWindow.cpp tcButton.cpp tcConsoleBox.cpp tcEditBox.cpp tcHookInfo.cpp tcOOBView.cpp tcParticleEffect.cpp tcRadioButton.cpp tcXmlWindow.cpp Log Message: Changes related to GDI+ replacement Index: tcXmlWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcXmlWindow.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcXmlWindow.cpp 2 Oct 2004 22:41:33 -0000 1.2 --- tcXmlWindow.cpp 7 Oct 2004 22:01:46 -0000 1.3 *************** *** 125,128 **** --- 125,130 ---- config = NULL; std::cerr << "Error loading XML file " << configFile.c_str() << std::endl; + wxString s = wxString::Format("Missing xml file %s", configFile.c_str()); + wxMessageBox(s, "Error", wxICON_ERROR); } } Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcConsoleBox.cpp 2 Oct 2004 22:41:33 -0000 1.7 --- tcConsoleBox.cpp 7 Oct 2004 22:01:46 -0000 1.8 *************** *** 30,33 **** --- 30,40 ---- + void tcConsoleBox::OnSize(wxSizeEvent& event) + { + wxSize s = event.GetSize(); + nyzero = s.GetHeight() - 20; + + tc3DWindow::OnSize(event); + } /** *************** *** 98,101 **** --- 105,119 ---- /** + * Clears the text buffer + */ + void tcConsoleBox::Clear() + { + textArray.Clear(); + cursorLine = 0; + cursorCol = 0; + mbRedraw = true; + } + + /** * */ *************** *** 108,112 **** ! DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, 1)); size_t nLines = textArray.GetCount(); // number of lines in textArray buffer --- 126,130 ---- ! // DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, 1)); size_t nLines = textArray.GetCount(); // number of lines in textArray buffer *************** *** 134,138 **** } ! //DrawBorder(); mbForceRedraw = false; --- 152,159 ---- } ! if (drawBorder) ! { ! DrawBorder(); ! } mbForceRedraw = false; *************** *** 146,152 **** if (!config) { ! std::cerr << "Error - bad xml config file for Console Box" << std::endl; ! fontSize = 9.0f; fontColor.set(0.392f, 1.0f, 0.392f, 1.0f); return; } --- 167,174 ---- if (!config) { ! std::cout << "Using default xml config for ConsoleBox" << std::endl; ! fontSize = 10.0f; fontColor.set(0.392f, 1.0f, 0.392f, 1.0f); + nyzero = mnHeight - 20; return; } *************** *** 161,168 **** // read window dimensions from XML int x; ! int y; int width; int height; int wrap = 50; current->Attribute("X", &x); --- 183,191 ---- // read window dimensions from XML int x; ! int y; int width; int height; int wrap = 50; + int borderState; current->Attribute("X", &x); *************** *** 171,185 **** current->Attribute("Height", &height); current->Attribute("Wrap", &wrap); SetSize(x, y, width, height); // set all size params - nyzero = height - 20; if (wrap < 10) wrap = 50; SetWrap(wrap); double xmlFontSize; current->Attribute("FontSize", &xmlFontSize); fontSize = xmlFontSize; ! fontColor.set(0.392f, 1, 0.392f, 1); } --- 194,213 ---- current->Attribute("Height", &height); current->Attribute("Wrap", &wrap); + current->Attribute("DrawBorder", &borderState); + + if (width == 0) width = mnWidth; + if (height == 0) height = mnHeight; SetSize(x, y, width, height); // set all size params if (wrap < 10) wrap = 50; SetWrap(wrap); + drawBorder = borderState != 0; + double xmlFontSize; current->Attribute("FontSize", &xmlFontSize); fontSize = xmlFontSize; ! if (fontSize == 0) fontSize = 10.0f; fontColor.set(0.392f, 1, 0.392f, 1); } *************** *** 262,266 **** */ tcConsoleBox::tcConsoleBox(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLConsoleBox"), cursorLine(0), cursorCol(0), --- 290,294 ---- */ tcConsoleBox::tcConsoleBox(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, parent->GetPosition(), parent->GetSize(), "XMLConsoleBox", parent), cursorLine(0), cursorCol(0), *************** *** 271,280 **** nlinespace(15), isMouseOver(false), ! isFocused(false) { ! nyzero = mnHeight - 20; ! ! ! InitFromXml(config); } --- 299,306 ---- nlinespace(15), isMouseOver(false), ! isFocused(false), ! drawBorder(true) { ! InitFromXml(config); } Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcOOBView.cpp 2 Oct 2004 22:41:33 -0000 1.1 --- tcOOBView.cpp 7 Oct 2004 22:01:46 -0000 1.2 *************** *** 25,31 **** #ifndef WX_PRECOMP #include "wx/wx.h" - #ifdef WIN32 - #include "wx/msw/private.h" // for MS Windows specific definitions - #endif #endif --- 25,28 ---- *************** *** 35,39 **** #include "tcSound.h" - using namespace Gdiplus; using namespace MapView; --- 32,35 ---- *************** *** 64,80 **** void tcOOBView::Update() { - Graphics *pGraphics; UpdateData(); UpdateFormation(); UpdateRect(); - if (!GetGraphics(pGraphics)) - { - WTL("Failed to get Graphics in tcOOBView::Update()\n"); - return; - } - PlaceIcons(pGraphics); - ReleaseGraphics(pGraphics); } --- 60,70 ---- void tcOOBView::Update() { UpdateData(); UpdateFormation(); UpdateRect(); + + PlaceIcons(); } *************** *** 143,146 **** --- 133,137 ---- void tcOOBView::UpdateFormation() { + #if 0 wxASSERT(mpSimState); *************** *** 184,187 **** --- 175,179 ---- } msFormationChangeInfo.mbApply = false; // always clear formation change + #endif } *************** *** 207,210 **** --- 199,203 ---- float& y, float stopy) { + #if 0 float x = mfXOffset; *************** *** 257,279 **** } } } ! int tcOOBView::Draw() { ! Graphics* graphics; ! float stopy = (float)mnHeight - mfRowSpacing; static int nFrameCount = 0; //if ((nFrameCount++ % 4)!=0) {return 1;} // draw every fourth call ! ! if (!GetGraphics(graphics)) ! { ! WTL("Failed to get Graphics in tcOOBView::Draw()\n"); ! return false; ! } if (IsBackgroundLoaded()) { ! DrawBackground(graphics); } else --- 250,267 ---- } } + #endif } ! void tcOOBView::Draw() { ! #if 0 float stopy = (float)mnHeight - mfRowSpacing; static int nFrameCount = 0; //if ((nFrameCount++ % 4)!=0) {return 1;} // draw every fourth call ! if (IsBackgroundLoaded()) { ! DrawBackground(); } else *************** *** 315,326 **** ReleaseGraphics(graphics); ! DrawBorder(); return 1; } ! void tcOOBView::DrawCategory(Gdiplus::Graphics* graphics, ! std::vector<tsOOBInfo>& objInfo, float stopy) { ! mpBrush->SetColor(Color(254,100,255,100)); --- 303,318 ---- ReleaseGraphics(graphics); ! return 1; + #endif + DrawBorder(); + + HideUnusedObjects(); + } ! void tcOOBView::DrawCategory(std::vector<tsOOBInfo>& objInfo, float stopy) { ! #if 0 mpBrush->SetColor(Color(254,100,255,100)); *************** *** 355,358 **** --- 347,351 ---- } } + #endif } *************** *** 363,369 **** float tcOOBView::GetCategoryY(std::vector<tsOOBInfo>& objInfo) { if (objInfo.size()) { ! return objInfo[0].rectf.Y; } else --- 356,363 ---- float tcOOBView::GetCategoryY(std::vector<tsOOBInfo>& objInfo) { + if (objInfo.size()) { ! return objInfo[0].rectf.bottom; } else *************** *** 371,374 **** --- 365,369 ---- return 0; } + } *************** *** 376,389 **** * updates location of icon rectangles within each OOBInfo item */ ! void tcOOBView::PlaceIcons(Graphics *apGraphics) { ! PlaceIconsCategory(apGraphics, surfaceObj); ! PlaceIconsCategory(apGraphics, airObj); ! PlaceIconsCategory(apGraphics, flightopsObj); } ! void tcOOBView::PlaceIconsCategory(Gdiplus::Graphics* graphics, ! std::vector<tsOOBInfo>& objInfo) { SizeF stringsize; --- 371,384 ---- * updates location of icon rectangles within each OOBInfo item */ ! void tcOOBView::PlaceIcons() { ! PlaceIconsCategory(surfaceObj); ! PlaceIconsCategory(airObj); ! PlaceIconsCategory(flightopsObj); } ! void tcOOBView::PlaceIconsCategory(std::vector<tsOOBInfo>& objInfo) { + #if 0 SizeF stringsize; *************** *** 407,410 **** --- 402,406 ---- info.raction.Inflate(-2.0f,-2.0f); } + #endif } *************** *** 415,419 **** if (tsOOBInfo* info = ! ButtonContainingPoint(PointF((float)point.x,(float)point.y))) { long new_key = info->mnID; --- 411,415 ---- if (tsOOBInfo* info = ! ButtonContainingPoint(wxRealPoint((float)point.x,(float)point.y))) { long new_key = info->mnID; *************** *** 441,445 **** if (tsOOBInfo* info = ! ButtonContainingPoint(PointF((float)point.x,(float)point.y))) { if (info->mnID != mnSelectedKey) --- 437,441 ---- if (tsOOBInfo* info = ! ButtonContainingPoint(wxRealPoint((float)point.x,(float)point.y))) { if (info->mnID != mnSelectedKey) *************** *** 454,458 **** } ! tsOOBInfo* tcOOBView::ButtonContainingPoint(PointF pointf) { tsOOBInfo* info = 0; --- 450,454 ---- } ! tsOOBInfo* tcOOBView::ButtonContainingPoint(wxRealPoint pointf) { tsOOBInfo* info = 0; *************** *** 474,480 **** } ! tsOOBInfo* tcOOBView::ButtonContainingPointCategory(Gdiplus::PointF pointf, std::vector<tsOOBInfo>& objInfo) { for (size_t n = 0; n < objInfo.size(); n++) { --- 470,477 ---- } ! tsOOBInfo* tcOOBView::ButtonContainingPointCategory(wxRealPoint pointf, std::vector<tsOOBInfo>& objInfo) { + #if 0 for (size_t n = 0; n < objInfo.size(); n++) { *************** *** 485,490 **** } } ! return 0; } --- 482,488 ---- } } ! #endif return 0; + } *************** *** 493,497 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name) , mpMapView(0), mnAlliance(0), --- 491,495 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tc3DWindow(parent, pos, size, name) , mpMapView(0), mnAlliance(0), *************** *** 504,508 **** { mpSimState = tcSimState::Get(); ! mpPen = new Pen(Color(0xFEFFFFFF),2); if (mpPen == NULL) {WTL("tcOOBView - mpPen creation failed\n");} --- 502,506 ---- { mpSimState = tcSimState::Get(); ! /* mpPen = new Pen(Color(0xFEFFFFFF),2); if (mpPen == NULL) {WTL("tcOOBView - mpPen creation failed\n");} *************** *** 514,517 **** --- 512,516 ---- mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB if (mpBrush == NULL) {WTL("tcOOBView - mpBrush creation failed\n");} + */ } *************** *** 519,524 **** --- 518,525 ---- tcOOBView::~tcOOBView() { + /* if (mpPen != NULL) {delete mpPen;} if (mpFont != NULL) {delete mpFont;} if (mpBrush != NULL) {delete mpBrush;} + */ } \ No newline at end of file Index: tcRadioButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcRadioButton.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcRadioButton.cpp 2 Oct 2004 22:41:33 -0000 1.6 --- tcRadioButton.cpp 7 Oct 2004 22:01:46 -0000 1.7 *************** *** 138,142 **** */ tcRadioButton::tcRadioButton(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLButton"), caption("NULL"), command(-1), --- 138,142 ---- */ tcRadioButton::tcRadioButton(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLButton", parent), caption("NULL"), command(-1), Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcHookInfo.cpp 2 Oct 2004 22:41:33 -0000 1.1 --- tcHookInfo.cpp 7 Oct 2004 22:01:46 -0000 1.2 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcHookInfo.cpp ! */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 35,39 **** #include "simmath.h" ! using namespace Gdiplus; void tcHookInfo::OnLButtonDown(wxMouseEvent& event) --- 37,41 ---- #include "simmath.h" ! void tcHookInfo::OnLButtonDown(wxMouseEvent& event) *************** *** 46,51 **** */ // This method needs to be broken up ! void tcHookInfo::DrawTrack(Gdiplus::Graphics *apGraphics, tnPoolIndex anID) { tcSensorMapTrack *pSMTrack; std::string s; --- 48,54 ---- */ // This method needs to be broken up ! void tcHookInfo::DrawTrack(tnPoolIndex anID) { + #if 0 tcSensorMapTrack *pSMTrack; std::string s; *************** *** 133,137 **** //*********** draw engagement info ************** DrawTrackEngaged(apGraphics, pSMTrack, ftextx, ftexty); ! } --- 136,140 ---- //*********** draw engagement info ************** DrawTrackEngaged(apGraphics, pSMTrack, ftextx, ftexty); ! #endif } *************** *** 144,150 **** * drawing methods can draw underneath. */ ! void tcHookInfo::DrawTrackEngaged(Gdiplus::Graphics *graphics, const Sensor::tcSensorMapTrack *smtrack, float& x, float& y) { char zBuff[128]; SizeF textSize; --- 147,154 ---- * drawing methods can draw underneath. */ ! void tcHookInfo::DrawTrackEngaged( const Sensor::tcSensorMapTrack *smtrack, float& x, float& y) { + #if 0 char zBuff[128]; SizeF textSize; *************** *** 221,229 **** y += textSize.Height + 2.0f; } ! } ! void tcHookInfo::DrawOwn(Gdiplus::Graphics *apGraphics, tcGameObject *pHookedObj) { std::string s; char zBuff[128]; --- 225,234 ---- y += textSize.Height + 2.0f; } ! #endif } ! void tcHookInfo::DrawOwn(tcGameObject *pHookedObj) { + #if 0 std::string s; char zBuff[128]; *************** *** 309,317 **** ftexty+=15; } ! } ! int tcHookInfo::Draw(void) { static int nFrameCount = 0; tcGameObject *pHookedObj; --- 314,323 ---- ftexty+=15; } ! #endif } ! void tcHookInfo::Draw() { + #if 0 static int nFrameCount = 0; tcGameObject *pHookedObj; *************** *** 347,355 **** ReleaseGraphics(pGraphics); ! DrawBorder(); //SetOpaque(); ! return 1; } --- 353,363 ---- ReleaseGraphics(pGraphics); ! //SetOpaque(); ! #endif ! DrawBorder(); + HideUnusedObjects(); } *************** *** 495,499 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name) { mnHookID = NULL_INDEX; --- 503,507 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tc3DWindow(parent, pos, size, name) { mnHookID = NULL_INDEX; *************** *** 503,506 **** --- 511,515 ---- drawEngagedMode = 1; + /* mpPen = new Pen(Color(0xFEFFFFFF),2); if (mpPen == NULL) {throw "tcHookInfo - mpPen creation failed\n";} *************** *** 515,518 **** --- 524,528 ---- mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB if (mpBrush == NULL) {throw "tcHookInfo - mpBrush creation failed\n";} + */ } *************** *** 520,526 **** --- 530,538 ---- tcHookInfo::~tcHookInfo() { + /* if (mpPen != NULL) {delete mpPen;} if (mpFont != NULL) {delete mpFont;} if (mpFontLarge != NULL) {delete mpFontLarge;} if (mpBrush != NULL) {delete mpBrush;} + */ } Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcButton.cpp 2 Oct 2004 22:41:33 -0000 1.11 --- tcButton.cpp 7 Oct 2004 22:01:46 -0000 1.12 *************** *** 177,181 **** */ tcButton::tcButton(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLButton") { caption = "NULL"; --- 177,181 ---- */ tcButton::tcButton(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLButton", parent) { caption = "NULL"; *************** *** 236,240 **** tcButton::tcButton(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tc3DWindow(parent, pos, size, name) { --- 236,240 ---- tcButton::tcButton(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tc3DWindow(parent, pos, size, name, parent) { Index: tcParticleEffect.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcParticleEffect.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcParticleEffect.cpp 1 Sep 2004 02:55:36 -0000 1.2 --- tcParticleEffect.cpp 7 Oct 2004 22:01:46 -0000 1.3 *************** *** 130,135 **** if (root) { ! std::cerr << "Warning - tcParticleEffect already added to scene graph, " ! "detaching first\n"; DetachFromSceneGraph(); } --- 130,135 ---- if (root) { ! fprintf(stderr, "Warning - tcParticleEffect already added to scene graph, " ! "detaching first\n"); DetachFromSceneGraph(); } *************** *** 239,244 **** if (!root) { ! std::cerr << "Warning - tcParticleEffect already removed from scene graph," ! "skipping\n"; return; } --- 239,244 ---- if (!root) { ! fprintf(stderr, "Warning - tcParticleEffect already removed from scene graph," ! "skipping\n"); return; } Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tc3DWindow.cpp 2 Oct 2004 22:41:33 -0000 1.4 --- tc3DWindow.cpp 7 Oct 2004 22:01:45 -0000 1.5 *************** *** 277,281 **** stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! stateSet->setRenderBinDetails(baseRenderBin - 10, "RenderBin"); osg::Depth* depth = new osg::Depth(osg::Depth::ALWAYS, 1, 1, false); --- 277,281 ---- stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! stateSet->setRenderBinDetails(baseRenderBin + backgroundRenderBin, "RenderBin"); osg::Depth* depth = new osg::Depth(osg::Depth::ALWAYS, 1, 1, false); *************** *** 1217,1220 **** --- 1217,1221 ---- stateSet->setRenderBinDetails(baseRenderBin + textRenderBin, "RenderBin"); stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); + stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); wxASSERT(root.valid()); *************** *** 1239,1244 **** void tc3DWindow::HideUnusedObjects() { - LogStatus(); - // text pool for (unsigned idx = textIdx; idx < textPool.size(); idx++) --- 1240,1243 ---- *************** *** 1368,1372 **** */ tc3DWindow::tc3DWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, ! const wxString& name) : wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW | wxNO_FULL_REPAINT_ON_RESIZE, name), //| wxNO_FULL_REPAINT_ON_RESIZE |wxCLIP_CHILDREN mnHeight(size.GetHeight()), mnWidth(size.GetWidth()), --- 1367,1371 ---- */ tc3DWindow::tc3DWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, ! const wxString& name, tc3DWindow* graphicsHost) : wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW | wxNO_FULL_REPAINT_ON_RESIZE, name), //| wxNO_FULL_REPAINT_ON_RESIZE |wxCLIP_CHILDREN mnHeight(size.GetHeight()), mnWidth(size.GetWidth()), *************** *** 1376,1380 **** backgroundRenderBin(-1), imageRenderBin(0), ! lineRenderBin(1), rectRenderBin(1), textRenderBin(2) --- 1375,1379 ---- backgroundRenderBin(-1), imageRenderBin(0), ! lineRenderBin(1), // using 1 causes dropouts at some 3D viewer window sizes!? rectRenderBin(1), textRenderBin(2) *************** *** 1394,1398 **** { wxSize parentSize = parent->GetSize(); ! yOffset = parentSize.GetHeight() - mnHeight; } --- 1393,1397 ---- { wxSize parentSize = parent->GetSize(); ! yOffset = parentSize.GetHeight() - mnHeight - 2*pos.y; } *************** *** 1415,1421 **** /* kind of a hack here to handle both top-level window case ** and child of window case */ ! if (tc3DWindow* parentWindow = dynamic_cast<tc3DWindow*>(parent)) { ! transform = parentWindow->CreateDrawTransform(); transform->setMatrix(osg::Matrix::translate(pos.x, pos.y + yOffset, 0)); transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_PARENTS); --- 1414,1420 ---- /* kind of a hack here to handle both top-level window case ** and child of window case */ ! if (graphicsHost) { ! transform = graphicsHost->CreateDrawTransform(); transform->setMatrix(osg::Matrix::translate(pos.x, pos.y + yOffset, 0)); transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_PARENTS); *************** *** 1451,1457 **** resizeable2DSurface = false; yMirror = 0; ! if (tc3DWindow* parent3D = dynamic_cast<tc3DWindow*>(parent)) { ! parent3D->AddChild(this); // adds this to parent's list of children to draw } --- 1450,1456 ---- resizeable2DSurface = false; yMirror = 0; ! if (graphicsHost) { ! graphicsHost->AddChild(this); // adds this to parent's list of children to draw } Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcEditBox.cpp 2 Oct 2004 22:41:33 -0000 1.7 --- tcEditBox.cpp 7 Oct 2004 22:01:46 -0000 1.8 *************** *** 205,209 **** tcEditBox::tcEditBox(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLEditBox"), isMouseOver(false), isFocused(false), --- 205,209 ---- tcEditBox::tcEditBox(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLEditBox", parent), isMouseOver(false), isFocused(false), Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tc3DViewer.cpp 2 Oct 2004 22:41:33 -0000 1.1 --- tc3DViewer.cpp 7 Oct 2004 22:01:45 -0000 1.2 *************** *** 227,232 **** wxSize parentSize = parent->GetSize(); int parentHeight = parentSize.GetHeight(); int correctedY = parentHeight - (pos.y + size.GetHeight()); ! sceneView->setViewport(pos.x,correctedY,size.GetWidth(),size.GetHeight()); mnWidth = size.GetWidth(); --- 227,234 ---- wxSize parentSize = parent->GetSize(); int parentHeight = parentSize.GetHeight(); + + int correctedY = parentHeight - (pos.y + size.GetHeight()); ! sceneView->setViewport(pos.x,correctedY, size.GetWidth(),size.GetHeight()); mnWidth = size.GetWidth(); *************** *** 557,561 **** osg::MatrixTransform* transform = new osg::MatrixTransform(); ! orthoProjection->addChild(transform); return transform; --- 559,564 ---- osg::MatrixTransform* transform = new osg::MatrixTransform(); ! //orthoProjection->addChild(transform); ! guiObjects->addChild(transform); return transform; *************** *** 705,708 **** --- 708,712 ---- { wxASSERT(sceneView.valid()); + wxASSERT(guiView.valid()); if (isFrozen && isActive) *************** *** 711,714 **** --- 715,723 ---- isFrozen = false; } + + guiView->update(); + guiView->cull(); + guiView->draw(); + if (isActive && sceneView.valid()) { *************** *** 716,719 **** --- 725,729 ---- sceneView->cull(); sceneView->draw(); + glFinish(); Swap(); *************** *** 721,724 **** --- 731,735 ---- else { + glFinish(); Swap(); } *************** *** 949,952 **** --- 960,1013 ---- } + /** + * + */ + void tc3DViewer::InitGuiView() + { + guiView = new osgUtil::SceneView(); + + wxASSERT(guiView->getDisplaySettings()==NULL); + displaySettings = new osg::DisplaySettings; + displaySettings->setDepthBuffer(false); + + guiView->setDisplaySettings(displaySettings.get()); + guiView->setDefaults(); + guiView->getState()->setContextID(1); + + wxWindow* parent = wxWindow::GetParent(); + wxSize parentSize = parent->GetSize(); + + guiView->setProjectionMatrixAsOrtho2D(0, parentSize.GetWidth(), + 0, parentSize.GetHeight()); + + + guiView->setViewport(0, 0, parentSize.GetWidth(), parentSize.GetHeight()); + guiView->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); + guiView->setLightingMode(osgUtil::SceneView::NO_SCENEVIEW_LIGHT); + guiView->setClearColor(osg::Vec4(0, 0, 0.4f, 1.0f)); + + + guiView->setCullingMode(osg::CullStack::NO_CULLING); + + // set up the clear mask. + osgUtil::RenderStage *stage = guiView->getRenderStage(); + stage->setClearMask(0); + + guiFrameStamp = new osg::FrameStamp; + guiFrameStamp->setReferenceTime(gameTime); + guiView->setFrameStamp(guiFrameStamp.get()); + + guiUpdateVisitor = new osgUtil::UpdateVisitor(); + guiUpdateVisitor->setFrameStamp(guiFrameStamp.get()); + guiView->setUpdateVisitor(guiUpdateVisitor.get()); + + guiObjects = new osg::MatrixTransform; + guiObjects->setMatrix(osg::Matrix::identity()); + guiObjects->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_ABSOLUTE); + + guiView->setSceneData(guiObjects.get()); + + } + void tc3DViewer::InitSceneView(wxPoint pos, wxSize size) { *************** *** 956,966 **** wxASSERT(sceneView->getDisplaySettings()==NULL); displaySettings = new osg::DisplaySettings; // displaySettings->setRGB(true); //displaySettings->setDoubleBuffer(true); - displaySettings->setDepthBuffer(true); //displaySettings->setMinimumNumAlphaBits(4); sceneView->setDisplaySettings(displaySettings.get()); sceneView->setDefaults(); wxWindow *parent = wxWindow::GetParent(); --- 1017,1029 ---- wxASSERT(sceneView->getDisplaySettings()==NULL); displaySettings = new osg::DisplaySettings; + displaySettings->setDepthBuffer(true); + // displaySettings->setRGB(true); //displaySettings->setDoubleBuffer(true); //displaySettings->setMinimumNumAlphaBits(4); sceneView->setDisplaySettings(displaySettings.get()); sceneView->setDefaults(); + sceneView->getState()->setContextID(0); wxWindow *parent = wxWindow::GetParent(); *************** *** 974,978 **** sceneView->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); sceneView->setLightingMode(osgUtil::SceneView::NO_SCENEVIEW_LIGHT); ! sceneView->setBackgroundColor(osg::Vec4(0, 0, 0, 1.0f)); //sceneView->setComputeNearFarMode(osgUtil::CullVisitor::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); --- 1037,1041 ---- sceneView->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); sceneView->setLightingMode(osgUtil::SceneView::NO_SCENEVIEW_LIGHT); ! sceneView->setClearColor(osg::Vec4(0, 0, 0, 1.0f)); //sceneView->setComputeNearFarMode(osgUtil::CullVisitor::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); *************** *** 1110,1113 **** --- 1173,1177 ---- else { + if (!rootnode->removeChild(skyTransform.get()) || !foggedObjects->removeChild(terrainNode.get()) || *************** *** 1401,1404 **** --- 1465,1469 ---- InitSceneView(pos, size); + InitGuiView(); osgDB::Registry::instance()->setDataFilePathList("3d"); |