This commit is contained in:
2026-02-20 19:35:09 +02:00
parent 3ed689f801
commit c00ecf4081
35 changed files with 576 additions and 99 deletions

View File

@@ -12,7 +12,7 @@ public:
virtual void Think( float fDelta );
IMesh *m_pMesh;
IMeshInstance *m_pMeshInstance;
IMeshInstance *m_pMeshInstances[10];
};
void C_MOBAPlayer::Precache()
@@ -21,7 +21,6 @@ void C_MOBAPlayer::Precache()
IBuffer *pDataBuffer;
IShader *pShader;
IMaterial *pMaterial;
g_pWorldRenderer->Init();
pShader = g_pRenderContext->CreateShader("game/core/shaders/mesh_raster.shader_c");
IFileHandle *pHandle = filesystem->Open("game/core/meshes/spot.fmesh_c", FILEMODE_READ);
@@ -47,10 +46,13 @@ void C_MOBAPlayer::Precache()
m_pMesh->SetVertices(pBuffer);
m_pMesh->SetMaterial(pMaterial);
m_pMeshInstance = g_pWorldRenderer->CreateInstance(m_pMesh);
m_pMeshInstance->SetScale({5, 5, 5});
m_pMeshInstance->SetPosition({0,0,0});
m_pMeshInstance->SetRotation({1,0,0,0});
for (int i = 0; i < 10; i++)
{
m_pMeshInstances[i] = g_pWorldRenderer->CreateInstance(m_pMesh);
m_pMeshInstances[i]->SetScale({1, 1, 1});
m_pMeshInstances[i]->SetPosition({(float)i,0,0});
m_pMeshInstances[i]->SetRotation({1,0,0,0});
}
}
@@ -62,10 +64,13 @@ void C_MOBAPlayer::Spawn()
void C_MOBAPlayer::Think( float fDelta )
{
m_pMeshInstance->SetPosition({0,0,-(float)g_pEngineVars->m_fTime});
versor v;
glm_euler_zxy_quat((vec3){(float)g_pEngineVars->m_fTime,0,0}, v);
m_pMeshInstance->SetRotation({v[0], v[1], v[2], v[3]});
for (int i = 0; i < 10; i++)
{
m_pMeshInstances[i]->SetPosition({(float)i, 0 ,-(float)g_pEngineVars->m_fTime});
versor v;
glm_euler_zxy_quat((vec3){(float)g_pEngineVars->m_fTime,0,0}, v);
m_pMeshInstances[i]->SetRotation({v[0], v[1], v[2], v[3]});
}
};
LINK_ENTITY_TO_CLASS(player, C_MOBAPlayer)