예제 #1
0
void SceneManager::computeVisibility(ptr<SceneNode> n, visibility v)
{
    if (v == PARTIALLY_VISIBLE) {
        v = getVisibility(n->getWorldBounds());
    }
    n->isVisible = v != INVISIBLE;

    for (unsigned int i = 0; i < n->getChildrenCount(); ++i) {
        computeVisibility(n->getChild(i), v);
    }
}
예제 #2
0
파일: nRenderer.cpp 프로젝트: gan74/nGine
void nRenderer::begin(bool clear) {
	computeVisibility();
	enableAttributes();
	if(clear) {
		clearBuffers();
	}

	glRasterPos2i(0, 0);
	glViewport(0, 0, viewport.x, viewport.y);

	resetMatrix();
}
예제 #3
0
void SceneManager::update(double t, double dt)
{
    this->t = t;
    this->dt = dt;

    if (root != NULL) {
        root->updateLocalToWorld(NULL);
        mat4d cameraToScreen = getCameraToScreen();
        worldToScreen = cameraToScreen * getCameraNode()->getWorldToLocal();
        root->updateLocalToCamera(getCameraNode()->getWorldToLocal(), cameraToScreen);
        getFrustumPlanes(worldToScreen, worldFrustumPlanes);
        computeVisibility(root, PARTIALLY_VISIBLE);
    }
}
예제 #4
0
파일: sprite_eng.c 프로젝트: kubilus1/SGDK
void SPR_update(Sprite *sprites, u16 num)
{
    u16 i, j;
    u16 ind;
    Sprite *sprite;
    VDPSprite *cache;

    // flush sprite tile cache
    TC_flushCache(&tcSprite);

    // do a first pass to re allocate tileset still present in cache
    sprite = sprites;
    i = num;
    while(i--)
    {
         // auto allocation
        if (sprite->fixedIndex == -1)
        {
            s32 visibility = sprite->visibility;

            // don't run for disabled sprite
            if (visibility != VISIBILITY_ALWAYS_OFF)
            {
                AnimationFrame *frame;
                FrameSprite **frameSprites;

                frame = sprite->frame;
                j = frame->numSprite;
                frameSprites = frame->frameSprites;

                // need update ?
                if (visibility == -1)
                {
                    computeVisibility(sprite);
                    visibility = sprite->visibility;
                }

                while(j--)
                {
                    // sprite visible --> try fast re alloc
                    if (visibility & 1)
                        TC_reAlloc(&tcSprite, (*frameSprites)->tileset);

                    frameSprites++;
                    visibility >>= 1;
                }
            }
        }
예제 #5
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createGeometry(ReservoirGeometryCacheType geometryType)
{
    RigReservoir* res = m_reservoirView->eclipseCase()->reservoirData();
    m_geometries[geometryType].clearAndSetReservoir(res);
    m_geometries[geometryType].setTransform(m_scaleTransform.p());
    std::vector<RigGridBase*> grids;
    res->allGrids(&grids);

    for (size_t i = 0; i < grids.size(); ++i)
    {
        cvf::ref<cvf::UByteArray> cellVisibility = m_geometries[geometryType].cellVisibility(i); 
        computeVisibility(cellVisibility.p(), geometryType, grids[i], i);

        m_geometries[geometryType].setCellVisibility(i, cellVisibility.p());
    }

    m_geometriesNeedsRegen[geometryType] = false;
}