Membru Ucenic
Membru Ucenic
Mesaje: 48
Membru din: 10 Mai 2026, 14:20
  • Reacții: 87
  • Mesaje utile: 0
  • Status: Pierd vremea ^.^
  • Regat: Shinsoo
  • Medalii

    [C++] directxmath marty 5.9 - Mesaj 1 - Imagine 1

    In summary, switching to DirectXMath in a game utilizing DX9Ex (such as in Metin2 infrastructures) does not directly turn the game into DirectX 11 or 12 (graphical rendering still operates via DX9Ex); however, it offloads the background mathematical processing burden from the CPU to provide hardware-accelerated performance and enables seamless compilation on modern compilers without errors.


    actorisntnacesync.cpp

    Code:
    #include "StdAfx.h"
    #include "ActorInstance.h"
    #include "RaceData.h"
    #include <DirectXMath.h> // DirectXMath kütüphanesi
    
    void CActorInstance::__Push(int x, int y)
    {
    	const TPixelPosition& c_rv3Src = GetPosition();
    
    	// TPixelPosition verisini DirectXMath vektör yazmacına yüklüyoruz
    	DirectX::XMVECTOR vSrc = DirectX::XMLoadFloat3(reinterpret_cast<const DirectX::XMFLOAT3*>(&c_rv3Src));
    	DirectX::XMVECTOR vDst = DirectX::XMVectorSet(static_cast<float>(x), static_cast<float>(-y), c_rv3Src.z, 0.0f);
    	DirectX::XMVECTOR vDelta = DirectX::XMVectorSubtract(vDst, vSrc);
    
    	constexpr float LoopValue = 100.0f;
    	DirectX::XMVECTOR vInc = DirectX::XMVectorScale(vDelta, 1.0f / LoopValue);
    	DirectX::XMVECTOR vMovement = DirectX::XMVectorZero();
    
    	IPhysicsWorld* pWorld = IPhysicsWorld::GetPhysicsWorld();
    	if (!pWorld)
    		return;
    
    	for (int i = 0; i < static_cast<int>(LoopValue); ++i)
    	{
    		DirectX::XMVECTOR vCheckPos = DirectX::XMVectorAdd(vSrc, vMovement);
    
    		// Fizik motorunun kabul etmesi için vektörü TPixelPosition formatına geri aktarıyoruz
    		TPixelPosition checkPos;
    		DirectX::XMStoreFloat3(reinterpret_cast<DirectX::XMFLOAT3*>(&checkPos), vCheckPos);
    
    		if (pWorld->isPhysicalCollision(checkPos))
    		{
    			ResetBlendingPosition();
    			return;
    		}
    		vMovement = DirectX::XMVectorAdd(vMovement, vInc);
    	}
    
    	TPixelPosition dstPos;
    	DirectX::XMStoreFloat3(reinterpret_cast<DirectX::XMFLOAT3*>(&dstPos), vDst);
    	SetBlendingPosition(dstPos);
    
    	if (IsResistFallen()) // @fixme033 check moved here
    		return;
    
    	if (!IsUsingSkill())
    	{
    		// Karekök hesaplaması yerine DirectXMath optimize 2D uzunluk fonksiyonu
    		DirectX::XMVECTOR vLength2D = DirectX::XMVector2Length(vDelta);
    		const float len = DirectX::XMVectorGetX(vLength2D);
    
    		if (len > 150.0f)
    		{
    			InterceptOnceMotion(CRaceMotionData::NAME_DAMAGE_FLYING);
    			PushOnceMotion(CRaceMotionData::NAME_STAND_UP);
    		}
    	}
    }
    
    void CActorInstance::TEMP_Push(int x, int y)
    {
    	__Push(x, y);
    }
    
    bool CActorInstance::__IsSyncing()
    {
    	if (IsDead())
    		return TRUE;
    
    	if (IsStun())
    		return TRUE;
    
    	if (IsPushing())
    		return TRUE;
    
    	return FALSE;
    }
    
    bool CActorInstance::IsPushing()
    {
    	return m_PhysicsObject.isBlending();
    }

    Nou Cum descarc de pe TeraBox?

    Afișează detalii Ascunde detalii
    • Este asemănător cu Mega.nz
    • Instalați-vă clientul lor de Download de aici
    • Faceți-vă un cont (vă puteți loga cu Facebook / Google / etc)
    • Nou Dacă nu vreți să descărcați clientul de Download, folosiți acest site
    • Gata! Acum puteți descărca resursele rapid & simplu.

    De ce folosim TeraBox?

    • Este gratuit
    • Primești 1TB de spațiu gratuit la orice cont creat!
    • Este ușor de folosit și varianta premium este foarte ieftină
    • Fișierele nu sunt șterse niciodată
    TeraBox logo

    Creează-ți un cont sau autentifică-te pentru a participa la discuție

    Trebuie să fii membru pentru a răspunde

    Creează-ți un cont

    Membrii pot crea subiecte noi și pot descărca resurse Metin2 Gratuit!


    Te poți înregistra sau conecta rapid utilizând contul tău de Discord, Github sau Google.

    Înregistrare

    Autentifică-te

    Înapoi la “Îmbunătățiri”

    Informații

    Utilizatori ce navighează pe acest forum: gabita0045, Google [Bot], jaxkc, Oregon și 3 vizitatori

    Discord ID copiat: