Changeset 1f81ecc in opengl-game for vulkan-game.hpp


Ignore:
Timestamp:
Apr 19, 2020, 3:06:51 AM (4 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
3950236
Parents:
237cbec
Message:

Add the ability for the ship to fire a laser from either of its wings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.hpp

    r237cbec r1f81ecc  
    233233      float spawnRate_asteroid = 0.5;
    234234      float lastSpawn_asteroid;
     235
     236      unsigned int leftLaserIdx = -1;
     237
     238      unsigned int rightLaserIdx = -1;
    235239
    236240      bool initWindow(int width, int height, unsigned char guiFlags);
     
    265269      void createSyncObjects();
    266270
     271      void addLaser(vec3 start, vec3 end, vec3 color, float width);
     272      void translateLaser(size_t index, const vec3& translation);
     273
    267274      // TODO: Since addObject() returns a reference to the new object now,
    268275      // stop using objects.back() to access the object that was just created
     
    277284      void updateObject(vector<SceneObject<VertexType, SSBOType>>& objects,
    278285            GraphicsPipeline_Vulkan<VertexType, SSBOType>& pipeline, size_t index);
     286
     287      template<class VertexType, class SSBOType>
     288      void updateObjectVertices(GraphicsPipeline_Vulkan<VertexType, SSBOType>& pipeline,
     289            SceneObject<VertexType, SSBOType>& obj, size_t index);
    279290
    280291      template<class VertexType>
     
    327338
    328339   SceneObject<VertexType, SSBOType>& obj = objects.back();
    329    centerObject(obj);
     340
     341   if (!is_same_v<VertexType, LaserVertex>) {
     342      centerObject(obj);
     343   }
    330344
    331345   bool storageBufferResized = pipeline.addObject(obj.vertices, obj.indices, obj.ssbo,
     
    366380}
    367381
     382template<class VertexType, class SSBOType>
     383void VulkanGame::updateObjectVertices(GraphicsPipeline_Vulkan<VertexType, SSBOType>& pipeline,
     384      SceneObject<VertexType, SSBOType>& obj, size_t index) {
     385   pipeline.updateObjectVertices(index, obj.vertices, this->commandPool, this->graphicsQueue);
     386}
     387
    368388template<class VertexType>
    369389vector<VertexType> VulkanGame::addVertexNormals(vector<VertexType> vertices) {
Note: See TracChangeset for help on using the changeset viewer.