Last active
July 16, 2018 11:56
-
-
Save jaisonoh/d0de23fb28694d801fe794ffd58a7f7b to your computer and use it in GitHub Desktop.
simple gradient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Debug" | |
void main() { | |
// Load a reference image | |
ref<Debug> debug; | |
std::vector<float4> _ref = debug->getRefimg(film); | |
// Calculate | |
float4* _refDxErr = new float4[xSize * ySize]; | |
float4* _refDyErr = new float4[xSize * ySize]; | |
for (int i = 0; i < xSize * ySize; ++i) { | |
int x = i % xSize; | |
int y = i / xSize; | |
_refDx[i].x = (x != xSize - 1) ? _ref[i + 1].x - _ref[i].x : 0.f; | |
_refDx[i].y = (x != xSize - 1) ? _ref[i + 1].y - _ref[i].y : 0.f; | |
_refDx[i].z = (x != xSize - 1) ? _ref[i + 1].z - _ref[i].z : 0.f; | |
_refDy[i].x = (y != ySize - 1) ? _ref[i + xSize].x - _ref[i].x : 0.f; | |
_refDy[i].y = (y != ySize - 1) ? _ref[i + xSize].y - _ref[i].y : 0.f; | |
_refDy[i].z = (y != ySize - 1) ? _ref[i + xSize].z - _ref[i].z : 0.f; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment