コード例 #1
0
ファイル: RadiosityRenderer.cpp プロジェクト: kdudka/rrv
void RadiosityRenderer::computeStep() {

    PatchRandomAccessEnumerator &patch = *patchEnumerator_;

    // Initialize radiosityLast tag of Triangle objects
    for(int i=0; i<patchCount_; i++) {
        Triangle &dest = patch[i];
        dest.radiosityLast = dest.radiosity;
        (*sceneRadiosity_)[i] = dest.radiosity;
    }

    if(patchCache_->full())
    {
        // OpenGL uses thread-local storage (all GL calls
        // must be from the thread that owns the context)
        // if the cache is full then OpenGL can't be called
        // which makes it safe to parallelize this loop
        #pragma omp parallel for
        for(int p = 0; p < patchCount_; ++p)
            computePatch(p, false, true);
    }
    else
    {
        // Compute new step
        for(currentPatch_=0; currentPatch_<patchCount_; currentPatch_++)
        {
            notifyPerStepProgress();
            computePatch(currentPatch_, currentStep_ == 0, false);
        }
    }
}
コード例 #2
0
ファイル: GLDriver_Core.cpp プロジェクト: martydill/Fizz3D
// Processing we do on the map after it has been loaded
// For the OpenGL driver, we generate display lists from the bezier patches.
int GLDriver::postProcessMap(Q3Map* mapData)
{
	Assert(mapData != NULL);

	pFace = mapData->pFace;
	pVertex = mapData->pVertex;
	//pShader = mapData->pShader;
	pMapShader = mapData->pMapShader;
	pLightMap = mapData->pLightMap;
		
	if(maxList > FONT_DISPLAY_LIST_SIZE)
		glDeleteLists(minList, maxList);

	for(int i = 0; i < mapData->numFaces; ++i)
	{
		if(mapData->pFace[i].type == Q3FaceType::Patch)
		{
			// FIXME: here or map?
			computePatch(i);
			genDisplayList(i);
		}
	}

	return 0;
}