root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp
@
13041
| Revision 13041, 2.4 kB (checked in by robert, 14 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | // -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008 |
| 2 | // $Id: Box.cpp 50 2008-05-06 05:06:36Z cubicool $ |
| 3 | |
| 4 | #include <osgDB/Registry> |
| 5 | #include <osgDB/Input> |
| 6 | #include <osgDB/Output> |
| 7 | #include <osgDB/FileUtils> |
| 8 | #include <osgWidget/Box> |
| 9 | |
| 10 | bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr) |
| 11 | { |
| 12 | /* |
| 13 | osgWidget::Box& box = static_cast<osgWidgegt::Box&>(obj); |
| 14 | |
| 15 | if(fr[0].matchWord("skeleton") and fr[1].isString()) iter = loadFile( |
| 16 | "skeleton", |
| 17 | &osgCal::osgWidget_Box::loadSkeleton, |
| 18 | model, |
| 19 | fr |
| 20 | ); |
| 21 | |
| 22 | if(fr[0].matchWord("animation") and fr[1].isString()) iter = loadFile( |
| 23 | "animation", |
| 24 | &osgCal::osgWidget_Box::loadAnimation, |
| 25 | model, |
| 26 | fr |
| 27 | ); |
| 28 | |
| 29 | if(fr[0].matchWord("mesh") and fr[1].isString()) iter = loadFile( |
| 30 | "mesh", |
| 31 | &osgCal::osgWidget_Box::loadMesh, |
| 32 | model, |
| 33 | fr |
| 34 | ); |
| 35 | |
| 36 | if(fr[0].matchWord("material") and fr[1].isString()) iter = loadFile( |
| 37 | "material", |
| 38 | &osgCal::osgWidget_Box::loadMaterial, |
| 39 | model, |
| 40 | fr |
| 41 | ); |
| 42 | */ |
| 43 | |
| 44 | osgWidget::warn() << "Box read" << std::endl; |
| 45 | |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | bool osgWidget_Box_writeData(const osg::Object& /*obj*/, osgDB::Output& fw) |
| 50 | { |
| 51 | // const osgWidget::Box& model = static_cast<const osgWidget::Box&>(obj); |
| 52 | |
| 53 | fw.indent() << fw.wrapString("Box stuff...") << std::endl; |
| 54 | |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | /* |
| 59 | bool Model_readData(osg::Object& obj, osgDB::Input& fr) { |
| 60 | bool iter = false; |
| 61 | |
| 62 | osgCal::Model& model = static_cast<osgCal::Model&>(obj); |
| 63 | osgCal::osgWidget_Box* core = static_cast<osgCal::osgWidget_Box*>( |
| 64 | fr.readObjectOfType(osgCal::osgWidget_Box("dummy")) |
| 65 | ); |
| 66 | |
| 67 | if(core) { |
| 68 | model.create(core); |
| 69 | |
| 70 | iter = true; |
| 71 | } |
| 72 | |
| 73 | if(fr.matchSequence("StartAnimation")) { |
| 74 | if(fr[1].isString()) { |
| 75 | int animation = core->getAnimationId(fr[1].getStr()); |
| 76 | |
| 77 | if(animation >= 0) model.startLoop(animation, 1.0f, 0.0f); |
| 78 | |
| 79 | else osg::notify(osg::WARN) |
| 80 | << "Couldn't start animation: " << fr[1].getStr() |
| 81 | << std::endl |
| 82 | ; |
| 83 | |
| 84 | iter = true; |
| 85 | fr += 2; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | return iter; |
| 90 | } |
| 91 | |
| 92 | bool Model_writeData(const osg::Object& obj, osgDB::Output& fw) { |
| 93 | const osgCal::Model& model = static_cast<const osgCal::Model&>(obj); |
| 94 | |
| 95 | fw.writeObject(*model.getosgWidget_Box()); |
| 96 | |
| 97 | return true; |
| 98 | } |
| 99 | |
| 100 | REGISTER_DOTOSGWRAPPER(g_ModelProxy) |
| 101 | ( |
| 102 | new osgCal::Model, |
| 103 | "Model", |
| 104 | "Object Node Model", |
| 105 | &Model_readData, |
| 106 | &Model_writeData |
| 107 | ); |
| 108 | */ |
| 109 | |
| 110 | REGISTER_DOTOSGWRAPPER(g_osgWidget_BoxProxy) |
| 111 | ( |
| 112 | new osgWidget::Box("unset"), |
| 113 | "osgWidget::Box", |
| 114 | "Object Node Group Transform MatrixTransform osgWidget::Box", |
| 115 | &osgWidget_Box_readData, |
| 116 | &osgWidget_Box_writeData |
| 117 | ); |
Note: See TracBrowser
for help on using the browser.
