本文整理汇总了C++中endEditCP函数的典型用法代码示例。如果您正苦于以下问题:C++ endEditCP函数的具体用法?C++ endEditCP怎么用?C++ endEditCP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了endEditCP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char **argv )
{
osgInit(argc,argv);
QApplication::setColorSpec( QApplication::CustomColor );
QApplication a( argc, argv );
if ( !QGLFormat::hasOpenGL() ) {
qWarning( "This system has no OpenGL support. Exiting." );
return -1;
}
OpenSGWidget w(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba |
QGL::DirectRendering));
// create the scene
NodePtr scene;
if(argc > 1)
{
scene = Node::create();
GroupPtr g = Group::create();
beginEditCP(scene);
scene->setCore(g);
for(UInt16 i = 1; i < argc; ++i)
scene->addChild(SceneFileHandler::the().read(argv[i]));
endEditCP(scene);
}
else
{
scene = makeTorus(.5, 3, 16, 16);
}
w.getManager()->setRoot(scene);
w.getManager()->showAll();
w.show();
return a.exec();
}
示例2: responseString
/***************************************************************************\
* Instance methods *
\***************************************************************************/
ComponentPtr DefaultDialogComponentGenerator::getResponseComponent(DialogInterfacePtr Parent, const boost::any& Value)
{
std::string responseString("");
try
{
responseString = lexical_cast(Value);
}
catch (boost::bad_lexical_cast &)
{
std::cout<<"Unable to display response"<<std::endl;
}
ButtonPtr TheResponseButton = Button::Ptr::dcast(getResponseButtonPrototype()->shallowCopy());
beginEditCP(TheResponseButton, Button::TextFieldMask);
TheResponseButton->setText(responseString);
endEditCP(TheResponseButton, Button::TextFieldMask);
return TheResponseButton;
}
示例3: loadConfig
void CharacterModel::changed(BitVector whichField, UInt32 origin)
{
Inherited::changed(whichField, origin);
if(whichField & ConfigFileFieldMask)
{
_coreModel = loadConfig(getConfigFile());
if(_coreModel)
{
// Only need to do this once, not every time the
// Cal3D Model is needed, that's why it's not
// done in loadConfig()
convertMaterials(getConfigFile());
CharacterModelPtr cp(this);
beginEditCP(cp, NumAnimationsFieldMask);
cp->setNumAnimations(_coreModel->getCoreAnimationCount());
endEditCP(cp, NumAnimationsFieldMask);
}
}
}
示例4: beginEditCP
void VRMLLODBinder::init(VRMLToOSGAction *)
{
if(_pNode == NULL)
return;
VRMLLOD *pNode = dynamic_cast<VRMLLOD *>(_pNode);
if(pNode == NULL)
return;
NodePtr pLODNode = Node ::create();
DistanceLODPtr pLOD = DistanceLOD::create();
beginEditCP(pLODNode, Node::CoreFieldMask);
{
pLODNode->setCore(pLOD);
}
endEditCP (pLODNode, Node::CoreFieldMask);
_pFieldContainer = pLODNode;
}
示例5: beginEditCP
/*!
* \brief Replaces corrupted geometrie nodes with group nodes.
* \return true if something was repaired.
*/
bool VerifyGraphOp::repairGeometry(void)
{
if (!_corruptedGeos.empty())
{
if (_verbose)
{
SINFO << "Repairing corrupted geos:" << endLog;
}
for (UInt32 i=0;i<_corruptedGeos.size();++i)
{
// now replace corrupted geometry core with a group core.
for (UInt32 j=0;j<_corruptedGeos[i]->getParents().size();++j)
{
NodePtr parent = _corruptedGeos[i]->getParents()[j];
if (parent != NullFC)
{
std::string nname;
if(OSG::getName(parent) != NULL)
{
nname = OSG::getName(parent);
}
if (_verbose)
{
SINFO << "Removing corrupted geom from node: "
<< nname << endLog;
}
nname += "_CORRUPTED";
OSG::setName(parent, nname.c_str());
beginEditCP(parent, Node::CoreFieldMask);
parent->setCore(Group::create());
endEditCP(parent, Node::CoreFieldMask);
}
}
}
return true;
}
return false;
}
示例6: display
// redraw the window
void display(void)
{
if (animate)
{
// Eventually switch between different hardware modes
float ctime = glutGet(GLUT_ELAPSED_TIME);
int dtime = ctime / 1000 / 2;
newMode = dtime % numModes;
// Make the volume rotate
int movement = (int) (ctime - lastFrame) * aniSpeed;
if (movement != 0) lastFrame = ctime;
mgr->mouseButtonPress (GLUT_LEFT_BUTTON, 0, 0);
mgr->mouseMove (movement, 0);
mgr->mouseButtonRelease(GLUT_LEFT_BUTTON, movement, 0);
}
// Switch shader mode if desired
if (newMode != curMode)
{
beginEditCP(shader, DVRSimpleLUTShader::LutModeFieldMask);
setField<Int8>(shader, "lutMode", newMode);
endEditCP(shader, DVRSimpleLUTShader::LutModeFieldMask);
}
mgr->redraw();
// Output active shader mode - field is valid after redraw only
if (newMode != curMode)
{
SLOG << "Mode " << newMode
<< ": " << shaderTests[newMode].name << " --> "
<< shaderTests[getField<Int8>(shader, "activeLutMode")].name << std::endl;
curMode = newMode;
}
}
示例7: beginEditCP
void VRMLAppearanceBinder::setTexture(TextureChunkPtr pTex)
{
if(pTex == NullFC)
return;
ChunkMaterialPtr pChunkMat =
ChunkMaterialPtr::dcast(_pFieldContainer);
if(pChunkMat != NullFC)
{
beginEditCP(pChunkMat, ChunkMaterial::ChunksFieldMask);
{
pChunkMat->addChunk(pTex);
}
endEditCP (pChunkMat, ChunkMaterial::ChunksFieldMask);
// check for alpha
ImagePtr img = pTex->getImage();
if(img != NullFC && img->getBpp() == 4)
_has_alpha = true;
}
}
示例8: TheSet
ImageComponentPtr IconManager::createIconImageComponent(const std::string& IconSetName)
{
IconSetPtr TheSet(getIconSet(IconSetName));
if(TheSet != NULL)
{
//Editor Icon
ImageComponentPtr IconImageComponent = ImageComponent::create();
beginEditCP(IconImageComponent, ImageComponent::TextureFieldMask | ImageComponent::RolloverTextureFieldMask | ImageComponent::FocusedTextureFieldMask | ImageComponent::DisabledTextureFieldMask);
IconImageComponent->setTexture(TheSet->getTexture(IconSet::ICON_NORMAL));
IconImageComponent->setRolloverTexture(TheSet->getTexture(IconSet::ICON_ROLLOVER));
IconImageComponent->setFocusedTexture(TheSet->getTexture(IconSet::ICON_FOCUSED));
IconImageComponent->setDisabledTexture(TheSet->getTexture(IconSet::ICON_DISABLED));
IconImageComponent->setScale(ImageComponent::SCALE_MIN_AXIS);
endEditCP(IconImageComponent, ImageComponent::TextureFieldMask | ImageComponent::RolloverTextureFieldMask | ImageComponent::FocusedTextureFieldMask | ImageComponent::DisabledTextureFieldMask);
return IconImageComponent;
}
else
{
return ImageComponent::create();
}
}
示例9: getContainer
osg::Real32 FieldAnimationAdvancer::getValue(void) const
{
if(getFieldId() == 0)
{
//Check if the Field Container is defined
if(getContainer() == osg::NullFC)
{
SWARNING << "There is no Field Container defined to get Field Advancer" << std::endl;
return 0.0f;
}
//Check if the field in this container is defined
FieldDescription * f = getContainer()->getType().findFieldDescription(getFieldName().c_str());
if( f == NULL )
{
SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << std::endl;
return 0.0f;
}
//Found the Field so set my Field Id
beginEditCP(FieldAnimationAdvancerPtr(this), FieldIdFieldMask);
const_cast<SFUInt32*>(&_sfFieldId)->setValue(f->getFieldId());
endEditCP(FieldAnimationAdvancerPtr(this), FieldIdFieldMask);
//The Field was not found
if(getFieldId() == 0)
{
SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << std::endl;
return 0.0f;
}
//Check if the field is a Real32
if(getContainer()->getField( getFieldId() )->getType() != SFReal32::getClassType())
{
SWARNING << "Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << "Is not a SFReal32 Field." << std::endl;
return 0.0f;
}
}
return static_cast<SFReal32*>(getContainer()->getField( getFieldId() ))->getValue();
}
示例10: Vec3f
void CFlystickTranslateTool::OnTrackingMove(Quaternion q, Vec3f position){
if (!m_bToolActive) return;
// the new position in tracking space should be the new position of the flystick
// plus the properly rotated vector with the length of the pick distance
Vec3f eNegZPickVec;
eNegZPickVec = Vec3f(0.0, 0.0, -1.0) * m_dPickDistance;
Vec3f pickVec;
q.multVec(eNegZPickVec, pickVec);
Vec3f trackingSpacePos = position + pickVec;
// evaluate the transformation in world space since pick event
NodePtr cameraBeacon = m_pSceneManager->GetPerspectiveCamera()->getBeacon();
Matrix cameraToWorld = cameraBeacon->getToWorld();
Vec3f trackingWorldSpacePos = trackingSpacePos;
cameraToWorld.multFullMatrixPnt(trackingWorldSpacePos);
Vec3f worldSpaceDiffVector = trackingWorldSpacePos - m_osgPickTimeWorldSpaceTrackingPos;
// transform the "transformation since pick event" (worldSpaceDiffVector) into object space
Matrix worldToPickedObjectTransformMatrix;
Vec3f pickedObjectSpaceDiffVector;
m_osgPickedObjectTransformToWorldMatrix.inverse3(worldToPickedObjectTransformMatrix);
worldToPickedObjectTransformMatrix.mult(worldSpaceDiffVector, pickedObjectSpaceDiffVector);
// transform the object appropriately
Matrix m = m_osgOldPickedObjectTransformMatrix;
Vec3f oldTranslation, vecDummy;
Quaternion qDummy1, qDummy2;
m.getTransform(oldTranslation, qDummy1, vecDummy, qDummy2);
Vec3f newTranslation = oldTranslation + pickedObjectSpaceDiffVector;
m.setTranslate(newTranslation);
beginEditCP(m_posgPickedObjectTransform, Transform::MatrixFieldMask);{
m_posgPickedObjectTransform->setMatrix(m);
};endEditCP(m_posgPickedObjectTransform, Transform::MatrixFieldMask);
}
示例11: display
// redraw the window
void display( void )
{
// create the matrix
Matrix m;
Real32 t = glutGet(GLUT_ELAPSED_TIME );
// set the transforms' matrices
for(UInt16 i=0; i<ncopies; ++i)
{
m.setTransform(Vec3f( osgsin(t / 1000.f + i * 4 * ncopies / Pi),
osgcos(t / 1000.f + i * 6 * ncopies / Pi),
osgsin(t / 1000.f + i * 7 * ncopies / Pi)),
Quaternion( Vec3f (1,1,0),
t / 1000.f + i * 4 * ncopies / Pi));
beginEditCP(trans[i], Transform::MatrixFieldMask);
{
trans[i]->setMatrix(m);
}
endEditCP (trans[i], Transform::MatrixFieldMask);
}
mgr->redraw();
}
示例12: FWARNING
void Image::diff(Image img)
{
if( _image->getWidth() != img._image->getWidth() ||
_image->getHeight() != img._image->getHeight() ||
_image->getPixelFormat() != img._image->getPixelFormat())
{
FWARNING(("Image::diff: incompatible images!"));
return;
}
beginEditCP(_image);
OSG::UInt8 *sdata = img._image->getData();
OSG::UInt8 *ddata = _image->getData();
OSG::UInt32 nb = _image->getSize(false,false,false);
for(OSG::UInt32 i = 0; i < nb; ++i, ++sdata, ++ddata)
{
*ddata = OSG::osgabs(*ddata - *sdata);
}
endEditCP(_image);
}
示例13: display
void display(void)
{
Real32 time = glutGet(GLUT_ELAPSED_TIME);
updateMesh(time);
// we extract the core out of the root node
// as we now this is a geometry node
GeometryPtr geo = GeometryPtr::dcast(scene->getCore());
//now modify it's content
// first we need a pointer to the position data field
GeoPositions3fPtr pos = GeoPositions3fPtr::dcast(geo->getPositions());
//this loop is similar to when we generted the data during createScenegraph()
beginEditCP(pos, GeoPositions3f::GeoPropDataFieldMask);
// here they all come
for (int x = 0; x < N; x++)
for (int z = 0; z < N; z++)
pos->setValue(Pnt3f(x, wMesh[x][z], z), N*x+z);
endEditCP(pos, GeoPositions3f::GeoPropDataFieldMask);
mgr->redraw();
}
示例14: display
// redraw the window
void display(void)
{
static Real32 speed = 10000.0f;
static Real32 t = glutGet(GLUT_ELAPSED_TIME);
static Real32 t2 = 0.0;
Real32 td = glutGet(GLUT_ELAPSED_TIME) - t;
if(td > speed)
t = glutGet(GLUT_ELAPSED_TIME);
if(_animation)
{
t2 = (2 * OSG::Pi / speed) * td;
beginEditCP(_shl, SHLChunk::ParametersFieldMask);
_shl->setUniformParameter("cos_time_0_2PI", osgcos(t2));
_shl->setUniformParameter("sin_time_0_2PI", osgsin(t2));
endEditCP(_shl, SHLChunk::ParametersFieldMask);
}
// render scene
_mgr->redraw();
}
示例15: endEditCP
void OSGLoader::endField(void)
{
PINFO << "End Field" << std::endl;
_fStack.pop();
if(_fStack.size() != 0)
{
_pCurrentField = _fStack.top();
}
else
{
_pCurrentField = NULL;
}
if(_pCurrentFC != NullFC && _pCurrentFieldDesc != NULL)
{
endEditCP(_pCurrentFC,
_pCurrentFieldDesc->getFieldMask(),
ChangedOrigin::Abstract |
ChangedOrigin::AbstrIgnoreCore |
ChangedOrigin::AbstrIgnoreChild );
}
_fdStack.pop();
if(_fdStack.size() != 0)
{
_pCurrentFieldDesc = _fdStack.top();
}
else
{
_pCurrentFieldDesc = NULL;
}
}