void ramPrimitive::internal_update() { if (body) { ofMatrix4x4 mat = body.getTransform(); setTransformMatrix(mat); } }
//---------------------------------------- void ofNode::clearParent(bool bMaintainGlobalTransform) { if(bMaintainGlobalTransform) { ofMatrix4x4 globalTransform(getGlobalTransformMatrix()); this->parent = NULL; setTransformMatrix(globalTransform); } else { this->parent = NULL; } }
//---------------------------------------- void ofNode::setParent(ofNode& parent, bool bMaintainGlobalTransform) { if(bMaintainGlobalTransform) { ofMatrix4x4 globalTransform(getGlobalTransformMatrix()); this->parent = &parent; setTransformMatrix(globalTransform); } else { this->parent = &parent; } }
BoneNode::BoneNode(aiNode *node) : parent(NULL), mInheritOrientation(true), mInheritScale(true) { this->node = node; setTransformMatrix(aiMatrix4x4ToOfMatrix44(node->mTransformation)); }
//---------------------------------------- void ofNode::setParent(ofNode& parent, bool bMaintainGlobalTransform) { if(bMaintainGlobalTransform) { ofMatrix4x4 postParentGlobalTransform = getGlobalTransformMatrix() * parent.getGlobalTransformMatrix().getInverse(); parent.addListener(*this); setTransformMatrix(postParentGlobalTransform); } else { parent.addListener(*this); } this->parent = &parent; }
//---------------------------------------- void ofNode::clearParent(bool bMaintainGlobalTransform) { if(parent){ parent->removeListener(*this); } if(bMaintainGlobalTransform) { auto globalTransform(getGlobalTransformMatrix()); this->parent = nullptr; setTransformMatrix(globalTransform); } else { this->parent = nullptr; } }
void KGameSvgDocument::shear(double xRadians, double yRadians, const MatrixOptions& options) { QMatrix matrix; if (options == ApplyToCurrentMatrix) { matrix = transformMatrix().QMatrix::shear(xRadians, yRadians); } else { matrix = QMatrix(); matrix.QMatrix::shear(xRadians, yRadians); } setTransformMatrix(matrix, ReplaceCurrentMatrix); }
void KGameSvgDocument::translate(int xPixels, int yPixels, const MatrixOptions& options) { QMatrix matrix; if (options == ApplyToCurrentMatrix) { matrix = transformMatrix().QMatrix::translate(xPixels, yPixels); } else { matrix = QMatrix(); matrix.QMatrix::translate(xPixels, yPixels); } setTransformMatrix(matrix, ReplaceCurrentMatrix); }
void KGameSvgDocument::rotate(double degrees, const MatrixOptions& options) { QMatrix matrix; if (options == ApplyToCurrentMatrix) { matrix = transformMatrix().QMatrix::rotate(degrees); } else { matrix = QMatrix(); matrix.QMatrix::rotate(degrees); } setTransformMatrix(matrix, ReplaceCurrentMatrix); }
//---------------------------------------- void ofNode::setParent(ofNode& parent, bool bMaintainGlobalTransform) { if (this->parent) { // we need to make sure to clear before // re-assigning parenthood. clearParent(bMaintainGlobalTransform); } if(bMaintainGlobalTransform) { auto postParentGlobalTransform = glm::inverse(parent.getGlobalTransformMatrix()) * getGlobalTransformMatrix(); parent.addListener(*this); setTransformMatrix(postParentGlobalTransform); } else { parent.addListener(*this); } this->parent = &parent; }
void KGameSvgDocument::scale(double xFactor, double yFactor, const MatrixOptions& options) { QMatrix matrix; if ((xFactor == 0) || (yFactor == 0)) { kWarning () << "KGameSvgDocument::scale: You cannnot scale by zero"; } if (options == ApplyToCurrentMatrix) { matrix = transformMatrix().QMatrix::scale(xFactor, yFactor); } else { matrix = QMatrix(); matrix.QMatrix::scale(xFactor, yFactor); } setTransformMatrix(matrix, ReplaceCurrentMatrix); }
//---------------------------------------------------- void swTransformRotateZ(float degree){ Vec4 temp; float sint,cost; swVectorCopy(&temp,&obj_u); sint=(float)sin(swMathDegreeToRadian(degree)); cost=(float)cos(swMathDegreeToRadian(degree)); obj_u.index[0] = (temp.index[0] * cost - obj_v.index[0] * sint); obj_u.index[1] = (temp.index[1] * cost - obj_v.index[1] * sint); obj_u.index[2] = (temp.index[2] * cost - obj_v.index[2] * sint); obj_v.index[0] = (obj_v.index[0] * cost + temp.index[0] * sint); obj_v.index[1] = (obj_v.index[1] * cost + temp.index[1] * sint); obj_v.index[2] = (obj_v.index[2] * cost + temp.index[2] * sint); setTransformMatrix(&obj_pos,&obj_u,&obj_v,&obj_n); }
//---------------------------------------- void ofNode::setTransformMatrix(const ofMatrix4x4 &m44) { setTransformMatrix(m44.getPtr()); }
//--------------------------------------------------------- void swTransformSetLocation(float x, float y, float z){ obj_pos.index[0]=x; obj_pos.index[1]=y; obj_pos.index[2]=z; setTransformMatrix(&obj_pos,&obj_u,&obj_v,&obj_n); }