mouse controls, fixed texture loading

This commit is contained in:
2026-04-27 22:33:40 +03:00
parent cbcfdce047
commit 9569555347
31 changed files with 112 additions and 40 deletions

View File

@@ -223,7 +223,6 @@ void CAssetManager::LoadMaterialData( CBaseMaterial *pMaterial, IJSONObject *pOb
if ( pValue->GetArray()->GetParameter(3)->GetType()
== JSON_PARAMETER_NUMBER )
data->w = pValue->GetArray()->GetParameter(3)->GetNumberValue();
V_printf("%s %f %f %f %f\n", desc.m_szEditorName, data->x, data->y, data->z, data->w);
break;
}
default:

View File

@@ -11,7 +11,6 @@ public:
virtual void SetUpMesh( MaterialData_t *pData ) override {
pData->m_vAlbedoColor = m_vAlbedo;
pData->m_uAlbedo = m_tAlbedo;
V_printf("SetUpMesh %f\n", pData->m_vAlbedoColor.x);
};

View File

@@ -30,6 +30,9 @@ void C_MOBAPlayer::Think( float fDelta )
vCameraPos.z = 20;
vCameraPos.y+=3;
g_pWorldRenderer->SetCameraPosition(vCameraPos);
Quat vCameraRot;
glm_euler_yxz_quat((vec3){m_fPitch, m_fYaw, 0}, *(versor*)&vCameraRot);
g_pWorldRenderer->SetCameraRotation(vCameraRot);
}
BaseClass::Think(fDelta);
};
@@ -127,3 +130,35 @@ static void IN_LeftUp( int c, char **v ) {
((C_MOBAPlayer*)pPlayer)->m_bIsLeft = false;
}
static ConCommand endleft("-left", IN_LeftUp);
void Game_OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue )
{
}
static ConVar m_pitch("m_pitch", "0.022", FCVAR_CLIENTDLL);
static ConVar m_yaw("m_yaw", "0.022", FCVAR_CLIENTDLL);
static ConVar sens("sens", "3", FCVAR_CLIENTDLL);
void Game_OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue )
{
C_BaseEntity *pPlayer = UTIL_GetLocalPlayer();
if (!pPlayer)
return;
if (!dynamic_cast<C_MOBAPlayer*>(pPlayer))
return;
switch(eAxis)
{
case k_EInputAxis_MouseY:
((C_MOBAPlayer*)pPlayer)->m_fPitch -= glm_rad(fValue * m_pitch.GetFloat() * sens.GetFloat());
break;
case k_EInputAxis_MouseX:
((C_MOBAPlayer*)pPlayer)->m_fYaw -= glm_rad(fValue * m_yaw.GetFloat() * sens.GetFloat());
break;
default:
break;
}
}

View File

@@ -24,6 +24,9 @@ public:
float m_fFBWalkingDirection;
float m_fLRWalkingDirection;
float m_fPitch= 0;
float m_fYaw = 0;
Vector m_vMovementVector;
Vector m_vLocalMovementVector;
Vector vCameraPos;

View File

@@ -1,6 +1,7 @@
#include "userinput.h"
#include "tier1/utlstring.h"
#include "game.h"
#include "baseentity.h"
class CFunnyInput: public IHumanDeviceInput
{
@@ -48,12 +49,20 @@ void CFunnyInput::OnGameButton( EInputDeviceType eDevice, EInputButton eScancode
}
}
void Game_OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue );
void Game_OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue );
void CFunnyInput::OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue)
{
Game_OnGameAxis(eDevice, eAxis, fValue);
}
void CFunnyInput::OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue )
{
Game_OnGameAxisDiff(eDevice, eAxis, fValue);
}

View File

@@ -241,6 +241,7 @@ void CFunnyWorldRenderer::Frame( float fDelta )
glm_mat4_identity(matCamera);
glm_mat4_identity(matCamera2);
glm_translate(matCamera2, m_vPos);
glm_quat_rotate(matCamera2, m_vRot, matCamera2);
glm_mat4_inv(matCamera2, matCamera2);
glm_perspective(glm_rad(75), uWidth/(float)uHeight, 0.01, 10000, matCamera);
glm_mul(matCamera, matCamera2, matCamera);