Changeset cd1cb0f in opengl-game for graphics-pipeline_vulkan.hpp


Ignore:
Timestamp:
Dec 24, 2019, 12:48:49 AM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
0fe8433
Parents:
a79be34
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (12/22/19 03:45:12)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (12/24/19 00:48:49)
Message:

In VulkanGame, make the ship move when the player holds down the right or left arrow keys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graphics-pipeline_vulkan.hpp

    ra79be34 rcd1cb0f  
    1010#include <vulkan/vulkan.h>
    1111
     12#define GLM_FORCE_RADIANS
     13#define GLM_FORCE_DEPTH_ZERO_TO_ONE // Since, in Vulkan, the depth range is 0 to 1 instead of -1 to 1
     14#define GLM_FORCE_RIGHT_HANDED
     15
     16#include <glm/glm.hpp>
     17#include <glm/gtc/matrix_transform.hpp>
     18
    1219#include "vulkan-utils.hpp"
     20
     21using namespace glm;
    1322
    1423// TODO: Maybe change the name of this struct so I can call the list something other than descriptorInfoList
     
    2837   vector<VertexType> vertices;
    2938   vector<uint16_t> indices;
     39
     40   mat4 model_base;
     41   mat4 model_transform;
    3042};
    3143
     
    5466      void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage);
    5567
    56       const vector<SceneObject<VertexType>>& getObjects();
     68      vector<SceneObject<VertexType>>& getObjects();
    5769      void addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, VkCommandPool commandPool,
    5870         VkQueue graphicsQueue);
     
    88100      VkDeviceMemory indexBufferMemory;
    89101
    90       // TODO: THe objects vector isn't used at all in this class, except in the method that returns
     102      // TODO: The objects vector isn't used at all in this class, except in the method that returns
    91103      // the number of objects. Move this vector and the SceneObject declaration into VulkanGame, esp.
    92       // since I'll be adding other // object-specific fields sich as transforms to SceneObject later
     104      // since I'll be adding other object-specific fields such as transforms to SceneObject later
    93105      vector<SceneObject<VertexType>> objects;
    94106
     
    410422
    411423template<class VertexType>
    412 const vector<SceneObject<VertexType>>& GraphicsPipeline_Vulkan<VertexType>::getObjects() {
     424vector<SceneObject<VertexType>>& GraphicsPipeline_Vulkan<VertexType>::getObjects() {
    413425   return objects;
    414426}
     
    428440      idx += numVertices;
    429441   }
    430    objects.push_back({ vertices, indices });
     442   objects.push_back({ vertices, indices, mat4(1.0f), mat4(1.0f) });
    431443
    432444   VulkanUtils::copyDataToBuffer(device, physicalDevice, commandPool, vertices, vertexBuffer, numVertices,
Note: See TracChangeset for help on using the changeset viewer.