void ApplicationEngine::Initialize(int width, int height) { m_trackballRadius = width / 3; m_screenSize = ivec2(width, height); m_centerPoint = m_screenSize / 2; string path = m_resourceManager->GetResourcePath(); vector<ISurface*> surfaces(SurfaceCount); FLTetrahedronWithBoundsDivisions* FLTWBD = new FLTetrahedronWithBoundsDivisions(2.5, GL_LINES); surfaces[0] = new FLTetrahedronQuaternaryPhaseDiagram(path + "/nimninco.ABCD", 2.5, GL_TRIANGLES); surfaces[1] = FLTWBD; surfaces[2] = new FLText3D("ni", (FLTWBD->topVertex.Position) - (FLTWBD->translateOriginToCenterOfMassVector)); surfaces[3] = new FLText3D("mn", (FLTWBD->rightVertex.Position) - (FLTWBD->translateOriginToCenterOfMassVector)); surfaces[4] = new FLText3D("in", (FLTWBD->leftVertex.Position) - (FLTWBD->translateOriginToCenterOfMassVector)); surfaces[5] = new FLText3D("co", (FLTWBD->frontVertex.Position) - (FLTWBD->translateOriginToCenterOfMassVector)); m_renderingEngine->Initialize(surfaces); for (int i = 0; i < SurfaceCount; i++) delete surfaces[i]; }
void LipstickCompositor::windowSwapped() { #if QT_VERSION >= QT_VERSION_CHECK(5,2,0) if (m_fullscreenSurface) { sendFrameCallbacks(QList<QWaylandSurface *>() << m_fullscreenSurface); } else { sendFrameCallbacks(surfaces()); } #else frameFinished(m_fullscreenSurface); #endif }
void LipstickCompositor::surfaceDamaged(const QRect &) { if (!isVisible()) { // If the compositor is not visible, do not throttle. // make it conditional to QT_WAYLAND_COMPOSITOR_NO_THROTTLE? #if QT_VERSION >= QT_VERSION_CHECK(5,2,0) sendFrameCallbacks(surfaces()); #else frameFinished(0); #endif } }
void ApplicationEngine::Initialize(int width, int height) { m_trackballRadius = width / 3; m_buttonSize.y = height / 10; m_buttonSize.x = 4 * m_buttonSize.y / 3; m_screenSize = ivec2(width, height - m_buttonSize.y); m_centerPoint = m_screenSize / 2; vector<ISurface*> surfaces(SurfaceCount); string path = m_resourceManager->GetResourcePath(); surfaces[0] = new ObjSurface(path + "/micronapalmv2.obj"); surfaces[1] = new ObjSurface(path + "/Ninja.obj"); surfaces[2] = new Torus(1.4, 0.3); surfaces[3] = new TrefoilKnot(1.8f); surfaces[4] = new KleinBottle(0.2f); surfaces[5] = new MobiusStrip(1); m_renderingEngine->Initialize(surfaces); for (int i = 0; i < SurfaceCount; i++) delete surfaces[i]; }
TexturePtr DisplayDeviceOpenGL::handleCreateTexture(const SurfacePtr& surface, TextureType type, int mipmap_levels) { std::vector<SurfacePtr> surfaces(1, surface); return std::make_shared<OpenGLTexture>(surfaces, type, mipmap_levels); }
SearchStructure::SearchStructure(const std::string &stageStream) : _team(new DummyTeam()), _isOptimized(false) { _team->setup(); StageSetJsonReader reader; reader.deserialize(*_team, stageStream); std::shared_ptr<StageSet> stageSet = _team->stageSet(); _searchZones.clear(); _searchSurfaces.clear(); if(!stageSet->isVisible()) return; std::vector<std::pair<StageZone*, size_t>> zoneStack; zoneStack.push_back(std::make_pair(stageSet.get(), -1)); while(!zoneStack.empty()) { StageZone* zone = zoneStack.back().first; size_t parentId = zoneStack.back().second; zoneStack.pop_back(); size_t addedSubzones = 0; for(size_t s=0; s < zone->subzones().size(); ++s) { StageZone* subz = zone->subzones()[s].get(); if(!subz->isVisible()) continue; // Bubble up unbounded subzones if(subz->bounds().get() == StageZone::UNBOUNDED.get()) { // Bubble up props size_t propCount = subz->props().size(); for(size_t p=0; p < propCount; ++p) { auto prop = subz->props()[p]; if(prop->isVisible()) zone->addProp(subz->props()[p]); } // Bubble up lights size_t lightCount = subz->lights().size(); for(size_t l=0; l < lightCount; ++l) { auto light = subz->lights()[l]; if(light->isVisible()) zone->addLight(light); } // Bubble up subzones size_t subzCount = subz->subzones().size(); for(size_t z=0; z < subzCount; ++z) { auto subsubz = subz->subzones()[z]; if(subsubz->isVisible()) zone->addSubzone(subsubz); } } else { size_t currId = _searchZones.size(); zoneStack.push_back(std::make_pair(subz, currId)); ++addedSubzones; } } size_t startSurfCount = _searchSurfaces.size(); size_t lightCount = zone->lights().size(); for(size_t l=0; l < lightCount; ++l) { auto light = zone->lights()[l]; if(light->isVisible()) { _searchSurfaces.emplace_back(light->surface()); if(light->isOn()) _lights.push_back(light); } } size_t propCount = zone->props().size(); for(size_t p=0; p < propCount; ++p) { auto prop = zone->props()[p]; if(prop->isVisible()) { size_t surfCount = prop->surfaces().size(); for(size_t s=0; s < surfCount; ++s) { _searchSurfaces.emplace_back( prop->surfaces()[s]); } } } size_t endSurfCount = _searchSurfaces.size(); size_t addedSurfaces = endSurfCount - startSurfCount; if(addedSubzones == 0 && addedSurfaces == 0) continue; SearchZone searchZone; searchZone.parent = parentId; searchZone.endZone = _searchZones.size() + 1; searchZone.endSurf = _searchSurfaces.size(); searchZone.begSurf = searchZone.endSurf - addedSurfaces; searchZone.bounds = zone->bounds().get(); _searchZones.push_back(searchZone); } int last = int(_searchZones.size() - 1); for(int i = last; i >= 0; --i) { const SearchZone& zone = _searchZones[i]; if(zone.parent != -1) { SearchZone& parent = _searchZones[zone.parent]; parent.endZone = glm::max(parent.endZone, zone.endZone); } } _isEmpty = _searchSurfaces.empty(); }