Merge, adding ship vertical shift

This commit is contained in:
Vladislav Khorev 2026-01-14 12:32:42 +03:00
parent 8d58e41459
commit 4cc6971542
2 changed files with 13 additions and 6 deletions

View File

@ -23,6 +23,8 @@ namespace ZL
static bool g_exitBgAnimating = false;
float x = 0;
Eigen::Quaternionf generateRandomQuaternion(std::mt19937& gen)
{
@ -462,8 +464,8 @@ namespace ZL
renderer.LoadIdentity();
renderer.TranslateMatrix({ 0,0, -1.0f * Environment::zoom });
renderer.TranslateMatrix({ 0, -6.f, 0 }); //Ship camera offset
renderer.TranslateMatrix({ 0, -Environment::zoom * 0.03f, 0 });
if (shipAlive) {
glBindTexture(GL_TEXTURE_2D, spaceshipTexture->getTexID());
renderer.DrawVertexRenderStruct(spaceship);
@ -478,7 +480,10 @@ namespace ZL
}
if (shipAlive) {
renderer.PushMatrix();
renderer.TranslateMatrix({ 0, 0, 16 });
sparkEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height);
renderer.PopMatrix();
projectileEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height);
}
@ -905,10 +910,12 @@ namespace ZL
if (event.key.keysym.sym == SDLK_o)
{
Environment::shipVelocity += 50.f;
//x = x + 2.0;
}
if (event.key.keysym.sym == SDLK_l)
{
Environment::shipVelocity -= 50.f;
//x = x - 2.0;
}
}
#endif

View File

@ -157,8 +157,8 @@ namespace ZL {
renderer.EnableVertexAttribArray(vPositionName);
renderer.EnableVertexAttribArray(vTexCoordName);
float aspectRatio = static_cast<float>(screenWidth) / static_cast<float>(screenHeight);
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5, aspectRatio, Environment::CONST_Z_NEAR, Environment::CONST_Z_FAR);
//float aspectRatio = static_cast<float>(screenWidth) / static_cast<float>(screenHeight);
//renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5, aspectRatio, Environment::CONST_Z_NEAR, Environment::CONST_Z_FAR);
glBindTexture(GL_TEXTURE_2D, texture->getTexID());
@ -166,13 +166,13 @@ namespace ZL {
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
renderer.PushMatrix();
renderer.LoadIdentity();
renderer.TranslateMatrix({ 0, 0, -1.0f * zoom });
//renderer.LoadIdentity();
//renderer.TranslateMatrix({ 0, 0, -1.0f * zoom });
renderer.DrawVertexRenderStruct(sparkQuad);
renderer.PopMatrix();
renderer.PopProjectionMatrix();
//renderer.PopProjectionMatrix();
glDisable(GL_BLEND);