15 #ifndef FULL_SCREEN_FADER_H
16 #define FULL_SCREEN_FADER_H
19 #include "precompiled.h"
33 void Start(
const WorldTime& time,
const WorldTime& fade_time,
34 const mathfu::vec4& color,
const bool fade_in);
38 bool Render(
const WorldTime& time);
41 bool Finished(
const WorldTime& time)
const {
42 return !fade_in_ && CalculateOffset(time) >= 1.0f;
45 void set_material(fplbase::Material* material) { material_ = material; }
46 fplbase::Material* material()
const {
return material_; }
47 void set_shader(fplbase::Shader* shader) { shader_ = shader; }
48 fplbase::Shader* shader()
const {
return shader_; }
49 void set_ortho_mat(
const mathfu::mat4& ortho_mat) { ortho_mat_ = ortho_mat; }
50 const mathfu::mat4& ortho_mat()
const {
return ortho_mat_; }
51 void set_extents(
const mathfu::vec2i& extents) { extents_ = extents; }
52 const mathfu::vec2i& extents()
const {
return extents_; }
56 inline float CalculateOffset(
const WorldTime& time)
const {
57 return static_cast<float>(time - start_time_) /
58 static_cast<float>(half_fade_time_);
62 WorldTime start_time_;
64 WorldTime half_fade_time_;
70 mathfu::mat4 ortho_mat_;
72 mathfu::vec2i extents_;
73 fplbase::Renderer* renderer_;
75 fplbase::Material* material_;
77 fplbase::Shader* shader_;
83 #endif // FULL_SCREEN_FADER_H
Definition: full_screen_fader.h:27