Jump to content

DDC

Member
  • Posts

    14
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by DDC

  1. 11 hours ago, masodikbela said:

    It is, and its already have clipping inside it, you can control it with the m_renderBox. The values in left, top, right and bottom of that m_renderBox will determine how much space have to be clipped from each side in pixel positions.

    I made a small visual presentation about clipping, more specifically about text clipping, but the theory behind it applys to every kind of texture clipping./cdn-cgi/mirage/e4db53991da469b6fa1052b1a4756dd7bd30d12f98891bc4fbd5449b77b3370a/1280/https://metin2.download/picture/3R234sCALcAFi5iv17gBHni4vZ9dsnHj/.png?width=1437&height=740

    Some additional good read about texture positions and texture rendering: Texture Coordinates, Directly Mapping Texels to Pixels

    Nice tutorial! Thank you for your time! ✌️

  2.  
    void CGraphicWikiRenderTargetTexture::Render() const
    {
    	const float sx = static_cast<float>(m_renderRect.left) - 0.5f + static_cast<float>(m_renderBox.left);
    	const float sy = static_cast<float>(m_renderRect.top) - 0.5f + static_cast<float>(m_renderBox.top);
    	const float ex = static_cast<float>(m_renderRect.left) + (static_cast<float>(m_renderRect.right) - static_cast<float>(m_renderRect.left)) - 0.5f - static_cast<float>(m_renderBox.right);
    	const float ey = static_cast<float>(m_renderRect.top) + (static_cast<float>(m_renderRect.bottom) - static_cast<float>(m_renderRect.top)) - 0.5f - static_cast<float>(m_renderBox.bottom);
    	
    	const float texReverseWidth = 1.0f / (static_cast<float>(m_renderRect.right) - static_cast<float>(m_renderRect.left));
    	const float texReverseHeight = 1.0f / (static_cast<float>(m_renderRect.bottom) - static_cast<float>(m_renderRect.top));
    	
    	const float su = m_renderBox.left * texReverseWidth;
    	const float sv = m_renderBox.top * texReverseHeight;
    	const float eu = ((m_renderRect.right - m_renderRect.left) - m_renderBox.right) * texReverseWidth;
    	const float ev = ((m_renderRect.bottom - m_renderRect.top) - m_renderBox.bottom) * texReverseHeight;
    
    	TPDTVertex pVertices[4];
    	pVertices[0].position = TPosition(sx, sy, 0.0f);
    	pVertices[0].texCoord = TTextureCoordinate(su, sv);
    	pVertices[0].diffuse = 0xffffffff;
    	
    	pVertices[1].position = TPosition(ex, sy, 0.0f);
    	pVertices[1].texCoord = TTextureCoordinate(eu, sv);
    	pVertices[1].diffuse = 0xffffffff;
    	
    	pVertices[2].position = TPosition(sx, ey, 0.0f);
    	pVertices[2].texCoord = TTextureCoordinate(su, ev);
    	pVertices[2].diffuse = 0xffffffff;
    	
    	pVertices[3].position = TPosition(ex, ey, 0.0f);
    	pVertices[3].texCoord = TTextureCoordinate(eu, ev);
    	pVertices[3].diffuse = 0xffffffff;
    	
    	if (SetPDTStream(pVertices, 4))
    	{
    		CGraphicBase::SetDefaultIndexBuffer(CGraphicBase::DEFAULT_IB_FILL_RECT);
    		
    		STATEMANAGER.SetTexture(0, GetD3DRenderTargetTexture());
    		STATEMANAGER.SetTexture(1, NULL);
    		STATEMANAGER.SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_DIFFUSE);
    
    
    		STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 4, 0, 2);
    	}
    }

    I think it's wiki from AE... but only for this part, i just don't understand how to use rect,vertices and StateManager!
    If you're refusing to update, i'll understand!

  3. 41 minutes ago, Valki said:

    @ DDC

    Search for:

    #ifdef ENABLE_EMOJI_SYSTEM
    	if (m_emojiVector.empty() == false)
    	{
    		for(auto& rEmo : m_emojiVector)
    		{
    			if (rEmo.pInstance)
    			{
    				rEmo.pInstance->SetPosition(fStanX + rEmo.x, (fStanY + 7.0) - (rEmo.pInstance->GetHeight() / 2));
    				rEmo.pInstance->Render();
    			}
    		}
    	}
    #endif

    in GrpTextInstance.cpp's ::Render function and change it like that:

    #ifdef ENABLE_EMOJI_SYSTEM
    	if (m_emojiVector.empty() == false)
    	{
    		for(auto& rEmo : m_emojiVector)
    		{
    			if (rEmo.pInstance)
    			{
    				rEmo.pInstance->SetPosition(fStanX + rEmo.x, (fStanY + 7.0) - (rEmo.pInstance->GetHeight() / 2));
    #if defined(__BL_CLIP_MASK__)
    				if (pClipRect)
    					rEmo.pInstance->Render(pClipRect);
    				else
    					rEmo.pInstance->Render();
    #else
    				rEmo.pInstance->Render();
    #endif
    			}
    		}
    	}
    #endif

     

    Thank you! 

    • Love 1
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.