Ejemplo n.º 1
0
void VrmlNodeMultiTouchSensor::eventIn(double timeStamp,
                                       const char *eventName,
                                       const VrmlField *fieldValue)
{
    if (strcmp(eventName, "markerName"))
    {
        if (fieldValue->toSFString()->get())
            markerID = coVRTouchTable::instance()->ttInterface->getMarker(fieldValue->toSFString()->get());
        else
            markerID = -1;
    }
    else if (strcmp(eventName, "markerRotation"))
    {
        recalcMatrix();
    }
    else if (strcmp(eventName, "markerPosition"))
    {
        recalcMatrix();
    }
    else if (strcmp(eventName, "orientation"))
    {
        recalcMatrix();
    }
    else if (strcmp(eventName, "minPosition"))
    {
        recalcMatrix();
    }
    VrmlNodeChild::eventIn(timeStamp, eventName, fieldValue);
}
Ejemplo n.º 2
0
// Set the value of one of the node fields.
void VrmlNodeMultiTouchSensor::setField(const char *fieldName,
                                        const VrmlField &fieldValue)
{
    if (strcmp(fieldName, "markerName") == 0)
    {

        if (fieldValue.toSFString()->get())
            markerID = coVRTouchTable::instance()->ttInterface->getMarker(fieldValue.toSFString()->get());
        else
            markerID = -1;
    }
    else if (strcmp(fieldName, "markerRotation"))
    {
        recalcMatrix();
    }
    else if (strcmp(fieldName, "markerPosition"))
    {
        recalcMatrix();
    }
    else if (strcmp(fieldName, "orientation"))
    {
        recalcMatrix();
    }
    else if (strcmp(fieldName, "minPosition"))
    {
        recalcMatrix();
    }
    if
        TRY_FIELD(trackObjects, SFBool)
    else if
        TRY_FIELD(freeze, SFBool)
    else if
        TRY_FIELD(enabled, SFBool)
    else if
        TRY_FIELD(currentCamera, SFBool)
    else if
        TRY_FIELD(size, SFVec2f)
    else if
        TRY_FIELD(minPosition, SFVec3f)
    else if
        TRY_FIELD(markerPosition, SFVec3f)
    else if
        TRY_FIELD(markerRotation, SFRotation)
    else if
        TRY_FIELD(invisiblePosition, SFVec3f)
    else if
        TRY_FIELD(orientationThreshold, SFFloat)
    else if
        TRY_FIELD(orientation, SFRotation)
    else if
        TRY_FIELD(positionThreshold, SFFloat)
    else if
        TRY_FIELD(markerName, SFString)
    else
        VrmlNodeChild::setField(fieldName, fieldValue);
}
Ejemplo n.º 3
0
VrmlNodeMultiTouchSensor::VrmlNodeMultiTouchSensor(VrmlScene *scene)
    : VrmlNodeChild(scene)
    , d_freeze(false)
    , d_trackObjects(false)
    , d_enabled(true)
    , d_currentCamera(true)
    , d_positionThreshold(0.3)
    , d_orientationThreshold(15.0)
    , d_orientation(0, 1, 0, 0)
    , d_size(-1.0, -1.0)
    , d_minPosition(-1.0, -1.0, -1.0)
    , d_markerPosition(0, 0, 0)
    , d_markerRotation(0, 1, 0, 0)
    , d_invisiblePosition(100000, 100000, 100000)
    , d_markerName(NULL)
    , d_visible(false)
    , d_translation(0, 0, 0)
    , d_rotation(0, 1, 0, 0)
    , d_scale(0.0000001, 0.0000001, 0.0000001)
{
    markerID = -1;
    setModified();
    oldPos[0] = 0;
    oldPos[1] = 0;
    oldAngle = 0;
    oldTime = 0.0;
    recalcMatrix();
}
Ejemplo n.º 4
0
VrmlNodeMultiTouchSensor::VrmlNodeMultiTouchSensor(const VrmlNodeMultiTouchSensor &n)
    : VrmlNodeChild(n.d_scene)
    , d_freeze(n.d_freeze)
    , d_trackObjects(n.d_trackObjects)
    , d_enabled(n.d_enabled)
    , d_currentCamera(n.d_currentCamera)
    , d_positionThreshold(n.d_positionThreshold)
    , d_orientationThreshold(n.d_orientationThreshold)
    , d_orientation(n.d_orientation)
    , d_size(n.d_size)
    , d_minPosition(n.d_minPosition)
    , d_markerPosition(n.d_markerPosition)
    , d_markerRotation(n.d_markerRotation)
    , d_invisiblePosition(n.d_invisiblePosition)
    , d_markerName(NULL)
    , d_visible(n.d_visible)
    , d_translation(n.d_translation)
    , d_rotation(n.d_rotation)
    , d_scale(n.d_scale)
{
    if (d_markerName.get())
    {
        if (coVRTouchTable::instance()->ttInterface)
        {
            markerID = coVRTouchTable::instance()->ttInterface->getMarker(d_markerName.get());
        }
    }
    else
        markerID = -1;
    setModified();
    oldPos[0] = 0;
    oldPos[1] = 0;
    oldAngle = 0;
    oldTime = 0.0;
    recalcMatrix();
}
Ejemplo n.º 5
0
	void Entity::setScale(const vec3 &s)
	{
		scale = s;
		recalcMatrix();
	}
Ejemplo n.º 6
0
	void Entity::setPos(const vec3 &p)
	{
		pos = p;
		recalcMatrix();
	}