Skip to content

Commit bbbe5c7

Browse files
author
Daniel Wickeroth
committed
colorAnimPlugin loads two more static models
1 parent d474d72 commit bbbe5c7

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

src/OpenCOVER/plugins/ukoeln/colorAnim/ColorAnimPlugin.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ ColorAnimPlugin::~ColorAnimPlugin()
4444
{
4545
cover->getObjectsRoot()->removeChild(brainTransform.get());
4646
}
47+
48+
if (secondModel.valid() && cover->getObjectsRoot())
49+
{
50+
cover->getObjectsRoot()->removeChild(secondModel.get());
51+
}
52+
53+
if (thirdModel.valid() && cover->getObjectsRoot())
54+
{
55+
cover->getObjectsRoot()->removeChild(thirdModel.get());
56+
}
4757
}
4858

4959
bool ColorAnimPlugin::init()
@@ -167,6 +177,40 @@ bool ColorAnimPlugin::init()
167177
updateColors();
168178
}
169179

180+
// Load second additional model
181+
std::string secondModelPath = coCoviseConfig::getEntry("value", "COVER.Plugin.ColorAnim.SecondModel", "");
182+
if (!secondModelPath.empty())
183+
{
184+
fprintf(stderr, "ColorAnimPlugin: Loading second model from %s\n", secondModelPath.c_str());
185+
secondModel = osgDB::readNodeFile(secondModelPath);
186+
if (secondModel.valid())
187+
{
188+
cover->getObjectsRoot()->addChild(secondModel.get());
189+
fprintf(stderr, "ColorAnimPlugin: Second model loaded successfully\n");
190+
}
191+
else
192+
{
193+
fprintf(stderr, "ColorAnimPlugin: Warning - Could not load second model: %s\n", secondModelPath.c_str());
194+
}
195+
}
196+
197+
// Load third additional model
198+
std::string thirdModelPath = coCoviseConfig::getEntry("value", "COVER.Plugin.ColorAnim.ThirdModel", "");
199+
if (!thirdModelPath.empty())
200+
{
201+
fprintf(stderr, "ColorAnimPlugin: Loading third model from %s\n", thirdModelPath.c_str());
202+
thirdModel = osgDB::readNodeFile(thirdModelPath);
203+
if (thirdModel.valid())
204+
{
205+
cover->getObjectsRoot()->addChild(thirdModel.get());
206+
fprintf(stderr, "ColorAnimPlugin: Third model loaded successfully\n");
207+
}
208+
else
209+
{
210+
fprintf(stderr, "ColorAnimPlugin: Warning - Could not load third model: %s\n", thirdModelPath.c_str());
211+
}
212+
}
213+
170214
fprintf(stderr, "ColorAnimPlugin: Initialization complete\n");
171215
return true;
172216
}

src/OpenCOVER/plugins/ukoeln/colorAnim/ColorAnimPlugin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ class ColorAnimPlugin : public coVRPlugin, public ui::Owner
6969
osg::ref_ptr<osg::Geode> brainGeode;
7070
osg::ref_ptr<osg::Geometry> brainGeometry;
7171

72+
// Additional static models
73+
osg::ref_ptr<osg::Node> secondModel;
74+
osg::ref_ptr<osg::Node> thirdModel;
75+
7276
// Animation data
7377
std::vector<osg::ref_ptr<osg::Vec4Array>> colorFrames;
7478
int numFrames;

0 commit comments

Comments
 (0)