Sped up application load time by Enginestatistics allocation from heap to stack, Colour and rotation render test
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#include "BarinkEngine.h"
|
||||
|
||||
EngineStatistics* ES;
|
||||
EngineStatistics ES;
|
||||
BarinkEngine::Renderer renderer;
|
||||
int main(int argc, char* argv[]) {
|
||||
// Setup performance sampler
|
||||
@ -12,6 +12,8 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
renderer = BarinkEngine::Renderer();
|
||||
InputSystem = BarinkEngine::InputManager();
|
||||
ES = EngineStatistics();
|
||||
|
||||
|
||||
InputSystem.attach(&MainWindow);
|
||||
|
||||
@ -55,7 +57,6 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
|
||||
// Shutdown Services
|
||||
delete ES;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,12 +18,14 @@ BarinkEngine::Renderer::~Renderer()
|
||||
// glDeleteBuffers(1, &UV_id);
|
||||
}
|
||||
|
||||
float Angle = 0.0;
|
||||
|
||||
void BarinkEngine::Renderer::Render()
|
||||
{
|
||||
// This creation of the projection and camera is somewhat wastefull
|
||||
Camera cam = Camera(glm::vec3(8.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), 90.0f);
|
||||
Camera cam = Camera(glm::vec3(16.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), 90.0f);
|
||||
glm::mat4 projection = glm::perspective(glm::radians(cam.Zoom), (800.0f / 600.0f), 0.001f, 100.0f);
|
||||
|
||||
Angle += 0.0001f;
|
||||
|
||||
for (auto model : models) {
|
||||
// Push matrices etc ....
|
||||
@ -40,15 +42,17 @@ void BarinkEngine::Renderer::Render()
|
||||
model->material->Apply();
|
||||
|
||||
model->material->shader.setUniformVec3("Color", model->material->Color);
|
||||
model->material->shader.setUniformMat4("M", glm::mat4());
|
||||
|
||||
|
||||
model->material->shader.setUniformMat4("M", glm::rotate(glm::mat4(), Angle, glm::vec3(0.5f, 0.5f, 0.0f)));
|
||||
model->material->shader.setUniformMat4("V", cam.GetViewMatrix());
|
||||
model->material->shader.setUniformMat4("P", projection);
|
||||
|
||||
}
|
||||
|
||||
// Update perf counters
|
||||
ES->verts = model->mesh->vertices.size();
|
||||
ES->DC++;
|
||||
ES.verts = model->mesh->vertices.size();
|
||||
ES.DC++;
|
||||
|
||||
glDrawElements(GL_TRIANGLES,
|
||||
static_cast<unsigned int>(model->mesh->elements.size()),
|
||||
|
@ -7,5 +7,5 @@ uniform sampler2D Texture;
|
||||
|
||||
|
||||
void main(){
|
||||
FragColor = mix ( texture(Texture, TexCoord), vec4(Color, 1.0f), 0.5f);
|
||||
FragColor = vec4(1.0f, 0.0f, 0.0f , 1.0f); // mix ( texture(Texture, TexCoord), vec4(Color, 1.0f), 1.0f);
|
||||
}
|
Reference in New Issue
Block a user