Changeset 60578ce in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Dec 18, 2019, 2:48:28 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
a79be34
Parents:
7c929fc
Message:

In VulkanGame, make lighting work correctly in the ship shader with the model, view, and projection matrices all being applied

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r7c929fc r60578ce  
    11#include "vulkan-game.hpp"
    2 
    3 #define GLM_FORCE_RADIANS
    4 #define GLM_FORCE_DEPTH_ZERO_TO_ONE
    52
    63#include <array>
     
    6259
    6360   initVulkan();
    64    initMatrices();
    6561   mainLoop();
    6662   cleanup();
     
    186182   createImageResources();
    187183   createFramebuffers();
     184
     185   initMatrices();
    188186
    189187   // TODO: Figure out how much of ubo creation and associated variables should be in the pipeline class
     
    505503      addObjectIndex<ShipVertex>(shipPipeline.getObjects().size(),
    506504      addVertexNormals<ShipVertex>({
    507          {{  0.5f,  -0.5f,   0.5f}, {0.0f, 0.6f, 0.0f}},
    508          {{ -0.5f,  -0.5f,   0.5f}, {0.0f, 0.6f, 0.0f}},
    509          {{ -0.5f,   0.5f,   0.5f}, {0.0f, 0.6f, 0.0f}},
    510          {{  0.5f,  -0.5f,   0.5f}, {0.0f, 0.6f, 0.0f}},
    511          {{ -0.5f,   0.5f,   0.5f}, {0.0f, 0.6f, 0.0f}},
    512          {{  0.5f,   0.5f,   0.5f}, {0.0f, 0.6f, 0.0f}},
    513 
    514          {{  0.3f,  -0.3f,   0.3f}, {0.0f, 0.0f, 0.7f}},
    515          {{ -0.3f,  -0.3f,   0.3f}, {0.0f, 0.0f, 0.7f}},
    516          {{ -0.3f,   0.3f,   0.3f}, {0.0f, 0.0f, 0.7f}},
    517          {{  0.3f,  -0.3f,   0.3f}, {0.0f, 0.0f, 0.7f}},
    518          {{ -0.3f,   0.3f,   0.3f}, {0.0f, 0.0f, 0.7f}},
    519          {{  0.3f,   0.3f,   0.3f}, {0.0f, 0.0f, 0.7f}},
     505         {{  40.0f,   40.0f,  72.0f}, {0.0f, 0.6f, 0.0f}},
     506         {{ -40.0f,   40.0f,  80.0f}, {0.0f, 0.6f, 0.0f}},
     507         {{ -40.0f,  -40.0f,  80.0f}, {0.0f, 0.6f, 0.0f}},
     508         {{  40.0f,   40.0f,  72.0f}, {0.0f, 0.6f, 0.0f}},
     509         {{ -40.0f,  -40.0f,  80.0f}, {0.0f, 0.6f, 0.0f}},
     510         {{  40.0f,  -40.0f,  72.0f}, {0.0f, 0.6f, 0.0f}},
     511
     512         {{   8.0f,    8.0f,  34.0f}, {0.0f, 0.0f, 0.7f}},
     513         {{  -8.0f,    8.0f,  30.0f}, {0.0f, 0.0f, 0.7f}},
     514         {{  -8.0f,   -8.0f,  30.0f}, {0.0f, 0.0f, 0.7f}},
     515         {{   8.0f,    8.0f,  34.0f}, {0.0f, 0.0f, 0.7f}},
     516         {{  -8.0f,   -8.0f,  30.0f}, {0.0f, 0.0f, 0.7f}},
     517         {{   8.0f,   -8.0f,  34.0f}, {0.0f, 0.0f, 0.7f}},
    520518      })), {
    521519         0,   1,   2,   3,   4,   5,
     
    551549
    552550   float cam_yaw = 0.0f;
    553    float cam_pitch = -50.0f;
     551   float cam_pitch = 0.0f; // -50.0f;
    554552
    555553   mat4 yaw_mat = rotate(mat4(1.0f), radians(-cam_yaw), vec3(0.0f, 1.0f, 0.0f));
Note: See TracChangeset for help on using the changeset viewer.