Esempio n. 1
0
void Transform::setIdentity()
{
    if (isStatic())
        return;

    _scale.set(1.0f, 1.0f, 1.0f);
    _rotation.setIdentity();
    _translation.set(0.0f, 0.0f, 0.0f);
    dirty(DIRTY_TRANSLATION | DIRTY_ROTATION | DIRTY_SCALE);
}
Esempio n. 2
0
void Transform::setRotation(const Matrix& rotation)
{
    if (isStatic())
        return;

    Quaternion rotationQuat;
    Quaternion::createFromRotationMatrix(rotation, &rotationQuat);
    _rotation.set(rotationQuat);
    dirty(DIRTY_ROTATION);
}
Esempio n. 3
0
void Transform::set(const Vector3& scale, const Vector3& axis, float angle, const Vector3& translation)
{
    if (isStatic())
        return;

    _scale.set(scale);
    _rotation.set(axis, angle);
    _translation.set(translation);
    dirty(DIRTY_TRANSLATION | DIRTY_ROTATION | DIRTY_SCALE);
}
Esempio n. 4
0
void Transform::set(const Transform& transform)
{
    if (isStatic())
        return;

    _scale.set(transform._scale);
    _rotation.set(transform._rotation);
    _translation.set(transform._translation);
    dirty(DIRTY_TRANSLATION | DIRTY_ROTATION | DIRTY_SCALE);
}
Esempio n. 5
0
void Transform::set(const Vector3& scale, const Quaternion& rotation, const Vector3& translation)
{
    if (isStatic())
        return;

    _scale.set(scale);
    _rotation.set(rotation);
    _translation.set(translation);
    dirty(DIRTY_TRANSLATION | DIRTY_ROTATION | DIRTY_SCALE);
}
Esempio n. 6
0
void Transform::translate(const Vector3& translation)
{
    if (isStatic())
        return;

    _translation.x += translation.x;
    _translation.y += translation.y;
    _translation.z += translation.z;
    dirty(DIRTY_TRANSLATION);
}
Esempio n. 7
0
void Transform::scale(float sx, float sy, float sz)
{
    if (isStatic())
        return;

    _scale.x *= sx;
    _scale.y *= sy;
    _scale.z *= sz;
    dirty(DIRTY_SCALE);
}
Esempio n. 8
0
void Transform::scale(const Vector3& scale)
{
    if (isStatic())
        return;

    _scale.x *= scale.x;
    _scale.y *= scale.y;
    _scale.z *= scale.z;
    dirty(DIRTY_SCALE);
}
OSErr QuicktimeLiveImageStream::dataProcCallback(SGChannel c, Ptr p, long len, long *offset, long chRefCon, TimeValue time, short writeType, long refCon)
{
    OSErr err = noErr;

    //
    OSG_INFO << " Video " << refCon << std::endl;
    dirty();
    //
    return err;
}
Esempio n. 10
0
void Transform::rotateZ(float angle)
{
    if (isStatic())
        return;

    Quaternion rotationQuat;
    Quaternion::createFromAxisAngle(Vector3::unitZ(), angle, &rotationQuat);
    _rotation.multiply(rotationQuat);
    dirty(DIRTY_ROTATION);
}
Esempio n. 11
0
void Transform::applyAnimationValueRotation(AnimationValue* value, unsigned int index, float blendWeight)
{
    if (isStatic())
        return;

    GP_ASSERT(value);
    Quaternion::slerp(_rotation.x, _rotation.y, _rotation.z, _rotation.w, value->getFloat(index), value->getFloat(index + 1), value->getFloat(index + 2), value->getFloat(index + 3), blendWeight,
                      &_rotation.x, &_rotation.y, &_rotation.z, &_rotation.w);
    dirty(DIRTY_ROTATION);
}
Esempio n. 12
0
void NodeMonitor::cleanIt()
{
	if (dirty())
	{
		// We have to re-attach the callback.
		attachCallbacks();
	}

	fIsDirty = false;
}
Esempio n. 13
0
void KWMapEditor::addEntry() {
	int x = numRows();
	insertRows(x, 1);
	TQPushButton *b = new TQPushButton("X", this);
	connect(b, TQT_SIGNAL(clicked()), this, TQT_SLOT(erase()));
	setCellWidget(x, 0, b);
	ensureCellVisible(x, 1);
	setCurrentCell(x, 1);
	emit dirty();
}
Esempio n. 14
0
void BoxItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    if (m_resizing) {
        m_resizing = false;
        setCursor(Qt::ArrowCursor);
        emit dirty();
    }
    else
        QGraphicsRectItem::mouseReleaseEvent(event);
}
Esempio n. 15
0
void Transform::translate(float tx, float ty, float tz)
{
    if (isStatic())
        return;

    _translation.x += tx;
    _translation.y += ty;
    _translation.z += tz;
    dirty(DIRTY_TRANSLATION);
}
Esempio n. 16
0
PRBool
PaintFrameCallback::operator()(gfxContext* aContext,
                               const gfxRect& aFillRect,
                               const gfxPattern::GraphicsFilter& aFilter,
                               const gfxMatrix& aTransform)
{
  if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER)
    return PR_FALSE;

  mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);

  nsSVGRenderState renderState(aContext);
  aContext->Save();

  // Clip to aFillRect so that we don't paint outside.
  aContext->NewPath();
  aContext->Rectangle(aFillRect);
  aContext->Clip();
  gfxMatrix savedMatrix(aContext->CurrentMatrix());

  aContext->Multiply(gfxMatrix(aTransform).Invert());

  // nsLayoutUtils::PaintFrame will anchor its painting at mFrame. But we want
  // to have it anchored at the top left corner of the bounding box of all of
  // mFrame's continuations. So we add a translation transform.
  nsRect bbox = nsSVGIntegrationUtils::GetNonSVGUserSpace(mFrame);
  PRInt32 appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
  gfxPoint offset = gfxPoint(bbox.x, bbox.y) / appUnitsPerDevPixel;
  aContext->Multiply(gfxMatrix().Translate(-offset));

  gfxSize paintServerSize =
    gfxSize(mPaintServerSize.width, mPaintServerSize.height) /
      mFrame->PresContext()->AppUnitsPerDevPixel();

  // nsLayoutUtils::PaintFrame wants to render with paintServerSize, but we
  // want it to render with mRenderSize, so we need to set up a scale transform.
  gfxFloat scaleX = mRenderSize.width / paintServerSize.width;
  gfxFloat scaleY = mRenderSize.height / paintServerSize.height;
  gfxMatrix scaleMatrix = gfxMatrix().Scale(scaleX, scaleY);
  aContext->Multiply(scaleMatrix);

  // Draw.
  nsRect dirty(bbox.x, bbox.y, mPaintServerSize.width, mPaintServerSize.height);
  nsLayoutUtils::PaintFrame(renderState.GetRenderingContext(mTarget), mFrame,
                            dirty, NS_RGBA(0, 0, 0, 0),
                            nsLayoutUtils::PAINT_IN_TRANSFORM |
                            nsLayoutUtils::PAINT_ALL_CONTINUATIONS);

  aContext->SetMatrix(savedMatrix);
  aContext->Restore();

  mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);

  return PR_TRUE;
}
Esempio n. 17
0
bool PropertyGroup::setFrame(int frame)
{
	bool ret = false;
	for(vector<PropertyBase*>::iterator it = properties_.begin(); it != properties_.end(); ++it) {
		ret |= (*it)->setFrame(frame);
	}
	if(ret) {
		dirty();
	}
	return ret;
}
Esempio n. 18
0
QgsProject::QgsProject()
    : imp_( new QgsProject::Imp )
{
  // Set some default project properties
  // XXX THESE SHOULD BE MOVED TO STATUSBAR RELATED SOURCE
  writeEntry( "PositionPrecision", "/Automatic", true );
  writeEntry( "PositionPrecision", "/DecimalPlaces", 2 );
  // XXX writeEntry() makes the project dirty, but it doesn't make sense
  // for a new project to be dirty, so let's clean it up
  dirty( false );
} // QgsProject ctor
Esempio n. 19
0
GfxCanvasItem::GfxCanvasItem(GfxCanvasItem *p)
: _parent(p), _x(this), _y(this), _z(this),
    _scale(this), _visible(this), _dirty(false)
{
    Q_ASSERT(p);

    _scale.setValue(1.);
    _visible.setValue(1.);
    _parent->addChild(this);
    dirty();
}
Esempio n. 20
0
GfxCanvasItem::~GfxCanvasItem()
{ 
    dirty();
    if(_parent) _parent->remChild(this);
    if(_dirty) 
        layer()->remDirty(this);

    QList<GfxCanvasItem *> children = _children;
    qDeleteAll(children);
    _dirty = false;
}
Esempio n. 21
0
void KWMapEditor::erase() {
	const TQObject *o = TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()));
	for (int i = 0; i < numRows(); i++) {
		if (TQT_BASE_OBJECT_CONST(cellWidget(i, 0)) == TQT_BASE_OBJECT_CONST(o)) {
			removeRow(i);
			break;
		}
	}

	emit dirty();
}
Esempio n. 22
0
KSambaShare::KSambaShare()
    : QObject(0)
    , d_ptr(new KSambaSharePrivate(this))
{
    Q_D(const KSambaShare);
    if (QFile::exists(d->userSharePath)) {
        KDirWatch::self()->addDir(d->userSharePath, KDirWatch::WatchFiles);
        connect(KDirWatch::self(), SIGNAL(dirty(QString)), this,
                SLOT(_k_slotFileChange(QString)));
    }
}
Esempio n. 23
0
void Transform::rotate(const Vector3& axis, float angle)
{
    if (isStatic())
        return;

    Quaternion rotationQuat;
    Quaternion::createFromAxisAngle(axis, angle, &rotationQuat);
    _rotation.multiply(rotationQuat);
    _rotation.normalize();
    dirty(DIRTY_ROTATION);
}
Esempio n. 24
0
void Transform::translateSmooth(const Vector3& target, float elapsedTime, float responseTime)
{
    if (isStatic())
        return;

    if (elapsedTime > 0)
    {
        _translation += (target - _translation) * (elapsedTime / (elapsedTime + responseTime));
        dirty(DIRTY_TRANSLATION);
    }
}
Esempio n. 25
0
int QParam::updataAll(){
    QSet<SpaItemHd>::Iterator iterator = modifyedItem.begin();
    int r=Md::Ok;
    while(iterator!=modifyedItem.end()){
        r = updata(*iterator);
        if(r!=Md::Ok)
            break;
        iterator = modifyedItem.erase(iterator);
    }
    emit dirty(!modifyedItem.isEmpty());
    return Md::Ok ;
}
Esempio n. 26
0
Picture::Picture(QObject *parent)
        : QObject(parent)
{
    m_defaultImage = KGlobal::dirs()->findResource("data", "plasma-applet-frame/picture-frame-default.jpg");
    m_checkDir = false;

    // listen for changes to the file we're displaying
    m_fileWatch = new KDirWatch(this);
    connect(m_fileWatch,SIGNAL(dirty(QString)),this,SLOT(reload()));
    connect(m_fileWatch,SIGNAL(created(QString)),this,SLOT(reload()));
    connect(m_fileWatch,SIGNAL(deleted(QString)),this,SLOT(reload()));
}
Esempio n. 27
0
/*!
 Add all the variables of this material object to the shader program "program".
 It expects that the program already exits and that the names in _glsl_names are used
 @param program - the glsl shader program integer id
 */
bool GLMaterial::addVariablesToProgram(GLuint program, int variable_index)
{

    if(program == -1)return false; // no program exits
    
    
    GLint params;
    glGetProgramiv( program, GL_LINK_STATUS, &params);
    if(params == GL_FALSE)
    {
        cerr << "[GLMaterial] Program " << program << " has not been linked. Materials cannot be added." << endl;
        return false;
    }
    
    
    // enable the program
    glUseProgram(program);
    
    glGetProgramiv( program, GL_ACTIVE_UNIFORMS, &params);
 

    GetVariableName(_glsl_struct, _glsl_names[0], variable_index);
    
    // get the location of a uniform variable. Note, the program must be linked at this position.
    _ambientColorPos = glGetUniformLocation(program, GetVariableName(_glsl_struct, _glsl_names[0], variable_index).c_str());
                        checkUniform(_ambientColorPos, _glsl_names[0]);
    
    _diffuseColorPos = glGetUniformLocation(program, GetVariableName(_glsl_struct, _glsl_names[1], variable_index).c_str());
                        checkUniform(_diffuseColorPos, _glsl_names[1]);
    
    _specularColorPos = glGetUniformLocation(program, GetVariableName(_glsl_struct, _glsl_names[2], variable_index).c_str());
                        checkUniform(_specularColorPos, _glsl_names[2]);
    
    _shininessIdx = glGetUniformLocation(program, GetVariableName(_glsl_struct, _glsl_names[3], variable_index).c_str());
                        checkUniform(_shininessIdx, _glsl_names[3]);

    _emissiveIdx = glGetUniformLocation(program, GetVariableName(_glsl_struct, _glsl_names[4], variable_index).c_str());
                        checkUniform(_emissiveIdx, _glsl_names[4]);
    
    _transparencyIdx = glGetUniformLocation(program, GetVariableName(_glsl_struct, _glsl_names[5], variable_index).c_str());
                    checkUniform(_transparencyIdx, _glsl_names[5]);
    
    // Send the material to your shader program
    /*glUniform3fv(_ambientColorPos, 1, &_ambient_material[0] );
    glUniform3fv(_diffuseColorPos, 1, &_diffuse_material[0]);
    glUniform3fv(_specularColorPos, 1, &_specular_material[0]);
    glUniform1f(_shininessIdx, _shininess);*/
    dirty(program);
    // disable the program
    // glUseProgram(0);
    
    return true;
}
Esempio n. 28
0
    void setNewImage()
    {
        _dataIter = _dataList.begin()+_dataNum;

        if ( *_dataIter )
        {
            unsigned char* image = (*_dataIter)->data;
            setImage(_s,_t,_r,_internalTextureFormat,_pixelFormat,_dataType,
                image,osg::Image::NO_DELETE,1);
            dirty();
        }
    }
Esempio n. 29
0
		virtual void apply_changes()
		{
			if (!dirty())
				return;
			std::set<string> categoriesChanged;
			for (setting_list::iterator iter = iSettings.begin(); iter != iSettings.end(); ++iter)
				if (iter->apply_change())
					categoriesChanged.insert(iter->category());
			for (std::set<string>::const_iterator iter = categoriesChanged.begin(); iter != categoriesChanged.end(); ++iter)
				notify_observers(i_subscriber::NotifySettingsChanged, *iter);
			save();
		}
Esempio n. 30
0
void Transform::set(const Vector3& scale, const Matrix& rotation, const Vector3& translation)
{
    if (isStatic())
        return;

    _scale.set(scale);
    Quaternion rotationQuat;
    Quaternion::createFromRotationMatrix(rotation, &rotationQuat);
    _rotation.set(rotationQuat);
    _translation.set(translation);
    dirty(DIRTY_TRANSLATION | DIRTY_ROTATION | DIRTY_SCALE);
}