Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp

Issue 1410863006: Update sample to use new perlin noise shader, and make cloud like (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/SampleApp.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
index b0d1812951f253a26df9bf49fb4a081d50485542..bbfb8cf5830bf9748213551b28cb67b366d734be 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
@@ -1076,7 +1076,7 @@ private:
class GrImprovedPerlinNoiseEffect : public GrFragmentProcessor {
public:
- static GrFragmentProcessor* Create(SkScalar octaves, SkScalar z,
+ static GrFragmentProcessor* Create(int octaves, SkScalar z,
SkPerlinNoiseShader2::PaintingData* paintingData,
GrTexture* permutationsTexture, GrTexture* gradientTexture,
const SkMatrix& matrix) {
@@ -1292,11 +1292,11 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
fsBuilder->codeAppendf("vec2 coords = %s * %s;", vCoords.c_str(), baseFrequencyUni);
fsBuilder->codeAppendf("float r = %s(vec3(coords, %s), %s);", noiseOctavesFuncName.c_str(),
zUni, octavesUni);
- fsBuilder->codeAppendf("float g = %s(vec3(coords, %s + 1000.0), %s);",
+ fsBuilder->codeAppendf("float g = %s(vec3(coords, %s + 0000.0), %s);",
noiseOctavesFuncName.c_str(), zUni, octavesUni);
- fsBuilder->codeAppendf("float b = %s(vec3(coords, %s + 2000.0), %s);",
+ fsBuilder->codeAppendf("float b = %s(vec3(coords, %s + 0000.0), %s);",
noiseOctavesFuncName.c_str(), zUni, octavesUni);
- fsBuilder->codeAppendf("float a = %s(vec3(coords, %s + 3000.0), %s);",
+ fsBuilder->codeAppendf("float a = %s(vec3(coords, %s + 0000.0), %s);",
noiseOctavesFuncName.c_str(), zUni, octavesUni);
fsBuilder->codeAppendf("%s = vec4(r, g, b, a);", args.fOutputColor);
@@ -1322,7 +1322,7 @@ void GrGLImprovedPerlinNoise::onSetData(const GrGLSLProgramDataManager& pdman,
const SkVector& baseFrequency = noise.baseFrequency();
pdman.set2f(fBaseFrequencyUni, baseFrequency.fX, baseFrequency.fY);
- pdman.set1f(fOctavesUni, noise.octaves());
+ pdman.set1f(fOctavesUni, SkIntToScalar(noise.octaves()));
pdman.set1f(fZUni, noise.z());
}
« no previous file with comments | « no previous file | gyp/SampleApp.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698