Changeset 60578ce in opengl-game for vulkan-game.hpp


Ignore:
Timestamp:
Dec 18, 2019, 2:48:28 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
a79be34
Parents:
7c929fc
Message:

In VulkanGame, make lighting work correctly in the ship shader with the model, view, and projection matrices all being applied

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.hpp

    r7c929fc r60578ce  
    11#ifndef _VULKAN_GAME_H
    22#define _VULKAN_GAME_H
     3
     4#define GLM_FORCE_RADIANS
     5#define GLM_FORCE_DEPTH_ZERO_TO_ONE // Since, in Vulkan, the depth range is 0 to 1 instead of -1 to 1
     6#define GLM_FORCE_LEFT_HANDED
    37
    48#include <glm/glm.hpp>
     
    5761      const float NEAR_CLIP = 0.1f;
    5862      const float FAR_CLIP = 100.0f;
    59       const float FOV_ANGLE = 67.0f;
     63      const float FOV_ANGLE = 67.0f; // means the camera lens goes from -33 deg to 33 def
    6064
    6165      vec3 cam_pos;
     
    203207      vec3 p3 = vertices[i+2].pos;
    204208
    205       vec3 normal = normalize(cross(p2 - p1, p3 - p1));
    206       //normal.z = -normal.z;
     209      // flip the y axis so that +y points up
     210      vec3 normal = -normalize(cross(p2 - p1, p3 - p1));
    207211
    208212      // Add the same normal for all 3 vertices
Note: See TracChangeset for help on using the changeset viewer.