本文整理汇总了C++中FWARNING函数的典型用法代码示例。如果您正苦于以下问题:C++ FWARNING函数的具体用法?C++ FWARNING怎么用?C++ FWARNING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FWARNING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FWARNING
void VRMLFile::addRoute(const Char8 *szOutNodename,
const Char8 *szOutFieldname,
const Char8 *szInNodename,
const Char8 *szInFieldname )
{
if(szOutNodename == NULL || szOutFieldname == NULL ||
szInNodename == NULL || szInFieldname == NULL )
{
FWARNING(("addRoute missing params\n"));
}
FieldContainer *pSrcNode = findReference(szOutNodename);
FieldContainer *pDstNode = findReference(szInNodename);
AttachmentContainer *pSrc = dynamic_cast<AttachmentContainer *>(pSrcNode);
AttachmentContainer *pDst = dynamic_cast<AttachmentContainer *>(pDstNode);
if(pSrc == NULL)
{
FWARNING(("Unknow src node %s\n", szOutNodename));
return;
}
if(pDstNode == NULL)
{
FWARNING(("Unknow dst node %s\n", szInNodename));
return;
}
VRMLGenericAtt *pSrcAtt = dynamic_cast<VRMLGenericAtt *>(
pSrc->findAttachment(VRMLGenericAtt::getClassType()));
VRMLGenericAtt *pDstAtt = NULL;
if(pDst != NULL)
{
pDstAtt = dynamic_cast<VRMLGenericAtt *>(
pDst->findAttachment(VRMLGenericAtt::getClassType()));
}
if(pSrcAtt == NULL)
{
Node *pNode = dynamic_cast<Node *>(pSrc);
if(pNode != NULL && pNode->getCore() != NULL)
{
pSrcAtt = dynamic_cast<VRMLGenericAtt *>(
pNode->getCore()->findAttachment(
VRMLGenericAtt::getClassType()));
}
}
if(pDstAtt == NULL)
{
Node *pNode = dynamic_cast<Node *>(pDst);
if(pNode != NULL && pNode->getCore() != NULL)
{
pDstAtt = dynamic_cast<VRMLGenericAtt *>(
pNode->getCore()->findAttachment(
VRMLGenericAtt::getClassType()));
}
}
std::string szOutFName = szOutFieldname;
std::string szInFName = szInFieldname;
std::string::size_type uiPos = szOutFName.rfind(std::string("_changed"));
if(uiPos != std::string::npos)
{
szOutFName.erase(uiPos, std::string::npos);
}
uiPos = szInFName.find(std::string("set_"));
if(uiPos != std::string::npos)
{
szInFName.erase(uiPos, uiPos + 4);
}
if(pSrcAtt != NULL)
{
VRMLNodeHelper *pHelper = findNodeHelper(
pSrcAtt->getVrmlNodeTypename().c_str());
if(pHelper != NULL)
{
pHelper->mapFieldname(pSrcAtt->getVrmlNodeTypename(), szOutFName);
}
}
if(pSrcAtt != NULL)
{
VRMLNodeHelper *pHelper = findNodeHelper(
pDstAtt->getVrmlNodeTypename().c_str());
//.........这里部分代码省略.........
示例2: OSG_OSB_LOG
/*! Fills the "pointer field" described by \a ptrField with the correct
pointers.
\param[in] ptrField Field to fill.
*/
void
OSBRootElement::mapPtrField(const PtrFieldInfo &ptrField)
{
OSG_OSB_LOG(("OSBRootElement::mapPtrField\n"));
PtrFieldInfo::PtrIdStoreConstIt idIt = ptrField.beginIdStore();
PtrFieldInfo::PtrIdStoreConstIt idEnd = ptrField.endIdStore ();
PtrFieldInfo::BindingStoreConstIt bindingIt = ptrField.beginBindingStore();
PtrFieldInfo::BindingStoreConstIt bindingEnd = ptrField.endBindingStore ();
const FieldContainerIdMap &idMap = getIdMap();
FieldContainerIdMapConstIt idMapIt;
FieldContainerIdMapConstIt idMapEnd = idMap.end();
if(bindingIt != bindingEnd)
{
if(ptrField.getHandledField() == true)
{
FieldContainer *fieldCon = ptrField.getContainer();
UInt32 fieldId = ptrField.getFieldId();
EditFieldHandlePtr fHandle = fieldCon->editField(fieldId);
EditMapFieldHandlePtr sfMapField =
boost::dynamic_pointer_cast<EditMapFieldHandle>(fHandle);
if(sfMapField == NULL || sfMapField->isValid() == false)
return;
sfMapField->fillFrom(ptrField.getBindingStore(),
ptrField.getIdStore (),
idMap);
}
else
{
Attachment *att = NULL;
AttachmentContainer *attCon =
dynamic_cast<AttachmentContainer *>(ptrField.getContainer());
for(; (idIt != idEnd) && (bindingIt != bindingEnd); ++idIt,
++bindingIt)
{
if(*idIt != 0)
{
idMapIt = idMap.find(*idIt);
if(idMapIt != idMapEnd)
{
att = dynamic_cast<Attachment *>(
FieldContainerFactory::the()->getContainer(
idMapIt->second));
}
else
{
FWARNING(("OSBRootElement::mapPtrField: could not find "
"FieldContainer with id [%u]\n", *idIt));
att = NULL;
}
}
else
{
att = NULL;
}
if(att != NULL)
{
OSG_OSB_LOG(("OSBRootElement::mapPtrField: adding "
"attchment [%u] [%u]\n",
att->getType().getGroupId(), *bindingIt));
}
attCon->addAttachment(att, *bindingIt);
}
}
}
else
{
FieldContainer *fc = NULL;
FieldContainer *fieldCon = ptrField.getContainer();
UInt32 fieldId = ptrField.getFieldId();
EditFieldHandlePtr fHandle = fieldCon->editField(fieldId);
FieldContainerPtrSFieldBase::EditHandlePtr pSFHandle =
boost::dynamic_pointer_cast<
FieldContainerPtrSFieldBase::EditHandle>(fHandle);
FieldContainerPtrMFieldBase::EditHandlePtr pMFHandle =
boost::dynamic_pointer_cast<
FieldContainerPtrMFieldBase::EditHandle>(fHandle);
for(; idIt != idEnd; ++idIt)
{
if(*idIt != 0)
//.........这里部分代码省略.........
示例3: getMFViewports
bool CSMWindow::init(void)
{
bool returnValue = true;
MFUnrecCSMViewportPtr::const_iterator vIt = getMFViewports()->begin();
MFUnrecCSMViewportPtr::const_iterator vEnd = getMFViewports()->end ();
while(vIt != vEnd)
{
returnValue = (*vIt)->init();
if(returnValue == false)
{
break;
}
++vIt;
}
if(_pWindow != NULL && returnValue == true)
{
vIt = getMFViewports()->begin();
vEnd = getMFViewports()->end ();
for(; vIt != vEnd; ++vIt)
{
CSMViewport::ViewportStoreConstIt pIt = (*vIt)->beginViewports();
CSMViewport::ViewportStoreConstIt pEnd = (*vIt)->endViewports ();
for(; pIt != pEnd; ++pIt)
{
_pWindow->addPort((*pIt));
}
}
fprintf(stderr, "foo %p %d\n",
ComplexSceneManager::the()->getDrawManager(),
UInt32(ComplexSceneManager::the()->
getDrawManager()->getParallel()));
#ifndef __APPLE__
UInt32 uiDrawMode = this->getPartitionDrawMode();
#else
UInt32 uiDrawMode = Window::SequentialPartitionDraw;
FWARNING(("Detected apple, only sequential draw mode available\n"));
#endif
if(ComplexSceneManager::the()->getDrawManager()->getParallel() == true)
{
uiDrawMode |= Window::ParallelDrawer;
}
else
{
uiDrawMode |= Window::StdDrawer;
}
_pWindow->setRenderOptions (this->getRenderOptions());
_pWindow->setPartitionDrawMode(uiDrawMode );
_pWindow->setDrawerType (uiDrawMode );
_pWindow->setIgnoreAllExtensions(this->getIgnoreAllExtensions());
MFString::const_iterator ieIt = _mfIgnoreExtensions.begin();
MFString::const_iterator ieEnd = _mfIgnoreExtensions.end ();
for(; ieIt != ieEnd; ++ieIt)
{
Window::ignoreExtensions(ieIt->c_str());
}
}
// OSGSceneFileType::the().writeContainer(_pWindow, "/tmp/window.osg");
if(this->getDumpContainer() == true)
{
FieldContainerFactory::the()->dump();
}
return returnValue;
}
示例4: FWARNING
void MergeGraphOp::processGeometries(Node * const node)
{
MFUnrecChildNodePtr::const_iterator mfit = node->getMFChildren()->begin();
MFUnrecChildNodePtr::const_iterator mfen = node->getMFChildren()->end ();
std::vector<Node *> toSub;
std::vector<NodeUnrecPtr > toAdd;
for ( ; mfit != mfen; ++mfit )
{
bool special=isInExcludeList(*mfit);
if ((*mfit)->getCore()->getType().isDerivedFrom(
Geometry::getClassType()))
{
#ifndef OSG2_MERGE_MISSING
Geometry *geo = dynamic_cast<Geometry *>((*mfit)->getCore());
#endif
//if a geometry, try to merge it in another geometry
//if successfull, delete it.
//check also if it is added for exclusion
bool inSubList=false;
std::vector<Node *>::const_iterator it3=toSub.begin();
std::vector<Node *>::const_iterator en3=toSub.end();
for ( ; it3 != en3; ++it3 )
if (*it3==*mfit) { inSubList=true; break; }
if (!special && !inSubList)
{
//ok, try
MFUnrecChildNodePtr::const_iterator it2=mfit+1;
Geometry *new_geo=NULL;
for ( ; it2!=mfen; ++it2)
{
if (!isInExcludeList(*it2) && (*it2)->getCore()->getType().isDerivedFrom(Geometry::getClassType()))
{
#ifndef OSG2_MERGE_MISSING
Geometry *geo2 = dynamic_cast<Geometry *>((*it2)->getCore());
if (geo->isMergeable(geo2))
{
// HACK merge crashes when indices == NULL!
if(geo->getIndices() == NULL)
OSG::createSharedIndex(geo);
if(geo2->getIndices() == NULL)
OSG::createSharedIndex(geo2);
if (new_geo==NULL)
{
new_geo=Geometry::create();
if (new_geo->merge(geo))
toSub.push_back(*it);
else FWARNING(("MergeGraphOp: processGeometries problem 1\n"));
if (new_geo->merge(geo2))
toSub.push_back(*it2);
else FWARNING(("MergeGraphOp: processGeometries problem 2\n"));
}
else
{
if (new_geo->merge(geo2))
toSub.push_back(*it2);
}
}
#endif
}
}
if (new_geo!=NULL)
{
NodeUnrecPtr new_node=Node::create();
new_node->setCore(new_geo);
toAdd.push_back(new_node);
}
}
else
{
//hmm...have to skip it
}
}
}
std::vector<NodeUnrecPtr>::const_iterator ait = toAdd.begin();
std::vector<NodeUnrecPtr>::const_iterator aen = toAdd.end ();
for ( ; ait != aen; ++ait )
{
node->addChild(*ait);
}
std::vector<Node *>::const_iterator sit = toSub.begin();
std::vector<Node *>::const_iterator sen = toSub.end ();
for ( ; sit != sen; ++sit )
{
node->subChild(*sit);
}
}
示例5: OSG_OSB_LOG
void
OSBTextureChunkElement::read(const std::string &typeName)
{
OSG_OSB_LOG(("OSBTextureChunkElement::read: [%s]\n", typeName.c_str()));
BinaryReadHandler *rh = editRoot()->getReadHandler();
UInt8 ptrTypeId;
UInt16 version;
rh->getValue(ptrTypeId);
rh->getValue(version );
OSG_OSB_LOG(("OSBTextureChunkElement::read: version: [%u]\n", version));
// create the two replacement chunks
_pTexObj = TextureObjChunk::create();
_pTexEnv = TextureEnvChunk::create();
std::string fieldName;
std::string fieldTypeName;
UInt32 fieldSize;
PtrFieldListIt ptrFieldIt;
while(readFieldHeader("", fieldName, fieldTypeName, fieldSize))
{
// some fields need to be duplicated for the two replacement chunks
if(fieldName == "parents")
{
// parent fields are ignored
rh->skip(fieldSize);
}
else if(fieldName == "internal")
{
bool fieldValue;
rh->getValue(fieldValue);
_pTexObj->setInternal(fieldValue);
_pTexEnv->setInternal(fieldValue);
}
else if(fieldName == "ignore")
{
bool fieldValue;
rh->getValue(fieldValue);
_pTexObj->setIgnore(fieldValue);
_pTexEnv->setIgnore(fieldValue);
}
else if(isTexObjField(fieldName))
{
// set TexObj as container for reading the field
setContainer(_pTexObj);
readFieldContent(fieldName, fieldTypeName, fieldSize, "", ptrFieldIt);
}
else if(isTexEnvField(fieldName))
{
// set TexEnv as container for reading the field
setContainer(_pTexEnv);
readFieldContent(fieldName, fieldTypeName, fieldSize, "", ptrFieldIt);
}
else
{
FWARNING(("OSBTextureChunkElement::read: Skipping unrecognized "
"field [%s].\n", fieldName.c_str()));
rh->skip(fieldSize);
}
}
// set TexObj as "the" container
setContainer(_pTexObj);
}
示例6: FWARNING
bool FrustumVolume::isOnSurface(const Pnt3f &OSG_CHECK_ARG(point)) const
{
FWARNING(("FrustumVolume::isOnSurface: NYI!\n"));
return false;
}
示例7: OSG_OSB_LOG
void
OSBGeometryElement::postReadV100(void)
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100\n"));
OSBRootElement *root = editRoot();
Geometry *geo =
dynamic_cast<Geometry*>(getContainer());
UInt32 indexMappingSize = UInt32(_indexMapping.size());
if(indexMappingSize <= 1)
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100: "
"Converting single index.\n" ));
if(_indicesPacked)
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100: "
"Converting packed indices.\n" ));
geo->setIndices(_indices);
}
else
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100: "
"Converting non-packed indices.\n" ));
// indices stored in container with id _indicesId
// create PtrFieldInfo structure to set all entries of field
// "propIndices" to the container with id _indicesId
FieldDescriptionBase *indFieldDesc =
geo->getFieldDescription("propIndices");
UInt32 indFieldId = indFieldDesc->getFieldId();
root->editPtrFieldList().push_back(PtrFieldInfo(geo, indFieldId));
PtrFieldInfo &indFieldPFI = root->editPtrFieldList().back();
for(UInt32 i = 0; i < Geometry::MaxAttribs; ++i)
{
indFieldPFI.editIdStore().push_back(_indicesId);
}
}
}
else
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100: "
"Converting multi index.\n" ));
OSBGeometryHelper gh;
if(_indicesPacked)
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100: "
"Converting packed indices.\n" ));
// create 16 bit or 32 bit indices
if(_indices16Bit)
{
GeoUInt16Property *ui16Indices =
dynamic_pointer_cast<GeoUInt16Property>(_indices);
gh.splitMultiIndex<GeoUInt16Property *>(
_indexMapping, ui16Indices, geo);
}
else
{
GeoUInt32Property *ui32Indices =
dynamic_pointer_cast<GeoUInt32Property>(_indices);
gh.splitMultiIndex<GeoUInt32Property *>(
_indexMapping, ui32Indices, geo);
}
}
else
{
OSG_OSB_LOG(("OSBGeometryElement::postReadV100: "
"Converting non-packed indices.\n" ));
FieldContainerIdMapConstIt mapIt =
root->getIdMap().find(_indicesId);
if(mapIt != root->getIdMap().end())
{
_indices = dynamic_cast<GeoIntegralProperty *>(
FieldContainerFactory::the()->getContainer(mapIt->second));
}
else
{
FWARNING(("OSBGeometryElement::postReadV100: "
"Could not find indices property.\n"));
return;
}
if(_indices->getFormatSize() == sizeof(UInt16))
{
GeoUInt16Property *ui16Indices =
dynamic_pointer_cast<GeoUInt16Property>(_indices);
gh.splitMultiIndex<GeoUInt16Property *>(
_indexMapping, ui16Indices, geo);
//.........这里部分代码省略.........
示例8: initialize
virtual void initialize(void)
{
// Check necessary stuff
if(_win == NullFC)
{
FWARNING(("SceneManager::initialize: window not set, "
"ignoring!\n"));
return;
}
// the rendering action
_ownAction = RenderAction::create();
_action = _ownAction;
// the camera and light beacon
NodePtr cartN = Node::create();
_cart = Transform::create();
beginEditCP(cartN);
cartN->setCore(_cart);
endEditCP(cartN);
// the headlight
_internalRoot = Node::create();
_headlight = DirectionalLight::create();
addRefCP(_internalRoot);
beginEditCP(_internalRoot);
_internalRoot->setCore(_headlight);
_internalRoot->addChild(cartN);
endEditCP(_internalRoot);
beginEditCP(_headlight);
_headlight->setAmbient (.3, .3, .3, 1);
_headlight->setDiffuse ( 1, 1, 1, 1);
_headlight->setSpecular ( 1, 1, 1, 1);
_headlight->setDirection( 0, 0, 1);
_headlight->setBeacon (cartN);
endEditCP(_headlight);
// the camera
_camera = PerspectiveCamera::create();
addRefCP(_camera);
beginEditCP(PerspectiveCameraPtr::dcast(_camera));
PerspectiveCameraPtr::dcast(_camera)->setBeacon(cartN);
PerspectiveCameraPtr::dcast(_camera)->setFov (deg2rad(60.f));
PerspectiveCameraPtr::dcast(_camera)->setNear (0.1f);
PerspectiveCameraPtr::dcast(_camera)->setFar (10000.f);
endEditCP(PerspectiveCameraPtr::dcast(_camera));
// need a viewport?
if(_win->getPort().size() == 0)
{
SolidBackgroundPtr bg = SolidBackground::create();
beginEditCP(bg);
bg->setColor(Color3f(0, 0, 0));
endEditCP(bg);
ViewportPtr vp = Viewport::create();
beginEditCP(vp);
vp->setCamera (_camera);
vp->setRoot (_internalRoot);
vp->setSize (0,0, 1,1);
vp->setBackground (bg);
endEditCP(vp);
beginEditCP(_win);
_win->addPort(vp);
endEditCP(_win);
}
}
示例9: main
// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
// OSG init
osgInit(argc,argv);
// Set up Window
TutorialWindowEventProducer = createDefaultWindowEventProducer();
WindowPtr MainWindow = TutorialWindowEventProducer->initWindow();
TutorialWindowEventProducer->setDisplayCallback(display);
TutorialWindowEventProducer->setReshapeCallback(reshape);
//Add Window Listener
TutorialKeyListener TheKeyListener;
TutorialWindowEventProducer->addKeyListener(&TheKeyListener);
TutorialMouseListener TheTutorialMouseListener;
TutorialMouseMotionListener TheTutorialMouseMotionListener;
TutorialWindowEventProducer->addMouseListener(&TheTutorialMouseListener);
TutorialWindowEventProducer->addMouseMotionListener(&TheTutorialMouseMotionListener);
// Create the SimpleSceneManager helper
mgr = new SimpleSceneManager;
// Tell the Manager what to manage
mgr->setWindow(TutorialWindowEventProducer->getWindow());
Path FBOFilePath;
if(argc < 2)
{
FWARNING(("No FBO file given!\n"));
FBOFilePath = Path("./Data/01LoadFBO.xml");
}
else
{
FBOFilePath = Path(std::string(argv[1]));
}
std::cout << "Loading xml File: " << FBOFilePath << std::endl;
FCFileType::FCPtrStore NewContainers;
NewContainers = FCFileHandler::the()->read(FBOFilePath);
FCFileType::FCPtrStore::iterator Itor;
for(Itor = NewContainers.begin() ; Itor != NewContainers.end() ; ++Itor)
{
if( (*Itor)->getType() == FBOViewport::getClassType())
{
TheFBOViewport = FBOViewport::Ptr::dcast(*Itor);
}
}
ChunkMaterialPtr BoxMaterial = ChunkMaterial::create();
GeometryPtr BoxGeoCore = makeBoxGeo(1.0,1.0,1.0,2,2,2);
beginEditCP(BoxGeoCore, Geometry::MaterialFieldMask);
BoxGeoCore->setMaterial(BoxMaterial);
endEditCP(BoxGeoCore, Geometry::MaterialFieldMask);
NodePtr BoxGeoNode = Node::create();
beginEditCP(BoxGeoNode, Node::CoreFieldMask);
BoxGeoNode->setCore(BoxGeoCore);
endEditCP(BoxGeoNode, Node::CoreFieldMask);
NodePtr SceneNode = Node::create();
beginEditCP(SceneNode, Node::CoreFieldMask | Node::ChildrenFieldMask);
SceneNode->setCore(Group::create());
SceneNode->addChild(BoxGeoNode);
endEditCP(SceneNode, Node::CoreFieldMask | Node::ChildrenFieldMask);
// tell the manager what to manage
mgr->setRoot (SceneNode);
// show the whole scene
mgr->showAll();
if(TheFBOViewport != NullFC)
{
//Add the texture chunk of the FBO to the Material for the box
beginEditCP(BoxMaterial, ChunkMaterial::ChunksFieldMask);
BoxMaterial->addChunk(TheFBOViewport->editTextures(0));
endEditCP(BoxMaterial, ChunkMaterial::ChunksFieldMask);
//Add The FBO Viewport the the Window
beginEditCP(TheFBOViewport, FBOViewport::ParentFieldMask);
TheFBOViewport->setParent(TutorialWindowEventProducer->getWindow());
endEditCP(TheFBOViewport, FBOViewport::ParentFieldMask);
beginEditCP(TutorialWindowEventProducer->getWindow());
ViewportPtr vp = TutorialWindowEventProducer->getWindow()->getPort(0);
addRefCP(vp);
TutorialWindowEventProducer->getWindow()->subPort(0);
//Put the FBO Vieport in front, so it is rendered first
TutorialWindowEventProducer->getWindow()->addPort(TheFBOViewport);
TutorialWindowEventProducer->getWindow()->addPort(vp );
endEditCP (TutorialWindowEventProducer->getWindow());
}
//.........这里部分代码省略.........
示例10: if
bool CSMClusterWindow::init(void)
{
MultiDisplayWindowUnrecPtr pCMDWindow = NULL;
BalancedMultiWindowUnrecPtr pCBMWindow = NULL;
SortFirstWindowUnrecPtr pCSFWindow = NULL;
SortLastWindowUnrecPtr pCSLWindow = NULL;
if(_sfClusterMode.getValue() == "Multi")
{
pCMDWindow = MultiDisplayWindow::create();
_pWindow = pCMDWindow;
_pClusterWindow = pCMDWindow;
}
else if(_sfClusterMode.getValue() == "Balanced")
{
pCBMWindow = BalancedMultiWindow::create();
pCMDWindow = pCBMWindow;
_pWindow = pCBMWindow;
_pClusterWindow = pCBMWindow;
}
else if(_sfClusterMode.getValue() == "SortFirst")
{
pCSFWindow = SortFirstWindow::create();
_pWindow = pCSFWindow;
_pClusterWindow = pCSFWindow;
}
else if(_sfClusterMode.getValue() == "SortLast")
{
pCSLWindow = SortLastWindow::create();
_pWindow = pCSLWindow;
_pClusterWindow = pCSLWindow;
}
else
{
fprintf(stderr, "Unknown cluster mode %s\n",
_sfClusterMode.getValue().c_str());
}
MFString::const_iterator serverIt = this->getMFServers()->begin();
MFString::const_iterator serverEnd = this->getMFServers()->end ();
UInt32 uiNumServer = 0;
while(serverIt != serverEnd)
{
fprintf(stderr, "Connecting to %s\n", serverIt->c_str());
_pClusterWindow->editMFServers()->push_back(serverIt->c_str());
++uiNumServer;
++serverIt;
}
bool bServerIdsValid = false;
if(this->getMFServers()->size() <= this->getMFServerIds()->size())
{
_pClusterWindow->editMFServerIds()->setValues(
*(this->getMFServerIds()));
bServerIdsValid = true;
}
else
{
if(this->getMFServerIds()->size() != 0)
{
FWARNING(("Not enough server ids (%d/%d), field ignored\n",
this->getMFServerIds()->size(),
this->getMFServers ()->size() ));
}
}
_pClusterWindow->setSize(UInt16(this->getXSize()),
UInt16(this->getYSize()));
_pClusterWindow->setConnectionType(this->getConnectionType());
if(this->getSFComposer()->getValue() != NULL)
{
_pClusterWindow->setComposer(this->getSFComposer()->getValue());
}
if(pCMDWindow != NULL)
{
if(uiNumServer != 0)
{
pCMDWindow->setHServers(uiNumServer / this->getServerRows());
pCMDWindow->setVServers(this->getServerRows());
}
else
{
pCMDWindow->setHServers(1);
pCMDWindow->setVServers(1);
}
//.........这里部分代码省略.........
示例11: FWARNING
void HDRStage::resizeStageData(HDRStageData *pData,
Int32 iPixelWidth,
Int32 iPixelHeight)
{
FWARNING(("HDRStage resize not implemented ==> wrong results\n"));
}
示例12: FWARNING
UInt32 ShaderExecutableChunk::handleGL(DrawEnv *pEnv,
UInt32 id,
Window::GLObjectStatusE mode,
UInt32 uiOptions)
{
UInt32 returnValue = 0;
Window *pWin = pEnv->getWindow();
if(!pWin->hasExtension(_extSHL))
{
FWARNING(("OpenGL Shading Language is not supported, couldn't find "
"extension 'GL_ARB_shading_language_100'!\n"));
pWin->setGLObjectId(getGLId(), 0);
return returnValue;
}
if(mode == Window::initialize ||
mode == Window::reinitialize ||
mode == Window::needrefresh )
{
GLuint uiProgram = GLuint(pWin->getGLObjectId(getGLId()));;
if(mode != Window::needrefresh)
{
if(uiProgram != 0)
{
OSGGETGLFUNC(OSGglDeleteProgramProc,
osgGlDeleteProgram,
ShaderProgram::getFuncIdDeleteProgram());
osgGlDeleteProgram(uiProgram);
}
OSGGETGLFUNC(OSGglCreateProgramProc,
osgGlCreateProgram,
ShaderProgram::getFuncIdCreateProgram());
OSGGETGLFUNC(OSGglAttachShaderProc,
osgGlAttachShader,
ShaderProgram::getFuncIdAttachShader());
OSGGETGLFUNC(OSGglLinkProgramProc,
osgGlLinkProgram,
ShaderProgram::getFuncIdLinkProgram());
uiProgram = osgGlCreateProgram();
FragmentShaderIt fIt = _mfFragmentShader.begin();
FragmentShaderIt fEnd = _mfFragmentShader.end ();
for(; fIt != fEnd; ++fIt)
{
(*fIt)->validate(pEnv);
GLuint uiShader =
GLuint(pWin->getGLObjectId((*fIt)->getGLId()));
if(uiShader != 0)
osgGlAttachShader(uiProgram, uiShader);
}
GeometryShaderIt gIt = _mfGeometryShader.begin();
GeometryShaderIt gEnd = _mfGeometryShader.end ();
for(; gIt != gEnd; ++gIt)
{
(*gIt)->validate(pEnv);
GLuint uiShader =
GLuint(pWin->getGLObjectId((*gIt)->getGLId()));
if(uiShader != 0)
osgGlAttachShader(uiProgram, uiShader);
}
VertexShaderIt vIt = _mfVertexShader.begin();
VertexShaderIt vEnd = _mfVertexShader.end ();
for(; vIt != vEnd; ++vIt)
{
(*vIt)->validate(pEnv);
GLuint uiShader =
GLuint(pWin->getGLObjectId((*vIt)->getGLId()));
if(uiShader != 0)
osgGlAttachShader(uiProgram, uiShader);
}
// attribute binding must be done before linking
updateAttribBindings(pEnv, uiProgram);
// parameters must be set before linking
updateParameters(pEnv, uiProgram);
osgGlLinkProgram(uiProgram);
GLint iInfoLength;
//.........这里部分代码省略.........
示例13: FWARNING
UInt32 ComputeShaderChunk::handleGL(DrawEnv *pEnv,
UInt32 id,
Window::GLObjectStatusE mode,
UInt64 uiOptions)
{
UInt32 returnValue = 0;
Window *pWin = pEnv->getWindow();
if(!pWin->hasExtOrVersion(_arbComputeShader, 0x0403, 0xFFFF))
{
FWARNING(("OpenGL compute shader is not supported, couldn't find "
"extension 'GL_ARB_compute_shader'!\n"));
pWin->setGLObjectId(getGLId(), 0);
return returnValue;
}
if(mode == Window::initialize ||
mode == Window::reinitialize ||
mode == Window::needrefresh )
{
GLuint uiProgram = GLuint(pWin->getGLObjectId(getGLId()));;
if(mode != Window::needrefresh)
{
if(uiProgram != 0)
{
OSGGETGLFUNCBYID_GL3_ES(glDeleteProgram,
osgGlDeleteProgram,
ShaderProgram::getFuncIdDeleteProgram(),
pWin);
osgGlDeleteProgram(uiProgram);
}
OSGGETGLFUNCBYID_GL3_ES(glCreateProgram,
osgGlCreateProgram,
ShaderProgram::getFuncIdCreateProgram(),
pWin);
OSGGETGLFUNCBYID_GL3_ES(glAttachShader,
osgGlAttachShader,
ShaderProgram::getFuncIdAttachShader(),
pWin);
OSGGETGLFUNCBYID_GL3_ES(glLinkProgram,
osgGlLinkProgram,
ShaderProgram::getFuncIdLinkProgram(),
pWin);
uiProgram = osgGlCreateProgram();
ComputeShaderIt vIt = _mfComputeShader.begin();
ComputeShaderIt vEnd = _mfComputeShader.end ();
for(; vIt != vEnd; ++vIt)
{
(*vIt)->validate(pEnv);
GLuint uiShader =
GLuint(pWin->getGLObjectId((*vIt)->getGLId()));
if(uiShader != 0)
osgGlAttachShader(uiProgram, uiShader);
}
osgGlLinkProgram(uiProgram);
GLint iInfoLength;
Char8 *szInfoBuffer = NULL;
OSGGETGLFUNCBYID_GL3_ES(glGetProgramiv,
osgGlGetProgramiv,
ShaderProgram::getFuncIdGetProgramiv(),
pWin);
osgGlGetProgramiv(uiProgram,
GL_OBJECT_INFO_LOG_LENGTH_ARB,
&iInfoLength);
if(iInfoLength > 0)
{
szInfoBuffer = new Char8[iInfoLength];
szInfoBuffer[0] = '\0';
OSGGETGLFUNCBYID_GL3_ES(
glGetProgramInfoLog,
osgGlGetProgramInfoLog,
ShaderProgram::getFuncIdGetProgramInfoLog(),
pWin);
osgGlGetProgramInfoLog( uiProgram,
iInfoLength,
&iInfoLength,
szInfoBuffer);
}
GLint iStatus = 0;
//.........这里部分代码省略.........
示例14: OSG_CHECK_ARG
UInt64 PNGImageFileType::storeData(const Image *OSG_PNG_ARG (pImage ),
UChar8 *OSG_PNG_ARG (buffer ),
Int32 OSG_CHECK_ARG(memSize))
{
#ifdef OSG_WITH_PNG
png_structp png_ptr;
png_infop info_ptr;
if(pImage->getDimension() < 1 || pImage->getDimension() > 2)
{
FWARNING(("PNGImageFileType::write: invalid dimension %d!\n",
pImage->getDimension()));
return 0;
}
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
* you can supply NULL for the last three parameters. We also check that
* the library version is compatible with the one used at compile time,
* in case we are using dynamically linked libraries. REQUIRED.
*/
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
0, &errorOutput, &warningOutput);
if (png_ptr == NULL)
{
return 0;
}
/* Allocate/initialize the image information data. REQUIRED */
info_ptr = png_create_info_struct(png_ptr);
if(info_ptr == NULL)
{
png_destroy_write_struct(&png_ptr, NULL);
return 0;
}
BufferInfo bufferInfo;
bufferInfo.buffer = buffer;
bufferInfo.length = 0;
png_set_write_fn(png_ptr,
static_cast<void *>(&bufferInfo),
user_write_data,
user_flush_data);
/* This is the hard way */
/* Set the image information here. Width and height are up to 2^31,
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
*/
Int32 ctype;
switch(pImage->getPixelFormat())
{
case Image::OSG_L_PF:
ctype = PNG_COLOR_TYPE_GRAY;
break;
case Image::OSG_LA_PF:
ctype = PNG_COLOR_TYPE_GRAY_ALPHA;
break;
#if defined(GL_BGR) || defined(GL_BGR_EXT)
case Image::OSG_BGR_PF:
#endif
case Image::OSG_RGB_PF:
ctype = PNG_COLOR_TYPE_RGB;
break;
#if defined(GL_BGRA) || defined(GL_BGRA_EXT)
case Image::OSG_BGRA_PF:
#endif
case Image::OSG_RGBA_PF:
ctype = PNG_COLOR_TYPE_RGB_ALPHA;
break;
default:
FWARNING(("PNGImageFileType::write: unknown pixel format %d!\n",
pImage->getPixelFormat()));
png_destroy_write_struct(&png_ptr, NULL);
return 0;
}
Int32 bit_depth;
switch (pImage->getDataType())
{
case Image::OSG_UINT8_IMAGEDATA:
bit_depth = 8;
break;
//.........这里部分代码省略.........
示例15: 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();
// load the scene
if(argc < 2)
{
FWARNING(("No file given!\n"));
FWARNING(("Supported file formats:\n"));
std::list<const char*> suffixes;
SceneFileHandler::the().getSuffixList(suffixes);
for(std::list<const char*>::iterator it = suffixes.begin();
it != suffixes.end();
++it)
{
FWARNING(("%s\n", *it));
}
std::vector<std::string> suffixesVec;
suffixesVec = FCFileHandler::the()->getSuffixList();
for(std::vector<std::string>::iterator it = suffixesVec.begin();
it != suffixesVec.end();
++it)
{
FWARNING(("%s\n", *it));
}
RootNodes.push_back( makeTorus(.5, 2, 16, 16) );
glutSetWindowTitle("No file Loaded");
}
else
{
glutSetWindowTitle(argv[1]);
Load(std::string(argv[1]), RootNodes, Cameras);
if(RootNodes.size() < 1)
{
std::cout << "There are no root nodes defined." << std::endl;
return 0;
}
}
//Create Statistics Foreground
SimpleStatisticsForegroundPtr TheStatForeground = SimpleStatisticsForeground::create();
beginEditCP(TheStatForeground);
TheStatForeground->setSize(25);
TheStatForeground->setColor(Color4f(0,1,0,0.7));
TheStatForeground->addElement(RenderAction::statDrawTime, "Draw FPS: %r.3f");
TheStatForeground->addElement(DrawActionBase::statTravTime, "TravTime: %.3f s");
TheStatForeground->addElement(RenderAction::statDrawTime, "DrawTime: %.3f s");
TheStatForeground->addElement(DrawActionBase::statCullTestedNodes,
"%d Nodes culltested");
TheStatForeground->addElement(DrawActionBase::statCulledNodes,
"%d Nodes culled");
TheStatForeground->addElement(RenderAction::statNMaterials,
"%d material changes");
TheStatForeground->addElement(RenderAction::statNMatrices,
"%d matrix changes");
TheStatForeground->addElement(RenderAction::statNGeometries,
"%d Nodes drawn");
TheStatForeground->addElement(RenderAction::statNTransGeometries,
"%d transparent Nodes drawn");
TheStatForeground->addElement(Drawable::statNTriangles,
"%d triangles drawn");
TheStatForeground->addElement(Drawable::statNLines,
"%d lines drawn");
TheStatForeground->addElement(Drawable::statNPoints,
"%d points drawn");
TheStatForeground->addElement(Drawable::statNPrimitives,
"%d primitive groups drawn");
TheStatForeground->addElement(Drawable::statNVertices,
"%d vertices transformed");
TheStatForeground->addElement(Drawable::statNGeoBytes, "%d bytes of geometry used");
TheStatForeground->addElement(RenderAction::statNTextures, "%d textures used");
TheStatForeground->addElement(RenderAction::statNTexBytes, "%d bytes of texture used");
endEditCP(TheStatForeground);
//Set up Selection
SelectedRootNode = 0;
SelectedCamera = -1;
// create the SimpleSceneManager helper
mgr = new SimpleSceneManager;
// tell the manager what to manage
mgr->setWindow(gwin );
//.........这里部分代码省略.........