Changeset cf727ca in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Dec 5, 2019, 5:45:47 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
2b40f48
Parents:
055750a
Message:

In VulkanGame, add an objectIndex vertex attribute to the ship shader so it can be used as an index into the ssbo object array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r055750a rcf727ca  
    255255   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::color));
    256256   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::normal));
     257   shipPipeline.addAttribute(VK_FORMAT_R32_UINT, offset_of(&ShipVertex::objIndex));
    257258
    258259   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
     
    268269   // TODO: With the normals, indexing basically becomes pointless since no vertices will have exactly
    269270   // the same data. Add an option to make some pipelines not use indexing
    270    shipPipeline.addObject(addVertexNormals<ShipVertex>({
     271   shipPipeline.addObject(
     272      addObjectIndex<ShipVertex>(shipPipeline.getObjects().size(),
     273      addVertexNormals<ShipVertex>({
    271274         //back
    272275         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
     
    464467         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
    465468         {{  1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
    466       }), {
     469      })), {
    467470           0,   1,   2,   3,   4,   5,
    468471           6,   7,   8,   9,  10,  11,
Note: See TracChangeset for help on using the changeset viewer.