Changeset 683dd55 in opengl-game


Ignore:
Timestamp:
Nov 22, 2019, 4:47:52 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
8e02b6b
Parents:
1908591
Message:

Add a getObjects() method to the GraphicsPipeline_Vulkan class that returns a reference to the list of objects added to the pipeline, and use that method instead of the numPlanes variable to keep track of the number of textured planes. Also, update the shader compilation batch file and add header files as dependencies to the vulkangame target in the makefile.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • compile.bat

    r1908591 r683dd55  
    11echo off
    22setlocal enabledelayedexpansion
     3
     4cd shaders
    35
    46set VULKAN_SDK_PATH=D:\VulkanSDK\1.1.108.0
     
    1012   %VULKAN_SDK_PATH%\Bin\glslangValidator.exe -V %%f -o %%~nf-!ext!.spv
    1113)
     14
     15cd ..
  • graphics-pipeline_vulkan.hpp

    r1908591 r683dd55  
    5656      void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage);
    5757
     58      const vector<SceneObject<VertexType>>& getObjects();
    5859      bool addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, VkCommandPool commandPool,
    5960         VkQueue graphicsQueue);
     
    104105}
    105106
     107// TODO: Verify that vertex capacity and index capacity are both > 0
    106108template<class VertexType>
    107109GraphicsPipeline_Vulkan<VertexType>::GraphicsPipeline_Vulkan(VkPhysicalDevice physicalDevice, VkDevice device,
     
    406408
    407409template<class VertexType>
     410const vector<SceneObject<VertexType>>& GraphicsPipeline_Vulkan<VertexType>::getObjects() {
     411   return objects;
     412}
     413
     414template<class VertexType>
    408415bool GraphicsPipeline_Vulkan<VertexType>::addObject(const vector<VertexType>& vertices, vector<uint16_t> indices,
    409416      VkCommandPool commandPool, VkQueue graphicsQueue) {
  • makefile

    r1908591 r683dd55  
    5959        $(CC) $(CXX_FLAGS) -o $@ $^ $(LIB_FLAGS) -DGAMEGUI_INCLUDE_VULKAN
    6060
    61 vulkangame: main-vulkan.cpp vulkan-game.cpp crash-logger.cpp logger.cpp vulkan-utils.cpp game-gui-sdl.cpp
    62         $(CC) $(CXX_FLAGS) -o $@ $^ $(LIB_FLAGS) -DGAMEGUI_INCLUDE_VULKAN
     61SRC_FILES = main-vulkan.cpp vulkan-game.cpp crash-logger.cpp logger.cpp vulkan-utils.cpp game-gui-sdl.cpp
     62HEADER_FILES = vulkan-game.hpp crash-logger.hpp logger.hpp vulkan-utils.hpp game-gui-sdl.hpp game-gui.hpp graphics-pipeline_vulkan.hpp
     63
     64vulkangame: $(SRC_FILES) $(HEADER_FILES)
     65        $(CC) $(CXX_FLAGS) -o $@ $(SRC_FILES) $(LIB_FLAGS) -DGAMEGUI_INCLUDE_VULKAN
    6366
    6467.PHONY: shaders
  • vulkan-game.cpp

    r1908591 r683dd55  
    248248   cout << "Created all the graphics pipelines" << endl;
    249249
    250    numPlanes = 2;
    251 
    252250   createCommandBuffers();
    253251
     
    255253}
    256254
     255// TODO: Maybe changes the name to initScene() or something similar
    257256void VulkanGame::initMatrices() {
    258257   cam_pos = vec3(0.0f, 0.0f, 2.0f);
     
    299298               } else if (e.key.keycode == SDL_SCANCODE_SPACE) {
    300299                  cout << "Adding a plane" << endl;
    301                   float zOffset = -2.0f + (0.5f * numPlanes);
     300                  float zOffset = -2.0f + (0.5f * modelPipeline.getObjects().size());
    302301
    303302                  vkDeviceWaitIdle(device);
     
    314313
    315314                  createCommandBuffers();
    316 
    317                   numPlanes++;
    318315               } else {
    319316                  cout << "Key event detected" << endl;
  • vulkan-game.hpp

    r1908591 r683dd55  
    113113
    114114      size_t currentFrame;
    115       size_t numPlanes = 0; // temp
    116115
    117116      bool framebufferResized;
Note: See TracChangeset for help on using the changeset viewer.