Thread: [Gcblue-commits] gcb_wx/src/graphics tc3DViewer.cpp,1.30,1.31 tc3DWindow.cpp,1.33,1.34 tcDatabaseInf
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:32:36
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422/src/graphics Modified Files: tc3DViewer.cpp tc3DWindow.cpp tcDatabaseInfoWindow.cpp tcHookInfo.cpp tcOOBView.cpp Log Message: Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcHookInfo.cpp 23 Mar 2006 01:11:02 -0000 1.18 --- tcHookInfo.cpp 26 Mar 2006 00:32:14 -0000 1.19 *************** *** 390,394 **** /*** damage ***/ ! float damageLevelPercent = 100.0f * pHookedObj->mfDamageLevel; if (damageLevelPercent > 100.0f) damageLevelPercent = 100.0f; --- 390,394 ---- /*** damage ***/ ! float damageLevelPercent = 100.0f * pHookedObj->GetDamageLevel(); if (damageLevelPercent > 100.0f) damageLevelPercent = 100.0f; Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tc3DViewer.cpp 23 Mar 2006 01:11:02 -0000 1.30 --- tc3DViewer.cpp 26 Mar 2006 00:32:14 -0000 1.31 *************** *** 2,6 **** ** @file tc3DViewer.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tc3DViewer.cpp */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tc3DWindow.cpp 23 Mar 2006 01:11:02 -0000 1.33 --- tc3DWindow.cpp 26 Mar 2006 00:32:14 -0000 1.34 *************** *** 352,356 **** osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f)); backgroundQuad->setColorArray(colors); backgroundQuad->setColorBinding(osg::Geometry::BIND_OVERALL); --- 352,356 ---- osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(backgroundColor); backgroundQuad->setColorArray(colors); backgroundQuad->setColorBinding(osg::Geometry::BIND_OVERALL); *************** *** 717,720 **** --- 717,728 ---- /** + * Sets color of background quad + */ + void tc3DWindow::SetBackgroundColor(const osg::Vec4& color) + { + backgroundColor = color; + } + + /** * @param state true to enable background drawing, false to disable */ *************** *** 737,740 **** --- 745,749 ---- //root->removeDrawable(backgroundQuad.get()); } + UpdateBackgroundQuad(); } *************** *** 1531,1539 **** osg::Image* image = LoadImage(fileName); ! osg::Texture2D* tex = new osg::Texture2D; ! tex->setDataVariance(osg::Object::STATIC); ! tex->setImage(image); ! return tex; } --- 1540,1556 ---- osg::Image* image = LoadImage(fileName); ! if (image != 0) ! { ! osg::Texture2D* tex = new osg::Texture2D; ! tex->setDataVariance(osg::Object::STATIC); ! tex->setImage(image); ! return tex; ! } ! else ! { ! wxASSERT(false); ! return 0; ! } } *************** *** 2213,2216 **** --- 2230,2234 ---- fontSizeLarge(18.0), fontSizeSmall(9.0), + backgroundColor(1.0f, 1.0f, 1.0f, 1.0f), hostParent(graphicsHost), blendingOn(true), Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcOOBView.cpp 23 Mar 2006 01:11:02 -0000 1.12 --- tcOOBView.cpp 26 Mar 2006 00:32:14 -0000 1.13 *************** *** 113,117 **** info.maFollowers.clear(); info.mbRadiating = platformObj->IsRadiating(); ! info.mfDamage_fract = platformObj->mfDamageLevel; if (platformObj->msFormationParameters.mbFormation) { --- 113,117 ---- info.maFollowers.clear(); info.mbRadiating = platformObj->IsRadiating(); ! info.mfDamage_fract = platformObj->GetDamageLevel(); if (platformObj->msFormationParameters.mbFormation) { Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDatabaseInfoWindow.cpp 23 Mar 2006 01:11:02 -0000 1.1 --- tcDatabaseInfoWindow.cpp 26 Mar 2006 00:32:14 -0000 1.2 *************** *** 31,34 **** --- 31,35 ---- #include "tcSimState.h" #include "common/tinyxml.h" + #include "tcTime.h" #include <osg/Geometry> *************** *** 69,77 **** DrawChildren(); ! if (!IsBackgroundEnabled()) ! { ! DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0.2, 0.2, 0.2, 0.7f), ! FILL_ON); ! } DrawDatabaseInfo(); --- 70,78 ---- DrawChildren(); ! //if (!IsBackgroundEnabled()) ! //{ ! // DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0.15, 0.15, 0.15, 1.0f), ! // FILL_ON); ! //} DrawDatabaseInfo(); *************** *** 122,125 **** --- 123,141 ---- defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth, textBox); + float imagex = 265.0; + float imagey = 10.0; + size_t nImages = imageList.size(); + if (nImages > 0) + { + DrawImageR(imageList[currentImageIdx].get(), imagex, imagey, 128.0f, 128.0f, ALIGN_BOTTOM_LEFT); + + // cycle through images + unsigned int t = tcTime::Get()->Get30HzCount(); + if (t - imageTime > 90) + { + currentImageIdx = (currentImageIdx + 1) % nImages; + imageTime = t; + } + } *************** *** 175,178 **** --- 191,210 ---- } + void tcDatabaseInfoWindow::LoadImageList() + { + imageList.clear(); + + database::tcDatabaseObject* databaseObject = GetDatabaseObject(); + if (databaseObject == 0) return; + + wxArrayString parsedImageList = databaseObject->GetParsedImageList(); + for (size_t n=0; n<parsedImageList.size(); n++) + { + wxString& fileName = parsedImageList[n]; + osg::ref_ptr<osg::Texture2D> tex = tc3DWindow::LoadTexture(fileName.c_str()); + if (tex.valid()) imageList.push_back(tex); + } + } + /** * Close and destroy window at next safe opportunity *************** *** 243,246 **** --- 275,283 ---- objId = id; databaseClassName = ""; + + currentImageIdx = 0; + imageTime = tcTime::Get()->Get30HzCount(); + + LoadImageList(); } *************** *** 274,278 **** windowDragOn(false), objId(-1), ! databaseClassName("") { --- 311,318 ---- windowDragOn(false), objId(-1), ! databaseClassName(""), ! currentImageIdx(0), ! imageTime(0) ! { *************** *** 313,317 **** */ ! SetActive(true); --- 353,358 ---- */ ! SetBackgroundColor(osg::Vec4(0.2f, 0.2f, 0.2f, 0.5f)); ! SetBackgroundDraw(true); SetActive(true); |