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


Ignore:
Timestamp:
Nov 27, 2019, 6:39:18 PM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
055750a
Parents:
06d959f
Message:

In VulkanGame, add normals to the ship pipeline and get lighting to work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r06d959f re1308e8  
    248248   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::pos));
    249249   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::color));
     250   shipPipeline.addAttribute(VK_FORMAT_R32G32B32_SFLOAT, offset_of(&ShipVertex::normal));
    250251
    251252   createUniformBuffers<UBO_MvpMat>(uniformBuffers_shipPipeline, uniformBuffersMemory_shipPipeline, uniformBufferInfoList_shipPipeline);
     
    254255      VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_shipPipeline);
    255256
    256    shipPipeline.addObject({
     257   // TODO: With the normals, indexing basically becomes pointless since no vertices will have exactly
     258   // the same data. Add an option to make some pipelines not use indexing
     259   shipPipeline.addObject(addVertexNormals<ShipVertex>({
    257260         //back
    258261         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
     
    450453         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
    451454         {{  1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
    452       }, {
     455      }), {
    453456           0,   1,   2,   3,   4,   5,
    454457           6,   7,   8,   9,  10,  11,
Note: See TracChangeset for help on using the changeset viewer.