本文整理汇总了C++中setMatrix函数的典型用法代码示例。如果您正苦于以下问题:C++ setMatrix函数的具体用法?C++ setMatrix怎么用?C++ setMatrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMatrix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setName
CSulScreenAlignedQuad::CSulScreenAlignedQuad( float fViewW, float fViewH, const CSulString& fileTexture )
{
setName( "CSulScreenAlignedQuad" );
osg::ref_ptr<osg::Image> image = osgDB::readImageFile( osgDB::findDataFile(fileTexture.c_str()) );
float x = 0.0f;
float y = 0.0f;
float w = image->s();
float h = image->t();
m_rGeomQuad = new CSulGeomQuad( osg::Vec3( x + w/2.0f, fViewH - (y+h/2.0f) , 0 ), w, h, CSulGeomQuad::PLANE_XY );
m_rGeomQuad->setTexture( image );
m_geodeQuad = new CSulGeode;
m_geodeQuad->addDrawable( m_rGeomQuad );
osg::Matrixd mOrtho = osg::Matrix::ortho2D( 0, fViewW, 0, fViewH );
setMatrix( mOrtho );
initConstructor();
}
示例2: displayResearchButton
// Render a research item given a BASE_STATS structure.
//
void displayResearchButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
{
iIMDShape *ResearchIMD = ((RESEARCH *)Stat)->pIMD;
iIMDShape *MountIMD = ((RESEARCH *)Stat)->pIMD2;
if(ResearchIMD)
{
setMatrix(Position, Rotation, RotXYZ);
pie_MatScale(scale / 100.f);
if(MountIMD) {
pie_Draw3DShape(MountIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
}
pie_Draw3DShape(ResearchIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
unsetMatrix();
}
else
{
debug(LOG_ERROR, "ResearchIMD == NULL");
}
}
示例3: S
//==============================================================================
void EllipsoidShapeNode::extractData(bool firstTime)
{
if( mShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_TRANSFORM)
|| mShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_PRIMITIVE)
|| firstTime )
{
Eigen::Matrix4d S(Eigen::Matrix4d::Zero());
const Eigen::Vector3d& s =
mEllipsoidShape->getSize()/smallestComponent(mEllipsoidShape->getSize());
S(0,0) = s[0]; S(1,1) = s[1]; S(2,2) = s[2]; S(3,3) = 1.0;
setMatrix(eigToOsgMatrix(S));
}
if(nullptr == mGeode)
{
mGeode = new EllipsoidShapeGeode(mEllipsoidShape.get(), mParentShapeFrameNode, this);
addChild(mGeode);
return;
}
mGeode->refresh();
}
示例4: matrix
void SchematicSceneViewer::zoomQt(bool zoomin, bool resetZoom) {
#if QT_VERSION >= 0x050000
double scale2 = matrix().determinant();
#else
double scale2 = matrix().det();
#endif
if (resetZoom ||
((scale2 < 100000 || !zoomin) && (scale2 > 0.001 * 0.05 || zoomin))) {
double oldZoomScale = sqrt(scale2);
double zoomScale = resetZoom ? 1 : ImageUtils::getQuantizedZoomFactor(
oldZoomScale, zoomin);
QMatrix scale =
QMatrix().scale(zoomScale / oldZoomScale, zoomScale / oldZoomScale);
// See QGraphicsView::mapToScene()'s doc for details
QRect rect(0, 0, width(), height());
QRectF sceneCenterRect(
mapToScene(QRect(rect.center(), QSize(2, 2))).boundingRect());
setMatrix(scale, true);
centerOn(sceneCenterRect.center());
}
}
示例5: SwkMatrix3x3
SwkMatrix3x3 (const GenericPointT& p1, const GenericPointT& p2, const GenericPointT& p3,
const GenericPointT& pt)
{
/*
// sort the points first
//
GenericPointT pos[3];
pos[0] = p1;
if (p2 < pos[0])
{
pos[1] = pos[0];
pos[0] = p2;
}
else
{
pos[1] = p2;
}
if (p3 < pos[0])
{
pos[2] = pos[1];
pos[1] = pos[0];
pos[0] = p3;
}
else if (p3 < pos[1])
{
pos[2] = pos[1];
pos[1] = p3;
}
else
{
pos[2] = p3;
}
setMatrix(pos[0], pos[1], pos[2], pt);
*/
setMatrix(p1, p2, p3, pt);
}
示例6: skew
void
CQIllustratorShape::
skew(double dx, double dy)
{
checkoutShape(CQIllustratorData::ChangeType::GEOMETRY);
CMatrix2D m;
m.setSkew(dx, dy);
CMatrix2D m1, m2;
CPoint2D rc = getRotateCenter();
m1.setTranslation(-rc.x, -rc.y);
m2.setTranslation( rc.x, rc.y);
CMatrix2D mm = m2*m*m1;
setMatrix(mm*m_);
checkinShape(CQIllustratorData::ChangeType::GEOMETRY);
}
示例7: loop
void loop() {
time_t rawtime; // raw time
struct tm *ptime; // time struct holder
// nyble vector for matrix columns
// [hour/10, hour/1, minute/10, minute/1]
uint8_t bTime[4] = {0b0000};
// row/column inc.
uint8_t x = 0;
uint8_t y = 0;
// get the time from system
time(&rawtime);
// load into the tm struct
ptime = localtime(&rawtime);
// convert the time to nybles for the matrix
pixelTime(ptime, bTime);
// quarter hour indicator
if ( (ptime->tm_min % 15 == 0) && ptime->tm_sec == 0) {
quarterHour(ptime->tm_hour, ptime->tm_min, QUARTER_WAIT);
}
if (pulse_second) {
for (x = 0; x < PIXEL_ROW; x += width) {
for (y = 0; y < PIXEL_COLUMN; y += height) {
setPixelColorT(pixelMap[x][y],Color(0,0,0));
}
}
show();
usleep(100*100);
}
// set the matrix to the binary time
setMatrix(bTime, sizeof(bTime)/sizeof(bTime[1]), Color(255,255,255), Color(255,0,0));
}
示例8: resizeEvent
virtual void resizeEvent(QResizeEvent *event) {
QGraphicsView::resizeEvent(event);
setSceneRect(Config.Rect);
if(Config.FitInView)
fitInView(sceneRect(), Qt::KeepAspectRatio);
if(matrix().m11() > 1)
setMatrix(QMatrix());
MainWindow *main_window = qobject_cast<MainWindow *>(parentWidget());
if(scene()->inherits("RoomScene")){
RoomScene *room_scene = qobject_cast<RoomScene *>(scene());
QRectF newSceneRect(0, 0, event->size().width(), event->size().height());
room_scene->setSceneRect(newSceneRect);
room_scene->adjustItems();
setSceneRect(room_scene->sceneRect());
if(Config.FitInView)
fitInView(room_scene->sceneRect(), Qt::KeepAspectRatio);
main_window->setBackgroundBrush(false);
return;
}
if(main_window)
main_window->setBackgroundBrush(true);
}
示例9: RobotOnPlane
Khepera::Khepera(World* world, SharedDataWrapper<Shared> shared, ConfigurationManager& params)
: RobotOnPlane(params)
, PhyKhepera(world, shared)
{
setName(m_initialName);
setMatrix(m_initialTm);
doKinematicSimulation(ConfigurationHelper::getBool(configurationManager(), confPath() + "kinematicRobot"));
const bool enableWheels = ConfigurationHelper::getBool(configurationManager(), confPath() + "enableWheels");
const bool enableProximityIR = ConfigurationHelper::getBool(configurationManager(), confPath() + "enableProximityIR");
const bool drawProximityIR = ConfigurationHelper::getBool(configurationManager(), confPath() + "drawProximityIR");
const bool drawIRRays = ConfigurationHelper::getBool(configurationManager(), confPath() + "drawIRRays");
const bool drawIRRaysRange = ConfigurationHelper::getBool(configurationManager(), confPath() + "drawIRRaysRange");
wheelsController()->setEnabled(enableWheels);
proximityIRSensorController()->setEnabled(enableProximityIR);
setProximityIRSensorsGraphicalProperties(drawProximityIR, drawIRRays, drawIRRaysRange);
setDrawFrontMarker(true);
// Setting the color of the robot
setColor(configuredRobotColor());
}
示例10: setMatrix
AffineTransform::AffineTransform(const CGAffineTransform& t)
{
setMatrix(t.a, t.b, t.c, t.d, t.tx, t.ty);
}
示例11: PROFILE_SCOPE
void GFXDevice::updateStates(bool forceSetAll /*=false*/)
{
PROFILE_SCOPE(GFXDevice_updateStates);
if(forceSetAll)
{
bool rememberToEndScene = false;
if(!canCurrentlyRender())
{
if (!beginScene())
{
AssertFatal(false, "GFXDevice::updateStates: Unable to beginScene!");
}
rememberToEndScene = true;
}
setMatrix( GFXMatrixProjection, mProjectionMatrix );
setMatrix( GFXMatrixWorld, mWorldMatrix[mWorldStackSize] );
setMatrix( GFXMatrixView, mViewMatrix );
setVertexDecl( mCurrVertexDecl );
for ( U32 i=0; i < VERTEX_STREAM_COUNT; i++ )
{
setVertexStream( i, mCurrentVertexBuffer[i] );
setVertexStreamFrequency( i, mVertexBufferFrequency[i] );
}
if( mCurrentPrimitiveBuffer.isValid() ) // This could be NULL when the device is initalizing
mCurrentPrimitiveBuffer->prepare();
/// Stateblocks
if ( mNewStateBlock )
setStateBlockInternal(mNewStateBlock, true);
mCurrentStateBlock = mNewStateBlock;
for(U32 i = 0; i < getNumSamplers(); i++)
{
switch (mTexType[i])
{
case GFXTDT_Normal :
{
mCurrentTexture[i] = mNewTexture[i];
setTextureInternal(i, mCurrentTexture[i]);
}
break;
case GFXTDT_Cube :
{
mCurrentCubemap[i] = mNewCubemap[i];
if (mCurrentCubemap[i])
mCurrentCubemap[i]->setToTexUnit(i);
else
setTextureInternal(i, NULL);
}
break;
default:
AssertFatal(false, "Unknown texture type!");
break;
}
}
// Set our material
setLightMaterialInternal(mCurrentLightMaterial);
// Set our lights
for(U32 i = 0; i < LIGHT_STAGE_COUNT; i++)
{
setLightInternal(i, mCurrentLight[i], mCurrentLightEnable[i]);
}
_updateRenderTargets();
if(rememberToEndScene)
endScene();
return;
}
if (!mStateDirty)
return;
// Normal update logic begins here.
mStateDirty = false;
// Update Projection Matrix
if( mProjectionMatrixDirty )
{
setMatrix( GFXMatrixProjection, mProjectionMatrix );
mProjectionMatrixDirty = false;
}
// Update World Matrix
if( mWorldMatrixDirty )
{
setMatrix( GFXMatrixWorld, mWorldMatrix[mWorldStackSize] );
mWorldMatrixDirty = false;
}
// Update View Matrix
if( mViewMatrixDirty )
//.........这里部分代码省略.........
示例12: setMatrix
AffineTransform::AffineTransform(double a, double b, double c, double d, double e, double f)
{
setMatrix(a, b, c, d, e, f);
}
示例13: switch
void GraphicsView::wheelEvent(QWheelEvent *event) {
int zoomType = event->delta();
QMatrix m = matrixImage;
switch (zoom) {
case -3:
if (zoomType > 0) {
m.scale(0.5, 0.5);
zoom = -2;
setMatrix(m);
}
break;
case -2:
if (zoomType < 0) {
m.scale(0.25, 0.25);
zoom = -3;
} else {
m.scale(0.75, 0.75);
zoom = -1;
}
setMatrix(m);
break;
case -1:
if (zoomType < 0) {
m.scale(0.5, 0.5);
zoom = -2;
} else {
m.scale(1, 1);
zoom = 0;
}
setMatrix(m);
break;
case 0:
if (zoomType < 0) {
m.scale(0.75, 0.75);
zoom = -1;
} else {
m.scale(1.25, 1.25);
zoom = 1;
}
setMatrix(m);
break;
case 1:
if (zoomType < 0) {
m.scale(1, 1);
zoom = 0;
} else {
m.scale(1.5, 1.5);
zoom = 2;
}
setMatrix(m);
break;
case 2:
if (zoomType < 0) {
m.scale(1.25, 1.25);
zoom = 1;
} else {
m.scale(1.75, 1.75);
zoom = 3;
}
setMatrix(m);
break;
case 3:
if (zoomType < 0) {
m.scale(1.5, 1.5);
zoom = 2;
} else {
m.scale(2, 2);
zoom = 4;
}
setMatrix(m);
break;
case 4:
if (zoomType < 0) {
m.scale(1.75, 1.75);
zoom = 3;
} else {
m.scale(2.25, 2.25);
zoom = 5;
}
setMatrix(m);
break;
case 5:
if (zoomType < 0) {
m.scale(2, 2);
zoom = 4;
setMatrix(m);
}
break;
}
}
示例14: main
int main(int argc, char** argv)
{
osg::ArgumentParser arguments( &argc, argv );
std::string dbPath;
arguments.read("--db_path", dbPath);
std::srand ( unsigned ( std::time(0) ) );
auto board = Board(boardDefinition, boardSizeX, boardSizeY, dbPath);
auto ghostFactory = GhostFactory();
auto main_obj = make_ref<osg::Group>();
main_obj->addChild(board.draw().get());
auto ghostModel = osgDB::readNodeFile(dbPath + "/cow.osg");
auto ghostCount = 16;
while(ghostCount--)
{
main_obj->addChild(ghostFactory.drawGhost(board, ghostModel).get());
}
// init rotate
auto init_rotate = make_ref<osg::MatrixTransform>();
init_rotate->setMatrix( osg::Matrix::rotate(osg::PI * 2, osg::Vec3(1.0f, 0.0f, 0.0f)) );
// chain rotates
init_rotate->addChild(main_obj);
// Root group
auto root = make_ref<osg::Group>();
root->addChild(init_rotate);
// Setup fog
if(FogEnabled) {
osg::ref_ptr<osg::Fog> fog = new osg::Fog;
fog->setMode( osg::Fog::EXP2 );
fog->setStart( 0.0f );
fog->setEnd(board.getFieldSizeX() * 20);
fog->setDensity(0.0135);
fog->setColor( osg::Vec4(0., 0., 0., 1.0) );
root->getOrCreateStateSet()->setAttributeAndModes(fog.get());
}
// Start viewer
osgViewer::Viewer viewer;
// Set up flashlight
auto lightSource = make_ref<osg::LightSource>();
lightSource->setReferenceFrame(osg::LightSource::ABSOLUTE_RF);
auto light = lightSource->getLight();
const osg::Vec3 lightPosition{1.5, -1, -1}; // right, down, front
light->setPosition(osg::Vec4{lightPosition, 1});
light->setDirection(osg::Vec3{0, 0, -1} * 30 - lightPosition);
light->setSpotExponent(60);
light->setSpotCutoff(90);
light->setDiffuse(osg::Vec4(1, 1, 1, 1));
light->setAmbient(osg::Vec4(0.6, 0.6, 0.6, 1));
light->setSpecular(osg::Vec4(1, 1, 1, 1));
light->setLinearAttenuation(0.001);
light->setConstantAttenuation(0.5);
root->addChild(lightSource);
double height = std::min(board.getFieldSizeX(), board.getFieldSizeY()) / 1.5;
auto fpsManipulator = make_ref<FPSManipulator>(board, viewer, *light);
fpsManipulator->setHomePosition(
osg::Vec3d(board.getFieldCenterX(1), board.getFieldCenterY(10), height),
osg::Vec3d(0.0f, 0.0f, height),
osg::Vec3d(0.0f, 0.0f, 1.0f)
);
auto keySwitch = make_ref<osgGA::KeySwitchMatrixManipulator>();
keySwitch->addNumberedMatrixManipulator(make_ref<osgGA::OrbitManipulator>());
keySwitch->addNumberedMatrixManipulator(fpsManipulator);
viewer.setCameraManipulator(keySwitch);
viewer.home();
viewer.setSceneData( root );
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
viewer.getCamera()->setClearColor(osg::Vec4{0, 0, 0, 0});
viewer.getCamera()->getView()->setLightingMode(osg::View::HEADLIGHT);
auto defaultLight = viewer.getCamera()->getView()->getLight();
defaultLight->setDiffuse(osg::Vec4(0, 0, 0, 1));
defaultLight->setAmbient(osg::Vec4(0, 0, 0, 1));
defaultLight->setSpecular(osg::Vec4(0, 0, 0, 1));
// Shaders
auto program = make_ref<osg::Program>();
auto fragmentObject = make_ref<osg::Shader>(osg::Shader::FRAGMENT);
loadShaderSource(fragmentObject, dbPath + "/shader.frag");
auto vertexObject = make_ref<osg::Shader>(osg::Shader::VERTEX);
loadShaderSource(vertexObject, dbPath + "/shader.vert");
program->addShader(vertexObject);
program->addShader(fragmentObject);
//.........这里部分代码省略.........
示例15: setMatrix
//////////////////////////////////////////////////////////////////////////
// setMatirx
// (desc) call by outside
// set transformation matrix
//////////////////////////////////////////////////////////////////////////
bool ZShadow::setMatrix(ZCharacterObject& char_, float size_ )
{
return setMatrix( *char_.m_pVMesh ,size_);
}