vertex_fragment.out 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include "drivers/gles3/shader_gles3.h"
  2. class VertexFragmentShaderGLES3 : public ShaderGLES3 {
  3. public:
  4. enum ShaderVariant {
  5. MODE_NINEPATCH,
  6. };
  7. enum Specializations {
  8. DISABLE_LIGHTING = 1,
  9. };
  10. _FORCE_INLINE_ bool version_bind_shader(RID p_version, ShaderVariant p_variant, uint64_t p_specialization = 0) {
  11. return _version_bind_shader(p_version, p_variant, p_specialization);
  12. }
  13. protected:
  14. virtual void _init() override {
  15. static const char **_uniform_strings = nullptr;
  16. static const char *_variant_defines[] = {
  17. "#define USE_NINEPATCH",
  18. };
  19. static TexUnitPair *_texunit_pairs = nullptr;
  20. static UBOPair *_ubo_pairs = nullptr;
  21. static Specialization _spec_pairs[] = {
  22. { "DISABLE_LIGHTING", false },
  23. };
  24. static const Feedback *_feedbacks = nullptr;
  25. static const char _vertex_code[] = {
  26. R"<!>(
  27. precision highp float;
  28. precision highp int;
  29. layout(location = 0) in highp vec3 vertex;
  30. out highp vec4 position_interp;
  31. void main() {
  32. position_interp = vec4(vertex.x,1,0,1);
  33. }
  34. )<!>"
  35. };
  36. static const char _fragment_code[] = {
  37. R"<!>(
  38. precision highp float;
  39. precision highp int;
  40. in highp vec4 position_interp;
  41. void main() {
  42. highp float depth = ((position_interp.z / position_interp.w) + 1.0);
  43. frag_color = vec4(depth);
  44. }
  45. )<!>"
  46. };
  47. _setup(_vertex_code, _fragment_code, "VertexFragmentShaderGLES3",
  48. 0, _uniform_strings, 0, _ubo_pairs,
  49. 0, _feedbacks, 0, _texunit_pairs,
  50. 1, _spec_pairs, 1, _variant_defines);
  51. }
  52. };