Fixing minor stuff, refactoring
This commit is contained in:
1 parent
3c2c06ca40
commit
a06cb77a66
7 files changed
+15
-102
No files matched your search
+5
-28
@@ -25,6 +25,8 @@
|
||||
#include "network/LocalClient.h"
|
||||
#endif
|
||||
|
||||
#include "GameConstants.h"
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
|
||||
@@ -418,12 +420,10 @@ namespace ZL
|
||||
|
||||
void Space::drawCubemap(float skyPercent)
|
||||
{
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string envShaderName = "env_sky";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
static const std::string envSkyShaderName = "env_sky";
|
||||
static const std::string skyPercentUniformName = "skyPercent";
|
||||
|
||||
renderer.shaderManager.PushShader(envShaderName);
|
||||
renderer.shaderManager.PushShader(envSkyShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
renderer.RenderUniform1f(skyPercentUniformName, skyPercent);
|
||||
|
||||
@@ -480,10 +480,6 @@ namespace ZL
|
||||
|
||||
void Space::drawShip()
|
||||
{
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string envShaderName = "env";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
|
||||
@@ -511,7 +507,7 @@ namespace ZL
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
renderer.shaderManager.PushShader("default");
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
@@ -522,7 +518,6 @@ namespace ZL
|
||||
renderer.TranslateMatrix(-Environment::shipState.position);
|
||||
for (const auto& p : projectiles) {
|
||||
if (p && p->isActive()) {
|
||||
//p->draw(renderer);
|
||||
p->projectileEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height);
|
||||
}
|
||||
}
|
||||
@@ -531,8 +526,6 @@ namespace ZL
|
||||
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
//projectileEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height);
|
||||
|
||||
if (shipAlive) {
|
||||
renderer.PushMatrix();
|
||||
renderer.TranslateMatrix({ 0, 0, 16 });
|
||||
@@ -550,9 +543,6 @@ namespace ZL
|
||||
explosionEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height, false);
|
||||
}
|
||||
|
||||
//glBindTexture(GL_TEXTURE_2D, basePlatformTexture->getTexID());
|
||||
//renderer.DrawVertexRenderStruct(basePlatform);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
@@ -562,10 +552,6 @@ namespace ZL
|
||||
|
||||
void Space::drawBoxes()
|
||||
{
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string envShaderName = "env";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5,
|
||||
@@ -586,7 +572,6 @@ namespace ZL
|
||||
renderer.RotateMatrix(boxCoordsArr[i].m);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, boxTexture->getTexID());
|
||||
//glBindTexture(GL_TEXTURE_2D, rockTexture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(boxRenderArr[i]);
|
||||
|
||||
renderer.PopMatrix();
|
||||
@@ -597,10 +582,6 @@ namespace ZL
|
||||
}
|
||||
|
||||
void Space::drawScene() {
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string envShaderName = "env";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
@@ -643,9 +624,6 @@ namespace ZL
|
||||
}
|
||||
|
||||
void Space::drawRemoteShips() {
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
|
||||
@@ -689,7 +667,6 @@ namespace ZL
|
||||
renderer.LoadIdentity();
|
||||
|
||||
renderer.TranslateMatrix({ 0,0, -1.0f * Environment::zoom });
|
||||
//renderer.TranslateMatrix({ 0, -6.f, 0 }); //Ship camera offset
|
||||
renderer.RotateMatrix(Environment::inverseShipMatrix);
|
||||
renderer.TranslateMatrix(-Environment::shipState.position);
|
||||
|
||||
|
||||
Reference in new issue
Block a user