Example #1
0
int main( int argc, char** argv )
{
    osgViewer::Viewer viewer;
    viewer.setSceneData( createTiles(300, 300) );
    viewer.addEventHandler( new osgViewer::StatsHandler );
    return viewer.run();
}
Example #2
0
void TiledBackingStore::commitScaleChange()
{
    m_contentsScale = m_pendingScale;
    m_pendingScale = 0;
    m_tiles.clear();
    createTiles();
}
Example #3
0
void TiledDrawingAreaProxy::setContentsScale(float scale)
{
    if (m_contentsScale == scale)
        return;
    m_contentsScale = scale;
    removeAllTiles();
    createTiles();
}
Example #4
0
void TiledBackingStore::coverWithTilesIfNeeded()
{
    IntRect visibleRect = this->visibleRect();
    IntRect rect = mapFromContents(m_client->tiledBackingStoreContentsRect());

    bool didChange = m_trajectoryVector != m_pendingTrajectoryVector || m_visibleRect != visibleRect || m_rect != rect;
    if (didChange || m_pendingTileCreation)
        createTiles();
}
Example #5
0
void TiledBackingStore::coverWithTilesIfNeeded(const FloatPoint& trajectoryVector)
{
    IntRect visibleRect = this->visibleRect();

    FloatPoint normalizedVector = trajectoryVector;
    normalizedVector.normalize();

    if (m_trajectoryVector == normalizedVector && m_visibleRect == visibleRect)
        return;

    m_trajectoryVector = normalizedVector;
    m_visibleRect = visibleRect;

    createTiles();
}
Example #6
0
void QQuickContext2DTexture::paint(QQuickContext2DCommandBuffer *ccb)
{
    QQuickContext2D::mutex.lock();
    if (canvasDestroyed()) {
        delete ccb;
        QQuickContext2D::mutex.unlock();
        return;
    }
    QQuickContext2D::mutex.unlock();
#if QT_CONFIG(opengl)
    GLAcquireContext currentContext(m_gl, m_surface);
#endif
    if (!m_tiledCanvas) {
        paintWithoutTiles(ccb);
        delete ccb;
        return;
    }

    QRect tiledRegion = createTiles(m_canvasWindow.intersected(QRect(QPoint(0, 0), m_canvasSize)));
    if (!tiledRegion.isEmpty()) {
        QRect dirtyRect;
        for (QQuickContext2DTile* tile : qAsConst(m_tiles)) {
            if (tile->dirty()) {
                if (dirtyRect.isEmpty())
                    dirtyRect = tile->rect();
                else
                    dirtyRect |= tile->rect();
            }
        }

        if (beginPainting()) {
            QQuickContext2D::State oldState = m_state;
            for (QQuickContext2DTile* tile : qAsConst(m_tiles)) {
                if (tile->dirty()) {
                    ccb->replay(tile->createPainter(m_smooth, m_antialiasing), oldState, scaleFactor());
                    tile->drawFinished();
                    tile->markDirty(false);
                }
                compositeTile(tile);
            }
            endPainting();
            m_state = oldState;
            markDirtyTexture();
        }
    }
    delete ccb;
}
	void TerrainImpl::createTerrain(TerrainInfo* info, ushort tileSize)
	{
		// ensure we have a viewport height set
		if (mOpt.factorC <= 0)
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "You need to set a valid pixel error margin.", "TerrainImpl::createTerrain");

		// delete currently loaded terrain (if any)
		destroyTerrain();

		// load new terrain
		mInfo = info;
		mOpt.tileSize = tileSize;
		mIndexHandler = new IndexHandler(mOpt.tileSize);
		createTiles();

		mTerrainLoaded = true;
	} 
Example #8
0
//+EAWebKitChange
//3/22/2012
void TiledBackingStore::UpdateTilesIfNeeded(void)
{
	// This also takes care of removing any unnecessary tiles (for example, when navigating to a new page with smaller content).
	coverWithTilesIfNeeded();

	if(m_tilesNeedCreation)
	{
		m_tilesNeedCreation = false;
		createTiles();
	}

    if (m_tilesNeedUpdate)
    {
        m_tilesNeedUpdate = false;
		updateTileBuffers();
    }
}
Example #9
0
//
// Load Texture Map
//
void JDTerrain::loadTextureMap()
{
    QImage img;
    img.load("/Users/rending/Desktop/JurassicDucks/CSIT/mapTexture.png");

    glGenTextures(1, &texID);
    glBindTexture(GL_TEXTURE_2D, texID);
    //Compulsory OpenGL parameters
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    //Copy image pixels to GPU
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
                 img.width(), img.height(), 0,
                 GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
    createTiles();
}
Example #10
0
void TiledBackingStore::tileCreationTimerFired(TileTimer*)
{
    createTiles();
}
Example #11
0
void TiledBackingStore::backingStoreUpdateTimerFired(Timer<TiledBackingStore>*)
{
    createTiles();
}
Example #12
0
void TiledDrawingAreaProxy::tileCreationTimerFired()
{
    createTiles();
}
Example #13
0
MapManager::MapManager(const std::string& fn) :
    Listener(),
    parser(XMLParser::getInstance()),
    numGridElements(0),
    player(NULL),
    dummyTile(NULL),
    tiles(),
    reserve(),
    updateTiles(),
    mapLayers(),
    gridElements(),
    tileWidth(),
    tileHeight(),
    tileRise(),
    mapWidth(),
    mapHeight(),
    origin(),
    weather()
{
    // load map into parser
    parser.parse(fn);

    // Read in map constants
    std::stringstream strm; 
    std::map<std::string, std::string> rootData = parser.parseNode(parser.findNodes("map").front());

    strm<<rootData[std::string("tilewidth")];
    strm >> tileWidth;
    strm.clear();
    strm<<rootData[std::string("tileheight")];
    strm >> tileHeight;
    strm.clear();
    strm<<rootData[std::string("tileRise")];
    strm >> tileRise;
    strm.clear();
    strm << rootData[std::string("width")];
    strm >> mapWidth;
    strm.clear();
    strm<<rootData[std::string("height")];
    strm >> mapHeight;
    strm.clear();
    strm<<rootData[std::string("weather")];
    strm >> weather;
    strm.clear();

    // Fill vector with appropriate number of lists and then fill it
    gridElements.reserve(mapWidth*mapHeight);
    int i;
    for(i=0; i < mapHeight * mapWidth; i++)
    {   
        gridElements.push_back( std::list<GridElement* >());
    }

    // Empty tile, used in error handling
    dummyTile = new Tile();

    // Read in tile data
    createTiles();

    // Fill in map structure
    createLayers();

    // coordinate of first tile on bottom layer
    origin = ( (*(*mapLayers.begin()).begin()).getCoord()) + Vector2f(tileWidth/2,0);

    // Register with the events we care about
    registerListeners();
}
Example #14
0
void TiledBackingStore::backingStoreUpdateTimerFired(Timer<TiledBackingStore>*)
{
    ASSERT(m_commitTileUpdatesOnIdleEventLoop);
    createTiles();
}