Use new @include preprocessor added to CyberarmEngin::Shader

This commit is contained in:
2020-01-28 10:48:47 -06:00
parent e7b84bd123
commit c25df59819
7 changed files with 23 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
GIT GIT
remote: https://github.com/cyberarm/cyberarm_engine remote: https://github.com/cyberarm/cyberarm_engine
revision: e59771e4127f51e3c6b3aa239dd2a5f8d2a4b7fe revision: 9a3caabc7e36f572ef458dc473edd2961dad8f40
specs: specs:
cyberarm_engine (0.12.1) cyberarm_engine (0.12.1)
gosu (~> 0.14.0) gosu (~> 0.14.0)

View File

@@ -56,8 +56,7 @@ class IMICFPS
ModelLoader.new(manifest: hash[:manifest], entity: @dummy_entity) ModelLoader.new(manifest: hash[:manifest], entity: @dummy_entity)
when :shader when :shader
if $debug.get(:use_shaders) if $debug.get(:use_shaders)
shader = Shader.new(name: hash[:name], vertex: "shaders/vertex/#{hash[:name]}.glsl", fragment: "shaders/fragment/#{hash[:name]}.glsl") shader = Shader.new(name: hash[:name], includes_dir: "shaders/include", vertex: "shaders/vertex/#{hash[:name]}.glsl", fragment: "shaders/fragment/#{hash[:name]}.glsl")
Shader.add(hash[:name], shader) if shader.compiled?
else else
warn "Skipping shader: #{hash[:name]}..." warn "Skipping shader: #{hash[:name]}..."
end end

View File

@@ -4,7 +4,7 @@ class IMICFPS
attr_reader :camera attr_reader :camera
attr_reader :console, :delta_time attr_reader :console, :delta_time
def initialize(window_width = 1280, window_height = 800, fullscreen = false) def initialize(window_width = 1280, window_height = 720, fullscreen = false)
fps_target = (ARGV.first.to_i != 0) ? ARGV.first.to_i : 60 fps_target = (ARGV.first.to_i != 0) ? ARGV.first.to_i : 60
if ARGV.join.include?("--native") if ARGV.join.include?("--native")
super(width: Gosu.screen_width, height: Gosu.screen_height, fullscreen: true, resizable: true, update_interval: 1000.0/fps_target) super(width: Gosu.screen_width, height: Gosu.screen_height, fullscreen: true, resizable: true, update_interval: 1000.0/fps_target)

View File

@@ -1,20 +1,6 @@
# version 330 core # version 330 core
const int MAX_LIGHTS = 4;
struct Light {
float end;
float type;
vec3 position;
vec3 diffuse;
vec3 ambient;
vec3 specular;
vec3 direction;
float intensity;
};
@include "light_struct"
in vec3 outPosition; in vec3 outPosition;
in vec3 outColor; in vec3 outColor;

View File

@@ -0,0 +1,15 @@
const int MAX_LIGHTS = 4;
struct Light {
float end;
float type;
vec3 position;
vec3 diffuse;
vec3 ambient;
vec3 specular;
vec3 direction;
float intensity;
};

View File

@@ -1,19 +1,6 @@
# version 330 core # version 330 core
const int MAX_LIGHTS = 4;
struct Light { @include "light_struct"
float end;
float type;
vec3 position;
vec3 diffuse;
vec3 ambient;
vec3 specular;
vec3 direction;
float intensity;
};
layout(location = 0) in vec3 inPosition; layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inColor; layout(location = 1) in vec3 inColor;