[Gcblue-commits] gcb_wx/src/graphics tc3DModel.cpp,1.3,1.4 tc3DTerrain.cpp,1.8,1.9 tcwindow.cpp,1.14
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@us...> - 2004-01-18 18:42:44
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv28162/src/graphics Modified Files: tc3DModel.cpp tc3DTerrain.cpp tcwindow.cpp Log Message: Changes to reduce block artifacts at screen transitions--planning to eliiminate Producer to fix gray background screen issue Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tc3DModel.cpp 16 Jan 2004 00:04:14 -0000 1.3 --- tc3DModel.cpp 18 Jan 2004 18:42:41 -0000 1.4 *************** *** 148,154 **** public: ! inline ModelCopyOp(tc3DModel *model): osg::CopyOp(SHALLOW_COPY), ! _model(model) {} --- 148,156 ---- public: ! inline ModelCopyOp(tc3DModel *model, bool rebindAnimations, float detailThreshold): osg::CopyOp(SHALLOW_COPY), ! _model(model), ! _rebindAnimations(rebindAnimations), ! _detailThreshold(detailThreshold) {} *************** *** 156,160 **** virtual osg::Node* operator() (const osg::Node* node) const { ! if (const osg::Transform *xform = node->asTransform()) { size_t nAnimations = _model->animationInfo.size(); --- 158,163 ---- virtual osg::Node* operator() (const osg::Node* node) const { ! const osg::Transform *xform = node->asTransform(); ! if ((_rebindAnimations)&&(xform)) { size_t nAnimations = _model->animationInfo.size(); *************** *** 170,174 **** } ! osg::Object *obj = (node->clone(ModelCopyOp(_model))); osg::Node* ret_node = dynamic_cast<osg::Node*>(obj); --- 173,178 ---- } ! osg::Object *obj ! = (node->clone(ModelCopyOp(_model, _rebindAnimations, _detailThreshold))); osg::Node* ret_node = dynamic_cast<osg::Node*>(obj); *************** *** 190,195 **** else { ! osg::Node* ret_node = CopyOp::operator()(node); ! return ret_node; } } --- 194,209 ---- else { ! // shallow copy node if larger than detail threshold ! const BoundingSphere& bs = node->getBound(); ! if (bs.radius() >= _detailThreshold) ! { ! osg::Node* ret_node = CopyOp::operator()(node); // shallow copy of node ! return ret_node; ! } ! else ! { ! return NULL; // osg::Group will not add null child ! } ! } } *************** *** 200,205 **** if (attr) { ! ret_attr = dynamic_cast<osg::StateAttribute*> ! (attr->clone(CopyOp(osg::CopyOp::DEEP_COPY_STATEATTRIBUTES))); } else --- 214,226 ---- if (attr) { ! if (_rebindAnimations) ! { ! ret_attr = dynamic_cast<osg::StateAttribute*> ! (attr->clone(CopyOp(osg::CopyOp::DEEP_COPY_STATEATTRIBUTES))); ! } ! else ! { ! ret_attr = CopyOp::operator()(attr); // shallow copy ! } } else *************** *** 212,215 **** --- 233,238 ---- protected: tc3DModel *_model; + bool _rebindAnimations; ///< set true if transforms should be deep copied and re-bound to animations + float _detailThreshold; ///< do not copy nodes smaller than this value }; *************** *** 231,240 **** void tc3DModel::DetachFromParent() { ! modelGroup->getParent(0)->removeChild(modelGroup.get()); } osg::ref_ptr<osg::Node> tc3DModel::GetNode() { ! osg::ref_ptr<osg::Node> node = modelGroup.get(); return node; } --- 254,263 ---- void tc3DModel::DetachFromParent() { ! modelTransform->getParent(0)->removeChild(modelTransform.get()); } osg::ref_ptr<osg::Node> tc3DModel::GetNode() { ! osg::ref_ptr<osg::Node> node = modelTransform.get(); return node; } *************** *** 242,247 **** unsigned int tc3DModel::GetNumParents() { ! wxASSERT(modelGroup.valid()); ! return modelGroup->getNumParents(); } --- 265,270 ---- unsigned int tc3DModel::GetNumParents() { ! wxASSERT(modelTransform.valid()); ! return modelTransform->getNumParents(); } *************** *** 342,349 **** - modelGroup = new osg::Group; modelTransform = new osg::MatrixTransform; modelTransform->setDataVariance(osg::Object::DYNAMIC); ! modelGroup->addChild(modelTransform.get()); animationInfo.clear(); --- 365,373 ---- modelTransform = new osg::MatrixTransform; modelTransform->setDataVariance(osg::Object::DYNAMIC); ! modelGroup = new osg::LOD; ! ! modelTransform->addChild(modelGroup.get()); animationInfo.clear(); *************** *** 354,360 **** } ! modelNode = dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this))); ! modelTransform->addChild(modelNode.get()); --- 378,396 ---- } ! modelNode = dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,true,0))); ! // add children with varying level of detail ! modelGroup->addChild(modelNode.get(),0,200.0); ! modelGroup->addChild( ! dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,2.0f))) ! , 200.0, 500.0); ! modelGroup->addChild( ! dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,5.0f))) ! , 500.0, 10000.0); ! modelGroup->addChild( ! dynamic_cast<osg::Node*>(source->modelNode->clone(ModelCopyOp(this,false,10.0f))) ! , 10000.0, 20000.0); ! ! unsigned nRanges = modelGroup->getNumRanges(); Index: tc3DTerrain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DTerrain.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tc3DTerrain.cpp 16 Dec 2003 00:02:47 -0000 1.8 --- tc3DTerrain.cpp 18 Jan 2004 18:42:41 -0000 1.9 *************** *** 193,197 **** terrainNode->addDrawable(pDrawable); terrainNode->setCullingActive(false); // disables small feature and view frustrum culling ! float detailThreshold = 5.0f; terrain->SetDetailThreshold(detailThreshold); } --- 193,197 ---- terrainNode->addDrawable(pDrawable); terrainNode->setCullingActive(false); // disables small feature and view frustrum culling ! float detailThreshold = 6.0f; terrain->SetDetailThreshold(detailThreshold); } Index: tcwindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcwindow.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcwindow.cpp 3 Jan 2004 00:45:12 -0000 1.14 --- tcwindow.cpp 18 Jan 2004 18:42:41 -0000 1.15 *************** *** 232,241 **** { wxWindow::Enable(true); ! //wxWindow::Move(wxPoint(mrectWindow.left,mrectWindow.top)); } else { wxWindow::Enable(false); ! //wxWindow::Move(wxPoint(10000,10000)); } mbActive=abActive; --- 232,241 ---- { wxWindow::Enable(true); ! wxWindow::Show(TRUE); } else { wxWindow::Enable(false); ! wxWindow::Show(FALSE); } mbActive=abActive; *************** *** 568,575 **** tcWindow::tcWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : ! wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW , name), //| wxNO_FULL_REPAINT_ON_RESIZE |wxCLIP_CHILDREN mnHeight(size.GetHeight()), mnWidth(size.GetWidth()) { ! mbCloned = false; mbActive = false; --- 568,576 ---- tcWindow::tcWindow(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()) { ! SetBackgroundColour(*wxBLACK); ! Show(FALSE); mbCloned = false; mbActive = false; |