diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /scene/resources/shader.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'scene/resources/shader.h')
| -rw-r--r-- | scene/resources/shader.h | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/scene/resources/shader.h b/scene/resources/shader.h index 59d7601d9..b7fa349df 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -29,14 +29,14 @@ #ifndef SHADER_H #define SHADER_H -#include "resource.h" #include "io/resource_loader.h" +#include "resource.h" #include "scene/resources/texture.h" class Shader : public Resource { - GDCLASS(Shader,Resource); - OBJ_SAVE_TYPE( Shader ); + GDCLASS(Shader, Resource); + OBJ_SAVE_TYPE(Shader); RES_BASE_EXTENSION("shd"); public: @@ -47,6 +47,7 @@ public: MODE_PARTICLES, MODE_MAX }; + private: RID shader; Mode mode; @@ -55,37 +56,31 @@ private: // shaders keep a list of ShaderMaterial -> VisualServer name translations, to make // convertion fast and save memory. mutable bool params_cache_dirty; - mutable Map<StringName,StringName> params_cache; //map a shader param to a material param.. - Map<StringName,Ref<Texture> > default_textures; - - + mutable Map<StringName, StringName> params_cache; //map a shader param to a material param.. + Map<StringName, Ref<Texture> > default_textures; protected: - - - static void _bind_methods(); -public: - +public: //void set_mode(Mode p_mode); Mode get_mode() const; - void set_code( const String& p_code); + void set_code(const String &p_code); String get_code() const; void get_param_list(List<PropertyInfo> *p_params) const; - bool has_param(const StringName& p_param) const; + bool has_param(const StringName &p_param) const; - void set_default_texture_param(const StringName& p_param, const Ref<Texture> &p_texture); - Ref<Texture> get_default_texture_param(const StringName& p_param) const; - void get_default_texture_param_list(List<StringName>* r_textures) const; + void set_default_texture_param(const StringName &p_param, const Ref<Texture> &p_texture); + Ref<Texture> get_default_texture_param(const StringName &p_param) const; + void get_default_texture_param_list(List<StringName> *r_textures) const; - _FORCE_INLINE_ StringName remap_param(const StringName& p_param) const { + _FORCE_INLINE_ StringName remap_param(const StringName &p_param) const { if (params_cache_dirty) get_param_list(NULL); - const Map<StringName,StringName>::Element *E=params_cache.find(p_param); + const Map<StringName, StringName>::Element *E = params_cache.find(p_param); if (E) return E->get(); return StringName(); @@ -95,38 +90,35 @@ public: Shader(Mode p_mode); ~Shader(); - }; -VARIANT_ENUM_CAST( Shader::Mode ); +VARIANT_ENUM_CAST(Shader::Mode); class SpatialShader : public Shader { - GDCLASS(SpatialShader,Shader); + GDCLASS(SpatialShader, Shader); public: - - SpatialShader() : Shader(MODE_SPATIAL) {}; + SpatialShader() + : Shader(MODE_SPATIAL){}; }; class CanvasItemShader : public Shader { - GDCLASS(CanvasItemShader,Shader); + GDCLASS(CanvasItemShader, Shader); public: - - CanvasItemShader() : Shader(MODE_CANVAS_ITEM) {}; + CanvasItemShader() + : Shader(MODE_CANVAS_ITEM){}; }; - class ParticlesShader : public Shader { - GDCLASS(ParticlesShader,Shader); + GDCLASS(ParticlesShader, Shader); public: - - ParticlesShader() : Shader(MODE_PARTICLES) {}; + ParticlesShader() + : Shader(MODE_PARTICLES){}; }; - #endif // SHADER_H |
