Changes in / [2b40f48:785333b] in opengl-game


Ignore:
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • graphics-pipeline_vulkan.hpp

    r2b40f48 r785333b  
    8888      VkDeviceMemory indexBufferMemory;
    8989
    90       // TODO: THe objects vector isn't used at all in this class, except in the method that returns
    91       // 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
    9390      vector<SceneObject<VertexType>> objects;
    9491
  • shaders/ship.vert

    r2b40f48 r785333b  
    1818layout(location = 1) in vec3 vertex_color;
    1919layout(location = 2) in vec3 vertex_normal;
    20 layout(location = 3) in uint obj_index;
     20//layout(location = 3) in uint ubo_index;
    2121
    2222layout(location = 0) out vec3 position_eye;
     
    3333// Check Anton's book to see how to fix this
    3434void main() {
    35    position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0));
     35   position_eye = vec3(ubo.view * sbo.objects[0].model * vec4(vertex_position, 1.0));
     36   //position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0));
    3637
    3738   // Using 0.0 instead of 1.0 means translations won't effect the normal
    38    normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));
     39   normal_eye = normalize(vec3(ubo.view * sbo.objects[0].model * vec4(vertex_normal, 0.0)));
     40   //normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0)));
    3941   color = vertex_color;
    4042   light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));
  • vulkan-game.cpp

    r2b40f48 r785333b  
    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));
    258257
    259258   createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
     
    270269   // the same data. Add an option to make some pipelines not use indexing
    271270   /*
    272    shipPipeline.addObject(
    273       addObjectIndex<ShipVertex>(shipPipeline.getObjects().size(),
    274       addVertexNormals<ShipVertex>({
     271   shipPipeline.addObject(addVertexNormals<ShipVertex>({
    275272         //back
    276273         {{ -0.5f,   0.3f,   0.0f}, {0.0f, 0.0f, 0.3f}},
     
    468465         {{  1.5f,   0.0f,   0.0f}, {0.0f, 0.0f, 0.3f}},
    469466         {{  1.3f,   0.0f,  -0.3f}, {0.0f, 0.0f, 0.3f}},
    470       })), {
     467      }), {
    471468           0,   1,   2,   3,   4,   5,
    472469           6,   7,   8,   9,  10,  11,
  • vulkan-game.hpp

    r2b40f48 r785333b  
    3333   vec3 color;
    3434   vec3 normal;
    35    unsigned int objIndex;
    3635};
    3736
     
    179178      vector<VertexType> addVertexNormals(vector<VertexType> vertices);
    180179
    181       template<class VertexType>
    182       vector<VertexType> addObjectIndex(unsigned int objIndex, vector<VertexType> vertices);
    183 
    184180      void createBufferSet(VkDeviceSize bufferSize, VkBufferUsageFlags flags,
    185181         vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory, vector<VkDescriptorBufferInfo>& bufferInfoList);
     
    215211}
    216212
    217 template<class VertexType>
    218 vector<VertexType> VulkanGame::addObjectIndex(unsigned int objIndex, vector<VertexType> vertices) {
    219    for (VertexType& vertex : vertices) {
    220       vertex.objIndex = objIndex;
    221    }
    222 
    223    return vertices;
    224 }
    225 
    226213#endif // _VULKAN_GAME_H
Note: See TracChangeset for help on using the changeset viewer.