void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect ) { bool highlight = mMouseOver; ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA; RectI renderRect( offset, getExtent() ); if ( !highlight ) renderRect.inset( 1, 1 ); GFXDrawUtil *drawer = GFX->getDrawUtil(); drawer->clearBitmapModulation(); // Draw background transparency grid texture... if ( mGrid.isValid() ) drawer->drawBitmapStretch( mGrid, renderRect ); // Draw swatch color as fill... if (!mUseSRGB) drawer->drawRectFill( renderRect, mSwatchColor.toGamma() ); else drawer->drawRectFill(renderRect, mSwatchColor); // Draw any borders... drawer->drawRect( renderRect, borderColor ); }
// Render out the fixed bitmap borders based on a multiplier into the bitmap array // It renders left and right caps, with a sizable fill area in the middle to reach // the x extent. It does not stretch in the y direction. void renderFixedBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile ) { // Indices into the bitmap array S32 numBitmaps = 3; S32 borderLeft = numBitmaps * baseMultiplier - numBitmaps; S32 fill = 1 + borderLeft; S32 borderRight = 2 + borderLeft; GFXDrawUtil *drawer = GFX->getDrawUtil(); drawer->clearBitmapModulation(); if(profile->mBitmapArrayRects.size() >= (numBitmaps * baseMultiplier)) { RectI destRect; RectI stretchRect; RectI* mBitmapBounds = profile->mBitmapArrayRects.address(); // Draw all corners first. //left border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderLeft]); //right border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x,bounds.point.y),mBitmapBounds[borderRight]); // End drawing corners // Begin drawing fill //fill stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderLeft].extent.x; destRect.extent.x = (bounds.extent.x) - mBitmapBounds[borderLeft].extent.x - mBitmapBounds[borderRight].extent.x; destRect.extent.y = mBitmapBounds[fill].extent.y; destRect.point.y = bounds.point.y; //stretch it stretchRect = mBitmapBounds[fill]; stretchRect.inset(1,0); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); // End drawing fill } }
void GuiTheoraCtrl::onRender(Point2I offset, const RectI &updateRect) { if( mDone && mIsLooping ) mTheoraTexture.play(); const RectI rect(offset, getBounds().extent); if( mTheoraTexture.isReady() ) { mTheoraTexture.refresh(); if( mTheoraTexture.isPlaying() || mTheoraTexture.isPaused() ) { // Draw the frame. GFXDrawUtil* drawUtil = GFX->getDrawUtil(); drawUtil->clearBitmapModulation(); drawUtil->drawBitmapStretch( mTheoraTexture.getTexture(), rect ); // Draw frame info, if requested. if( mRenderDebugInfo ) { String info = String::ToString( "Frame Number: %i | Frame Time: %.2fs | Playback Time: %.2fs | Dropped: %i", mTheoraTexture.getFrameNumber(), mTheoraTexture.getFrameTime(), F32( mTheoraTexture.getPosition() ) / 1000.f, mTheoraTexture.getNumDroppedFrames() ); drawUtil->setBitmapModulation( mProfile->mFontColors[ 0 ] ); drawUtil->drawText( mProfile->mFont, localToGlobalCoord( Point2I( 0, 0 ) ), info, mProfile->mFontColors ); } } else mDone = true; } else GFX->getDrawUtil()->drawRectFill(rect, mBackgroundColor); // black rect renderChildControls(offset, updateRect); }
void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect) { RectI ctrlRect(offset, getExtent()); //grab lowest dimension if(getHeight() <= getWidth()) mDim = getHeight(); else mDim = getWidth(); GFXDrawUtil* drawUtil = GFX->getDrawUtil(); drawUtil->clearBitmapModulation(); if(mNumberOfBitmaps == 1) { //draw the progress with image S32 width = (S32)((F32)(getWidth()) * mProgress); if (width > 0) { //drawing stretch bitmap RectI progressRect = ctrlRect; progressRect.extent.x = width; drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[0]); } } else if(mNumberOfBitmaps >= 3) { //drawing left-end bitmap RectI progressRectLeft(ctrlRect.point.x, ctrlRect.point.y, mDim, mDim); drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRectLeft, mProfile->mBitmapArrayRects[0]); //draw the progress with image S32 width = (S32)((F32)(getWidth()) * mProgress); if (width > mDim) { //drawing stretch bitmap RectI progressRect = ctrlRect; progressRect.point.x += mDim; progressRect.extent.x = (width - mDim - mDim); if (progressRect.extent.x < 0) progressRect.extent.x = 0; drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[1]); //drawing right-end bitmap RectI progressRectRight(progressRect.point.x + progressRect.extent.x, ctrlRect.point.y, mDim, mDim ); drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRectRight, mProfile->mBitmapArrayRects[2]); } } else Con::warnf("guiProgressBitmapCtrl only processes an array of bitmaps == 1 or >= 3"); //if there's a border, draw it if (mProfile->mBorder) drawUtil->drawRect(ctrlRect, mProfile->mBorderColor); Parent::onRender( offset, updateRect ); //render the children renderChildControls(offset, updateRect); }
// Render out the sizable bitmap borders based on a multiplier into the bitmap array // Based on the 'Skinnable GUI Controls in TGE' resource by Justin DuJardin void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, GuiControlProfile *profile ) { // Indices into the bitmap array S32 numBitmaps = 9; S32 borderTopLeft = startIndex; S32 borderTop = 1 + borderTopLeft; S32 borderTopRight = 2 + borderTopLeft; S32 borderLeft = 3 + borderTopLeft; S32 fill = 4 + borderTopLeft; S32 borderRight = 5 + borderTopLeft; S32 borderBottomLeft = 6 + borderTopLeft; S32 borderBottom = 7 + borderTopLeft; S32 borderBottomRight = 8 + borderTopLeft; GFXDrawUtil *drawer = GFX->getDrawUtil(); drawer->clearBitmapModulation(); if(profile->mBitmapArrayRects.size() >= (startIndex + numBitmaps)) { RectI destRect; RectI stretchRect; RectI* mBitmapBounds = profile->mBitmapArrayRects.address(); // Draw all corners first. //top left border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderTopLeft]); //top right border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderTopRight].extent.x,bounds.point.y),mBitmapBounds[borderTopRight]); //bottom left border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomLeft].extent.y),mBitmapBounds[borderBottomLeft]); //bottom right border drawer->drawBitmapSR(profile->mTextureObject,Point2I( bounds.point.x + bounds.extent.x - mBitmapBounds[borderBottomRight].extent.x, bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomRight].extent.y), mBitmapBounds[borderBottomRight]); // End drawing corners // Begin drawing sides and top stretched borders //start with top line stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderTopLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[borderTopRight].extent.x - mBitmapBounds[borderTopLeft].extent.x; destRect.extent.y = mBitmapBounds[borderTop].extent.y; destRect.point.y = bounds.point.y; //stretch it stretchRect = mBitmapBounds[borderTop]; stretchRect.inset(1,0); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //bottom line stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderBottomLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[borderBottomRight].extent.x - mBitmapBounds[borderBottomLeft].extent.x; destRect.extent.y = mBitmapBounds[borderBottom].extent.y; destRect.point.y = bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottom].extent.y; //stretch it stretchRect = mBitmapBounds[borderBottom]; stretchRect.inset(1,0); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x; destRect.extent.x = mBitmapBounds[borderLeft].extent.x; destRect.extent.y = bounds.extent.y - mBitmapBounds[borderTopLeft].extent.y - mBitmapBounds[borderBottomLeft].extent.y; destRect.point.y = bounds.point.y + mBitmapBounds[borderTopLeft].extent.y; //stretch it stretchRect = mBitmapBounds[borderLeft]; stretchRect.inset(0,1); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x; destRect.extent.x = mBitmapBounds[borderRight].extent.x; destRect.extent.y = bounds.extent.y - mBitmapBounds[borderTopRight].extent.y - mBitmapBounds[borderBottomRight].extent.y; destRect.point.y = bounds.point.y + mBitmapBounds[borderTopRight].extent.y; //stretch it stretchRect = mBitmapBounds[borderRight]; stretchRect.inset(0,1); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //fill stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderLeft].extent.x; destRect.extent.x = (bounds.extent.x) - mBitmapBounds[borderLeft].extent.x - mBitmapBounds[borderRight].extent.x; destRect.extent.y = bounds.extent.y - mBitmapBounds[borderTop].extent.y - mBitmapBounds[borderBottom].extent.y; destRect.point.y = bounds.point.y + mBitmapBounds[borderTop].extent.y; //stretch it stretchRect = mBitmapBounds[fill]; stretchRect.inset(1,1); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); // End drawing sides and top stretched borders } }
void renderBorder( const RectI &bounds, GuiControlProfile *profile ) { S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1; S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1; GFXDrawUtil *drawer = GFX->getDrawUtil(); switch(profile->mBorder) { case 1: drawer->drawRect(bounds, profile->mBorderColor); break; case 2: drawer->drawLine(l + 1, t + 1, l + 1, b - 2, profile->mBevelColorHL); drawer->drawLine(l + 2, t + 1, r - 2, t + 1, profile->mBevelColorHL); drawer->drawLine(r, t, r, b, profile->mBevelColorHL); drawer->drawLine(l, b, r - 1, b, profile->mBevelColorHL); drawer->drawLine(l, t, r - 1, t, profile->mBorderColorNA); drawer->drawLine(l, t + 1, l, b - 1, profile->mBorderColorNA); drawer->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColorNA); drawer->drawLine(r - 1, t + 1, r - 1, b - 2, profile->mBorderColorNA); break; case 3: drawer->drawLine(l, b, r, b, profile->mBevelColorHL); drawer->drawLine(r, t, r, b - 1, profile->mBevelColorHL); drawer->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mFillColor); drawer->drawLine(r - 1, t + 1, r - 1, b - 2, profile->mFillColor); drawer->drawLine(l, t, l, b - 1, profile->mBorderColorNA); drawer->drawLine(l + 1, t, r - 1, t, profile->mBorderColorNA); drawer->drawLine(l + 1, t + 1, l + 1, b - 2, profile->mBevelColorLL); drawer->drawLine(l + 2, t + 1, r - 2, t + 1, profile->mBevelColorLL); break; case 4: drawer->drawLine(l, t, l, b - 1, profile->mBevelColorHL); drawer->drawLine(l + 1, t, r, t, profile->mBevelColorHL); drawer->drawLine(l, b, r, b, profile->mBevelColorLL); drawer->drawLine(r, t + 1, r, b - 1, profile->mBevelColorLL); drawer->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor); drawer->drawLine(r - 1, t + 1, r - 1, b - 2, profile->mBorderColor); break; case 5: renderFilledBorder( bounds, profile ); break; // case -1: // Draw a simple sizable border with corners // Taken from the 'Skinnable GUI Controls in TGE' resource by Justin DuJardin if(profile->mBitmapArrayRects.size() >= 8) { drawer->clearBitmapModulation(); RectI destRect; RectI stretchRect; RectI* mBitmapBounds = profile->mBitmapArrayRects.address(); // Indices into the bitmap array enum { BorderTopLeft = 0, BorderTop, BorderTopRight, BorderLeft, //Fill, BorderRight, BorderBottomLeft, BorderBottom, BorderBottomRight, NumBitmaps }; // Draw all corners first. //top left border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[BorderTopLeft]); //top right border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderTopRight].extent.x,bounds.point.y),mBitmapBounds[BorderTopRight]); //bottom left border drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomLeft].extent.y),mBitmapBounds[BorderBottomLeft]); //bottom right border drawer->drawBitmapSR(profile->mTextureObject,Point2I( bounds.point.x + bounds.extent.x - mBitmapBounds[BorderBottomRight].extent.x, bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomRight].extent.y), mBitmapBounds[BorderBottomRight]); // End drawing corners // Begin drawing sides and top stretched borders //start with top line stretch destRect.point.x = bounds.point.x + mBitmapBounds[BorderTopLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[BorderTopRight].extent.x - mBitmapBounds[BorderTopLeft].extent.x; destRect.extent.y = mBitmapBounds[BorderTop].extent.y; destRect.point.y = bounds.point.y; //stretch it stretchRect = mBitmapBounds[BorderTop]; stretchRect.inset(1,0); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //bottom line stretch destRect.point.x = bounds.point.x + mBitmapBounds[BorderBottomLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[BorderBottomRight].extent.x - mBitmapBounds[BorderBottomLeft].extent.x; destRect.extent.y = mBitmapBounds[BorderBottom].extent.y; destRect.point.y = bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottom].extent.y; //stretch it stretchRect = mBitmapBounds[BorderBottom]; stretchRect.inset(1,0); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x; destRect.extent.x = mBitmapBounds[BorderLeft].extent.x; destRect.extent.y = bounds.extent.y - mBitmapBounds[BorderTopLeft].extent.y - mBitmapBounds[BorderBottomLeft].extent.y; destRect.point.y = bounds.point.y + mBitmapBounds[BorderTopLeft].extent.y; //stretch it stretchRect = mBitmapBounds[BorderLeft]; stretchRect.inset(0,1); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); //right line stretch destRect.point.x = bounds.point.x + bounds.extent.x - mBitmapBounds[BorderRight].extent.x; destRect.extent.x = mBitmapBounds[BorderRight].extent.x; destRect.extent.y = bounds.extent.y - mBitmapBounds[BorderTopRight].extent.y - mBitmapBounds[BorderBottomRight].extent.y; destRect.point.y = bounds.point.y + mBitmapBounds[BorderTopRight].extent.y; //stretch it stretchRect = mBitmapBounds[BorderRight]; stretchRect.inset(0,1); //draw it drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect); // End drawing sides and top stretched borders break; } case -2: // Draw a simple sizable border with corners that is filled in renderSizableBitmapBordersFilled(bounds, 1, profile); break; case -3: // Draw a simple fixed height border with center fill horizontally. renderFixedBitmapBordersFilled( bounds, 1, profile ); break; } }
void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect) { GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile; GFXDrawUtil* drawUtil = GFX->getDrawUtil(); F32 xScale = (float) getWidth() / profile->getRowWidth(); bool profileHasIcons = profile->hasArrows(); S32 rowHeight = profile->getRowHeight(); Point2I currentOffset = offset; Point2I extent = getExtent(); Point2I rowExtent(extent.x, rowHeight); Point2I textOffset(profile->mTextOffset.x * xScale, profile->mTextOffset.y); Point2I textExtent(extent.x - textOffset.x, rowHeight); Point2I iconExtent, iconOffset(0.0f, 0.0f); if (profileHasIcons) { iconExtent = profile->getIconExtent(); // icon is centered vertically plus any specified offset S32 iconOffsetY = (rowHeight - iconExtent.y) >> 1; iconOffsetY += profile->mIconOffset.y; iconOffset = Point2I(profile->mIconOffset.x * xScale, iconOffsetY); } for (Vector<Row *>::iterator row = mRows.begin(); row < mRows.end(); ++row) { if (row != mRows.begin()) { // rows other than the first can have padding above them currentOffset.y += (*row)->mHeightPad; currentOffset.y += rowHeight; } // select appropriate colors and textures ColorI fontColor; U32 buttonTextureIndex; S32 iconIndex = (*row)->mIconIndex; bool useHighlightIcon = (*row)->mUseHighlightIcon; if (! (*row)->mEnabled) { buttonTextureIndex = Profile::TEX_DISABLED; fontColor = profile->mFontColorNA; } else if (row == &mRows[mSelected]) { if (iconIndex != NO_ICON) { iconIndex++; } buttonTextureIndex = Profile::TEX_SELECTED; fontColor = profile->mFontColorSEL; } else if ((mHighlighted != NO_ROW) && (row == &mRows[mHighlighted])) { if (iconIndex != NO_ICON && useHighlightIcon) { iconIndex++; } buttonTextureIndex = Profile::TEX_HIGHLIGHT; fontColor = profile->mFontColorHL; } else { buttonTextureIndex = Profile::TEX_NORMAL; fontColor = profile->mFontColor; } // render the row bitmap drawUtil->clearBitmapModulation(); drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex)); // render the row icon if it has one if ((iconIndex != NO_ICON) && profileHasIcons && (! profile->getBitmapArrayRect((U32)iconIndex).extent.isZero())) { iconIndex += Profile::TEX_FIRST_ICON; drawUtil->clearBitmapModulation(); drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex)); } // render the row text drawUtil->setBitmapModulation(fontColor); renderJustifiedText(currentOffset + textOffset, textExtent, (*row)->mLabel); } if (mDebugRender) { onDebugRender(offset); } renderChildControls(offset, updateRect); }
void Forest::prepRenderImage( SceneRenderState *state ) { PROFILE_SCOPE(Forest_RenderCells); // TODO: Fix stats. /* ForestCellVector &theCells = mData->getCells(); smTotalCells += theCells.size(); // Don't render if we don't have a grid! if ( theCells.empty() ) return false; */ // Prepare to render. GFXTransformSaver saver; // Figure out the grid range in the viewing area. const bool isReflectPass = state->isReflectPass(); const F32 cullScale = isReflectPass ? mReflectionLodScalar : 1.0f; // If we need to update our cached // zone state then do it now. if ( mZoningDirty ) { mZoningDirty = false; Vector<ForestCell*> cells; mData->getCells( &cells ); for ( U32 i=0; i < cells.size(); i++ ) cells[i]->_updateZoning( getSceneManager()->getZoneManager() ); } // TODO: Move these into the TSForestItemData as something we // setup once and don't do per-instance. // Set up the TS render state. TSRenderState rdata; rdata.setSceneState( state ); // Use origin sort on all forest elements as // its alot cheaper than the bounds sort. rdata.setOriginSort( true ); // We may have some forward lit materials in // the forest, so pass down a LightQuery for it. LightQuery lightQuery; rdata.setLightQuery( &lightQuery ); Frustum culler = state->getFrustum(); // Adjust the far distance if the cull scale has changed. if ( !mIsEqual( cullScale, 1.0f ) ) { const F32 visFarDist = culler.getFarDist() * cullScale; culler.setFarDist( visFarDist ); } Box3F worldBox; // Used for debug drawing. GFXDrawUtil* drawer = GFX->getDrawUtil(); drawer->clearBitmapModulation(); // Go thru the visible cells. const Box3F &cullerBounds = culler.getBounds(); const Point3F &camPos = state->getDiffuseCameraPosition(); U32 clipMask; smAverageItemsPerCell = 0.0f; U32 cellsProcessed = 0; ForestCell *cell; // First get all the top level cells which // intersect the frustum. Vector<ForestCell*> cellStack; mData->getCells( culler, &cellStack ); // Get the culling zone state. const BitVector &zoneState = state->getCullingState().getZoneVisibilityFlags(); // Now loop till we run out of cells. while ( !cellStack.empty() ) { // Pop off the next cell. cell = cellStack.last(); cellStack.pop_back(); const Box3F &cellBounds = cell->getBounds(); // If the cell is empty or its bounds is outside the frustum // bounds then we have nothing nothing more to do. if ( cell->isEmpty() || !cullerBounds.isOverlapped( cellBounds ) ) continue; // Can we cull this cell entirely? clipMask = culler.testPlanes( cellBounds, Frustum::PlaneMaskAll ); if ( clipMask == -1 ) continue; // Test cell visibility for interior zones. const bool visibleInside = !cell->getZoneOverlap().empty() ? zoneState.testAny( cell->getZoneOverlap() ) : false; // Test cell visibility for outdoor zone, but only // if we need to. bool visibleOutside = false; if( !cell->mIsInteriorOnly && !visibleInside ) { U32 outdoorZone = SceneZoneSpaceManager::RootZoneId; visibleOutside = !state->getCullingState().isCulled( cellBounds, &outdoorZone, 1 ); } // Skip cell if neither visible indoors nor outdoors. if( !visibleInside && !visibleOutside ) continue; // Update the stats. smAverageItemsPerCell += cell->getItems().size(); ++cellsProcessed; //if ( cell->isLeaf() ) //++leafCellsProcessed; // Get the distance from the camera to the cell bounds. F32 dist = cellBounds.getDistanceToPoint( camPos ); // If the largest item in the cell can be billboarded // at the cell distance to the camera... then the whole // cell can be billboarded. // if ( smForceImposters || ( dist > 0.0f && cell->getLargestItem().canBillboard( state, dist ) ) ) { // If imposters are disabled then skip out. if ( smDisableImposters ) continue; PROFILE_SCOPE(Forest_RenderBatches); // Keep track of how many cells were batched. ++smCellsBatched; // Ok... everything in this cell should be batched. First // create the batches if we don't have any. if ( !cell->hasBatches() ) cell->buildBatches(); //if ( drawCells ) //mCellRenderFlag[ cellIter - theCells.begin() ] = 1; // TODO: Light queries for batches? // Now render the batches... we pass the culler if the // cell wasn't fully visible so that each batch can be culled. smCellItemsBatched += cell->renderBatches( state, clipMask != 0 ? &culler : NULL ); continue; } // If this isn't a leaf then recurse. if ( !cell->isLeaf() ) { cell->getChildren( &cellStack ); continue; } // This cell has mixed billboards and mesh based items. ++smCellsRendered; PROFILE_SCOPE(Forest_RenderItems); //if ( drawCells ) //mCellRenderFlag[ cellIter - theCells.begin() ] = 2; // Use the cell bounds as the light query volume. // // This means all forward lit items in this cell will // get the same lights, but it performs much better. lightQuery.init( cellBounds ); // This cell is visible... have it render its items. smCellItemsRendered += cell->render( &rdata, clipMask != 0 ? &culler : NULL ); } // Keep track of the average items per cell. if ( cellsProcessed > 0 ) smAverageItemsPerCell /= (F32)cellsProcessed; // Got debug drawing to do? if ( smDrawCells && state->isDiffusePass() ) { ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>(); ri->renderDelegate.bind( this, &Forest::_renderCellBounds ); ri->type = RenderPassManager::RIT_Editor; state->getRenderPass()->addInst( ri ); } }