#include "SGRotateTransform.hxx"
#include "SGScaleTransform.hxx"
+using OpenThreads::Mutex;
+using OpenThreads::ReentrantMutex;
+using OpenThreads::ScopedLock;
+
\f
////////////////////////////////////////////////////////////////////////
// Static utility functions.
return expr;
}
-static SGExpressiond*
+SGExpressiond*
read_value(const SGPropertyNode* configNode, SGPropertyNode* modelRoot,
const char* unit, double defMin, double defMax)
{
else
_initialValue = 0;
- _axis[0] = configNode->getDoubleValue("axis/x", 0);
- _axis[1] = configNode->getDoubleValue("axis/y", 0);
- _axis[2] = configNode->getDoubleValue("axis/z", 0);
+ if (configNode->hasValue("axis/x1-m")) {
+ SGVec3d v1, v2;
+ v1[0] = configNode->getDoubleValue("axis/x1-m", 0);
+ v1[1] = configNode->getDoubleValue("axis/y1-m", 0);
+ v1[2] = configNode->getDoubleValue("axis/z1-m", 0);
+ v2[0] = configNode->getDoubleValue("axis/x2-m", 0);
+ v2[1] = configNode->getDoubleValue("axis/y2-m", 0);
+ v2[2] = configNode->getDoubleValue("axis/z2-m", 0);
+ _axis = v2 - v1;
+ } else {
+ _axis[0] = configNode->getDoubleValue("axis/x", 0);
+ _axis[1] = configNode->getDoubleValue("axis/y", 0);
+ _axis[2] = configNode->getDoubleValue("axis/z", 0);
+ }
if (8*SGLimitsd::min() < norm(_axis))
_axis = normalize(_axis);
}
namespace
{
-OpenThreads::Mutex normalizeMutex;
+Mutex normalizeMutex;
osg::StateSet* getNormalizeStateSet()
{
static osg::ref_ptr<osg::StateSet> normalizeStateSet;
- OpenThreads::ScopedLock<OpenThreads::Mutex> lock(normalizeMutex);
+ ScopedLock<Mutex> lock(normalizeMutex);
if (!normalizeStateSet.valid()) {
normalizeStateSet = new osg::StateSet;
normalizeStateSet->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
namespace
{
// Keep one copy of the most common alpha test its state set.
-OpenThreads::ReentrantMutex alphaTestMutex;
+ReentrantMutex alphaTestMutex;
osg::ref_ptr<osg::AlphaFunc> standardAlphaFunc;
osg::ref_ptr<osg::StateSet> alphaFuncStateSet;
osg::AlphaFunc* makeAlphaFunc(float clamp)
{
- using namespace OpenThreads;
ScopedLock<ReentrantMutex> lock(alphaTestMutex);
if (osg::equivalent(clamp, 0.01f)) {
if (standardAlphaFunc.valid())
osg::Group* group = new osg::Group;
group->setName("texture transform group");
osg::StateSet* stateSet = group->getOrCreateStateSet();
+ stateSet->setDataVariance(osg::Object::DYNAMIC);
osg::TexMat* texMat = new osg::TexMat;
UpdateCallback* updateCallback = new UpdateCallback(getCondition());
// interpret the configs ...
// Contains the normal geometry that is interactive
osg::ref_ptr<osg::Group> normalGroup = new osg::Group;
+ normalGroup->setName("pick normal group");
normalGroup->addChild(commonGroup);
// Used to render the geometry with just yellow edges
osg::Group* highlightGroup = new osg::Group;
+ highlightGroup->setName("pick highlight group");
highlightGroup->setNodeMask(SG_NODEMASK_PICK_BIT);
highlightGroup->addChild(commonGroup);
SGSceneUserData* ud;
- ud = SGSceneUserData::getOrCreateSceneUserData(highlightGroup);
+ ud = SGSceneUserData::getOrCreateSceneUserData(commonGroup);
std::vector<SGPropertyNode_ptr> actions;
actions = getConfig()->getChildren("action");
for (unsigned int i = 0; i < actions.size(); ++i)