Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 2 files). Show all
Unified · Split
| @@ -11,6 +11,8 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include "DebugDeferredBuffer.h" | 12 | #include "DebugDeferredBuffer.h" |
| 13 | 13 | ||
| 14 | #include <QFile> | ||
| 15 | |||
| 14 | #include <gpu/Batch.h> | 16 | #include <gpu/Batch.h> |
| 15 | #include <gpu/Context.h> | 17 | #include <gpu/Context.h> |
| 16 | #include <render/Scene.h> | 18 | #include <render/Scene.h> |
| @@ -32,6 +34,14 @@ enum Slots { · 15 unmodified lines | |||
| 32 | Lighting | 34 | Lighting |
| 33 | }; | 35 | }; |
| 34 | 36 | ||
| 37 | static std::string getFileContent(std::string fileName, std::string defaultContent = std::string()) { | ||
| 38 | QFile customFile(QString::fromStdString(fileName)); | ||
| 39 | if (customFile.open(QIODevice::ReadOnly)) { | ||
| 40 | return customFile.readAll().toStdString(); | ||
| 41 | } | ||
| 42 | return defaultContent; | ||
| 43 | } | ||
| 44 | |||
| 35 | std::string DebugDeferredBuffer::getShaderSourceCode(Modes mode) { | 45 | std::string DebugDeferredBuffer::getShaderSourceCode(Modes mode) { |
| 36 | switch (mode) { | 46 | switch (mode) { |
| 37 | case DiffuseMode: | 47 | case DiffuseMode: |
| @@ -49,7 +59,7 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Modes mode) { · 11 unmodified lines | |||
| 49 | case LightingMode: | 59 | case LightingMode: |
| 50 | return "vec4 getFragmentColor() { return vec4(pow(texture(lightingMap, uv).xyz, vec3(1.0 / 2.2)), 1.0); }"; | 60 | return "vec4 getFragmentColor() { return vec4(pow(texture(lightingMap, uv).xyz, vec3(1.0 / 2.2)), 1.0); }"; |
| 51 | case CustomMode: | 61 | case CustomMode: |
| 52 | return "vec4 getFragmentColor() { return vec4(1.0); }"; | 62 | return getFileContent(CUSTOM_FILE, "vec4 getFragmentColor() { return vec4(1.0); }"); |
| 53 | } | 63 | } |
| 54 | } | 64 | } |
| 55 | 65 | ||
| @@ -58,8 +68,6 @@ bool DebugDeferredBuffer::pipelineNeedsUpdate(Modes mode) const { · 2 unmodified lines | |||
| 58 | return !_pipelines[mode]; | 68 | return !_pipelines[mode]; |
| 59 | } | 69 | } |
| 60 | 70 | ||
| 61 | |||
| 62 | |||
| 63 | return true; | 71 | return true; |
| 64 | } | 72 | } |
| 65 | 73 | ||