Esempio n. 1
0
			ImpCompactNumberArray::unique_ptr_type construct(iterator_in it_in, uint64_t const n)
			{
				for ( uint64_t i = 0; i < n; ++i )
					add(*(it_in++));
				ImpCompactNumberArray::unique_ptr_type ptr(createFinal());
				
				return UNIQUE_PTR_MOVE(ptr);
			}
Esempio n. 2
0
DePee::DePee(osg::Group* parent, osg::Group* subgraph, unsigned width, unsigned height)
{
    _renderToFirst = false;

    _isSketchy =false;
    _isColored = false;
    _isEdgy = true;
    _isCrayon = false;

    _normalDepthMapProgram = Utility::createProgram("shaders/depthpeel_normaldepthmap.vert","shaders/depthpeel_normaldepthmap.frag");
    _colorMapProgram = Utility::createProgram("shaders/depthpeel_colormap.vert","shaders/depthpeel_colormap.frag" );
    _edgeMapProgram = Utility::createProgram("shaders/depthpeel_edgemap.vert", "shaders/depthpeel_edgemap.frag");

    _parent = new osg::Group;
    parent->addChild(_parent.get());
    _subgraph = subgraph;

    _width = width;
    _height = height;
    _texWidth = width;
    _texHeight = height;

    assert(parent);
    assert(subgraph);

    _fps = 0;
    _colorCamera = 0;

    _sketchy = new osg::Uniform("sketchy", false);
    _colored = new osg::Uniform("colored", false);
    _edgy = new osg::Uniform("edgy", true);
    _sketchiness = new osg::Uniform("sketchiness", (float) 1.0);

    _normalDepthMap0  = Utility::newColorTexture2D(_texWidth, _texHeight, 32);
    _normalDepthMap1  = Utility::newColorTexture2D(_texWidth, _texHeight, 32);
    _edgeMap = Utility::newColorTexture2D(_texWidth, _texHeight, 8);
    _colorMap = Utility::newColorTexture2D(_texWidth, _texHeight, 8);

    //create a noise map...this doesn't end up in a new rendering pass
    (void) createMap(NOISE_MAP);

    //the viewport aligned quad
    _quadGeode = Utility::getCanvasQuad(_width, _height);


    //!!!Getting problems if assigning unit to texture in depth peeling subgraph and removing depth peeling steps!!!
    //That's why it is done here
    osg::StateSet* stateset = _parent->getOrCreateStateSet();
    stateset->setTextureAttributeAndModes(1, _normalDepthMap0.get(), osg::StateAttribute::ON);
    stateset->setTextureAttributeAndModes(2, _normalDepthMap1.get(), osg::StateAttribute::ON);
    stateset->setTextureAttributeAndModes(3, _edgeMap.get(), osg::StateAttribute::ON);
    stateset->setTextureAttributeAndModes(4, _colorMap.get(), osg::StateAttribute::ON);
    stateset->setTextureAttributeAndModes(5, _noiseMap.get(), osg::StateAttribute::ON);

    // render the final thing
    (void) createFinal();

    //take one step initially
    addDePeePass();

    //render head up display
    (void) createHUD();
}