本文整理汇总了C++中TextureChunkPtr::getImage方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureChunkPtr::getImage方法的具体用法?C++ TextureChunkPtr::getImage怎么用?C++ TextureChunkPtr::getImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureChunkPtr
的用法示例。
在下文中一共展示了TextureChunkPtr::getImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTexture
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;
}
}
示例2: createSceneFBO
//.........这里部分代码省略.........
// Make Torus Node (creates Torus in background of scene)
NodePtr TorusGeometryNode = makeTorus(.5, 2, 24, 48);
beginEditCP(TorusGeometryNode->getCore());
GeometryPtr::dcast(TorusGeometryNode->getCore())->setMaterial(TheMaterial);
endEditCP(TorusGeometryNode->getCore());
calcVertexNormals(GeometryPtr::dcast(TorusGeometryNode->getCore()));
calcVertexTangents(GeometryPtr::dcast(TorusGeometryNode->getCore()),0,Geometry::TexCoords7FieldId, Geometry::TexCoords6FieldId);
RootTransformCore = Transform::create();
NodePtr TorusTransformNode = Node::create();
beginEditCP(TorusTransformNode, Node::CoreFieldMask);
TorusTransformNode->setCore(RootTransformCore);
TorusTransformNode->addChild(TorusGeometryNode);
endEditCP(TorusTransformNode, Node::CoreFieldMask);
//Create Light Beacon
Matrix LightMat;
LightMat.setTranslate(0.0f,10.0f,1.0f);
TransformPtr LightBeconCore = Transform::create();
beginEditCP(LightBeconCore, Transform::MatrixFieldMask);
LightBeconCore->setMatrix(LightMat);
endEditCP(LightBeconCore, Transform::MatrixFieldMask);
NodePtr LightBeconNode = Node::create();
beginEditCP(LightBeconNode, Node::CoreFieldMask);
LightBeconNode->setCore(LightBeconCore);
endEditCP(LightBeconNode, Node::CoreFieldMask);
//Create Light
TheLight = PointLight::create();
beginEditCP(TheLight);
TheLight->setBeacon(LightBeconNode);
endEditCP(TheLight);
NodePtr LightNode = Node::create();
beginEditCP(LightNode, Node::CoreFieldMask);
LightNode->setCore(TheLight);
LightNode->addChild(TorusTransformNode);
endEditCP(LightNode, Node::CoreFieldMask);
//Create Root
NodePtr TheRoot = Node::create();
beginEditCP(TheRoot);
TheRoot->setCore(Group::create());
TheRoot->addChild(CameraBeconNode);
TheRoot->addChild(LightNode);
TheRoot->addChild(LightBeconNode);
endEditCP(TheRoot);
//Create Background
SolidBackgroundPtr TheBackground = SolidBackground::create();
TheBackground->setColor(Color3f(1.0,0.0,0.0));
//DepthClearBackgroundPtr TheBackground = DepthClearBackground::create();
//Create the Image
ImagePtr TheColorImage = Image::create();
TheColorImage->set(Image::OSG_RGB_PF,2,2,1,1,1,0.0f,0,Image::OSG_FLOAT16_IMAGEDATA);
//Create the texture
TextureChunkPtr TheColorTextureChunk = TextureChunk::create();
beginEditCP(TheColorTextureChunk);
TheColorTextureChunk->setImage(TheColorImage);
TheColorTextureChunk->setMinFilter(GL_NEAREST);
TheColorTextureChunk->setMagFilter(GL_NEAREST);
TheColorTextureChunk->setWrapS(GL_CLAMP_TO_EDGE);
TheColorTextureChunk->setWrapR(GL_CLAMP_TO_EDGE);
TheColorTextureChunk->setScale(false);
TheColorTextureChunk->setNPOTMatrixScale(true);
TheColorTextureChunk->setEnvMode(GL_REPLACE);
TheColorTextureChunk->setInternalFormat(GL_RGB16F);
endEditCP(TheColorTextureChunk);
//Create FBO
FBOViewportPtr TheFBO = FBOViewport::create();
beginEditCP(TheFBO);
TheFBO->setBackground(TheBackground);
TheFBO->setRoot(TheRoot);
TheFBO->setCamera(TheCamera);
TheFBO->setEnabled(true);
TheFBO->getTextures().push_back(TheColorTextureChunk);
TheFBO->setStorageWidth(TheColorTextureChunk->getImage()->getWidth());
TheFBO->setStorageHeight(TheColorTextureChunk->getImage()->getHeight());
TheFBO->setSize(0,0,TheColorTextureChunk->getImage()->getWidth()-1, TheColorTextureChunk->getImage()->getHeight()-1);
endEditCP(TheFBO);
return TheFBO;
}