History

working on renderstates

SamGondelman committed 9 years ago

Commit 3c719b21 parent 3a35cd16 files · +97 −17Browse files

Showing the changes to interface/src/raypick/LaserPointerScriptingInterface.cpp (1 of 6 files). Show all

Unified · Split

interface/src/raypick/LaserPointerScriptingInterface.cpp+41−3
@@ -15,6 +15,8 @@ · 14 unmodified lines
15#include "RegisteredMetaTypes.h"15#include "RegisteredMetaTypes.h"
16#include "GLMHelpers.h"16#include "GLMHelpers.h"
17 17
18#include "Application.h"
19
18LaserPointerScriptingInterface* LaserPointerScriptingInterface::getInstance() {20LaserPointerScriptingInterface* LaserPointerScriptingInterface::getInstance() {
19 static LaserPointerScriptingInterface instance;21 static LaserPointerScriptingInterface instance;
20 return &instance;22 return &instance;
@@ -52,10 +54,46 @@ uint32_t LaserPointerScriptingInterface::createLaserPointer(const QVariant& prop · 31 unmodified lines
52 enabled = propertyMap["enabled"].toBool();54 enabled = propertyMap["enabled"].toBool();
53 }55 }
54 56
55 // TODO:57 QHash<QString, RenderState> renderStates;
56 // handle render state properties58 if (propertyMap["renderStates"].isValid()) {
59 QList<QVariant> renderStateVariants = propertyMap["renderStates"].toList();
60 for (QVariant& renderStateVariant : renderStateVariants) {
61 if (renderStateVariant.isValid()) {
62 QVariantMap renderStateMap = renderStateVariant.toMap();
63 if (renderStateMap["name"].isValid()) {
64 QString name = renderStateMap["name"].toString();
65
66 QUuid startID;
67 if (renderStateMap["start"].isValid()) {
68 QVariantMap startMap = renderStateMap["start"].toMap();
69 if (startMap["type"].isValid()) {
70 startID = qApp->getOverlays().addOverlay(startMap["type"].toString(), startMap);
71 }
72 }
73
74 QUuid pathID;
75 if (renderStateMap["path"].isValid()) {
76 QVariantMap pathMap = renderStateMap["path"].toMap();
77 if (pathMap["type"].isValid()) {
78 pathID = qApp->getOverlays().addOverlay(pathMap["type"].toString(), pathMap);
79 }
80 }
81
82 QUuid endID;
83 if (renderStateMap["end"].isValid()) {
84 QVariantMap endMap = renderStateMap["end"].toMap();
85 if (endMap["type"].isValid()) {
86 endID = qApp->getOverlays().addOverlay(endMap["type"].toString(), endMap);
87 }
88 }
89
90 renderStates[name] = RenderState(startID, pathID, endID);
91 }
92 }
93 }
94 }
57 95
58 return LaserPointerManager::getInstance().createLaserPointer(jointName, posOffset, dirOffset, filter, maxDistance, enabled);96 return LaserPointerManager::getInstance().createLaserPointer(jointName, posOffset, dirOffset, filter, maxDistance, renderStates, enabled);
59 } else {97 } else {
60 return 0;98 return 0;
61 }99 }