Example #1
0
        // only find local links
        void EntityLinkDecorator::gatherLinksLocal(Vec4f::List& vList, RenderContext& context, Model::Entity& curEnt) {
            if (!context.filter().entityVisible(curEnt))
                return;

            Model::EntityList::const_iterator it, end;
            const Model::EntityList& targetList = curEnt.linkTargets();

            for (it = targetList.begin(), end = targetList.end(); it != end; ++it) {
                const Model::Entity& targetEnt = **it;

                if (!context.filter().entityVisible(targetEnt))
                    continue;

                addArrowVerts(vList, curEnt.center(), targetEnt.center());
            }

            const Model::EntityList& sourceList = curEnt.linkSources();

            for (it = sourceList.begin(), end = sourceList.end(); it != end; ++it) {
                const Model::Entity& sourceEnt = **it;

                if (!context.filter().entityVisible(sourceEnt))
                    continue;

                addArrowVerts(vList, sourceEnt.center(), curEnt.center());
            }
        }
Example #2
0
        void EntityRenderer::validateBounds(RenderContext& context) {
            delete m_boundsVertexArray;
            m_boundsVertexArray = NULL;

            Model::EntityList entities;
            Model::EntitySet::iterator entityIt, entityEnd;
            for (entityIt = m_entities.begin(), entityEnd = m_entities.end(); entityIt != entityEnd; ++entityIt) {
                Model::Entity* entity = *entityIt;
                if (context.filter().entityVisible(*entity))
                    entities.push_back(entity);
            }

            if (entities.empty())
                return;

            SetVboState mapVbo(m_boundsVbo, Vbo::VboMapped);

            if (m_overrideBoundsColor) {
                unsigned int vertexCount = 2 * 4 * 6 * static_cast<unsigned int>(entities.size());
                m_boundsVertexArray = new VertexArray(m_boundsVbo, GL_LINES, vertexCount,
                                                      Attribute::position3f());
                writeBounds(context, entities);
            } else {
                unsigned int vertexCount = 2 * 4 * 6 * static_cast<unsigned int>(entities.size());
                m_boundsVertexArray = new VertexArray(m_boundsVbo, GL_LINES, vertexCount,
                                                      Attribute::position3f(),
                                                      Attribute::color4f());
                writeColoredBounds(context, entities);
            }

            m_boundsValid = true;
        }
Example #3
0
        void EntityRenderer::renderModels(RenderContext& context) {
            if (m_modelRenderers.empty())
                return;

            Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();
            EntityModelRendererManager& modelRendererManager = m_document.sharedResources().modelRendererManager();

            ShaderManager& shaderManager = m_document.sharedResources().shaderManager();
            ShaderProgram& entityModelProgram = shaderManager.shaderProgram(Shaders::EntityModelShader);

            if (entityModelProgram.activate()) {
                modelRendererManager.activate();
                entityModelProgram.setUniformVariable("Brightness", prefs.getFloat(Preferences::RendererBrightness));
                entityModelProgram.setUniformVariable("ApplyTinting", m_applyTinting);
                entityModelProgram.setUniformVariable("TintColor", m_tintColor);
                entityModelProgram.setUniformVariable("GrayScale", m_grayscale);

                EntityModelRenderers::iterator it, end;
                for (it = m_modelRenderers.begin(), end = m_modelRenderers.end(); it != end; ++it) {
                    Model::Entity* entity = it->first;
                    if (context.filter().entityVisible(*entity)) {
                        EntityModelRenderer* renderer = it->second.renderer;
                        renderer->render(entityModelProgram, context.transformation(), *entity);
                    }
                }

                modelRendererManager.deactivate();
                entityModelProgram.deactivate();
            }
        }
Example #4
0
        // find links in a "context"
        void EntityLinkDecorator::gatherLinks(Vec4f::List& vListLocal, Vec4f::List& vListContext, RenderContext& context, Model::Entity& curEnt, Model::EntitySet& visitedEntities) {
            Model::EntitySet::iterator vIt = visitedEntities.lower_bound(&curEnt);

            if (*vIt == &curEnt)
                return;

            visitedEntities.insert(vIt, &curEnt);

            if (!context.filter().entityVisible(curEnt))
                return;

            Model::EntityList::const_iterator it, end;
            const Model::EntityList& targetList = curEnt.linkTargets();

            for (it = targetList.begin(), end = targetList.end(); it != end; ++it) {
                Model::Entity& targetEnt = **it;

                if (!context.filter().entityVisible(targetEnt))
                    continue;

                if (curEnt.selected() || targetEnt.selected())
                    addArrowVerts(vListLocal, curEnt.center(), targetEnt.center());
                else
                    addArrowVerts(vListContext, curEnt.center(), targetEnt.center());

                gatherLinks(vListLocal, vListContext, context, targetEnt, visitedEntities);
            }

            const Model::EntityList& sourceList = curEnt.linkSources();

            for (it = sourceList.begin(), end = sourceList.end(); it != end; ++it) {
                Model::Entity& sourceEnt = **it;

                if (!context.filter().entityVisible(sourceEnt))
                    continue;

                gatherLinks(vListLocal, vListContext, context, sourceEnt, visitedEntities);
            }
        }
Example #5
0
 bool EntityRenderer::EntityClassnameFilter::stringVisible(RenderContext& context, const EntityKey& entity) const {
     return context.filter().entityVisible(*entity);
 }