• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ endEditCP函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中endEditCP函数的典型用法代码示例。如果您正苦于以下问题:C++ endEditCP函数的具体用法?C++ endEditCP怎么用?C++ endEditCP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了endEditCP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:42,代码来源:testPassiveQT4.cpp


示例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;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:23,代码来源:OSGDefaultDialogComponentGenerator.cpp


示例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);           
        }
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:21,代码来源:OSGCharacterModel.cpp


示例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;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:21,代码来源:OSGVRMLLOD.cpp


示例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;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:44,代码来源:OSGVerifyGraphOp.cpp


示例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;
    }
}
开发者ID:BackupTheBerlios,项目名称:opensgplus,代码行数:40,代码来源:testSimpleLUTShaderRender.cpp


示例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;
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:23,代码来源:OSGVRMLAppearance.cpp


示例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();
	}

}
开发者ID:Langkamp,项目名称:KabalaEngine,代码行数:23,代码来源:KEIconManager.cpp


示例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();
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:37,代码来源:OSGFieldAnimationAdvancer.cpp


示例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);
}
开发者ID:ufz-vislab,项目名称:vislab,代码行数:37,代码来源:FlystickTranslateTool.cpp


示例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();
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:25,代码来源:14switch.cpp


示例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);
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:24,代码来源:Image.cpp


示例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();
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:24,代码来源:09geometry_water2.cpp


示例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();
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:25,代码来源:testSHLEarth.cpp


示例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;
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:36,代码来源:OSGLoader.cpp


示例16: beginEditCP

void Particles::createSymmetricEmitterLine(Vec3f dir, Real32 dist, UInt16 num)
{
	NodePtr localTransNode;
	TransformPtr localTrans;
	Matrix m;
	dir.normalize();
	for (int i = 1; i < num; i++)
	{
		localTransNode = Node::create();
		localTrans = Transform::create();
		m.setIdentity();
		m.setTranslate(dir*(i*dist));
		beginEditCP(localTrans, Transform::MatrixFieldMask);
			localTrans->setMatrix(m);
		endEditCP(localTrans, Transform::MatrixFieldMask);
		beginEditCP(localTransNode, Node::CoreFieldMask | Node::ChildrenFieldMask);
			localTransNode->setCore(localTrans);
			localTransNode->addChild(cloneTree(particleNode));
		endEditCP(localTransNode, Node::CoreFieldMask | Node::ChildrenFieldMask);
		beginEditCP(particleTransNode, Node::ChildrenFieldMask);
			particleTransNode->addChild(localTransNode);
		endEditCP(particleTransNode, Node::ChildrenFieldMask);

		localTransNode = Node::create();
		localTrans = Transform::create();
		m.setIdentity();
		m.setTranslate(dir*(-i*dist));
		beginEditCP(localTrans, Transform::MatrixFieldMask);
			localTrans->setMatrix(m);
		endEditCP(localTrans, Transform::MatrixFieldMask);
		beginEditCP(localTransNode, Node::CoreFieldMask | Node::ChildrenFieldMask);
			localTransNode->setCore(localTrans);
			localTransNode->addChild(cloneTree(particleNode));
		endEditCP(localTransNode, Node::CoreFieldMask | Node::ChildrenFieldMask);
		beginEditCP(particleTransNode, Node::ChildrenFieldMask);
			particleTransNode->addChild(localTransNode);
		endEditCP(particleTransNode, Node::ChildrenFieldMask);
	} // for
} // createSymmetricEmitterLine
开发者ID:flair2005,项目名称:inVRs,代码行数:39,代码来源:Particles.cpp


示例17: FWARNING

/*! Create LineChunk from fetched data.
 *  The DXF line pattern description is mapped to a 16 bit stipple pattern
 *  suitable for OpenGL line stippling. This mapping only approximately
 *  resembles the DXF line pattern.
 *
 *  \todo 
 *	Currently it's not checked, whether the fetched data is consistent!
 */
DXFResult DXFLtype::endEntity(void)
{
	if(_linetypeMapP->find(_name) != _linetypeMapP->end())
	{
		FWARNING(("DXF Loader: before line %d: "
				  "LTYPE entity '%s' already exists. "
				  "Overwriting with new one!\n",
				  DXFRecord::getLineNumber(),
				  _name.c_str()
				 ));
	}

	// Do consistency checks
	Real32 checkedPatternLen = 0.0;
	for(std::vector<Real64>::iterator itr = _elementLen.begin();
		itr != _elementLen.end();
		++ itr)
	{
		checkedPatternLen += osgabs(*itr);
	}
	
	if(osgabs(checkedPatternLen - _patternLen) > Eps)
	{
		FWARNING(("DXF Loader: before line %d: "
				  "LTYPE entity defines inconsistent pattern lenght!\n",
				  DXFRecord::getLineNumber()
				 ));
		// we go on, but will use consistent data: checkedPatternLen
	}

	if(_nElements != _elementLen.size())
	{
		FWARNING(("DXF Loader: before line %d: "
				  "LTYPE entity declares %d pattern elements but provides %d!\n",
				  DXFRecord::getLineNumber(),
				  _nElements,
				  _elementLen.size()
				 ));
		// we go on, but will use consistent data: _elementLen.size()
	}

	UInt16 pattern = 0;
	LineChunkPtr linetype = LineChunk::create();	
	beginEditCP(linetype);
	{		
//		linetype->setWidth(1);
		if(_elementLen.size() != 0)
		{
			// Build OpenGL 16 bit stipple pattern: for each bit calculate, which
			// pattern element it belongs to and set it if the pattern element is
			// positive, otherwise leave it unset.
			Real32 s = checkedPatternLen/16.0;
			UInt8 j = 0;
			Real32 elementLenSum = osgabs(_elementLen[j]);
			for(UInt8 i = 0;
				i < 16;
				++ i)
			{
				if(elementLenSum < (0.5 + i) * s && j < _elementLen.size())
				{
					++ j;
					elementLenSum += osgabs( _elementLen[j] );
				}
				if( _elementLen[j] > 0.0)
					pattern |= 1<<i;
			}
			linetype->setStippleRepeat(1);
			linetype->setStipplePattern(pattern);	
		}
		linetype->setSmooth(true);  //TODO: make this configurable by an option?
	}
	endEditCP(linetype);
	
#if 1 // DEBUG TODO: raus?!?!
	std::string pstr("");
	for(UInt8 i=0; i<16; ++i)
		pstr += (pattern & (1<<i)) ? "1" : "0";
	FDEBUG(("DXFLtype::endEntity(): pattern '%s' = %s\n",
			_name.c_str(),
			pstr.c_str()));
#endif // DEBUG
	(*_linetypeMapP)[_name] = linetype;

	return DXFStateContinue;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:93,代码来源:OSGDXFLtype.cpp


示例18: main

// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    // GLUT init
    int winid = setupGLUT(&argc, argv);

    // the connection between GLUT and OpenSG
    GLUTWindowPtr gwin= GLUTWindow::create();
    gwin->setId(winid);
    gwin->init();

    // create the scene or load it from a .osg-file
    if (argc == 1)
    {
        scene = makeVolume("00_data64x64x64.dat");
    }
    else if(!strcmp(argv[1], "RGBA"))
    {
        ImagePtr imageP = Image::create();
        const int res=64;
        Real32 rres = res;
        beginEditCP(imageP);
        imageP->set(Image::OSG_RGBA_PF,res,res,res);

        UInt8 *d = imageP->editData();
        for(Int16 z = 0; z < res; ++z)         
        for(Int16 y = 0; y < res; ++y)         
        for(Int16 x = 0; x < res; ++x)
        {
            Real32 dx = x/rres - .5f;
            Real32 dy = y/rres - .5f;
            Real32 dz = z/rres - .5f;

            Real32 dsq = (dx*dx + dy*dy + dz*dz);

            int  bx = (x<2 || x >=res-2),
                 by = (y<2 || y >=res-2),
                 bz = (z<2 || z >=res-2);
            if(bx + by + bz >=2)
            {
                *d++ = 0;
                *d++ = 255;
                *d++ = 0;
                *d++ = 64;
            } 
            else if (osgabs(dx) < .2 && osgabs(dy) < .2)
            {
                *d++ = 0;
                *d++ = 0;
                *d++ = 0;
                *d++ = 0;              
            }
            else if(dsq <= .25f)
            {
                *d++ = static_cast<UInt8>(x/rres * 255.f);
                *d++ = static_cast<UInt8>(y/rres * 255.f);
                *d++ = static_cast<UInt8>(z/rres * 255.f);
                *d++ = static_cast<UInt8>((.3f-dsq*dsq*dsq) * 255.f);
            }
            else
            {
                *d++ = 0;
                *d++ = 0;
                *d++ = 0;
                *d++ = 0;
            }
        }      

        endEditCP(imageP);  
        
        imageP->setAttachmentField( "SliceThickness", "1 1 1" );
        scene = makeVolume(imageP);        
    }
    else if(!strcmp(argv[1], "RGB"))
    {
        ImagePtr imageP = Image::create();
        const int res=64;
        Real32 rres = res;
        beginEditCP(imageP);
        imageP->set(Image::OSG_RGB_PF,res,res,res);

        UInt8 *d = imageP->editData();
        for(Int16 z = 0; z < res; ++z)         
        for(Int16 y = 0; y < res; ++y)         
        for(Int16 x = 0; x < res; ++x)
        {
            Real32 dx = x/rres - .5f;
            Real32 dy = y/rres - .5f;
            Real32 dz = z/rres - .5f;

            Real32 dsq = (dx*dx + dy*dy + dz*dz);

            int  bx = (x<2 || x >=res-2),
                 by = (y<2 || y >=res-2),
                 bz = (z<2 || z >=res-2);
            if(bx + by + bz >=2)
            {
//.........这里部分代码省略.........
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:101,代码来源:testSimpleVolumeNodeRender.cpp


示例19: setName

void OSGLoader::beginNode(const Char8 *szNodeTypename,
                          const Char8 *szNodename)
{
    FieldContainerPtr pNewNode;

    if(szNodeTypename == NULL)
        return;

    PINFO << "Begin node : " << szNodeTypename << " | ";

    if(szNodename == NULL)
    {
        PINFO << "NULL";
    }
    else
    {
        PINFO << szNodename;
    }

    PINFO << std::endl;

    pNewNode =
        FieldContainerFactory::the()->createFieldContainer(szNodeTypename);

    if(szNodename != NULL && pNewNode != NullFC)
    {
        AttachmentContainerPtr pAttCon =
            AttachmentContainerPtr::dcast(pNewNode);

        if(pAttCon != NullFC)
        {
            setName(pAttCon, szNodename);
        }

        _defMap.insert(std::make_pair(std::string(szNodename), pNewNode));
    }

    // assign nodepointer to current sf|mf field
    setFieldContainerValue(pNewNode);

    _pCurrentFC = pNewNode;

    _fcStack.push(_pCurrentFC);

    if(_fcStack.size() == 1)
    {
        NodePtr pNode;
        if(_pCurrentFC->getType().isNode())
        {
            pNode = NodePtr::dcast(_pCurrentFC);
        }
        else if(_pCurrentFC->getType().isNodeCore())
        {
            pNode = Node::create();
            pNode->setCore(NodeCorePtr::dcast(_pCurrentFC));
        }
        else
        {
            SLOG << "Fieldcontainer " << szNodeTypename
                 << "is neither Node nor NodeCore " << std::endl;
        }

        if(_pRootNode == NullFC)
        {
            GroupPtr pGroup = Group::create();

            _pRootNode = Node::create();

            beginEditCP(_pRootNode, Node::CoreFieldMask);
            {
                _pRootNode->setCore(pGroup);
            }
            endEditCP  (_pRootNode, Node::CoreFieldMask);
        }

        beginEditCP(_pRootNode, Node::ChildrenFieldMask);
        {
            _pRootNode->addChild(pNode);
        }
        endEditCP  (_pRootNode, Node::ChildrenFieldMask);
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:82,代码来源:OSGLoader.cpp


示例20: getMaterials

void CharacterModel::convertMaterials(std::string configfile)
{
    getMaterials().clear();
    UInt32 mcnt = 0;
    PathHandler ph;
    
    ph.setBaseFile(configfile.c_str());
       
    for(int mid = 0; mid < _coreModel->getCoreMaterialCount(); mid++)
    {
        CalCoreMaterial *coremat = _coreModel->getCoreMaterial(mid);
        SimpleMaterialPtr mat = SimpleMaterial::create();

        beginEditCP(mat);

        CalCoreMaterial::Color &calamb = coremat->getAmbientColor();
        CalCoreMaterial::Color &caldif = coremat->getDiffuseColor();
        CalCoreMaterial::Color &calspec = coremat->getSpecularColor();

        mat->setAmbient(Color3f(calamb.red / 255.0f, calamb.green / 255.0f, calamb.blue / 255.0f));
        mat->setDiffuse(Color3f(caldif.red / 255.0f, caldif.green / 255.0f, caldif.blue / 255.0f));
        mat->setSpecular(Color3f(calspec.red / 255.0f, calspec.green / 255.0f, calspec.blue / 255.0f));
        
        mat->setShininess(coremat->getShininess() * 100.f);
        mat->setLit(true);
        mat->setColorMaterial(GL_NONE);
        
        for(int mapId = 0; mapId < coremat->getMapCount(); mapId++)
        {
            std::string file = coremat->getMapFilename(mapId);
            std::string pfile = ph.findFile(file.c_str());
            SINFO << "Loading texture '" << pfile << "'..." << endLog;

            ImagePtr img = Image::create();
            
             if(!img->read(pfile.c_str()))
            {
                SWARNING << "CharacterModel::convertMaterials: error "
                         << "loading image " << file << endLog;
            }
            else
            {
                // amz with my test scene paladin.cfg all textures were
                // upside down so I disabled the vertical flipping perhaps
                // they fixed the bug in Cal3D?
#if 0
                beginEditCP(img);
                {
                // For some reason Cal3D expects textures upside down ???
                UInt32 bpl = img->getBpp() * img->getWidth();
                UChar8 *t = img->getData(), 
                       *b = t + (img->getHeight() - 1) * bpl,
                        dum;

                for(UInt32 y = img->getHeight() / 2; y > 0; --y)
                {
                    for(UInt32 x = bpl; x > 0; --x, ++t, ++b)
                    {
                        dum = *t;
                        *t = *b;
                        *b = dum;
                    }
                    b -= bpl * 2;
                }
                }
                endEditCP(img);
#endif
                
                TextureChunkPtr tex = TextureChunk::create();
                
                beginEditCP(tex);
                tex->setImage(img);
                tex->setEnvMode(GL_MODULATE);
                endEditCP(tex);
                
                mat->addChunk(tex);
            }
        }
            
        endEditCP(mat);
        
        coremat->setUserData((Cal::UserData)mcnt);
        getMaterials().push_back(mat);
        mcnt ++;
    }    
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:86,代码来源:OSGCharacterModel.cpp



注:本文中的endEditCP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ endGame函数代码示例发布时间:2022-05-30
下一篇:
C++ endEdit函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap