private void RenderPerTexture(EntityCache cache, Rect2d blockRange) { bool firstRender; for (int depth = EntityCache.DISTANCE_COUNT - 1; depth >= 0; depth--) { for (int rtype = 0; rtype < EntityCache.RenderTypeCount; rtype++) { firstRender = true; foreach (Entity e in cache.GetEntitiesAt(depth, rtype)) { if (blockRange.Includes(e.position)) { if (firstRender || rtype == (int)EntityRenderType.BRT_DYNAMIC) { e.GetCurrentTexture().bind(); firstRender = false; } RenderNoBindRectangle(e.GetCorrectTexturePosition(), e.GetCurrentTexture(), e.GetDistance(), e.GetTransparency()); } } } } }