コード例 #1
0
ファイル: OgreHlmsJsonPbs.cpp プロジェクト: devxkh/FrankE
 //-----------------------------------------------------------------------------------
 void HlmsJsonPbs::saveFresnel( const HlmsPbsDatablock *datablock, String &outString )
 {
     saveTexture( datablock->getFresnel(), ColourValue::ZERO, "fresnel", PBSM_SPECULAR,
                  true, false, true, true,
                  datablock->getWorkflow() == HlmsPbsDatablock::SpecularAsFresnelWorkflow,
                  datablock, outString );
 }
コード例 #2
0
ファイル: backdrop.cpp プロジェクト: hyrmedia/opensludge
bool getRGBIntoStack (unsigned int x, unsigned int y, stackHandler * sH) {
	if (x >= sceneWidth || y >= sceneHeight) {
		return fatal ("Co-ordinates are outside current scene!");
	}

	variable newValue;

	newValue.varType = SVT_NULL;

	saveTexture (backdropTextureName, backdropTexture);

	GLubyte * target;
	if (! NPOT_textures) {
		target = backdropTexture + 4*getNextPOT(sceneWidth)*y + x*4;
	} else {
		target = backdropTexture + 4*sceneWidth*y + x*4;
	}

	setVariable (newValue, SVT_INT, target[2]);
	if (! addVarToStackQuick (newValue, sH -> first)) return false;
	sH -> last = sH -> first;

	setVariable (newValue, SVT_INT, target[1]);
	if (! addVarToStackQuick (newValue, sH -> first)) return false;

	setVariable (newValue, SVT_INT, target[0]);
	if (! addVarToStackQuick (newValue, sH -> first)) return false;

	return true;
}
コード例 #3
0
ファイル: OgreHlmsJsonPbs.cpp プロジェクト: devxkh/FrankE
 //-----------------------------------------------------------------------------------
 void HlmsJsonPbs::saveTexture( float value, const char *blockName,
                                PbsTextureTypes textureType,
                                const HlmsPbsDatablock *datablock, String &outString,
                                bool writeTexture )
 {
     saveTexture( Vector3(value), ColourValue::ZERO, blockName, textureType,
                  true, false, true, false, writeTexture, datablock, outString);
 }
コード例 #4
0
ファイル: OgreHlmsJsonPbs.cpp プロジェクト: devxkh/FrankE
 //-----------------------------------------------------------------------------------
 void HlmsJsonPbs::saveTexture(const Vector3 &value, const char *blockName,
                                PbsTextureTypes textureType,
                                const HlmsPbsDatablock *datablock, String &outString,
                                bool writeTexture, const ColourValue &bgColour )
 {
     const bool writeBgDiffuse = textureType == PBSM_DIFFUSE;
     saveTexture( value, bgColour, blockName, textureType,
                  true, writeBgDiffuse, false, false, writeTexture,
                  datablock, outString );
 }
コード例 #5
0
ファイル: qsgadaptationlayer.cpp プロジェクト: RobinWuDev/Qt
void QSGDistanceFieldGlyphCache::update()
{
    m_populatingGlyphs.clear();

    if (m_pendingGlyphs.isEmpty())
        return;

    bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled();
    if (profileFrames)
        qsg_render_timer.start();
    Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphAdaptationLayerFrame);

    QList<QDistanceField> distanceFields;
    for (int i = 0; i < m_pendingGlyphs.size(); ++i) {
        GlyphData &gd = glyphData(m_pendingGlyphs.at(i));
        distanceFields.append(QDistanceField(gd.path,
                                             m_pendingGlyphs.at(i),
                                             m_doubleGlyphResolution));
        gd.path = QPainterPath(); // no longer needed, so release memory used by the painter path
    }

    qint64 renderTime = 0;
    int count = m_pendingGlyphs.size();
    if (profileFrames)
        renderTime = qsg_render_timer.nsecsElapsed();
    Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame);

    m_pendingGlyphs.reset();

    storeGlyphs(distanceFields);

#if defined(QSG_DISTANCEFIELD_CACHE_DEBUG)
    foreach (Texture texture, m_textures)
        saveTexture(texture.textureId, texture.size.width(), texture.size.height());
#endif

    if (QSG_LOG_TIME_GLYPH().isDebugEnabled()) {
        quint64 now = qsg_render_timer.elapsed();
        qCDebug(QSG_LOG_TIME_GLYPH,
                "distancefield: %d glyphs prepared in %dms, rendering=%d, upload=%d",
                count,
                (int) now,
                int(renderTime / 1000000),
                int((now - (renderTime / 1000000))));
    }
    Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
                                        (qint64)count);
}
コード例 #6
0
ファイル: FontPanel.cpp プロジェクト: LiberatorUSA/GUCEF
	void FontPanel::notifyMouseButtonClick(MyGUI::Widget* _widget)
	{
		// шрифтов нету
		if (mComboFont->getOnlyText().empty())
			return;
		if (mEditSaveFileName->getOnlyText().empty() && _widget == mButtonSave)
			return;

		if (_widget == mButtonSave)
		{
			std::string textureName = mEditSaveFileName->getOnlyText() + ".png";
			saveTexture(mFontName, textureName);

			std::string fontName = MyGUI::utility::toString(mEditSaveFileName->getOnlyText(), ".ttf.", mFontHeight);
			std::string fileName = mEditSaveFileName->getOnlyText() + ".ttf.xml";
			saveFontTTFXml(fontName, fileName);

			fontName = MyGUI::utility::toString(mEditSaveFileName->getOnlyText(), ".manual.", mFontHeight);
			fileName = mEditSaveFileName->getOnlyText() + ".manual.xml";
			saveFontManualXml(fontName, textureName, fileName);
		}
		else if (_widget == mButtonGenerate)
		{
			MyGUI::ResourceManager& manager = MyGUI::ResourceManager::getInstance();
			if (manager.isExist(mFontName))
			{
				manager.removeByName(mFontName);
			}

			MyGUI::xml::Document document;
			document.createDeclaration();
			MyGUI::xml::ElementPtr root = document.createRoot("MyGUI");
			generateFontTTFXml(root, mFontName);

			MyGUI::ResourceManager::getInstance().loadFromXmlNode(root, "", MyGUI::Version());
			MyGUI::IResource* resource = manager.getByName(mFontName, false);
			MYGUI_ASSERT(resource != nullptr, "Could not find font '" << mFontName << "'");
			MyGUI::IFont* font = resource->castType<MyGUI::IFont>();

			// вывод реального размера шрифта
			mFontHeight = font->getDefaultHeight();
			mTextPix->setCaption(MyGUI::utility::toString("Height of a font is ", mFontHeight, " pixels"));

			mFontView->setFontName(mFontName);
			mTextureView->setFontName(mFontName);
		}
	}
コード例 #7
0
void PassInfoDemo::init(WidgetRenderer * renderer, Camera& myCam, DebugMenuManager * menu) {
	myCam.lookAt(glm::vec3(10,10,10),glm::vec3());
	meEpicTexture = renderer->addPassInfo(false);
	renderer->setDefaultPassInfo(meEpicTexture);
	meEpicTexture->initTextures(renderer->width(),renderer->height());
	meEpicTexture->cam.enabled = true;
	addToFakeOutput(renderer,meEpicTexture->cam,menu);

	meEpicTexture->clearColor = glm::vec3();

	//renderer->resetDefaultPassInfoToScreen();
	renderer->setDefaultPassInfo(myDefaultPass);

	auto tempRenderable = renderer->addRenderable(renderer->addGeometry(Neumont::ShapeGenerator::makeCube()),renderer->defaultShaders.passThroughTexture, meEpicTexture->colorTexture);
	tempRenderable->saveTexture("myTexture");
	tempRenderable->saveMatrixInfo("model2WorldTransform");
	tempRenderable->transformData.rotation.x = 90;
	tempRenderable->transformData.scale = glm::vec3(5,5,5);
	tempRenderable->transformData.position.y = 2;
	tempRenderable->transformData.position.x = 2;
		
}
コード例 #8
0
ファイル: application.cpp プロジェクト: vince91/Chess3D
void Application::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);

    // CAMERA CONTROL
    if (action == GLFW_PRESS) {
        switch(key) {
        case 'W':
            scene.setCamFW(true);
            break;
        case 'S':
            scene.setCamBW(true);
            break;
        case 'A':
            scene.setCamLS(true);
            break;
        case 'D':
            scene.setCamRS(true);
            break;
        case 'Q':
            scene.setCamZP(true);
            break;
        case 'E':
            scene.setCamZN(true);
            break;
        case 'T':
            saveTexture();
            break;
        case 'O':
            game.loadFromFile(&scene);
            break;
        case 'F':
            game.saveToFile();
            break;
        case 'Y':
            scene.setSelectTex(0);
            game.initClassicGame(&scene);
            break;
        case 'X':
            light_enabled_demo[0] = light_enabled_demo[0]?false:true;
            break;
        case 'C':
            light_enabled_demo[1] = light_enabled_demo[1]?false:true;
            break;
        case 'B':
            skybox_enabled_demo = skybox_enabled_demo?false:true;
            break;
        case 'V':
            shadow_enabled_demo = shadow_enabled_demo?false:true;
            break;
        case 'N':
            reflection_enabled_demo = reflection_enabled_demo?false:true;
            break;
        default:
            break;
        }
    } else if (action == GLFW_RELEASE) {
        switch(key) {
        case 'W':
            scene.setCamFW(false);
            break;
        case 'S':
            scene.setCamBW(false);
            break;
        case 'A':
            scene.setCamLS(false);
            break;
        case 'D':
            scene.setCamRS(false);
            break;
        case 'Q':
            scene.setCamZP(false);
            break;
        case 'E':
            scene.setCamZN(false);
            break;
        default:
            break;
        }
    }
}
コード例 #9
0
void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
{
	if (!isActionEnabled(userdata))
		return;

	const std::string command_name = userdata.asString();
	if (command_name == "new_window")
	{
		newWindow();
	}
	if (command_name == "sort_by_name")
	{
		const LLSD arg = "name";
		setSortBy(arg);
	}
	if (command_name == "sort_by_recent")
	{
		const LLSD arg = "date";
		setSortBy(arg);
	}
	if (command_name == "show_filters")
	{
		toggleFindOptions();
	}
	if (command_name == "reset_filters")
	{
		resetFilters();
	}
	if (command_name == "close_folders")
	{
		closeAllFolders();
	}
	if (command_name == "empty_trash")
	{
		const std::string notification = "ConfirmEmptyTrash";
		gInventory.emptyFolderType(notification, LLFolderType::FT_TRASH);
	}
	if (command_name == "empty_lostnfound")
	{
		const std::string notification = "ConfirmEmptyLostAndFound";
		gInventory.emptyFolderType(notification, LLFolderType::FT_LOST_AND_FOUND);
	}
	if (command_name == "save_texture")
	{
		saveTexture(userdata);
	}
	// This doesn't currently work, since the viewer can't change an assetID an item.
	if (command_name == "regenerate_link")
	{
		LLInventoryPanel *active_panel = getActivePanel();
		LLFolderViewItem* current_item = active_panel->getRootFolder()->getCurSelectedItem();
		if (!current_item)
		{
			return;
		}
		const LLUUID item_id = current_item->getListener()->getUUID();
		LLViewerInventoryItem *item = gInventory.getItem(item_id);
		if (item)
		{
			item->regenerateLink();
		}
		active_panel->setSelection(item_id, TAKE_FOCUS_NO);
	}
	if (command_name == "find_original")
	{
		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
		if (!current_item)
		{
			return;
		}
		current_item->getListener()->performAction(getActivePanel()->getModel(), "goto");
	}

	if (command_name == "find_links")
	{
		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
		if (!current_item)
		{
			return;
		}
		const LLUUID& item_id = current_item->getListener()->getUUID();
		const std::string &item_name = current_item->getListener()->getName();
		mFilterSubString = item_name;
		LLInventoryFilter *filter = mActivePanel->getFilter();
		filter->setFilterSubString(item_name);
		mFilterEditor->setText(item_name);

		mFilterEditor->setFocus(TRUE);
		filter->setFilterUUID(item_id);
		filter->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
		filter->setFilterLinks(LLInventoryFilter::FILTERLINK_ONLY_LINKS);
	}
}
コード例 #10
0
ファイル: OgreHlmsJsonPbs.cpp プロジェクト: devxkh/FrankE
    //-----------------------------------------------------------------------------------
    void HlmsJsonPbs::saveMaterial( const HlmsDatablock *datablock, String &outString )
    {
        assert( dynamic_cast<const HlmsPbsDatablock*>(datablock) );
        const HlmsPbsDatablock *pbsDatablock = static_cast<const HlmsPbsDatablock*>(datablock);

        outString += ",\n\t\t\t\"workflow\" : ";
        toQuotedStr( pbsDatablock->getWorkflow(), outString );

        if( pbsDatablock->getBrdf() != PbsBrdf::Default )
        {
            outString += ",\n\t\t\t\"brdf\" : ";
            toQuotedStr( pbsDatablock->getBrdf(), outString );
        }

        if( pbsDatablock->getTwoSidedLighting() )
            outString += ",\n\t\t\t\"two_sided\" : true";

        if( !pbsDatablock->getReceiveShadows() )
            outString += ",\n\t\t\t\"receive_shadows\" : false";

        if( pbsDatablock->getTransparencyMode() != HlmsPbsDatablock::None )
        {
            outString += ",\n\t\t\t\"transparency\" :\n\t\t\t{";
            outString += "\n\t\t\t\t\"value\" : ";
            outString += StringConverter::toString( pbsDatablock->getTransparency() );
            outString += ",\n\t\t\t\t\"mode\" : ";
            toQuotedStr( pbsDatablock->getTransparencyMode(), outString );
            outString += ",\n\t\t\t\t\"use_alpha_from_textures\" : ";
            outString += pbsDatablock->getUseAlphaFromTextures() ? "true" : "false";
            outString += "\n\t\t\t}";
        }

        saveTexture( pbsDatablock->getDiffuse(),  "diffuse", PBSM_DIFFUSE,
                     pbsDatablock, outString, true, pbsDatablock->getBackgroundDiffuse() );
        saveTexture( pbsDatablock->getSpecular(), "specular", PBSM_SPECULAR,
                     pbsDatablock, outString,
                     pbsDatablock->getWorkflow() == HlmsPbsDatablock::SpecularWorkflow );
        if( pbsDatablock->getWorkflow() != HlmsPbsDatablock::MetallicWorkflow )
        {
            saveFresnel( pbsDatablock, outString );
        }
        else
        {
            saveTexture( pbsDatablock->getMetalness(), "metalness", PBSM_METALLIC,
                         pbsDatablock, outString );
        }

        if( pbsDatablock->getNormalMapWeight() != 1.0f ||
            !pbsDatablock->getTexture( PBSM_NORMAL ).isNull() )
        {
            saveTexture( pbsDatablock->getNormalMapWeight(), "normal", PBSM_NORMAL,
                         pbsDatablock, outString );
        }

        saveTexture( pbsDatablock->getRoughness(), "roughness", PBSM_ROUGHNESS,
                     pbsDatablock, outString );

        if( !pbsDatablock->getTexture( PBSM_DETAIL_WEIGHT ).isNull() )
            saveTexture( "detail_weight", PBSM_DETAIL_WEIGHT, pbsDatablock, outString );

        for( int i=0; i<4; ++i )
        {
            PbsBlendModes blendMode = pbsDatablock->getDetailMapBlendMode( i );
            const Vector4 &offsetScale = pbsDatablock->getDetailMapOffsetScale( i );
            const Vector2 offset( offsetScale.x, offsetScale.y );
            const Vector2 scale( offsetScale.z, offsetScale.w );

            const PbsTextureTypes textureType = static_cast<PbsTextureTypes>(PBSM_DETAIL0 + i);

            if( blendMode != PBSM_BLEND_NORMAL_NON_PREMUL || offset != Vector2::ZERO ||
                scale != Vector2::UNIT_SCALE || pbsDatablock->getDetailMapWeight( i ) != 1.0f ||
                !pbsDatablock->getTexture( textureType ).isNull() )
            {
                char tmpBuffer[64];
                LwString blockName( LwString::FromEmptyPointer( tmpBuffer, sizeof(tmpBuffer) ) );

                blockName.a( "detail_diffuse", i );

                saveTexture( pbsDatablock->getDetailMapWeight( i ), blockName.c_str(),
                             static_cast<PbsTextureTypes>(PBSM_DETAIL0 + i), pbsDatablock,
                             outString );
            }
        }

        for( int i=0; i<4; ++i )
        {
            const Vector4 &offsetScale = pbsDatablock->getDetailMapOffsetScale( i );
            const Vector2 offset( offsetScale.x, offsetScale.y );
            const Vector2 scale( offsetScale.z, offsetScale.w );

            const PbsTextureTypes textureType = static_cast<PbsTextureTypes>(PBSM_DETAIL0_NM + i);

            if( offset != Vector2::ZERO || scale != Vector2::UNIT_SCALE ||
                pbsDatablock->getDetailNormalWeight( i ) != 1.0f ||
                !pbsDatablock->getTexture( textureType ).isNull() )
            {
                char tmpBuffer[64];
                LwString blockName( LwString::FromEmptyPointer( tmpBuffer, sizeof(tmpBuffer) ) );

                blockName.a( "detail_normal", i );
                saveTexture( pbsDatablock->getDetailNormalWeight( i ), blockName.c_str(),
                             static_cast<PbsTextureTypes>(PBSM_DETAIL0_NM + i), pbsDatablock,
                             outString );
            }
        }

        if( pbsDatablock->hasEmissive() )
        {
            saveTexture( pbsDatablock->getEmissive(), "emissive", PBSM_EMISSIVE,
                         pbsDatablock, outString );
        }

        if( !pbsDatablock->getTexture( PBSM_REFLECTION ).isNull() )
            saveTexture( "reflection", PBSM_REFLECTION, pbsDatablock, outString );
    }
コード例 #11
0
ファイル: TextureEditor.cpp プロジェクト: dabroz/Tamy
void TextureEditor::onInitialize()
{
   TamyEditor& mainEditor = TamyEditor::getInstance();


   // setup the main layout
   QVBoxLayout* mainLayout = new QVBoxLayout( this );
   mainLayout->setContentsMargins(0, 0, 0, 0);
   setLayout( mainLayout );

   // add the toolbar
   {
      QToolBar* toolBar = new QToolBar( this );
      mainLayout->addWidget( toolBar );

      QAction* actionSaveScene = new QAction( QIcon( tr( ":/TamyEditor/Resources/Icons/Editor/saveFile.png" ) ), tr( "Save Scene" ), toolBar );
      toolBar->addAction( actionSaveScene );
      connect( actionSaveScene, SIGNAL( triggered() ), this, SLOT( saveTexture() ) );
   }

   // edit frame
   {
      QFrame* editFrame = new QFrame( this );
      QHBoxLayout* editFrameLayout = new QHBoxLayout( editFrame );
      editFrame->setLayout( editFrameLayout );
      mainLayout->addWidget( editFrame );

      // side panel for properties
      {
         QFrame* propertiesFrame = new QFrame( editFrame );
         QVBoxLayout* propertiesLayout = new QVBoxLayout( propertiesFrame );
         propertiesFrame->setLayout( propertiesLayout );
         editFrameLayout->addWidget( propertiesFrame, 0 );

         // properties viewer
         {
            QPropertiesView* propertiesView = new QPropertiesView();
            propertiesLayout->addWidget( propertiesView, 1 );
            m_texture.viewProperties( *propertiesView );
         }

         // image info box
         {
            QGroupBox* infoFrame = new QGroupBox( "Info", propertiesFrame );
            QFormLayout* infoLayout = new QFormLayout( infoFrame );
            infoFrame->setLayout( infoLayout );
            propertiesLayout->addWidget( infoFrame, 1 );

            infoLayout->addRow( new QLabel( "Width:", infoFrame ), m_imageWidthInfo = new QLabel( "0", infoFrame ) );
            infoLayout->addRow( new QLabel( "Height:", infoFrame ), m_imageHeightInfo = new QLabel( "0", infoFrame ) );
            infoLayout->addRow( new QLabel( "Depth:", infoFrame ), m_imageDepthInfo = new QLabel( "0 bits", infoFrame ) );
         }

      }

      // add the image viewer widget
      {
         m_image = new DropArea( editFrame, new FSNodeMimeData( m_imagePaths ) );
         editFrameLayout->addWidget( m_image, 1 );
         m_image->setBackgroundRole( QPalette::Base );
         m_image->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored );
         m_image->setScaledContents( true );

         connect( m_image, SIGNAL( changed() ), this, SLOT( onTextureSet() ) );
      }
   }

   // initialize the contents
   refreshImage();
}
void QSGSharedDistanceFieldGlyphCache::processPendingGlyphs()
{
    Q_ASSERT(QThread::currentThread() == thread());

    waitForGlyphs();

    {
        QMutexLocker locker(&m_pendingGlyphsMutex);
        if (m_pendingMissingGlyphs.isEmpty()
            && m_pendingReadyGlyphs.isEmpty()
            && m_pendingInvalidatedGlyphs.isEmpty()) {
            return;
        }

        {
            QVector<glyph_t> pendingMissingGlyphs;
            pendingMissingGlyphs.reserve(m_pendingMissingGlyphs.size());

            QSet<glyph_t>::const_iterator it = m_pendingMissingGlyphs.constBegin();
            while (it != m_pendingMissingGlyphs.constEnd()) {
                pendingMissingGlyphs.append(*it);
                ++it;
            }

            markGlyphsToRender(pendingMissingGlyphs);
        }

        {
            QVector<glyph_t> filteredPendingInvalidatedGlyphs;
            filteredPendingInvalidatedGlyphs.reserve(m_pendingInvalidatedGlyphs.size());

            QSet<glyph_t>::const_iterator it = m_pendingInvalidatedGlyphs.constBegin();
            while (it != m_pendingInvalidatedGlyphs.constEnd()) {
                bool rerequestGlyph = false;

                // The glyph was invalidated right after being posted as ready, we throw away
                // the ready glyph and rerequest it to be certain
                QHash<quint32, PendingGlyph>::iterator pendingGlyphIt = m_pendingReadyGlyphs.find(*it);
                if (pendingGlyphIt != m_pendingReadyGlyphs.end()) {
                    m_sharedGraphicsCache->dereferenceBuffer(pendingGlyphIt.value().buffer);
                    pendingGlyphIt = m_pendingReadyGlyphs.erase(pendingGlyphIt);
                    rerequestGlyph = true;
                }

                void *bufferId = m_bufferForGlyph.value(*it, 0);
                if (bufferId != 0) {
                    m_sharedGraphicsCache->dereferenceBuffer(bufferId);
                    m_bufferForGlyph.remove(*it);
                    rerequestGlyph = true;
                }

                if (rerequestGlyph)
                    filteredPendingInvalidatedGlyphs.append(*it);

                ++it;
            }

            // If this cache is still using the glyphs, reset the texture held by them, and mark them
            // to be rendered again since they are still needed.
            if (!filteredPendingInvalidatedGlyphs.isEmpty()) {
                setGlyphsTexture(filteredPendingInvalidatedGlyphs, Texture());
                markGlyphsToRender(filteredPendingInvalidatedGlyphs);
            }
        }

        {
            QList<GlyphPosition> glyphPositions;

            QHash<void *, TextureContent> textureContentForBuffer;
            {
                QHash<quint32, PendingGlyph>::iterator it = m_pendingReadyGlyphs.begin();
                while (it != m_pendingReadyGlyphs.end()) {
                    void *currentGlyphBuffer = m_bufferForGlyph.value(it.key(), 0);
                    if (currentGlyphBuffer != 0) {
                        if (!m_sharedGraphicsCache->dereferenceBuffer(currentGlyphBuffer)) {
                            Q_ASSERT(!textureContentForBuffer.contains(currentGlyphBuffer));
                        }
                    }

                    PendingGlyph &pendingGlyph  = it.value();

                    // We don't ref or deref the buffer here, since it was already referenced when
                    // added to the pending ready glyphs
                    m_bufferForGlyph[it.key()] = pendingGlyph.buffer;

                    textureContentForBuffer[pendingGlyph.buffer].size = pendingGlyph.bufferSize;
                    textureContentForBuffer[pendingGlyph.buffer].glyphs.append(it.key());

                    GlyphPosition glyphPosition;
                    glyphPosition.glyph = it.key();
                    glyphPosition.position = pendingGlyph.position;

                    glyphPositions.append(glyphPosition);

                    ++it;
                }
            }

            setGlyphsPosition(glyphPositions);

            {
                QHash<void *, TextureContent>::const_iterator it = textureContentForBuffer.constBegin();
                while (it != textureContentForBuffer.constEnd()) {
                    Texture texture;
                    texture.textureId = m_sharedGraphicsCache->textureIdForBuffer(it.key());
                    texture.size = m_sharedGraphicsCache->sizeOfBuffer(it.key());

#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG_)
                    saveTexture(texture.textureId, texture.size.width(), texture.size.height());
#endif
                    setGlyphsTexture(it.value().glyphs, texture);

                    ++it;
                }
            }
        }

        m_pendingMissingGlyphs.clear();
        m_pendingInvalidatedGlyphs.clear();
        m_pendingReadyGlyphs.clear();
    }
}
コード例 #13
0
ファイル: ImageIO.cpp プロジェクト: karpinsn/SLS
bool ImageIO::saveTexture(const string &filename, Texture &texture)
{
  return saveTexture(filename, &texture);
}