237 sep =
new SoSeparator;
sep->ref();
245 QTemporaryDir tempDir;
246 QFile w1 = QFile(
":/vp1/data/models/worker1.wrl");
247 QFile w2 = QFile(
":/vp1/data/models/worker2.wrl");
248 SoSeparator* worker1 =
nullptr;
249 SoSeparator* worker2 =
nullptr;
250 if (tempDir.isValid()) {
251 const QString tempFile1 = tempDir.path() +
"/worker1.wrl";
252 if ( w1.copy(tempFile1) ) {
253 worker1 =
loadModel( tempFile1.toStdString() );
255 std::cout <<
"ERROR!! QFile copy of Worker1 was NOT successful!\n";
257 const QString tempFile2 = tempDir.path() +
"/worker2.wrl";
258 if ( w2.copy(tempFile2) ) {
259 worker2 =
loadModel( tempFile2.toStdString() );
261 std::cout <<
"ERROR!! QFile copy of Worker2 was NOT successful!\n";
264 std::cout <<
"ERROR!! TempDir is NOT valid!\n";
266 if (worker1 ==
nullptr) {
267 std::cout <<
"\n\nERROR! The 3D model Worker1 could not be loaded!\n\n";
270 if (worker2 ==
nullptr) {
271 std::cout <<
"\n\nERROR! The 3D model Worker2 could not be loaded!\n\n";
285 SoScale* myScale1 =
new SoScale();
286 myScale1->scaleFactor.setValue(scaleFactor1, scaleFactor1, scaleFactor1);
287 SoScale* myScale2 =
new SoScale();
288 myScale2->scaleFactor.setValue(scaleFactor2, scaleFactor2, scaleFactor2);
291 trans1 =
new SoTranslation;
293 trans2 =
new SoTranslation;
295 trans3 =
new SoTranslation;
299 SoRotationXYZ * rotY =
new SoRotationXYZ();
303 SoVRMLMaterial* matVRML =
new SoVRMLMaterial();
304 matVRML->diffuseColor.setValue(0., 1., 1.);
309 SoSeparator* sepScaledWorker1 =
new SoSeparator();
310 sepScaledWorker1->addChild(matVRML);
311 sepScaledWorker1->addChild(myScale1);
312 sepScaledWorker1->addChild(rotY);
313 sepScaledWorker1->addChild(worker1);
315 SoSeparator* sepWorker1 =
new SoSeparator();
316 sepWorker1->addChild(
trans1);
317 sepWorker1->addChild(sepScaledWorker1);
319 SoSeparator* sepScaledWorker2 =
new SoSeparator();
320 sepScaledWorker2->addChild(myScale2);
321 sepScaledWorker2->addChild(rotY);
322 sepScaledWorker2->addChild(worker2);
323 SoSeparator* sepWorker2 =
new SoSeparator();
324 sepWorker2->addChild(
trans2);
325 sepWorker2->addChild(sepScaledWorker2);
327 SoTranslation*
xt =
new SoTranslation();
329 SoSeparator* sepWorker3 =
new SoSeparator();
330 sepWorker3->addChild(
trans3);
331 sepWorker3->addChild(sepScaledWorker1);
332 sepWorker3->addChild(
xt);
333 sepWorker3->addChild(sepScaledWorker2);
336 sep->addChild(sepWorker1);
337 sep->addChild(sepWorker2);
338 sep->addChild(sepWorker3);